SCCS-vsn: usr.bin/sccs/sccs.c 1.16
# include <sysexits.h>
# include <whoami.h>
# include <sysexits.h>
# include <whoami.h>
-static char SccsId[] = "@(#)sccs.c 1.15 %G%";
+static char SccsId[] = "@(#)sccs.c 1.16 %G%";
# define bitset(bit, word) ((bit) & (word))
# define bitset(bit, word) ((bit) & (word))
struct direct dir;
struct stat stbuf;
char buf[100];
struct direct dir;
struct stat stbuf;
char buf[100];
register FILE *dirfd;
register char *basefile;
bool gotedit;
register FILE *dirfd;
register char *basefile;
bool gotedit;
dirfd = fopen(SccsPath, "r");
if (dirfd == NULL)
dirfd = fopen(SccsPath, "r");
if (dirfd == NULL)
strcpy(buf, SccsPath);
strcat(buf, "/p.");
basefile = &buf[strlen(buf)];
strcpy(buf, SccsPath);
strcat(buf, "/p.");
basefile = &buf[strlen(buf)];
- basefile[sizeof dir.d_name - 2] = '\0';
strcpyn(basefile, &dir.d_name[2], sizeof dir.d_name - 2);
strcpyn(basefile, &dir.d_name[2], sizeof dir.d_name - 2);
- if (stat(buf, &stbuf) >= 0)
+ basefile[sizeof dir.d_name - 2] = '\0';
+ pfp = fopen(buf, "r");
+ if (pfp != NULL)
- printf("%s: being editted\n", basefile);
+ while (fgets(pline, sizeof pline, pfp) != NULL)
+ printf("%12s: being editted: %s", basefile, pline);
+ fclose(pfp);
gotedit = TRUE;
continue;
}
gotedit = TRUE;
continue;
}