actually exit with an error when it happens
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+11
-4
@@ -39,7 +39,7 @@ usage(int status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
process_file(const char *path)
|
process_file(const char *path)
|
||||||
{
|
{
|
||||||
status_t status = B_OK;
|
status_t status = B_OK;
|
||||||
@@ -57,6 +57,7 @@ process_file(const char *path)
|
|||||||
fprintf(stderr, "%s: \"%s\": %s\n",
|
fprintf(stderr, "%s: \"%s\": %s\n",
|
||||||
sProgramName, path, strerror(status));
|
sProgramName, path, strerror(status));
|
||||||
}
|
}
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,6 +95,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
BApplication app("application/x-vnd.haiku.mimeset");
|
BApplication app("application/x-vnd.haiku.mimeset");
|
||||||
|
|
||||||
|
int err = 0;
|
||||||
while (*argv) {
|
while (*argv) {
|
||||||
char *arg = *argv++;
|
char *arg = *argv++;
|
||||||
|
|
||||||
@@ -103,10 +105,15 @@ main(int argc, char **argv)
|
|||||||
while (fgets(name, sizeof(name), stdin) != NULL) {
|
while (fgets(name, sizeof(name), stdin) != NULL) {
|
||||||
name[strlen(name) - 1] = '\0';
|
name[strlen(name) - 1] = '\0';
|
||||||
// remove trailing '\n'
|
// remove trailing '\n'
|
||||||
process_file(name);
|
err = process_file(name);
|
||||||
|
if (err)
|
||||||
|
exit(err);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
process_file(arg);
|
err = process_file(arg);
|
||||||
|
if (err)
|
||||||
|
exit(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user