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

Diff for /src/usr.bin/oldrdist/Attic/docmd.c between version 1.6 and 1.7

version 1.6, 1996/07/30 20:34:54 version 1.7, 1996/08/22 20:33:17
Line 41 
Line 41 
 #include "defs.h"  #include "defs.h"
 #include <setjmp.h>  #include <setjmp.h>
 #include <netdb.h>  #include <netdb.h>
   #include <regex.h>
   
 FILE    *lfp;                   /* log file for recording files updated */  FILE    *lfp;                   /* log file for recording files updated */
 struct  subcmd *subcmds;        /* list of sub-commands for current cmd */  struct  subcmd *subcmds;        /* list of sub-commands for current cmd */
Line 148 
Line 149 
                 signal(SIGPIPE, lostconn);                  signal(SIGPIPE, lostconn);
                 if (!makeconn(rhost))                  if (!makeconn(rhost))
                         return;                          return;
                 if ((fd = mkstemp(tempfile)) == -1 ||                  if ((fd = open(tempfile, O_CREAT|O_EXCL|O_WRONLY, 0600)) < 0 ||
                     (lfp = fdopen(fd, "w")) == NULL) {                      (lfp = fdopen(fd, "w")) == NULL) {
                         if (fd != -1)                          if (fd >= 0)
                                 close(fd);                                  (void) close(fd);
                         fatal("cannot open %s\n", tempfile);                          fatal("cannot open %s\n", tempfile);
                         exit(1);                          exit(1);
                 }                  }
Line 245 
Line 246 
                 ruser = user;                  ruser = user;
         if (!qflag)          if (!qflag)
                 printf("updating host %s\n", rhost);                  printf("updating host %s\n", rhost);
         (void) snprintf(buf, BUFSIZ, "%s -Server%s", _PATH_RDIST,          (void) snprintf(buf, sizeof(buf), "%s -Server%s", _PATH_RDIST,
                 qflag ? " -q" : "");                  qflag ? " -q" : "");
 #if     defined(DIRECT_RCMD)  #if     defined(DIRECT_RCMD)
         if (port < 0) {          if (port < 0) {
Line 272 
Line 273 
         rem = rcmd(&rhost, port, user, ruser, buf, 0);          rem = rcmd(&rhost, port, user, ruser, buf, 0);
         seteuid(userid);          seteuid(userid);
 #else   /* !DIRECT_RCMD */  #else   /* !DIRECT_RCMD */
         rem = rshrcmd(&rhost, -1, user, ruser, buf, 0);          rem = rcmdsh(&rhost, -1, user, ruser, buf, NULL);
 #endif  /* !DIRECT_RCMD */  #endif  /* !DIRECT_RCMD */
         if (rem < 0)          if (rem < 0)
                 return(0);                  return(0);
Line 399 
Line 400 
         else {          else {
                 int fd;                  int fd;
   
                 if ((fd = mkstemp(tempfile)) == -1 ||                  if ((fd = open(tempfile, O_CREAT|O_EXCL|O_WRONLY, 0600)) < 0 ||
                     (tfp = fdopen(fd, "w")) == NULL) {                      (tfp = fdopen(fd, "w")) == NULL) {
                         if (fd != -1)  
                                 close(fd);  
                         error("%s: %s\n", stamp, strerror(errno));                          error("%s: %s\n", stamp, strerror(errno));
                           if (fd >= 0)
                                   (void) close(fd);
                         return;                          return;
                 }                  }
                 (void) gettimeofday(&tv[0], &tz);                  (void) gettimeofday(&tv[0], &tz);
Line 565 
Line 566 
         /*          /*
          * Create a pipe to mailling program.           * Create a pipe to mailling program.
          */           */
         (void) snprintf(buf, BUFSIZ, "%s -oi -t", _PATH_SENDMAIL);          (void) snprintf(buf, sizeof(buf), "%s -oi -t", _PATH_SENDMAIL);
         pf = popen(buf, "w");          pf = popen(buf, "w");
         if (pf == NULL) {          if (pf == NULL) {
                 error("notify: \"%s\" failed\n", _PATH_SENDMAIL);                  error("notify: \"%s\" failed\n", _PATH_SENDMAIL);
Line 628 
Line 629 
 {  {
         register struct subcmd *sc;          register struct subcmd *sc;
         register struct namelist *nl;          register struct namelist *nl;
           regex_t s;
           int err;
   
         if (debug)          if (debug)
                 printf("except(%s)\n", file);                  printf("except(%s)\n", file);
Line 641 
Line 644 
                                         return(1);                                          return(1);
                                 continue;                                  continue;
                         }                          }
                         re_comp(nl->n_name);                          if ((err = regcomp(&s, nl->n_name, 0)) != 0) {
                         if (re_exec(file) > 0)                                  (void) regerror(err, &s, buf, sizeof(buf));
                                   error("%s: %s\n", nl->n_name, buf);
                           }
                           if (regexec(&s, file, 0, NULL, 0) == 0) {
                                   regfree(&s);
                                 return(1);                                  return(1);
                           }
                           regfree(&s);
                 }                  }
         }          }
         return(0);          return(0);

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