cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/src ChangeLog log.c main.c rcs.c rcs.h rem...


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog log.c main.c rcs.c rcs.h rem...
Date: Mon, 22 Sep 2008 17:36:28 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     08/09/22 17:36:28

Modified files:
        src            : ChangeLog log.c main.c rcs.c rcs.h remove.c 

Log message:
        * log.c, main.c, remove.c: Some cleanup.
        * rcs.c: Likewise.
        (locate_rcs): Export.  Change int arg to bool.
        * rcs.h (locate_rcs): Add prototype.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3610&r2=1.3611
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/log.c?cvsroot=cvs&r1=1.115&r2=1.116
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/main.c?cvsroot=cvs&r1=1.279&r2=1.280
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/rcs.c?cvsroot=cvs&r1=1.396&r2=1.397
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/rcs.h?cvsroot=cvs&r1=1.84&r2=1.85
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/remove.c?cvsroot=cvs&r1=1.66&r2=1.67

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3610
retrieving revision 1.3611
diff -u -b -r1.3610 -r1.3611
--- ChangeLog   22 Sep 2008 16:48:16 -0000      1.3610
+++ ChangeLog   22 Sep 2008 17:36:26 -0000      1.3611
@@ -1,5 +1,10 @@
 2008-09-22  Derek R. Price  <address@hidden>
 
+       * log.c, main.c, remove.c: Some cleanup.
+       * rcs.c: Likewise.
+       (locate_rcs): Export.  Change int arg to bool.
+       * rcs.h (locate_rcs): Add prototype.
+
        * stack.c (unshift_string_array, init_string_list): New utility
        functions.
        * stack.h (unshift_string_array, init_string_list): Prototypes for

Index: log.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/log.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -b -r1.115 -r1.116
--- log.c       15 Sep 2008 21:48:56 -0000      1.115
+++ log.c       22 Sep 2008 17:36:27 -0000      1.116
@@ -1788,7 +1788,7 @@
        return R_SKIP_ALL;
 
     if (!quiet)
-       error (0, 0, "Logging %s", update_dir);
+       error (0, 0, "Logging %s", NULL2DOT (update_dir));
     return R_PROCESS;
 }
 

Index: main.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/main.c,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -b -r1.279 -r1.280
--- main.c      15 Sep 2008 21:48:56 -0000      1.279
+++ main.c      22 Sep 2008 17:36:27 -0000      1.280
@@ -1199,10 +1199,8 @@
             * specified on the command line, set the root from the
             * CVS/Root file.
             */
-           if (!CVSroot_parsed
-               && !(cm->attr & CVS_CMD_IGNORE_ADMROOT)
-              )
-               CVSroot_parsed = Name_Root (NULL, NULL);
+           if (!CVSroot_parsed && !(cm->attr & CVS_CMD_IGNORE_ADMROOT))
+               CVSroot_parsed = Name_Root (NULL, "");
 
            /* Now, if there is no root on the command line and we didn't find
             * one in a file, set it via the $CVSROOT env var.

Index: rcs.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/rcs.c,v
retrieving revision 1.396
retrieving revision 1.397
diff -u -b -r1.396 -r1.397
--- rcs.c       17 Sep 2008 19:53:30 -0000      1.396
+++ rcs.c       22 Sep 2008 17:36:28 -0000      1.397
@@ -22,11 +22,12 @@
 /* Verify interface.  */
 #include "rcs.h"
 
-/* SUS */
+/* Standards */
 #include <unistd.h>
 
 /* GNULIB */
 #include "base64.h"
+#include "quote.h"
 
 /* CVS */
 #include "edit.h"
@@ -189,7 +190,7 @@
 
 /*
  * char *
- * locate_rcs ( const char* file, const char *repository , int *inattic )
+ * locate_rcs (const char* file, const char *repository, bool *inattic)
  *
  * Find an RCS file in the repository, case insensitively when the cased name
  * doesn't exist, we are running as the server, and a client has asked us to
@@ -225,8 +226,8 @@
  *  the Attic was found but no matching files were found in the Attic or its
  *  parent.
  */
