From 52efabab2ad12d22cd5aa5a3d2d08ee88ce2b20e Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Sat, 28 Mar 2020 13:57:58 -0400
Subject: minor badroff.c update
---
badroff.c | 15 ++++++++++-----
1 file 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
#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;
--
cgit