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

Diff for /src/usr.bin/mail/cmd3.c between version 1.7 and 1.8

version 1.7, 1997/07/14 00:24:25 version 1.8, 1997/07/30 06:32:38
Line 65 
Line 65 
         char *shell;          char *shell;
         char cmd[BUFSIZ];          char cmd[BUFSIZ];
   
         (void)strcpy(cmd, str);          (void)strncpy(cmd, str, sizeof(cmd) - 1);
         if (bangexp(cmd) < 0)          cmd[sizeof(cmd) - 1] = '\0';
           if (bangexp(cmd, sizeof(cmd)) < 0)
                 return(1);                  return(1);
         if ((shell = value("SHELL")) == NULL)          if ((shell = value("SHELL")) == NULL)
                 shell = _PATH_CSHELL;                  shell = _PATH_CSHELL;
Line 99 
Line 100 
  * Expand the shell escape by expanding unescaped !'s into the   * Expand the shell escape by expanding unescaped !'s into the
  * last issued command where possible.   * last issued command where possible.
  */   */
   
 char    lastbang[128];  
   
 int  int
 bangexp(str)  bangexp(str, strsize)
         char *str;          char *str;
           size_t strsize;
 {  {
         char bangbuf[BUFSIZ];          char bangbuf[BUFSIZ];
           static char lastbang[BUFSIZ];
         register char *cp, *cp2;          register char *cp, *cp2;
         register int n;          register int n;
         int changed = 0;          int changed = 0;
Line 141 
Line 141 
         }          }
         *cp2 = 0;          *cp2 = 0;
         if (changed) {          if (changed) {
                 printf("!%s\n", bangbuf);                  (void)printf("!%s\n", bangbuf);
                 fflush(stdout);                  (void)fflush(stdout);
         }          }
         strcpy(str, bangbuf);          (void)strncpy(str, bangbuf, strsize - 1);
         strncpy(lastbang, bangbuf, sizeof(lastbang) - 1);          str[strsize - 1]  = '\0';
           (void)strncpy(lastbang, bangbuf, sizeof(lastbang) - 1);
         lastbang[sizeof(lastbang) - 1] = '\0';          lastbang[sizeof(lastbang) - 1] = '\0';
         return(0);          return(0);
 }  }

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