aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog5
-rw-r--r--util/fileutil.c2
-rw-r--r--util/iobuf.c10
3 files changed, 16 insertions, 1 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 7c79787a2..9768748bb 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-13 Werner Koch <[email protected]>
+
+ * iobuf.c (iobuf_is_pipe_filename): New.
+ * fileutil.c (is_file_compressed): Use it here.
+
2004-09-30 David Shaw <[email protected]>
* iobuf.c (pop_filter): Make static.
diff --git a/util/fileutil.c b/util/fileutil.c
index c36488640..99aa0776b 100644
--- a/util/fileutil.c
+++ b/util/fileutil.c
@@ -200,7 +200,7 @@ is_file_compressed( const char *s, int *ret_rc )
{ 4, { 0x50, 0x4b, 0x03, 0x04 } }, /* (pk)zip */
};
- if ( !s || (*s == '-' && !s[1]) || !ret_rc )
+ if ( iobuf_is_pipe_filename (s) || !ret_rc )
return 0; /* We can't check stdin or no file was given */
a = iobuf_open( s );
diff --git a/util/iobuf.c b/util/iobuf.c
index 1a97e564f..26cde114f 100644
--- a/util/iobuf.c
+++ b/util/iobuf.c
@@ -1005,6 +1005,16 @@ check_special_filename ( const char *fname )
return -1;
}
+/* This fucntion returns true if FNAME indicates a PIPE (stdout or
+ stderr) or a special file name if those are enabled. */
+int
+iobuf_is_pipe_filename (const char *fname)
+{
+ if (!fname || (*fname=='-' && !fname[1]) )
+ return 1;
+ return check_special_filename (fname) != -1;
+}
+
/****************
* Create a head iobuf for reading from a file
* returns: NULL if an error occures and sets errno