-static char *
-locate_rcs (const char *repository, const char *file, int *inattic)
+char *
+locate_rcs (const char *repository, const char *file, bool *inattic)
 {
     char *retval;
 
@@ -241,8 +242,7 @@
     sprintf (retval, "%s/%s%s", repository, file, RCSEXT);
     if (isreadable (retval))
     {
-       if (inattic)
-           *inattic = 0;
+       if (inattic) *inattic = false;
        return retval;
     }
 
@@ -250,8 +250,7 @@
     sprintf (retval, "%s/%s/%s%s", repository, CVSATTIC, file, RCSEXT);
     if (isreadable (retval))
     {
-       if (inattic)
-           *inattic = 1;
+       if (inattic) *inattic = true;
        return retval;
     }
     free (retval);
@@ -291,17 +290,17 @@
     FILE *fp;
     RCSNode *retval = NULL;
     char *rcsfile;
-    int inattic;
+    bool inattic;
 
     /* We're creating a new RCSNode, so there is no hope of finding it
        in the cache.  */
-    rcsbuf_cache_close ();
+    rcsbuf_cache_close();
 
     if (!(rcsfile = locate_rcs (repos, file, &inattic)))
     {
        /* Handle the error cases */
     }
-    else if ((fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ))) 
+    else if (fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ))
     {
        rcs = RCS_parsercsfile_i (fp, rcsfile);
        if (rcs)
@@ -317,7 +316,7 @@
     else
     {
        if (!existence_error (errno))
-           error (0, errno, "cannot open `%s'", rcsfile);
+           error (0, errno, "cannot open %s", quote (rcsfile));
        free (rcsfile);
     }
 
@@ -2347,11 +2346,11 @@
 {
     char *tag;
 
-    if (simple_tag != NULL)
+    if (simple_tag)
        *simple_tag = 0;
 
     /* make sure we have something to look at... */
-    assert (rcs != NULL);
+    assert (rcs);
 
     /* XXX this is probably not necessary, --jtc */
     if (rcs->flags & PARTIAL) 
@@ -2372,7 +2371,7 @@
 
        /* If we got a symbolic tag, resolve it to a numeric */
        version = translate_symtag (rcs, symtag);
-       if (version != NULL)
+       if (version)
        {
            int dots;
            char *magic, *branch, *cp;
@@ -2394,15 +2393,15 @@
 
                /* see if we have .magic-branch. (".0.") */
                magic = xmalloc (strlen (tag) + 1);
-               (void) sprintf (magic, ".%d.", RCS_MAGIC_BRANCH);
+               sprintf (magic, ".%d.", RCS_MAGIC_BRANCH);
                if (STRNEQ (magic, cp, strlen (magic)))
                {
                    /* it's magic.  See if the branch exists */
                    *cp = '\0';         /* turn it into a revision */
-                   (void) sprintf (magic, "%s.%s", tag, branch);
+                   sprintf (magic, "%s.%s", tag, branch);
                    branch = RCS_getbranch (rcs, magic, 1);
                    free (magic);
-                   if (branch != NULL)
+                   if (branch)
                    {
                        free (tag);
                        return branch;
@@ -2436,7 +2435,7 @@
     while (tag[strlen (tag) - 1] == '.')
        tag[strlen (tag) - 1] = '\0';
 
-    if ((numdots (tag) & 1) == 0)
+    if (!(numdots (tag) & 1))
     {
        char *branch;
 
@@ -2451,7 +2450,7 @@
 
        /* we have a revision tag, so make sure it exists */
        p = findnode (rcs->versions, tag);
-       if (p != NULL)
+       if (p)
        {
            /* We have found a numeric revision for the revision tag.
               To support expanding the RCS keyword Name, if
@@ -2460,7 +2459,7 @@
               there other cases in which we should set this?  In
               particular, what if we expand RCS keywords internally
               without calling co?  */
-           if (simple_tag != NULL)
+           if (simple_tag)
                *simple_tag = 1;
            return tag;
        }

Index: rcs.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/rcs.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- rcs.h       24 Apr 2006 18:50:27 -0000      1.84
+++ rcs.h       22 Sep 2008 17:36:28 -0000      1.85
@@ -319,5 +319,6 @@
 void RCS_output_diff_options (int diff_argc, char * const *diff_argv,
                              bool devnull, const char *rev1, const char *rev2,
                              const char *workfile);
+char *locate_rcs (const char *repository, const char *file, bool *inattic);
 
 #endif /* RCS_H */

Index: remove.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/remove.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- remove.c    16 Sep 2008 21:00:21 -0000      1.66
+++ remove.c    22 Sep 2008 17:36:28 -0000      1.67
@@ -112,8 +112,8 @@
               in doing the following checks.  */
        }
 
-       start_server ();
-       ign_setup ();
+       start_server();
+       ign_setup();
        if (local)
            send_arg("-l");
        send_arg ("--");
@@ -122,7 +122,7 @@
        send_file_names (argc, argv, 0);
        free_names (&argc, argv);
        send_to_server ("remove\012", 0);
-        return get_responses_and_close ();
+        return get_responses_and_close();
     }
 #endif
 
@@ -132,8 +132,12 @@
                           CVS_LOCK_READ, NULL, 1, NULL);
 
     if (removed_files && !really_quiet)
-       error (0, 0, "use `%s commit' to remove %s permanently", program_name,
+    {
+       char *cmd = Xasprintf ("%s commit", program_name);
+       error (0, 0, "use %s to remove %s permanently", quote (cmd),
               (removed_files == 1) ? "this file" : "these files");
+       free (cmd);
+    }
 
     if (existing_files)
        error (0, 0,
@@ -142,11 +146,12 @@
                "%d files exist; remove them first"),
               existing_files);
 
-    return (err);
+    return err;
 }
 
-#ifdef CLIENT_SUPPORT
 
+
+#ifdef CLIENT_SUPPORT
 /*
  * This is called via start_recursion if we are running as the client
  * and the -f option was used.  We just physically remove the file.
@@ -156,13 +161,14 @@
 static int
 remove_force_fileproc (void *callerdat, struct file_info *finfo)
 {
-    if (CVS_UNLINK (finfo->file) < 0 && ! existence_error (errno))
+    if (CVS_UNLINK (finfo->file) < 0 && !existence_error (errno))
        error (0, errno, "unable to remove %s", quote (finfo->fullname));
     return 0;
 }
-
 #endif
 
+
+
 /*
  * remove the file, only if it has already been physically removed
  */
@@ -216,17 +222,18 @@
 
 #ifdef SERVER_SUPPORT
        if (server_active)
-           server_checked_in (finfo->file, finfo->update_dir, 
finfo->repository);
+           server_checked_in (finfo->file, finfo->update_dir,
+                              finfo->repository);
 #endif
        free (fname);
     }
     else if (vers->vn_user[0] == '-')
     {
        if (!quiet)
-           error (0, 0, "file `%s' already scheduled for removal",
-                  finfo->fullname);
+           error (0, 0, "file %s already scheduled for removal",
+                  quote (finfo->fullname));
     }
-    else if (vers->tag != NULL && isdigit ((unsigned char) *vers->tag))
+    else if (vers->tag && isdigit ((unsigned char) *vers->tag))
     {
        /* Commit will just give an error, and so there seems to be
           little reason to allow the remove.  I mean, conflicts that
@@ -238,17 +245,16 @@
           tag means to delete the tag from the file.  I'm not sure that
           is a good behavior, but until it is changed, we need to allow
           it.  */
-       error (0, 0, "\
-cannot remove file `%s' which has a numeric sticky tag of `%s'",
-              finfo->fullname, vers->tag);
+       error (0, 0,
+              "cannot remove file %s which has a numeric sticky tag of %s",
+              quote_n (0, finfo->fullname), quote_n (1, vers->tag));
     }
-    else if (vers->date != NULL)
+    else if (vers->date)
     {
        /* Commit will just give an error, and so there seems to be
           little reason to allow the remove.  */
-       error (0, 0, "\
-cannot remove file `%s' which has a sticky date of `%s'",
-              finfo->fullname, vers->date);
+       error (0, 0, "cannot remove file %s which has a sticky date of %s",
+              quote_n (0, finfo->fullname), quote_n (1, vers->date));
     }
     else
     {
@@ -269,7 +275,7 @@
     }
 
     freevers_ts (&vers);
-    return (0);
+    return 0;
 }
 
 
@@ -283,6 +289,6 @@
                 const char *update_dir, List *entries)
 {
     if (!quiet)
-       error (0, 0, "Removing %s", update_dir);
-    return (R_PROCESS);
+       error (0, 0, "Removing %s", NULL2DOT (update_dir));
+    return R_PROCESS;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]