|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ T r ┃
Length: 1112 (0x458) Types: TextFile Names: »readstat.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─ ⟦this⟧ »EUUGD11/euug-87hel/sec8/cfs/readstat.c«
/* * readstat - reads pathname & stats from statfile on fp * returns 0 if read OK; +1 if EOF; -1 if error */ #include "cfs.h" readstat (fp, statfile, name, sbuf) FILE *fp; char *statfile; char *name; struct stat *sbuf; { extern char *myname; int nread; int retval = 0; char c; int nc = 0; struct stat dummy; /* * read the null-terminated pathname */ while (((nread = fread (&c, 1, 1, fp)) == 1) && (c != '\0') && nc < MAXPATHLEN) { name[nc++] = c; } name[nc] = '\0'; if (nread == 0) { retval = 1; if (nc != 0) { fprintf (stderr, "%s: error - truncated statfile %s\n", myname, statfile); retval = -1; } } if ((nread > 0) && (c != '\0')) { fprintf (stderr, "%s: error - bad pathname in statfile %s\n", myname, statfile); retval = -1; } if (retval == 0) { /* * read the fixed-size statbuf */ nread = fread (sbuf, sizeof (dummy), 1, fp); if (nread != 1) { fprintf (stderr, "%s: error - truncated statfile %s\n", myname, statfile); retval = -1; } } return (retval); }