add ``create'' command
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 27 May 1981 15:22:36 +0000 (07:22 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 27 May 1981 15:22:36 +0000 (07:22 -0800)
SCCS-vsn: usr.bin/sccs/sccs.c 1.63
SCCS-vsn: usr.bin/sccs/sccs.1 1.24

usr/src/usr.bin/sccs/sccs.1
usr/src/usr.bin/sccs/sccs.c

index a9cf61b..18d37c9 100644 (file)
@@ -78,6 +78,18 @@ as described above,
 and all the flags listed for ``get''
 above except \-e and \-k
 are passed to ``edit''.
 and all the flags listed for ``get''
 above except \-e and \-k
 are passed to ``edit''.
+.IP create
+Creates an
+.SM SCCS
+file,
+taking the initial contents from the file of the same name.
+Any flags to ``admin'' are accepted.
+If the creation is successful,
+the files are renamed with a comma on the front.
+These should be removed when you are convinced that
+the
+.SM SCCS
+files have been created successfully.
 .IP fix
 Must be followed by a
 .B \-r
 .IP fix
 Must be followed by a
 .B \-r
index fbb840b..8ceba1a 100644 (file)
@@ -93,7 +93,7 @@
 **             Copyright 1980 Regents of the University of California
 */
 
 **             Copyright 1980 Regents of the University of California
 */
 
-static char SccsId[] = "@(#)sccs.c     1.62 %G%";
+static char SccsId[] = "@(#)sccs.c     1.63 %G%";
 \f
 /*******************  Configuration Information  ********************/
 
 \f
 /*******************  Configuration Information  ********************/
 
@@ -152,6 +152,7 @@ struct sccsprog
 # define SHELL         5       /* call a shell file (like PROG) */
 # define DIFFS         6       /* diff between sccs & file out */
 # define DODIFF                7       /* internal call to diff program */
 # define SHELL         5       /* call a shell file (like PROG) */
 # define DIFFS         6       /* diff between sccs & file out */
 # define DODIFF                7       /* internal call to diff program */
+# define CREATE                8       /* create new files */
 
 /* bits for sccsflags */
 # define NO_SDOT       0001    /* no s. on front of args */
 
 /* bits for sccsflags */
 # define NO_SDOT       0001    /* no s. on front of args */
@@ -200,6 +201,7 @@ struct sccsprog SccsProg[] =
        "print",        CMACRO, 0,                      "prt -e/get -p -m -s",
        "branch",       CMACRO, NO_SDOT,
                "get:ixrc -e -b/delta: -s -n -ybranch-place-holder/get:pl -e -t -g",
        "print",        CMACRO, 0,                      "prt -e/get -p -m -s",
        "branch",       CMACRO, NO_SDOT,
                "get:ixrc -e -b/delta: -s -n -ybranch-place-holder/get:pl -e -t -g",
+       "create",       CREATE, NO_SDOT,                NULL,
        NULL,           -1,     0,                      NULL
 };
 
        NULL,           -1,     0,                      NULL
 };
 
@@ -362,7 +364,7 @@ command(argv, forkflag, arg0)
 {
        register struct sccsprog *cmd;
        register char *p;
 {
        register struct sccsprog *cmd;
        register char *p;
-       char buf[40];
+       char buf[100];
        extern struct sccsprog *lookup();
        char *nav[1000];
        char **np;
        extern struct sccsprog *lookup();
        char *nav[1000];
        char **np;
@@ -554,6 +556,32 @@ command(argv, forkflag, arg0)
                syserr("cannot exec %s", cmd->sccspath);
                exit(EX_OSERR);
 
                syserr("cannot exec %s", cmd->sccspath);
                exit(EX_OSERR);
 
+         case CREATE:          /* create new sccs files */
+               /* skip over flag arguments */
+               for (np = &ap[1]; *np != NULL && **np == '-'; np++)
+                       continue;
+               argv = np;
+
+               /* do an admin for each file */
+               p = argv[1];
+               while (*np != NULL)
+               {
+                       sprintf(buf, "-i%s", *np);
+                       ap[0] = buf;
+                       argv[0] = tail(*np);
+                       argv[1] = NULL;
+                       rval = command(ap, TRUE, "admin");
+                       argv[1] = p;
+                       if (rval == 0)
+                       {
+                               sprintf(buf, ",%s", tail(*np));
+                               if (link(*np, buf) >= 0)
+                                       unlink(*np);
+                       }
+                       np++;
+               }
+               break;
+
          default:
                syserr("oper %d", cmd->sccsoper);
                exit(EX_SOFTWARE);
          default:
                syserr("oper %d", cmd->sccsoper);
                exit(EX_SOFTWARE);