diff options
author | Steven Schubiger <stsc@refcnt.org> | 2015-01-25 16:54:10 +0100 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2015-01-25 16:54:10 +0100 |
commit | cc3c8db022b248d3b862757379b4df529d07b6c1 (patch) | |
tree | 9e53a1e9d7a497467d1068b4993c125609560293 /colorize.c | |
parent | 20c83df5d03e4b89d3a93803db0f9f9307517faf (diff) | |
download | colorize-cc3c8db022b248d3b862757379b4df529d07b6c1.tar.gz colorize-cc3c8db022b248d3b862757379b4df529d07b6c1.tar.bz2 |
Reuse file opening function
Diffstat (limited to 'colorize.c')
-rw-r--r-- | colorize.c | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -666,7 +666,6 @@ process_file_arg (const char *file_string, const char **file, FILE **stream) *stream = stdin; else { - FILE *s; const char *file = file_string; struct stat sb; int ret; @@ -680,12 +679,7 @@ process_file_arg (const char *file_string, const char **file, FILE **stream) if (!VALID_FILE_TYPE (sb.st_mode)) vfprintf_fail (formats[FMT_TYPE], file, "unrecognized type", get_file_type (sb.st_mode)); - errno = 0; - - s = fopen (file, "r"); - if (!s) - vfprintf_fail (formats[FMT_FILE], file, strerror (errno)); - *stream = s; + *stream = open_file (file, "r"); } *file = file_string; } |