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

Diff for /src/usr.bin/sort/Attic/fields.c between version 1.1 and 1.2

version 1.1, 1997/01/20 19:39:49 version 1.2, 1997/06/16 02:21:54
Line 110 
Line 110 
                 col++;                  col++;
                 if (pos >= lineend) {                  if (pos >= lineend) {
                         clpos->end = lineend;                          clpos->end = lineend;
                         ++i;                          i++;
                         break;                          break;
                 }                  }
         }          }
         for (; i <= ncols; i++)          for (; i <= ncols; i++)
                 clist[i].start = clist[i].end = lineend;                  clist[i].start = clist[i].end = lineend;
         if (clist[0].start < (u_char *) line->data)          if (clist[0].start < (u_char *) line->data)
                 ++clist[0].start;                  clist[0].start++;
         endkey = (u_char *) keybuf + size - line->size;          endkey = (u_char *) keybuf + size - line->size;
         for (ftpos = fieldtable + 1; ftpos->icol.num; ftpos++)          for (ftpos = fieldtable + 1; ftpos->icol.num; ftpos++)
                 if ((keypos = enterfield(keypos, endkey, ftpos,                  if ((keypos = enterfield(keypos, endkey, ftpos,
Line 147 
Line 147 
         struct column icol, tcol;          struct column icol, tcol;
         register u_int flags;          register u_int flags;
         u_int Rflag;          u_int Rflag;
   
         icol = cur_fld->icol;          icol = cur_fld->icol;
         tcol = cur_fld->tcol;          tcol = cur_fld->tcol;
         flags = cur_fld->flags;          flags = cur_fld->flags;
Line 156 
Line 157 
                 blancmange(start);                  blancmange(start);
         start += icol.indent;          start += icol.indent;
         start = min(start, lineend);          start = min(start, lineend);
   
         if (!tcol.num)          if (!tcol.num)
                 end = lineend;                  end = lineend;
         else {          else {
                 if (tcol.indent) {                  if (tcol.indent) {
                         end = tcol.p->start;                          end = tcol.p->start;
                         if (flags & BT) blancmange(end);                          if (flags & BT)
                                   blancmange(end);
                         end += tcol.indent;                          end += tcol.indent;
                         end = min(end, lineend);                          end = min(end, lineend);
                 } else                  } else
Line 185 
Line 188 
                         } else {                          } else {
                                 *tablepos++ = lweight[*start];                                  *tablepos++ = lweight[*start];
                                 if (tablepos == endkey)                                  if (tablepos == endkey)
                                 return (NULL);                                          return (NULL);
                         }                          }
                 }                  }
         *tablepos++ = lweight[0];          *tablepos++ = lweight[0];
Line 203 
Line 206 
  * if the exponent is exactly 61, 61+252, etc--this is ok, since it's the   * if the exponent is exactly 61, 61+252, etc--this is ok, since it's the
  * only time a field delimiter can come in that position.   * only time a field delimiter can come in that position.
  * Reverse order is done analagously.   * Reverse order is done analagously.
 */   */
   
 u_char *  u_char *
 number(pos, bufend, line, lineend, Rflag)  number(pos, bufend, line, lineend, Rflag)
Line 222 
Line 225 
                 nweights = fnum;                  nweights = fnum;
         if (pos > bufend - 8)          if (pos > bufend - 8)
                 return (NULL);                  return (NULL);
         /* or_sign sets the sort direction:          /*
          *      (-r: +/-)(sign: +/-)(expsign: +/-) */           * or_sign sets the sort direction:
            *      (-r: +/-)(sign: +/-)(expsign: +/-)
            */
         or_sign = sign ^ expsign ^ Rflag;          or_sign = sign ^ expsign ^ Rflag;
         blancmange(line);          blancmange(line);
         if (*line == '-') {     /* set the sign */          if (*line == '-') {     /* set the sign */
Line 232 
Line 237 
                 line++;                  line++;
         }          }
         /* eat initial zeroes */          /* eat initial zeroes */
         for (; *line == '0' && line < lineend; line++);          for (; *line == '0' && line < lineend; line++)
                   ;
         /* calculate exponents < 0 */          /* calculate exponents < 0 */
         if (*line == DECIMAL) {          if (*line == DECIMAL) {
                 exponent = 1;                  exponent = 1;
Line 301 
Line 307 
 /* This forces a gap around the record delimiter  /* This forces a gap around the record delimiter
  * Thus fnum has vaues over (0,254) -> ((0,REC_D-1),(REC_D+1,255));   * Thus fnum has vaues over (0,254) -> ((0,REC_D-1),(REC_D+1,255));
  * rnum over (0,254) -> (255,REC_D+1),(REC_D-1,0))   * rnum over (0,254) -> (255,REC_D+1),(REC_D-1,0))
 */   */
 void  void
 num_init()  num_init()
 {  {
Line 311 
Line 317 
         OFF_TENS = TENS - '0';          OFF_TENS = TENS - '0';
         OFF_NTENS = NEGTENS - '0';          OFF_NTENS = NEGTENS - '0';
         for (i = 1; i < 10; i++) {          for (i = 1; i < 10; i++) {
                 TENS[i] = TENS[i-1] + 10;                  TENS[i] = TENS[i - 1] + 10;
                 NEGTENS[i] = NEGTENS[i-1] - 10;                  NEGTENS[i] = NEGTENS[i - 1] - 10;
         }          }
         for (i = 0; i < REC_D; i++) {          for (i = 0; i < REC_D; i++) {
                 fnum[i] = i;                  fnum[i] = i;
                 rnum[255-i] = i;                  rnum[255 - i] = i;
         }          }
         for (i = REC_D; i <255; i++) {          for (i = REC_D; i <255; i++) {
                 fnum[i] = i+1;                  fnum[i] = i + 1;
                 rnum[255-i] = i-1;                  rnum[255 - i] = i - 1;
         }          }
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2