a new tool from tth
This commit is contained in:
parent
5a610e0926
commit
9e8a6b3411
4
code/misctools/Makefile
Normal file
4
code/misctools/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
nonascii: nonascii.c Makefile
|
||||
gcc -Wall $< -o $@
|
7
code/misctools/README.md
Normal file
7
code/misctools/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Outils divers
|
||||
|
||||
|
||||
OK, let's go for a few nice tools.
|
||||
|
||||
## non ascii ?
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user