aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-03-28 13:57:58 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-03-28 13:57:58 -0400
commit52efabab2ad12d22cd5aa5a3d2d08ee88ce2b20e (patch)
tree25afab66a493a18f83f17e33ba2c9328e8c2d563
parentf1638f63a7e0ffe854ec6bb940c4ed1e4a175215 (diff)
minor badroff.c update
-rw-r--r--badroff.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/badroff.c b/badroff.c
index 5149c23..592ac7e 100644
--- a/badroff.c
+++ b/badroff.c
@@ -1,13 +1,18 @@
#include <stdio.h>
#include "sb.h"
-int main(int argc, char** argv){
- FILE* in;
- int c;
+FILE* getfile(int argc, char** argv){
if (argc >= 2)
- in = fopen(argv[1], "r");
+ return fopen(argv[1], "r");
else
- in = stdin;
+ return stdin;
+}
+
+FILE* in;
+
+int main(int argc, char** argv){
+ int c;
+ in = getfile(argc, argv);
if (in == NULL){
perror(argv[1]);
return 1;