Skip to content

Commit

Permalink
Merge pull request #1035 from LudwigOrtmann/issue_840
Browse files Browse the repository at this point in the history
native: add help option
  • Loading branch information
Kijewski committed Apr 21, 2014
2 parents 066d743 + 6044dc2 commit 8af4c16
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cpu/native/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ void usage_exit()

real_printf(" [-d] [-e|-E] [-o]\n");

real_printf(" help: %s -h\n", _progname);

real_printf("\nOptions:\n\
-h help\n\
-d daemonize\n\
-e redirect stderr to file\n\
-E do not redirect stderr (i.e. leave sterr unchanged despite socket/daemon io)\n\
Expand Down Expand Up @@ -203,15 +206,24 @@ __attribute__((constructor)) static void startup(int argc, char **argv)
#endif

#ifdef MODULE_NATIVENET
if (argc < 2) {
if (
(argc < 2)
|| (
(strcmp("-h", argv[argp]) == 0)
|| (strcmp("--help", argv[argp]) == 0)
)
) {
usage_exit();
}
argp++;
#endif

for (; argp < argc; argp++) {
char *arg = argv[argp];
if (strcmp("-d", arg) == 0) {
if ((strcmp("-h", arg) == 0) || (strcmp("--help", arg) == 0)) {
usage_exit();
}
else if (strcmp("-d", arg) == 0) {
daemonize();
if (strcmp(stdiotype, "stdio") == 0) {
stdiotype = "null";
Expand Down

0 comments on commit 8af4c16

Please sign in to comment.