Skip to content

Commit

Permalink
Added the option -h for 'radattr' tool. refs #1123
Browse files Browse the repository at this point in the history
  • Loading branch information
jpereira authored and alandekok committed Jul 7, 2015
1 parent d86e6c3 commit 45b75da
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main/radattr.c
Expand Up @@ -896,6 +896,17 @@ static void process_file(const char *root_dir, char const *filename)
if (fp != stdin) fclose(fp);
}

static void NEVER_RETURNS usage(void)
{
fprintf(stderr, "usage: radattr [OPTS] filename\n");
fprintf(stderr, " -d <raddb> Set user dictionary directory (defaults to " RADDBDIR ").\n");
fprintf(stderr, " -D <dictdir> Set main dictionary directory (defaults to " DICTDIR ").\n");
fprintf(stderr, " -x Debugging mode.\n");
fprintf(stderr, " -M Show program version information.\n");

exit(1);
}

int main(int argc, char *argv[])
{
int c;
Expand All @@ -910,11 +921,13 @@ int main(int argc, char *argv[])
}
#endif

while ((c = getopt(argc, argv, "d:D:xM")) != EOF) switch (c) {
while ((c = getopt(argc, argv, "d:D:xMh")) != EOF) switch (c) {
case 'd':
if (!optarg) usage();
radius_dir = optarg;
break;
case 'D':
if (!optarg) usage();
dict_dir = optarg;
break;
case 'x':
Expand All @@ -924,9 +937,9 @@ int main(int argc, char *argv[])
case 'M':
report = true;
break;
case 'h':
default:
fprintf(stderr, "usage: radattr [OPTS] filename\n");
exit(1);
usage();
}
argc -= (optind - 1);
argv += (optind - 1);
Expand Down

0 comments on commit 45b75da

Please sign in to comment.