~ubuntu-branches/ubuntu/quantal/numdiff/quantal

« back to all changes in this revision

Viewing changes to util.c

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2012-02-18 22:46:31 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120218224631-nxdvpq36o05v6sx7
Tags: 5.6.0-1
* New upstream release:
  - provides manpages -- dropped fix-missing-manpages.patch
  - the other patches updated
* Added patches:
  - up-mkdir-manpages.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
bool
74
74
lines_differ (char const *s1, char const *s2, int index1, int index2, argslist* argl)
75
75
{
 
76
  const unsigned long fieldno_upper_limit = 8*FIELDMASK_SIZE;
76
77
  register char const *f1 = s1;
77
78
  register char const *f2 = s2;
78
79
  char *e1, *e2, ch1, ch2; 
104
105
      /*
105
106
        Ignore the fields selected through the option -X
106
107
      */
107
 
      while ( *f1 != '\n' && fieldno1 < 8*FIELDMASK_SIZE && (ghostmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) )
 
108
      while ( *f1 != '\n' && fieldno1 < fieldno_upper_limit && (ghostmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) )
108
109
        {
109
110
          /* First move `f1' to the begin of the next field */
110
111
          for (; *f1 != '\n' && !strchr (ifs, *f1); f1++);
112
113
          /* and then increment the field index */
113
114
          fieldno1++; 
114
115
        }
115
 
      if ( fieldno1 >= 8*FIELDMASK_SIZE )
 
116
      if ( fieldno1 >= fieldno_upper_limit )
116
117
        {
117
 
          printf (_("Line \"%s\"\ncontains too many fields!\n"), s1);
 
118
          fprintf (stderr, _("***  Fatal error occurred in function %s:\n%s"),
 
119
                   __FUNCTION__,
 
120
                   _("***  a very long line has been encountered which contains\n***  too many fields to be correctly handled\n"));
118
121
          exit (EXIT_TROUBLE);
119
122
        }
120
 
      while ( *f2 != '\n' && fieldno2 < 8*FIELDMASK_SIZE && (Ghostmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) )
 
123
      while ( *f2 != '\n' && fieldno2 < fieldno_upper_limit && (Ghostmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) )
121
124
        {
122
125
          /* First move `f2' to the begin of the next field */
123
126
          for (; *f2 != '\n' && !strchr (Ifs, *f2); f2++);
125
128
          /* and then increment the field index */
126
129
          fieldno2++; 
127
130
        }
128
 
      if ( fieldno2 >= 8*FIELDMASK_SIZE )
 
131
      if ( fieldno2 >= fieldno_upper_limit )
129
132
        {
130
 
          printf (_("Line \"%s\"\ncontains too many fields!\n"), s2);
 
133
          fprintf (stderr, _("***  Fatal error occurred in function %s:\n%s"),
 
134
                   __FUNCTION__,
 
135
                   _("***  a very long line has been encountered which contains\n***  too many fields to be correctly handled\n"));
131
136
          exit (EXIT_TROUBLE);
132
137
        }
133
138
      if (*f1 != '\n' && *f2 != '\n')
225
230
  /*
226
231
    Ignore the fields selected through the option -X
227
232
  */
228
 
  while ( *f1 != '\n' && fieldno1 < 8*FIELDMASK_SIZE && (ghostmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) )
 
233
  while ( *f1 != '\n' && fieldno1 < fieldno_upper_limit && (ghostmask[fieldno1 >> 3] & 0x80 >> (fieldno1 & 0x7)) )
229
234
    {
230
235
      /* First move `f1' to the begin of the next field */
231
236
      for (; *f1 != '\n' && !strchr (ifs, *f1); f1++);
233
238
      /* and then increment the field index */
234
239
      fieldno1++; 
235
240
    }
236
 
  if ( fieldno1 >= 8*FIELDMASK_SIZE )
 
241
  if ( fieldno1 >= fieldno_upper_limit )
237
242
    {
238
 
      printf (_("Line \"%s\"\ncontains too many fields!\n"), s1);
 
243
      fprintf (stderr, _("***  Fatal error occurred in function %s:\n%s"),
 
244
               __FUNCTION__,
 
245
               _("***  a very long line has been encountered which contains\n***  too many fields to be correctly handled\n"));
239
246
      exit (EXIT_TROUBLE);
240
247
    }  
241
248
 
242
 
  while ( *f2 != '\n' && fieldno2 < 8*FIELDMASK_SIZE && (Ghostmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) )
 
249
  while ( *f2 != '\n' && fieldno2 < fieldno_upper_limit && (Ghostmask[fieldno2 >> 3] & 0x80 >> (fieldno2 & 0x7)) )
243
250
    {
244
251
      /* First move `f2' to the begin of the next field */
245
252
      for (; *f2 != '\n' && !strchr (Ifs, *f2); f2++);
247
254
      /* and then increment the field index */
248
255
      fieldno2++; 
249
256
    }
250
 
  if ( fieldno2 >= 8*FIELDMASK_SIZE )
 
257
  if ( fieldno2 >= fieldno_upper_limit )
251
258
    {
252
 
      printf (_("Line \"%s\"\ncontains too many fields!\n"), s2);
 
259
      fprintf (stderr, _("***  Fatal error occurred in function %s:\n%s"),
 
260
               __FUNCTION__,
 
261
               _("***  a very long line has been encountered which contains\n***  too many fields to be correctly handled\n"));
253
262
      exit (EXIT_TROUBLE);
254
263
    }
255
264