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

Diff for /src/usr.bin/encrypt/encrypt.c between version 1.27 and 1.28

version 1.27, 2007/05/01 01:26:25 version 1.28, 2007/07/14 21:26:38
Line 51 
Line 51 
 char buffer[_PASSWORD_LEN];  char buffer[_PASSWORD_LEN];
   
 void    usage(void);  void    usage(void);
 char    *trim(char *);  
 void    print_passwd(char *, int, void *);  void    print_passwd(char *, int, void *);
   
 void  void
Line 64 
Line 63 
         exit(1);          exit(1);
 }  }
   
 char *  
 trim(char *line)  
 {  
         char *ptr;  
   
         if (line[0] == '\0')  
                 return (line);  
   
         for (ptr = &line[strlen(line)-1]; ptr > line; ptr--) {  
                 if (!isspace(*ptr))  
                         break;  
         }  
         ptr[1] = '\0';  
   
         for (ptr = line; isspace(*ptr); ptr++)  
                 ;  
   
         return(ptr);  
 }  
   
 void  void
 print_passwd(char *string, int operation, void *extra)  print_passwd(char *string, int operation, void *extra)
 {  {
Line 206 
Line 185 
                         print_passwd(string, operation, extra);                          print_passwd(string, operation, extra);
                         (void)fputc('\n', stdout);                          (void)fputc('\n', stdout);
                 } else {                  } else {
                           size_t len;
                         /* Encrypt stdin to stdout. */                          /* Encrypt stdin to stdout. */
                         while (!feof(stdin) &&                          while (!feof(stdin) &&
                             (fgets(line, sizeof(line), stdin) != NULL)) {                              (fgets(line, sizeof(line), stdin) != NULL)) {
                                 /* Kill the whitesapce. */                                  len = strlen(line);
                                 string = trim(line);                                  if (len == 0 || line[0] == '\n')
                                 if (*string == '\0')  
                                         continue;                                          continue;
                                   if (line[len - 1] == '\n')
                                 print_passwd(string, operation, extra);                                          line[len - 1] = '\0';
   
                                   print_passwd(line, operation, extra);
   
                                 if (operation == DO_MAKEKEY) {                                  if (operation == DO_MAKEKEY) {
                                         fflush(stdout);                                          fflush(stdout);

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28