Changeset 4273 for zzuf/trunk/src
- Timestamp:
- Jan 15, 2010, 10:14:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/src/zzcat.c
r4271 r4273 62 62 static void usage(void); 63 63 64 /* Output parameters */ 65 static int escape_tabs = 0; 66 static int escape_ends = 0; 67 static int escape_other = 0; 68 static int number_lines = 0; 69 static int number_nonblank = 0; 70 static int squeeze_lines = 0; 64 /* Global parameters */ 65 static char escape_tabs = 0; 66 static char escape_ends = 0; 67 static char escape_other = 0; 68 static char number_lines = 0; 69 static char number_nonblank = 0; 70 static char squeeze_lines = 0; 71 72 /* Global output state */ 73 static int ncrs = 0; 74 static int line = 1; 75 static char newline = 1; 71 76 72 77 /* … … 177 182 { 178 183 size_t i; 179 int line = 1, newline = 1; 180 184 185 /* If no special features are requested, output directly */ 181 186 if (!(escape_tabs || escape_ends || escape_other 182 187 || number_lines || number_nonblank || squeeze_lines)) … … 186 191 } 187 192 193 /* If any special feature is active, go through every possibility */ 188 194 for (i = 0; i < len; i++) 189 195 { 190 196 int ch = (unsigned int)(unsigned char)buf[i]; 191 197 192 if (squeeze_lines && i > 1 193 && ch == '\n' && buf[i - 1] == '\n' && buf[i - 2] == '\n') 194 continue; 198 if (squeeze_lines) 199 { 200 if (ch == '\n') 201 { 202 if (++ncrs > 2) 203 continue; 204 } 205 else 206 ncrs = 0; 207 } 195 208 196 209 if (number_lines || number_nonblank) … … 352 365 size_t retlen = 0, retoff = 0; 353 366 int nloops = 0, fd = -1, feofs = 0, finish = 0; 367 368 /* Initialise per-file state */ 369 /* TODO */ 354 370 355 371 /* Allocate 32MB for our temporary buffer. Any larger value will crash. */
Note: See TracChangeset
for help on using the changeset viewer.