diff options
-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; |