aboutsummaryrefslogtreecommitdiff
path: root/misc/lv/files
diff options
context:
space:
mode:
authorMunechika SUMIKAWA <sumikawa@FreeBSD.org>2012-08-23 08:59:30 +0000
committerMunechika SUMIKAWA <sumikawa@FreeBSD.org>2012-08-23 08:59:30 +0000
commit95d1e8b57f1d4bcdc3b1509e28e9e0301f429cb8 (patch)
tree17b7efdf7bed52d4fc60bcb9e7963df15f2d0d07 /misc/lv/files
parentea4790d5f45aee17b56de65b0e5f4d61b491c812 (diff)
downloadports-95d1e8b57f1d4bcdc3b1509e28e9e0301f429cb8.tar.gz
ports-95d1e8b57f1d4bcdc3b1509e28e9e0301f429cb8.zip
Notes
Diffstat (limited to 'misc/lv/files')
-rw-r--r--misc/lv/files/patch-src_lv.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/misc/lv/files/patch-src_lv.c b/misc/lv/files/patch-src_lv.c
new file mode 100644
index 000000000000..5922497d86ef
--- /dev/null
+++ b/misc/lv/files/patch-src_lv.c
@@ -0,0 +1,49 @@
+--- lv.c.orig 2004-01-05 16:30:15.000000000 +0900
++++ lv.c 2012-08-23 16:49:46.728726453 +0900
+@@ -2,6 +2,7 @@
+ * lv.c
+ *
+ * All rights reserved. Copyright (C) 1996 by NARITA Tomio.
++ * Copyright (C) Oct 27, 2011 Koichiro IWAO. All rights reserved.
+ * $Id: lv.c,v 1.10 2004/01/05 07:30:15 nrt Exp $
+ */
+ /*
+@@ -89,16 +90,35 @@
+ grep_mode = FALSE;
+ }
+
++private boolean_t isDirectory(byte **file) {
++ struct stat buf;
++ stat((unsigned char *)file, &buf);
++ if (S_ISDIR(buf.st_mode)) {
++ fprintf(stderr, "%s is a directory\n", file);
++ return TRUE;
++ } else {
++ return FALSE;
++ }
++}
++
+ private boolean_t LvOpen( conf_t *conf )
+ {
++ boolean_t flagIsDirectory = FALSE;
++
+ if( NULL != conf->file ){
++ if( TRUE == isDirectory( *conf->file ) ){
++ flagIsDirectory = TRUE;
++ }
+ if( NULL == (conf->st = StreamOpen( *conf->file )) ){
+ while( NULL != *(++conf->file) ){
+- if( NULL != (conf->st = StreamOpen( *conf->file )) )
+- return TRUE;
++ if( NULL != (conf->st = StreamOpen( *conf->file )) ){
++ if( TRUE == isDirectory( *conf->file ) ){
++ flagIsDirectory = TRUE;
++ }
++ }
+ }
+- return FALSE;
+ }
++ return (TRUE == flagIsDirectory ? FALSE : TRUE);
+ } else {
+ conf->st = StreamReconnectStdin();
+ }