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

Diff for /src/usr.bin/ftp/complete.c between version 1.4 and 1.5

version 1.4, 1997/03/14 04:32:13 version 1.5, 1997/03/21 20:59:28
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: complete.c,v 1.3 1997/03/13 06:23:13 lukem Exp $       */  /*      $NetBSD: complete.c,v 1.6 1997/03/16 14:24:16 lukem Exp $       */
   
 /*-  /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.   * Copyright (c) 1997 The NetBSD Foundation, Inc.
Line 37 
Line 37 
  * POSSIBILITY OF SUCH DAMAGE.   * POSSIBILITY OF SUCH DAMAGE.
  */   */
   
   #ifndef SMALL
 #ifndef lint  #ifndef lint
 static char rcsid[] = "$OpenBSD$";  static char rcsid[] = "$OpenBSD$";
 #endif /* not lint */  #endif /* not lint */
Line 86 
Line 87 
                 return (CC_ERROR);      /* no choices available */                  return (CC_ERROR);      /* no choices available */
   
         if (words->sl_cur == 1) {       /* only once choice available */          if (words->sl_cur == 1) {       /* only once choice available */
                 strcpy(insertstr, words->sl_str[0]);                  (void)strcpy(insertstr, words->sl_str[0]);
                 if (el_insertstr(el, insertstr + wordlen) == -1)                  if (el_insertstr(el, insertstr + wordlen) == -1)
                         return (CC_ERROR);                          return (CC_ERROR);
                 else                  else
Line 105 
Line 106 
                                 matchlen = j;                                  matchlen = j;
                 }                  }
                 if (matchlen > wordlen) {                  if (matchlen > wordlen) {
                         strncpy(insertstr, lastmatch, matchlen);                          (void)strncpy(insertstr, lastmatch, matchlen);
                         insertstr[matchlen] = '\0';                          insertstr[matchlen] = '\0';
                         if (el_insertstr(el, insertstr + wordlen) == -1)                          if (el_insertstr(el, insertstr + wordlen) == -1)
                                 return (CC_ERROR);                                  return (CC_ERROR);
Line 167 
Line 168 
         unsigned char rv;          unsigned char rv;
   
         if ((file = strrchr(word, '/')) == NULL) {          if ((file = strrchr(word, '/')) == NULL) {
                 strcpy(dir, ".");                  dir[0] = '.';
                   dir[1] = '\0';
                 file = word;                  file = word;
         } else {          } else {
                 if (file == word)                  if (file == word) {
                         strcpy(dir, "/");                          dir[0] = '/';
                 else {                          dir[1] = '\0';
                         strncpy(dir, word, file - word);                  } else {
                           (void)strncpy(dir, word, file - word);
                         dir[file - word] = '\0';                          dir[file - word] = '\0';
                 }                  }
                 ++file;                  file++;
         }          }
   
         if ((dd = opendir(dir)) == NULL)          if ((dd = opendir(dir)) == NULL)
Line 224 
Line 227 
         char *dummyargv[] = { "complete", dir, NULL };          char *dummyargv[] = { "complete", dir, NULL };
   
         if ((file = strrchr(word, '/')) == NULL) {          if ((file = strrchr(word, '/')) == NULL) {
                 (void)strcpy(dir, ".");                  dir[0] = '.';
                   dir[1] = '\0';
                 file = word;                  file = word;
         } else {          } else {
                 cp = file;                  cp = file;
Line 320 
Line 324 
         len = lf->lastchar - lf->buffer;          len = lf->lastchar - lf->buffer;
         if (len >= sizeof(line))          if (len >= sizeof(line))
                 return (CC_ERROR);                  return (CC_ERROR);
         strncpy(line, lf->buffer, len);          (void)strncpy(line, lf->buffer, len);
         line[len] = '\0';          line[len] = '\0';
         cursor_pos = line + (lf->cursor - lf->buffer);          cursor_pos = line + (lf->cursor - lf->buffer);
         lastc_argc = cursor_argc;       /* remember last cursor pos */          lastc_argc = cursor_argc;       /* remember last cursor pos */
Line 336 
Line 340 
             && strncmp(word, margv[cursor_argc], cursor_argo) == 0)              && strncmp(word, margv[cursor_argc], cursor_argo) == 0)
                 dolist = 1;                  dolist = 1;
         else          else
             strncpy(word, margv[cursor_argc], cursor_argo);              (void)strncpy(word, margv[cursor_argc], cursor_argo);
         word[cursor_argo] = '\0';          word[cursor_argo] = '\0';
   
         if (cursor_argc == 0)          if (cursor_argc == 0)
Line 376 
Line 380 
   
         return (CC_ERROR);          return (CC_ERROR);
 }  }
   #endif

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5