Don't indent non-numbered lines in nl(1)

This is yet another GNU-specific behaviour we fell for.
POSIX explicitly states that for non-numbered lines, all indentation-
crap should be dropped immediately. Well, we didn't listen, so this
commit will set things straight again.
Honestly speaking, this also looks much cleaner than before.
Fuck GNU!
This commit is contained in:
FRIGN 2015-03-22 18:30:45 +01:00
parent 3ccfa1877d
commit b96c9d06c5

5
nl.c
View File

@ -46,7 +46,7 @@ getsection(char *buf, int *section)
static void static void
nl(const char *fname, FILE *fp) nl(const char *fname, FILE *fp)
{ {
size_t i, number = startnum, size = 0; size_t number = startnum, size = 0;
int donumber, oldsection, section = 1, bl = 1; int donumber, oldsection, section = 1, bl = 1;
char *buf = NULL; char *buf = NULL;
@ -81,9 +81,6 @@ nl(const char *fname, FILE *fp)
if (donumber) { if (donumber) {
printf(format, width, number, sep); printf(format, width, number, sep);
number += incr; number += incr;
} else {
for (i = 0; i < width; i++)
putchar(' ');
} }
fputs(buf, stdout); fputs(buf, stdout);
} }