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

Diff for /src/usr.bin/look/look.c between version 1.18 and 1.19

version 1.18, 2015/10/09 01:37:08 version 1.19, 2016/09/13 15:27:47
Line 57 
Line 57 
   
 #include "pathnames.h"  #include "pathnames.h"
   
 /*  
  * FOLD and DICT convert characters to a normal form for comparison,  
  * according to the user specified flags.  
  *  
  * DICT expects integers because it uses a non-character value to  
  * indicate a character which should not participate in comparisons.  
  */  
 #define EQUAL           0  #define EQUAL           0
 #define GREATER         1  #define GREATER         1
 #define LESS            (-1)  #define LESS            (-1)
 #define NO_COMPARE      (-2)  
   
 #define FOLD(c) (isascii(c) && isupper(c) ? tolower(c) : (c))  
 #define DICT(c) (isascii(c) && isalnum(c) ? (c) : NO_COMPARE)  
   
 int dflag, fflag;  int dflag, fflag;
   
 char    *binary_search(char *, char *, char *);  char    *binary_search(char *, char *, char *);
Line 147 
Line 136 
         /* Reformat string to avoid doing it multiple times later. */          /* Reformat string to avoid doing it multiple times later. */
         for (readp = writep = string; ch = *readp++;) {          for (readp = writep = string; ch = *readp++;) {
                 if (fflag)                  if (fflag)
                         ch = FOLD((unsigned char)ch);                          ch = tolower((unsigned char)ch);
                 if (dflag)                  if (!dflag || isalnum((unsigned char)ch))
                         ch = DICT((unsigned char)ch);  
                 if (ch != NO_COMPARE)  
                         *(writep++) = ch;                          *(writep++) = ch;
         }          }
         *writep = '\0';          *writep = '\0';
Line 294 
Line 281 
         for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) {          for (; *s1 && s2 < back && *s2 != '\n'; ++s1, ++s2) {
                 ch = *s2;                  ch = *s2;
                 if (fflag)                  if (fflag)
                         ch = FOLD((unsigned char)ch);                          ch = tolower((unsigned char)ch);
                 if (dflag)                  if (dflag && !isalnum((unsigned char)ch)) {
                         ch = DICT((unsigned char)ch);  
   
                 if (ch == NO_COMPARE) {  
                         ++s2;           /* Ignore character in comparison. */                          ++s2;           /* Ignore character in comparison. */
                         continue;                          continue;
                 }                  }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19