aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--process_args.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/process_args.c b/process_args.c
new file mode 100644
index 0000000..6e6827d
--- /dev/null
+++ b/process_args.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+void process_args(int argc, char **argv,char *docstring){
+ if (argc > 1 && argv[1][0]=='-' && argv[1][1]=='h') {
+ fprintf(stderr,docstring);
+ fprintf(stderr,"\n\nusage: %s [infile] [outfile]\n",argv[0]);
+ exit(1);
+ }
+
+ if (argc > 1){
+ freopen(argv[1],"r",stdin);
+ }
+
+ if (argc > 2){
+ freopen(argv[2],"w",stdout);
+ }
+
+}
+
+