Path: utzoo!utgpu!watserv1!watmath!att!bu.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!bcm!lib!thesis1.hsch.utexas.edu From: jmaynard@thesis1.hsch.utexas.edu (Jay Maynard) Newsgroups: comp.sources.bugs Subject: abc: syntax error in unix/u1file.c on System V Message-ID: <4492@lib.tmc.edu> Date: 21 Dec 90 22:04:53 GMT Sender: usenet@lib.tmc.edu Organization: University of Texas Medical School at Houston Lines: 239 Nntp-Posting-Host: thesis1.hsch.utexas.edu Originator: jmaynard@thesis1.hsch.utexas.edu Problem: During compilation, file unix/u1file.c fails with a syntax error. Environment: NCR Tower XP, System V release 2, OS release 3.02.01. Description: The line in error is "extern char *getwd();". Under other than AT&T System III/System V systems, this compiles as advertised. Under System III/V, though, (any system that results in the ATT system type being selected in Setup), this actually is compiled differently because of the line "define getwd(path) getcwd(path, SIZE_BYTES)" in uhdrs/os.h - resulting in the definition being turned into "extern char *getcwd(, SIZE_BYTES);". As the compiler rightfully complains, this is a syntax error. Fix: The following patch adds another definition to unix/os.h, for HAS_GETCWD; adds logic in Setup to define it appropriately; changes unix/u1file.c to do the right thing if it's set; and makes unix/u1os.c take it into account when deciding whether or not to use its internal getwd() routine. The patch may be applied by feeding this article to patch -p0. ---------------8<---------------cut here----------------->8------------------- *** Setup.orig --- Setup ************** *** 686,691 perror="#define" mkdir="#define" getwd="#define" rename="#define" select="#define" readdir="#define" --- 686,692 ----- perror="#define" mkdir="#define" getwd="#define" + getcwd="#undef " rename="#define" select="#define" readdir="#define" ************** *** 695,700 perror="#define" mkdir="#undef " getwd="#undef " rename="#undef " select="#undef " readdir="#undef " --- 696,702 ----- perror="#define" mkdir="#undef " getwd="#undef " + getcwd="#undef " rename="#undef " select="#undef " readdir="#undef " ************** *** 704,709 perror="#define" mkdir="#define" getwd="#undef " rename="#undef " select="#undef " readdir="#undef " --- 706,712 ----- perror="#define" mkdir="#define" getwd="#undef " + getcwd="#define" rename="#undef " select="#undef " readdir="#undef " ************** *** 714,719 perror="#undef " mkdir="#undef " getwd="#undef " rename="#undef " select="#undef " readdir="#undef " --- 717,723 ----- perror="#undef " mkdir="#undef " getwd="#undef " + getcwd="#undef " rename="#undef " select="#undef " readdir="#undef " ************** *** 751,756 /^#define HAS_PERROR/s?#define?$perror? /^#define HAS_MKDIR/s?#define?$mkdir? /^#define HAS_GETWD/s?#define?$getwd? /^#define HAS_RENAME/s?#define?$rename? /^#define HAS_SELECT/s?#define?$select? /^#define HAS_READDIR/s?#define?$readdir? --- 755,761 ----- /^#define HAS_PERROR/s?#define?$perror? /^#define HAS_MKDIR/s?#define?$mkdir? /^#define HAS_GETWD/s?#define?$getwd? + /^#define HAS_GETCWD/s?#define?$getcwd? /^#define HAS_RENAME/s?#define?$rename? /^#define HAS_SELECT/s?#define?$select? /^#define HAS_READDIR/s?#define?$readdir? ************** *** 801,817 case $strchr in strchr) $editor uhdrs/os.h <