home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / xenix / sco / 2575 < prev    next >
Encoding:
Text File  |  1992-07-26  |  1.4 KB  |  42 lines

  1. Newsgroups: comp.unix.xenix.sco
  2. Path: sparky!uunet!cs.utexas.edu!torn!utzoo!telly!druid!pseudo!mjn
  3. From: mjn@pseudo.uucp (Murray Nesbitt)
  4. Subject: Re: dirent and strerror problems in SCO XENIX 2.3?
  5. Organization: Private system in Toronto, ON
  6. Date: Sun, 26 Jul 1992 07:07:35 GMT
  7. Message-ID: <MJN.92Jul25230735@pseudo.uucp>
  8. In-Reply-To: alan@ahmcs.mq.com's message of 24 Jul 92 06:40:31 GMT
  9. References: <466@ahmcs.mq.com>
  10. Sender: mjn@pseudo.uucp (Murray Nesbitt)
  11. Lines: 29
  12.  
  13.  
  14. In article <466@ahmcs.mq.com> alan@ahmcs.mq.com (Alan Mintz) writes:
  15.  
  16. > Also, has anyone had trouble with the strerror macro in string.h under
  17. > gcc? I get unexplainable "parse errors" when using it, yet, in looking
  18. > at the output of cpp, all looks normal. What am I missing?
  19.  
  20. Look more closely at the output of cpp.
  21.  
  22. This is how the macro strerror() is defined in my original string.h
  23. (Xenix 2.3.2):
  24.  
  25.     #define strerror(err)       (sys_errlist[err]);
  26.  
  27. Notice the semi-colon at the end.  Obviously, this causes problems
  28. when you invoke the macro in statements like this: 
  29.  
  30.     fprintf( stderr, "You lose: %s\n", strerror(errno) );
  31.  
  32. as it expands to 
  33.  
  34.     fprintf( stderr, "You lose: %s\n", (sys_errlist[errno]); );
  35.  
  36. Delete the trailing semi from string.h (or have your sysadmin do it),
  37. and you shouldn't get bitten by this one again.
  38.  
  39. Murray
  40. -- 
  41. Until my site's in the maps, please reply to "druid!pseudo!mjn".
  42.