void
-usage(void)
+usage(FILE *stream, int eval)
{
const char *p;
p = lafe_getprogname();
- fprintf(stderr, "Usage: %s [-h] [--help] [--version] [--] [filenames...]\n", p);
- exit(1);
+ fprintf(stream, "Usage: %s [-h] [--help] [--version] [--] [filenames...]\n", p);
+ exit(eval);
}
static void
case '-':
if (strcmp(argv[optind], "--version") == 0)
version();
- if (strcmp(argv[optind], "--help") != 0)
+ if (strcmp(argv[optind], "--help") != 0) {
lafe_warnc(0, "invalid option -- '%s'", argv[optind]);
+ usage(stderr, 1);
+ }
+ case 'h':
+ usage(stdout, 0);
default:
- usage();
+ usage(stderr, 1);
}
}
#include <archive.h>
#include <archive_entry.h>
-void usage(void);
+void usage(FILE *stream, int eval);
void bsdcat_next(void);
void bsdcat_print_error(void);
void bsdcat_read_to_stdout(char* filename);