| 1 |
/* Reduced from coreutils/ls.c attach. */ |
| 2 |
|
| 3 |
void add_zero_terminator (char *buf) |
| 4 |
{ |
| 5 |
char *end = buf; |
| 6 |
while (end++); /* TODO: arguably we should report this. */ |
| 7 |
if (buf < end) |
| 8 |
end[-1] = '\0'; |
| 9 |
} |
| 10 |
|
| 11 |
/* Reduced from coreutils/cat.c. */ |
| 12 |
|
| 13 |
#define LINE_COUNTER_BUF_LEN 20 |
| 14 |
static char line_buf[LINE_COUNTER_BUF_LEN] = |
| 15 |
{ |
| 16 |
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', |
| 17 |
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0', |
| 18 |
'\t', '\0' |
| 19 |
}; |
| 20 |
|
| 21 |
/* Position of the first digit in 'line_buf'. */ |
| 22 |
static char *line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3; |
| 23 |
|
| 24 |
static void |
| 25 |
next_line_num (void) |
| 26 |
{ |
| 27 |
if (line_num_start > line_buf) |
| 28 |
*--line_num_start = '1'; |
| 29 |
} |