[BACK]Return to add.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/add.c between version 1.9 and 1.10

version 1.9, 2004/12/08 20:23:06 version 1.10, 2004/12/21 16:48:39
Line 29 
Line 29 
 #include <errno.h>  #include <errno.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <unistd.h>  
 #include <string.h>  #include <string.h>
 #include <sysexits.h>  #include <sysexits.h>
   #include <unistd.h>
   
 #include "cvs.h"  #include "cvs.h"
 #include "log.h"  #include "log.h"
Line 41 
Line 41 
 extern char *__progname;  extern char *__progname;
   
   
   
 int  cvs_add_file (CVSFILE *, void *);  int  cvs_add_file (CVSFILE *, void *);
   
   
   
 /*  /*
  * cvs_add()   * cvs_add()
  *   *
Line 59 
Line 57 
         char *kflag, *msg;          char *kflag, *msg;
         struct cvsroot *root;          struct cvsroot *root;
   
         kflag = NULL;          kflag = msg = NULL;
   
         while ((ch = getopt(argc, argv, "k:m:")) != -1) {          while ((ch = getopt(argc, argv, "k:m:")) != -1) {
                 switch (ch) {                  switch (ch) {
Line 84 
Line 82 
         if (cvs_files == NULL)          if (cvs_files == NULL)
                 return (EX_DATAERR);                  return (EX_DATAERR);
   
           root = CVS_DIR_ROOT(cvs_files);
   
           if ((root->cr_method != CVS_METHOD_LOCAL) && (cvs_connect(root) < 0))
                   return (EX_PROTOCOL);
   
         cvs_file_examine(cvs_files, cvs_add_file, NULL);          cvs_file_examine(cvs_files, cvs_add_file, NULL);
   
         root = CVS_DIR_ROOT(cvs_files);          if (root->cr_method != CVS_METHOD_LOCAL) {
                   if (cvs_senddir(root, cvs_files) < 0)
                           return (EX_PROTOCOL);
   
         for (i = 0; i < argc; i++)                  for (i = 0; i < argc; i++)
                 cvs_sendarg(root, argv[i], 0);                          if (cvs_sendarg(root, argv[i], 0) < 0)
         if (cvs_sendreq(root, CVS_REQ_ADD, NULL) < 0)                                  return (EX_PROTOCOL);
                 return (-1);  
   
                   if (cvs_sendreq(root, CVS_REQ_ADD, NULL) < 0)
                           return (EX_PROTOCOL);
           }
   
         return (0);          return (0);
 }  }
   
Line 100 
Line 108 
 int  int
 cvs_add_file(CVSFILE *cf, void *arg)  cvs_add_file(CVSFILE *cf, void *arg)
 {  {
           int ret;
         struct cvsroot *root;          struct cvsroot *root;
   
         if (cf->cf_type == DT_DIR) {          ret = 0;
                 if (cf->cf_cvstat != CVS_FST_UNKNOWN) {          root = CVS_DIR_ROOT(cf);
                         root = cf->cf_ddat->cd_root;  
                         if ((cf->cf_parent == NULL) ||  
                             (root != cf->cf_parent->cf_ddat->cd_root)) {  
                                 cvs_connect(root);  
                         }  
   
                         cvs_senddir(root, cf);          if (cf->cf_type == DT_DIR) {
                   if (root->cr_method != CVS_METHOD_LOCAL) {
                           if (cf->cf_cvstat == CVS_FST_UNKNOWN)
                                   ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE,
                                       CVS_FILE_NAME(cf));
                           else
                                   ret = cvs_senddir(root, cf);
                 }                  }
   
                 return (0);                  return (ret);
         }          }
   
         root = CVS_DIR_ROOT(cf);  
   
         if (root->cr_method != CVS_METHOD_LOCAL) {          if (root->cr_method != CVS_METHOD_LOCAL) {
                 cvs_sendreq(root, CVS_REQ_ISMODIFIED, CVS_FILE_NAME(cf));                  cvs_sendreq(root, CVS_REQ_ADD, CVS_FILE_NAME(cf));
         } else {          } else {
                 cvs_log(LP_INFO, "scheduling file `%s' for addition",                  cvs_log(LP_INFO, "scheduling file `%s' for addition",
                     cf->cf_name);                      CVS_FILE_NAME(cf));
                 cvs_log(LP_INFO, "use `%s commit' to add this file permanently",                  cvs_log(LP_INFO, "use `%s commit' to add this file permanently",
                     __progname);                      __progname);
         }          }
   
         return (0);          return (ret);
 }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10