From e31a950387f7f2108dd38ed3537892af1880d074 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 25 Jun 2003 06:32:46 +0000 Subject: [PATCH] * ext.c (regex_check_type): Strip tab(s) after "filename:" in file output. --- src/ChangeLog | 5 +++++ src/ext.c | 48 +++++++++++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4c1da180f..ae7338b92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2003-06-25 Andrew V. Samoilov + + * ext.c (regex_check_type): Strip tab(s) after "filename:" in + file output. + 2003-06-22 Pavel Roskin * execute.c (do_execute): Make static. Print end of line after diff --git a/src/ext.c b/src/ext.c index b1c0ecd5a..d89c159da 100644 --- a/src/ext.c +++ b/src/ext.c @@ -56,7 +56,6 @@ flush_extension_file (void) g_free (data); data = NULL; } - } typedef char *(*quote_func_t) (const char *name, int i); @@ -417,27 +416,31 @@ regex_check_type (char *filename, int file_len, char *ptr, int *have_type) if ((pp = strchr (content_string, '\n')) != 0) *pp = 0; - if (islocal && !strncmp (content_string, filename, file_len)) { - /* Skip "filename: " */ - content_shift = file_len; - if (content_string[content_shift] == ':') - for (content_shift++; + if (islocal) { + if (!strncmp (content_string, filename, file_len)) { + /* Skip "filename: " */ + content_shift = file_len; + if (content_string[content_shift] == ':') { + content_shift++; + /* Solaris' file prints tab after ':' */ + for (content_shift++; + content_string[content_shift] == ' ' + || content_string[content_shift] == '\t'; + content_shift++); + } + } + } else { + if (!strncmp (content_string, "standard input:", 15)) { + /* Skip "standard input: " */ + for (content_shift = 15; content_string[content_shift] == ' '; content_shift++); - } else if (!islocal - && !strncmp (content_string, "standard input:", - 15)) { - /* Skip "standard input: " */ - for (content_shift = 15; - content_string[content_shift] == ' '; - content_shift++); - } else if (!islocal - && !strncmp (content_string, "/dev/stdin:", - 11)) { - /* Skip "/dev/stdin: " */ - for (content_shift = 11; - content_string[content_shift] == ' '; - content_shift++); + } else if (!strncmp (content_string, "/dev/stdin:", 11)) { + /* Skip "/dev/stdin: " */ + for (content_shift = 11; + content_string[content_shift] == ' '; + content_shift++); + } } } else { /* No data */ @@ -449,9 +452,8 @@ regex_check_type (char *filename, int file_len, char *ptr, int *have_type) return -1; } - if (content_string && content_string[0] - && regexp_match (ptr, content_string + content_shift, - match_regex)) { + if (content_string[0] + && regexp_match (ptr, content_string + content_shift, match_regex)) { found = 1; }