[comp.unix.microport] C news on System V/AT

philip@axis.fr (Philip Peake) (07/12/89)

Trying to compile the file relay/hdrdefs.c on Microport System V/AT
produces complaints from the compiler, about too complex expressions.

For those who want to run C news on their Microport system (and I reccommend
it - its much less load and faster), the following is a really dirty
fix to the problem.

The problem is the offset() macro, which calculates the offset of a structure
member *at compile time*, and uses it to initialise another structure
member.

If you know how structures are stored on your machine, you can simply
calculate the offsets yourself, and write them directly into the code
(ugh ! - but no more ugh than letting the compiler do this dirty trick
for you in the first place !).

For Microport 286 systems, compiling in small model (ie NO -Ml flag),
the following patch will allow you to compile C news.

(You will need to hack 'spacefor' a little too)


*** hdrdefs.c.orig	Wed Jul 12 16:10:36 1989
--- hdrdefs.c	Wed Jul 12 16:10:28 1989
***************
*** 46,52
  static const char illobjnm[] = "Illegal-Object:";	/* zmailer bitching */
  
  static const struct hdrdef msghdr = {
! 	msgnm, STRLEN(msgnm), offsetof(struct headers, h_msgid) };
  static const struct hdrdef ngshdr = {
  	ngsnm, STRLEN(ngsnm), offsetof(struct headers, h_ngs) };
  const struct hdrdef pathhdr = {

--- 46,52 -----
  static const char illobjnm[] = "Illegal-Object:";	/* zmailer bitching */
  
  static const struct hdrdef msghdr = {
! 	msgnm, STRLEN(msgnm), 10 };
  static const struct hdrdef ngshdr = {
  	ngsnm, STRLEN(ngsnm), 2 };
  const struct hdrdef pathhdr = {
***************
*** 48,54
  static const struct hdrdef msghdr = {
  	msgnm, STRLEN(msgnm), offsetof(struct headers, h_msgid) };
  static const struct hdrdef ngshdr = {
! 	ngsnm, STRLEN(ngsnm), offsetof(struct headers, h_ngs) };
  const struct hdrdef pathhdr = {
  	pathnm, STRLEN(pathnm), offsetof(struct headers, h_path) };
  static const struct hdrdef subjhdr = {

--- 48,54 -----
  static const struct hdrdef msghdr = {
  	msgnm, STRLEN(msgnm), 10 };
  static const struct hdrdef ngshdr = {
! 	ngsnm, STRLEN(ngsnm), 2 };
  const struct hdrdef pathhdr = {
  	pathnm, STRLEN(pathnm), 16 };
  static const struct hdrdef subjhdr = {
***************
*** 50,56
  static const struct hdrdef ngshdr = {
  	ngsnm, STRLEN(ngsnm), offsetof(struct headers, h_ngs) };
  const struct hdrdef pathhdr = {
! 	pathnm, STRLEN(pathnm), offsetof(struct headers, h_path) };
  static const struct hdrdef subjhdr = {
  	subjnm, STRLEN(subjnm), offsetof(struct headers, h_subj) };
  

--- 50,56 -----
  static const struct hdrdef ngshdr = {
  	ngsnm, STRLEN(ngsnm), 2 };
  const struct hdrdef pathhdr = {
! 	pathnm, STRLEN(pathnm), 16 };
  static const struct hdrdef subjhdr = {
  	subjnm, STRLEN(subjnm), 0 };
  
***************
*** 52,58
  const struct hdrdef pathhdr = {
  	pathnm, STRLEN(pathnm), offsetof(struct headers, h_path) };
  static const struct hdrdef subjhdr = {
! 	subjnm, STRLEN(subjnm), offsetof(struct headers, h_subj) };
  
  static const struct hdrdef apphdr = {
  	appnm, STRLEN(appnm), offsetof(struct headers, h_approved) };

--- 52,58 -----
  const struct hdrdef pathhdr = {
  	pathnm, STRLEN(pathnm), 16 };
  static const struct hdrdef subjhdr = {
! 	subjnm, STRLEN(subjnm), 0 };
  
  static const struct hdrdef apphdr = {
  	appnm, STRLEN(appnm), 8 };
***************
*** 55,61
  	subjnm, STRLEN(subjnm), offsetof(struct headers, h_subj) };
  
  static const struct hdrdef apphdr = {
! 	appnm, STRLEN(appnm), offsetof(struct headers, h_approved) };
  static const struct hdrdef ctlhdr = {
  	ctlnm, STRLEN(ctlnm), offsetof(struct headers, h_ctlcmd) };
  static const struct hdrdef exphdr = {

--- 55,61 -----
  	subjnm, STRLEN(subjnm), 0 };
  
  static const struct hdrdef apphdr = {
! 	appnm, STRLEN(appnm), 8 };
  static const struct hdrdef ctlhdr = {
  	ctlnm, STRLEN(ctlnm), 6 };
  static const struct hdrdef exphdr = {
***************
*** 57,63
  static const struct hdrdef apphdr = {
  	appnm, STRLEN(appnm), offsetof(struct headers, h_approved) };
  static const struct hdrdef ctlhdr = {
! 	ctlnm, STRLEN(ctlnm), offsetof(struct headers, h_ctlcmd) };
  static const struct hdrdef exphdr = {
  	expnm, STRLEN(expnm), offsetof(struct headers, h_expiry) };
  static const struct hdrdef distrhdr = {

--- 57,63 -----
  static const struct hdrdef apphdr = {
  	appnm, STRLEN(appnm), 8 };
  static const struct hdrdef ctlhdr = {
! 	ctlnm, STRLEN(ctlnm), 6 };
  static const struct hdrdef exphdr = {
  	expnm, STRLEN(expnm), 14 };
  static const struct hdrdef distrhdr = {
***************
*** 59,65
  static const struct hdrdef ctlhdr = {
  	ctlnm, STRLEN(ctlnm), offsetof(struct headers, h_ctlcmd) };
  static const struct hdrdef exphdr = {
! 	expnm, STRLEN(expnm), offsetof(struct headers, h_expiry) };
  static const struct hdrdef distrhdr = {
  	distrnm, STRLEN(distrnm), offsetof(struct headers, h_distr) };
  static const struct hdrdef sendhdr = {

--- 59,65 -----
  static const struct hdrdef ctlhdr = {
  	ctlnm, STRLEN(ctlnm), 6 };
  static const struct hdrdef exphdr = {
! 	expnm, STRLEN(expnm), 14 };
  static const struct hdrdef distrhdr = {
  	distrnm, STRLEN(distrnm), 4 };
  static const struct hdrdef sendhdr = {
***************
*** 61,67
  static const struct hdrdef exphdr = {
  	expnm, STRLEN(expnm), offsetof(struct headers, h_expiry) };
  static const struct hdrdef distrhdr = {
! 	distrnm, STRLEN(distrnm), offsetof(struct headers, h_distr) };
  static const struct hdrdef sendhdr = {
  	sendnm, STRLEN(sendnm), offsetof(struct headers, h_sender) };
  const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };

--- 61,67 -----
  static const struct hdrdef exphdr = {
  	expnm, STRLEN(expnm), 14 };
  static const struct hdrdef distrhdr = {
! 	distrnm, STRLEN(distrnm), 4 };
  static const struct hdrdef sendhdr = {
  	sendnm, STRLEN(sendnm), 18 };
  const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
***************
*** 63,69
  static const struct hdrdef distrhdr = {
  	distrnm, STRLEN(distrnm), offsetof(struct headers, h_distr) };
  static const struct hdrdef sendhdr = {
! 	sendnm, STRLEN(sendnm), offsetof(struct headers, h_sender) };
  const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
  
  static const struct hdrdef arthdr = {

--- 63,69 -----
  static const struct hdrdef distrhdr = {
  	distrnm, STRLEN(distrnm), 4 };
  static const struct hdrdef sendhdr = {
! 	sendnm, STRLEN(sendnm), 18 };
  const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
  
  static const struct hdrdef arthdr = {
***************
*** 67,73
  const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
  
  static const struct hdrdef arthdr = {
! 	artnm, STRLEN(artnm), offsetof(struct headers, h_artid) };
  
  static const struct hdrdef datrcvhdr = { datercvnm, STRLEN(datercvnm), -1 };
  static const struct hdrdef rcvhdr = { rcvnm, STRLEN(rcvnm), -1 };

--- 67,73 -----
  const struct hdrdef xrefhdr = { xrefnm, STRLEN(xrefnm), -1 };
  
  static const struct hdrdef arthdr = {
! 	artnm, STRLEN(artnm), 12 };
  
  static const struct hdrdef datrcvhdr = { datercvnm, STRLEN(datercvnm), -1 };
  static const struct hdrdef rcvhdr = { rcvnm, STRLEN(rcvnm), -1 };