mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 16:56:40 +08:00
Use stdin by default as before
This commit is contained in:
parent
972d061e90
commit
1c89a2f8ff
@ -122,11 +122,16 @@ int main(int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE * f = NULL;
|
FILE * f = stdin;
|
||||||
int error_seen = 0;
|
int error_seen = 0;
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
// No file arg, use stdin by default
|
||||||
|
detect(f);
|
||||||
|
}
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
char *filename = argv[i];
|
const char *filename = argv[i];
|
||||||
f = fopen(filename, "r");
|
f = fopen(filename, "r");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
{
|
{
|
||||||
@ -134,11 +139,11 @@ int main(int argc, char ** argv)
|
|||||||
error_seen = 1;
|
error_seen = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (argc > 2) {
|
if (argc > 2)
|
||||||
|
{
|
||||||
printf("%s: ", filename);
|
printf("%s: ", filename);
|
||||||
}
|
}
|
||||||
detect(f);
|
detect(f);
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return error_seen;
|
return error_seen;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user