static char SccsId
[] = "@(#)sccs.c 1.3 delta %G% 00:27:33 get %H% %T%";
char *sccsname
; /* name of SCCS routine */
short sccsflags
; /* see below */
char *sccspath
; /* pathname of binary implementing */
# define F_NOSDOT 0001 /* no s. on front of args */
struct sccsprog SccsProg
[] =
"admin", 0, "/usr/sccs/admin",
"chghist", 0, "/usr/sccs/rmdel",
"comb", 0, "/usr/sccs/comb",
"delta", 0, "/usr/sccs/delta",
"get", 0, "/usr/sccs/get",
"help", F_NOSDOT
, "/usr/sccs/help",
"prt", 0, "/usr/sccs/prt",
"rmdel", 0, "/usr/sccs/rmdel",
"what", F_NOSDOT
, "/usr/sccs/what",
char *SccsPath
= "SCCS/s.";
register struct sccsprog
*cmd
;
** Detect and decode flags intended for this program.
case 'r': /* run as real user */
case 'p': /* path of sccs files */
fprintf(stderr
, "Sccs: unknown option -%s\n", p
);
** At this point, p and argv point to the command name.
for (cmd
= SccsProg
; cmd
->sccsname
!= NULL
; cmd
++)
if (strcmp(cmd
->sccsname
, p
) == 0)
if (cmd
->sccsname
== NULL
)
fprintf(stderr
, "Sccs: Unknown command \"%s\"\n", p
);
** Build new argument vector.
/* copy program filename arguments and flags */
if ((cmd
->sccsflags
& F_NOSDOT
) == 0 && *p
!= '-')
/* terminate argument vector */
** Call real SCCS program.
execv(cmd
->sccspath
, newargv
);
fprintf(stderr
, "Sccs: cannot execute ");
** See if this filename should be used as-is.
** There are three conditions where this can occur.
** 1. The name already begins with "s.".
** 2. The name has a "/" in it somewhere.
** 3. The name references a directory.
if (strncmp(name
, "s.", 2) == 0)
for (p
= name
; (c
= *p
) != '\0'; p
++)
if (stat(name
, &stbuf
) >= 0 && (stbuf
.st_mode
& S_IFMT
) == S_IFDIR
)
** Prepend the path of the sccs file.
p
= malloc(strlen(buf
) + 1);