OSDN Git Service

* configure.ac: added a configure option: --enable-ignore-dot-files.
authorarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Sun, 22 Dec 2002 17:41:28 +0000 (17:41 +0000)
committerarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Sun, 22 Dec 2002 17:41:28 +0000 (17:41 +0000)
* config.h.in: ditto.

* src/lharc.c (parse_option): added `-X' option to ignore dot files.

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@606 6a8cc165-1e22-0410-a132-eb4e3f353aba

config.h.in
configure.ac
src/lharc.c

index eeaa793..cf7e08d 100644 (file)
 /* Define to 1 if `vfork' works. */
 #undef HAVE_WORKING_VFORK
 
 /* Define to 1 if `vfork' works. */
 #undef HAVE_WORKING_VFORK
 
+/* Define to 1 if you want to ignore dot files with -X command line switch */
+#undef IGNORE_DOT_FILES
+
 /* Define to 1 if you want to use the user/group name extened header */
 #undef INCLUDE_OWNER_NAME_IN_HEADER
 
 /* Define to 1 if you want to use the user/group name extened header */
 #undef INCLUDE_OWNER_NAME_IN_HEADER
 
index 97cf5d4..479b694 100644 (file)
@@ -269,6 +269,22 @@ if test "x$enable_backup_archive" = xyes; then
            [Define to 1 if you want to leave an old archive])
 fi
 
            [Define to 1 if you want to leave an old archive])
 fi
 
+# enable this option if you need to ignore '.file' files
+# (mainly for the Mac OS X) *experimental*
+AC_MSG_CHECKING(whether enable -X option which ignore dot files)
+AC_ARG_ENABLE(ignore-dot-files,
+  AC_HELP_STRING([--enable-ignore-dot-files],
+                [enable -X option [[default=no]]]),
+  ,
+  # default
+  enable_ignore_dot_files=no)
+
+AC_MSG_RESULT($enable_ignore_dot_files)
+if test "x$enable_ignore_dot_files" = xyes; then
+  AC_DEFINE(IGNORE_DOT_FILES, 1,
+           [Define to 1 if you want to ignore dot files with -X command line switch])
+fi
+
 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile olddoc/Makefile])
 AC_CONFIG_FILES([tests/Makefile tests/lha-test])
 AC_OUTPUT
 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile olddoc/Makefile])
 AC_CONFIG_FILES([tests/Makefile tests/lha-test])
 AC_OUTPUT
index 47ef9e2..538c85f 100644 (file)
@@ -163,6 +163,11 @@ commands:                           options:\n\
                                      w=<dir> specify extract directory (x/e)\n\
                                      x=<pattern>  eXclude files (a/u/c)\n\
 ");
                                      w=<dir> specify extract directory (x/e)\n\
                                      x=<pattern>  eXclude files (a/u/c)\n\
 ");
+#if IGNORE_DOT_FILES            /* experimental feature */
+    fprintf(stderr, "\
+                                     X ignore dot files (a/u/c)\n\
+");
+#endif
 }
 
 static void
 }
 
 static void
@@ -347,6 +352,10 @@ parse_option(int argc, char **argv)
                                                  sizeof(char*) * (i+2));
 
                 if (*p == 0) {
                                                  sizeof(char*) * (i+2));
 
                 if (*p == 0) {
+                    if (*argv == 0) {
+                        print_tiny_usage();
+                        exit(2);
+                    }
                     exclude_files[i] = *argv++; argc--;
                     exclude_files[i+1] = 0;
                     goto next;
                     exclude_files[i] = *argv++; argc--;
                     exclude_files[i+1] = 0;
                     goto next;
@@ -357,10 +366,25 @@ parse_option(int argc, char **argv)
                     p += strlen(p);
                 }
                 break;
                     p += strlen(p);
                 }
                 break;
+#if IGNORE_DOT_FILES            /* experimental feature */
+            case 'X':
+                for (i = 0; exclude_files && exclude_files[i]; i++)
+                    ;
+                exclude_files = (char**)xrealloc(exclude_files,
+                                                 sizeof(char*) * (i+2));
+
+                exclude_files[i] = xstrdup(".*");
+                exclude_files[i+1] = 0;
+                break;
+#endif
             case 'w':
                 if (*p == '=')
                     p++;
                 if (*p == 0) {
             case 'w':
                 if (*p == '=')
                     p++;
                 if (*p == 0) {
+                    if (*argv == 0) {
+                        print_tiny_usage();
+                        exit(2);
+                    }
                     extract_directory = *argv++; argc--;
                     goto next;
                 }
                     extract_directory = *argv++; argc--;
                     goto next;
                 }