diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-03-28 13:57:58 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-03-28 13:57:58 -0400 |
commit | 52efabab2ad12d22cd5aa5a3d2d08ee88ce2b20e (patch) | |
tree | 25afab66a493a18f83f17e33ba2c9328e8c2d563 | |
parent | f1638f63a7e0ffe854ec6bb940c4ed1e4a175215 (diff) |
minor badroff.c update
-rw-r--r-- | badroff.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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; |