SCCS-vsn: usr.bin/sccs/sccs.c 1.13
"del", CMACRO, 0, "delta/get",
"delt", CMACRO, 0, "delta/get",
"fix", FIX, 0, NULL,
"del", CMACRO, 0, "delta/get",
"delt", CMACRO, 0, "delta/get",
"fix", FIX, 0, NULL,
- "clean", CLEAN, REALUSER, NULL,
+ "clean", CLEAN, REALUSER, (char *) TRUE,
+ "info", CLEAN, REALUSER, (char *) FALSE,
exit(EX_SOFTWARE);
case CLEAN:
exit(EX_SOFTWARE);
case CLEAN:
+ clean((bool) cmd->sccspath);
** exists in the current directory is purged.
**
** Parameters:
** exists in the current directory is purged.
**
** Parameters:
+** really -- if TRUE, remove everything.
+** else, just report status.
** removes files in the current directory.
*/
** removes files in the current directory.
*/
+clean(really)
+ bool really;
{
struct direct dir;
struct stat stbuf;
char buf[100];
{
struct direct dir;
struct stat stbuf;
char buf[100];
+ register FILE *dirfd;
+ register char *basefile;
dirfd = fopen(SccsPath, "r");
if (dirfd == NULL)
dirfd = fopen(SccsPath, "r");
if (dirfd == NULL)
/* got an s. file -- see if the p. file exists */
strcpy(buf, SccsPath);
strcat(buf, "/p.");
/* got an s. file -- see if the p. file exists */
strcpy(buf, SccsPath);
strcat(buf, "/p.");
- buf[strlen(buf) + sizeof dir.d_name - 2] = '\0';
- strcatn(buf, &dir.d_name[2], sizeof dir.d_name - 2);
+ basefile = &buf[strlen(buf)];
+ basefile[sizeof dir.d_name - 2] = '\0';
+ strcpyn(basefile, &dir.d_name[2], sizeof dir.d_name - 2);
if (stat(buf, &stbuf) >= 0)
if (stat(buf, &stbuf) >= 0)
+ {
+ printf("%s: being editted\n", basefile);
/* the s. file exists and no p. file exists -- unlink the g-file */
/* the s. file exists and no p. file exists -- unlink the g-file */
- buf[sizeof dir.d_name - 2] = '\0';
- strcpyn(buf, &dir.d_name[2], sizeof dir.d_name - 2);
- unlink(buf);
+ if (really)
+ {
+ strcpyn(buf, &dir.d_name[2], sizeof dir.d_name - 2);
+ buf[sizeof dir.d_name - 2] = '\0';
+ unlink(buf);
+ }