commit b4d2e996413139a66e94aa25b1713510abbf6de1
parent 1db7617a472084a77b29fad1d9cec824505734f1
Author: Willy Goiffon <w.goiffon@gmail.com>
Date: Sun, 20 Oct 2013 21:46:19 +0200
Added a usage() function
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/prout.c b/src/prout.c
@@ -19,6 +19,12 @@
#include <stdbool.h>
#include <cups/cups.h>
+/* Usage function */
+static void usage()
+{
+ fputs("usage: prout [-o opt=value,...] <file>\n", stdout);
+}
+
/* Return the file name if the file is opennable. exit instead */
static char* check_file(char *file)
{
@@ -148,8 +154,8 @@ int main(int argc, char **argv)
char *file;
/* check the input file */
- if (argc != 2 ) {
- fputs("I can only handle one file at a time\n", stderr);
+ if (argc < 2 ) {
+ usage();
exit (1);
}