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

Diff for /src/usr.bin/cvs/modules.c between version 1.6 and 1.7

version 1.6, 2008/02/03 23:34:41 version 1.7, 2008/02/04 19:08:32
Line 40 
Line 40 
 }  }
   
 void  void
 modules_parse_line(char *line)  modules_parse_line(char *line, int lineno)
 {  {
         int flags;          int flags;
         struct cvs_filelist *fl;  
         char *val, *p, *module, *sp, *dp;  
         struct module_info *mi;          struct module_info *mi;
         char *dirname, fpath[MAXPATHLEN];          char *val, *p, *module, *sp, *dp;
           char *dirname, fpath[MAXPATHLEN], *prog;
   
         flags = 0;          flags = 0;
         p = val = line;          p = val = line;
         while (*p != ' ' && *p != '\t')          while (*p != ' ' && *p != '\t' && *p != '\0')
                 p++;                  p++;
   
           if (*p == '\0')
                   goto bad;
   
         *(p++) = '\0';          *(p++) = '\0';
         module = val;          module = val;
   
         while (*p == ' ' || *p == '\t')          while ((*p == ' ' || *p == '\t') && *p != '\0')
                 p++;                  p++;
   
         if (*p == '\0') {          if (*p == '\0')
                 cvs_log(LP_NOTICE, "premature ending of CVSROOT/modules line");                  goto bad;
                 return;  
         }  
   
         val = p;          val = p;
         while (*p != ' ' && *p != '\t')          while (*p != ' ' && *p != '\t')
                 p++;                  p++;
   
         if (*p == '\0') {          prog = NULL;
                 cvs_log(LP_NOTICE, "premature ending of CVSROOT/modules line");  
                 return;  
         }  
   
         while (val[0] == '-') {          while (val[0] == '-') {
                 p = val;                  p = val;
                 while (*p != ' ' && *p != '\t' && *p != '\0')                  while (*p != ' ' && *p != '\t' && *p != '\0')
                         p++;                          p++;
   
                 if (*p == '\0') {                  if (*p == '\0')
                         cvs_log(LP_NOTICE,                          goto bad;
                             "misplaced option in CVSROOT/modules");  
                         return;  
                 }  
   
                 *(p++) = '\0';                  *(p++) = '\0';
   
Line 105 
Line 98 
                         flags |= MODULE_NORECURSE;                          flags |= MODULE_NORECURSE;
                         break;                          break;
                 case 'i':                  case 'i':
                         if (flags != 0) {                          if (flags != 0 || prog != NULL) {
                                 cvs_log(LP_NOTICE,                                  cvs_log(LP_NOTICE,
                                     "-i cannot be used with other flags");                                      "-i cannot be used with other flags");
                                 return;                                  return;
                         }                          }
   
                           if ((val = strchr(p, ' ' )) == NULL)
                                   goto bad;
   
                           *(val++) = '\0';
                           prog = xstrdup(p);
                           p = val;
                         flags |= MODULE_RUN_ON_COMMIT;                          flags |= MODULE_RUN_ON_COMMIT;
                         break;                          break;
                 }                  }
Line 117 
Line 117 
                 val = p;                  val = p;
         }          }
   
         /* XXX: until we support it */          if (*val == '\0')
         if (flags & MODULE_RUN_ON_COMMIT)                  goto bad;
                 return;  
   
         mi = xmalloc(sizeof(*mi));          mi = xmalloc(sizeof(*mi));
         mi->mi_name = xstrdup(module);          mi->mi_name = xstrdup(module);
         mi->mi_flags = flags;          mi->mi_flags = flags;
           mi->mi_prog = prog;
   
         dirname = NULL;          dirname = NULL;
         TAILQ_INIT(&(mi->mi_modules));          TAILQ_INIT(&(mi->mi_modules));
Line 164 
Line 164 
                 cvs_file_get(dirname, 0, &(mi->mi_modules));                  cvs_file_get(dirname, 0, &(mi->mi_modules));
   
         TAILQ_INSERT_TAIL(&modules, mi, m_list);          TAILQ_INSERT_TAIL(&modules, mi, m_list);
           return;
   
   bad:
           cvs_log(LP_NOTICE, "malformed line in CVSROOT/modules: %d", lineno);
 }  }
   
 struct module_checkout *  struct module_checkout *
Line 180 
Line 184 
                         mc->mc_modules = mi->mi_modules;                          mc->mc_modules = mi->mi_modules;
                         mc->mc_ignores = mi->mi_ignores;                          mc->mc_ignores = mi->mi_ignores;
                         mc->mc_canfree = 0;                          mc->mc_canfree = 0;
                         mc->mc_name = xstrdup(mi->mi_name);                          mc->mc_name = mi->mi_name;
                         mc->mc_flags = mi->mi_flags;                          mc->mc_flags = mi->mi_flags;
                           mc->mc_prog = mi->mi_prog;
                         return (mc);                          return (mc);
                 }                  }
         }          }
Line 190 
Line 195 
         TAILQ_INIT(&(mc->mc_ignores));          TAILQ_INIT(&(mc->mc_ignores));
         cvs_file_get(name, 0, &(mc->mc_modules));          cvs_file_get(name, 0, &(mc->mc_modules));
         mc->mc_canfree = 1;          mc->mc_canfree = 1;
         mc->mc_name = xstrdup(name);          mc->mc_name = name;
         mc->mc_flags |= MODULE_ALIAS;          mc->mc_flags |= MODULE_ALIAS;
           mc->mc_prog = NULL;
   
         return (mc);          return (mc);
 }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7