mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
intel/tools/aubinator_error_decode: allow "-" as an input file
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7833>
This commit is contained in:
parent
8ffa45a775
commit
7a7010d4f5
1 changed files with 11 additions and 8 deletions
|
|
@ -749,7 +749,7 @@ print_help(const char *progname, FILE *file)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file = NULL;
|
||||||
const char *path;
|
const char *path;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int c, i, error;
|
int c, i, error;
|
||||||
|
|
@ -820,11 +820,14 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
path = argv[optind];
|
path = argv[optind];
|
||||||
error = stat(path, &st);
|
if (strcmp(path, "-") == 0) {
|
||||||
if (error != 0) {
|
file = stdin;
|
||||||
fprintf(stderr, "Error opening %s: %s\n",
|
} else {
|
||||||
path, strerror(errno));
|
error = stat(path, &st);
|
||||||
exit(EXIT_FAILURE);
|
if (error != 0) {
|
||||||
|
fprintf(stderr, "Error opening %s: %s\n", path, strerror(errno));
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -834,7 +837,7 @@ main(int argc, char *argv[])
|
||||||
if (isatty(1) && pager)
|
if (isatty(1) && pager)
|
||||||
setup_pager();
|
setup_pager();
|
||||||
|
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (!file && S_ISDIR(st.st_mode)) {
|
||||||
ASSERTED int ret;
|
ASSERTED int ret;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
|
@ -860,7 +863,7 @@ main(int argc, char *argv[])
|
||||||
path);
|
path);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!file) {
|
||||||
file = fopen(path, "r");
|
file = fopen(path, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
fprintf(stderr, "Failed to open %s: %s\n",
|
fprintf(stderr, "Failed to open %s: %s\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue