aboutsummaryrefslogtreecommitdiff
path: root/badroff.c
diff options
context:
space:
mode:
Diffstat (limited to 'badroff.c')
-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;