diff --git a/code/misctools/Makefile b/code/misctools/Makefile new file mode 100644 index 0000000..515ba38 --- /dev/null +++ b/code/misctools/Makefile @@ -0,0 +1,4 @@ + + +nonascii: nonascii.c Makefile + gcc -Wall $< -o $@ diff --git a/code/misctools/README.md b/code/misctools/README.md new file mode 100644 index 0000000..2c03962 --- /dev/null +++ b/code/misctools/README.md @@ -0,0 +1,7 @@ +# Outils divers + + +OK, let's go for a few nice tools. + +## non ascii ? + diff --git a/code/misctools/nonascii.c b/code/misctools/nonascii.c index c8dcbb3..c5e411e 100644 --- a/code/misctools/nonascii.c +++ b/code/misctools/nonascii.c @@ -12,16 +12,14 @@ int main(int argc, char *argv[]) int input, linenum, count; int flagline; -linenum = 1; +linenum = 1; /* humans start line count at 1 */ count = 0; while (EOF != (input=getc(stdin))) { - if ('\n' == input) { linenum++; flagline = 0; } - if ((input < 0) || (input>127)) { if (!flagline) { fprintf(stderr, "non ascii 0x%x line %d\n", @@ -32,9 +30,8 @@ while (EOF != (input=getc(stdin))) { } } if (count) { - fprintf(stderr, "%d non-ascii chars\n", count); + fprintf(stderr, "at least %d non-ascii characters found\n", count); exit(1); } - return 0; } \ No newline at end of file