home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!emory!wa4mei!westgac3!tomk
- From: tomk@westgac3
- Newsgroups: comp.os.os9
- Subject: wierd happenings with C compiler
- Summary: Can anyone explain these?
- Keywords: C compiler
- Message-ID: <14@westgac3>
- Date: 28 Aug 92 10:09:44 GMT
- Organization: West Georgia Color Computer 3
- Lines: 76
-
- SETUP: Color Computer 3 w/OS9 Level2, C compiler from Level 1, patched for HD.
- Stock libraries replaced by Kreider libraries.
-
- Problems .....
-
- 1) In the header file from Rick Adams UUCP, There is the entry
- #define PUBDIR "/dd/spool/uucppublic"
-
- While attempting to apply a patch to one of the modules for "uucico"...
-
- ssendfile(cline)
- char *cline;
- {
- FILE *file;
- static char holdit[200];
-
- (stuff deleted)
-
- if ((index(words[4], 'c') != NULL) && (words[2][0] == '~')) {
- sprintf(holdit,"%s%s",PUBDIR,rindex(words[1],'/'));
- if(debuglvl >= 3) printf("Receiving UNIX file %s.\n",holdit);
-
- (rest of stuff deleted)
-
- When the debug message was printed, I got the following:
- Receiving UNIX file /dd/spool/uucppubl/watizit.z
- ^^^^^^^^
- what happened?????
-
- Anyhow, my fix for that compiler generated booboo was:
- char *dir_pub="/dd/spool/uucppublic";
- ...
- sprintf(holdit,"%s%s",dir_pub,rindex(words[1],'/'));
- Again, does anyone know _why_ the compiler truncated the header definition??
-
- 2) I was trying to do some fancy footwork with the function "sscanf()", perhaps
- someone can explain this one...
-
- typedef struct {
- char name[32],
- passwd[40];
- int uid,
- priority;
- char execution[80],
- homebase[80],
- startpgm[80];
- } PSWD;
-
- fetch_pw()
- {
- PSWD *p, pwd;
- FILE *f, fopen();
- (etc.)
-
- p = &pwd;
-
- (open system password file and place entry into char buffer, "cbuf")
-
- sscanf(cbuf,"%[^,],%[^,],%d,%d,%[^,],%[^,],%s",p->name,p->passwd,
- p->uid,p->priority,p->execution,p->homebase,p->startpgm);
-
- printf("%s %s %d %d %s %s %s\n",p->name,p->passwd,p->uid,p->priority,
- p->execution,p->homebase,p->startpgm);
-
- (and continue with rest of file)
- }
- The result that I get from fetch_pw() is the first string and all other
- parts of the struct are NULL/ZIPPO/NADA. I then replaced the struct
- access with individual variables and adjusted the sscanf() & printf() to
- fill those variables and the _same_ result. Does anyone have a clue as
- to why sscanf() won't parse the string correctly???
-
- --
- Thomas Kocourek KD4CIK :UUCP on an OS9 system,
- UUCP: ...!{emory,gatech}!wa4mei!westgac3!tomk :Multitasking & windows in
- INTERNET tomk@westgac3 :512KBytes - All in a COCO3!
-