clean output messages

This commit is contained in:
tTh 2022-10-04 05:47:23 +02:00
parent cb76c0350f
commit 11d559eade

40
code/misctools/nonascii.c Normal file
View File

@ -0,0 +1,40 @@
/*
* nonascii.c
*
* new Mon 03 Oct 2022 05:42:42 PM CEST
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int input, linenum, count;
int flagline;
linenum = 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",
input, linenum);
flagline = 1;
}
count++;
}
}
if (count) {
fprintf(stderr, "%d non-ascii chars\n", count);
exit(1);
}
return 0;
}