rester bien sagement en ASCII
This commit is contained in:
parent
73a611e55f
commit
cb76c0350f
5
misctools/README.md
Normal file
5
misctools/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Outils divers
|
||||
|
||||
|
||||
## non ascii ?
|
||||
|
33
misctools/nonascii.c
Normal file
33
misctools/nonascii.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
linenum = 1;
|
||||
count = 0;
|
||||
|
||||
while (EOF != (input=getc(stdin))) {
|
||||
|
||||
if ('\n' == input) linenum++;
|
||||
|
||||
if ((input < 0) || (input>127)) {
|
||||
fprintf(stderr, "non ascii 0x%x line %d\n",
|
||||
input, linenum);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count) {
|
||||
fprintf(stderr, "%d non-ascii chars\n", count);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user