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

Diff for /src/usr.bin/rdist/expand.c between version 1.16 and 1.17

version 1.16, 2018/09/09 13:53:11 version 1.17, 2018/09/21 19:00:45
Line 52 
Line 52 
 char           *lastpathp;  char           *lastpathp;
 char           *tilde;          /* "~user" if not expanding tilde, else "" */  char           *tilde;          /* "~user" if not expanding tilde, else "" */
 char           *tpathp;  char           *tpathp;
   char            pathbuf[BUFSIZ];
   
 int             expany;         /* any expansions done? */  int             expany;         /* any expansions done? */
 char           *entp;  char           *entp;
Line 116 
Line 117 
 {  {
         struct namelist *nl, *prev;          struct namelist *nl, *prev;
         int n;          int n;
         char pathbuf[BUFSIZ];  
   
         if (debug)          if (debug)
                 debugmsg(DM_CALL, "expand(%p, %d) start, list = %s",                  debugmsg(DM_CALL, "expand(%p, %d) start, list = %s",
Line 260 
Line 260 
                 return;                  return;
         }          }
         if (*s == '~') {          if (*s == '~') {
                 struct passwd *pw;                  if ((cp = strchr(s, '/')) == NULL) {
   
                 cp = ++s;  
                 if (*cp == CNULL || *cp == '/') {  
                         tilde = "~";                          tilde = "~";
                         cp1 = (u_char *)homedir;                          s++;
                 } else {                  } else {
                         tilde = (char *)(cp1 = ebuf);                          tilde = memcpy(ebuf, s, (cp - s));
                         *cp1++ = '~';                          ebuf[cp - s] = '\0';
                         do  
                                 *cp1++ = *cp++;  
                         while (*cp && *cp != '/');  
                         *cp1 = CNULL;  
                         if (strcmp(locuser, (char *)ebuf+1) != 0) {  
                                 if ((pw = getpwnam((char *)ebuf+1)) == NULL) {  
                                         strlcat((char *)ebuf,  
                                                 ": unknown user name",  
                                                 sizeof(ebuf));  
                                         yyerror((char *)ebuf+1);  
                                         return;  
                                 }  
                                 cp1 = (u_char *)pw->pw_dir;  
                         } else {  
                                 cp1 = (u_char *)homedir;  
                         }  
                         s = cp;                          s = cp;
                 }                  }
                 for (cp = (u_char *)path; (*cp++ = *cp1++) != '\0'; )                  cp = exptilde(path, tilde, sizeof(pathbuf));
                         continue;                  tpathp = pathp = (char *)cp;
                 tpathp = pathp = (char *)cp - 1;  
         } else {          } else {
                 tpathp = pathp = path;                  tpathp = pathp = path;
                 tilde = "";                  tilde = "";

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17