OSDN Git Service

Added an option ignoring Mac specific files
authorarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Wed, 23 May 2007 15:04:10 +0000 (15:04 +0000)
committerarai <arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Wed, 23 May 2007 15:04:10 +0000 (15:04 +0000)
The option -X was deprecated.
In place of it, added a long option --ignore-mac-files which ignore
Mac specific files ._*, .DS_Store and Icon\r when the archive is
created. Thanks to Hiroto Sakai.

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

ChangeLog [changed mode: 0644->0755]
config.h.in
configure.ac
src/lharc.c

old mode 100644 (file)
new mode 100755 (executable)
index 5186a1f..d2e13f4
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+2007-05-23  Koji Arai  <arai@users.sourceforge.jp>
+
+       * config.h.in, configure.ac, src/lharc.c: the option -X was deprecated.
+       In place of it, added a long option --ignore-mac-files which
+       ignore Mac specific files ._*, .DS_Store and Icon\r when the
+       archive is created. Thanks to Hiroto Sakai.
+
 2007-05-20  Koji Arai  <arai@users.sourceforge.jp>
 
-       * repository changed into the Subversion.
+       * repository changed to the Subversion.
 
        * tests/lha-test12: should not use the raw CR code.
          (when checkout from SVN repos, raw CR code is removed.)
index 00a48c2..98ef370 100644 (file)
 /* Define to 1 if you have the `vsnprintf' function. */
 #undef HAVE_VSNPRINTF
 
-/* 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
 
index 626abf7..d9503e1 100644 (file)
@@ -275,22 +275,6 @@ if test "x$enable_backup_archive" = xyes; then
            [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
-
 case $host_os in 
 *msdosdjgpp*)
 CFLAGS="$CFLAGS -DNOT_COMPATIBLE_MODE"
index b809dbb..0e577a7 100644 (file)
@@ -119,30 +119,29 @@ init_variable()     /* Added N.Watazaki */
 static void
 print_tiny_usage()
 {
-#if HAVE_LIBAPPLEFILE
     fprintf(stdout, "\
 usage: lha [-]<commands>[<options>] [-<options> ...] archive_file [file...]\n\
   commands:  [axelvudmcpt]\n\
-  options:   [q[012]vnfto[567]dizg012eb[w=<dir>|x=<pattern>]]\n\
-  long options: --system-kanji-code={euc,sjis,utf8,cap}\n\
-                --archive-kanji-code={euc,sjis,utf8,cap}\n\
-                --extract-broken-archive\n\
-                --convert-filename-case\n\
-                --help\n\
-                --version\n");
-#else
-    fprintf(stdout, "\
-usage: lha [-]<commands>[<options>] [-<options> ...] archive_file [file...]\n\
-  commands:  [axelvudmcpt]\n\
-  options:   [q[012]vnfto[567]dizg012e[w=<dir>|x=<pattern>]]\n\
+  options:   [q[012]vnfto[567]dizg012%s%s[w=<dir>|x=<pattern>]]\n\
   long options: --system-kanji-code={euc,sjis,utf8,cap}\n\
                 --archive-kanji-code={euc,sjis,utf8,cap}\n\
                 --extract-broken-archive\n\
                 --convert-filename-case\n\
+               --ignore-mac-files\n\
                 --traditional\n\
                 --help\n\
-                --version\n");
+                --version\n"
+#ifdef EUC
+            ,"e"
+#else
+            ,""
+#endif
+#if HAVE_LIBAPPLEFILE
+            ,"b"                 /* decode_macbinary_contents */
+#else
+            ,""
 #endif
+            );
 }
 
 static void
@@ -198,11 +197,6 @@ commands:                           options:\n\
                                      w=<dir> specify extract directory (x/e)\n\
                                      x=<pattern>  eXclude files (a/u/c)\n\
 ");
-#if IGNORE_DOT_FILES            /* experimental feature */
-    fprintf(stdout, "\
-                                     X ignore dot files (a/u/c)\n\
-");
-#endif
 }
 
 #include "getopt_long.h"
@@ -219,6 +213,7 @@ parse_suboption(int argc, char **argv)
         SYSTEM_KANJI_CODE_OPTION,
         ARCHIVE_KANJI_CODE_OPTION,
         TRADITIONAL_BEHAVIOR,
+        IGNORE_MAC_FILES,
     };
 
     struct option long_options[] = {
@@ -231,6 +226,7 @@ parse_suboption(int argc, char **argv)
         {"extract-broken-archive", no_argument, &extract_broken_archive, 1},
         {"convert-filename-case", no_argument, &convertcase, TRUE},
         {"traditional", no_argument, 0, TRADITIONAL_BEHAVIOR},
+        {"ignore-mac-files", no_argument, 0, IGNORE_MAC_FILES},
         {0, 0, 0, 0}
     };
     int i;
@@ -238,9 +234,6 @@ parse_suboption(int argc, char **argv)
     char short_options[256] = "q[012]vnfto[567]dizg012ew:x:";
     /* "[...]" means optional 1 byte argument (original extention) */
 
-#if IGNORE_DOT_FILES
-    strncat(short_options, "X", sizeof(short_options)-strlen(short_options)-1);
-#endif
 #if HAVE_LIBAPPLEFILE
     strncat(short_options, "b", sizeof(short_options)-strlen(short_options)-1);
 #endif
@@ -366,17 +359,6 @@ parse_suboption(int argc, char **argv)
             exclude_files[i+1] = 0;
 
             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 (!optarg) {
                 error("working directory does not specified for `-w'");
@@ -448,6 +430,20 @@ parse_suboption(int argc, char **argv)
             convertcase = TRUE;
             break;
 
+        case IGNORE_MAC_FILES:
+            /* ignore Mac specific files (._*, .DS_Store and Icon\r)
+               when archiving */
+            for (i = 0; exclude_files && exclude_files[i]; i++)
+                ;
+            exclude_files = (char**)xrealloc(exclude_files,
+                                             sizeof(char*) * (i+4));
+
+            exclude_files[i] = xstrdup("._*");
+            exclude_files[i+1] = xstrdup(".DS_Store");
+            exclude_files[i+2] = xstrdup("Icon\r");
+            exclude_files[i+3] = 0;
+            break;
+
         default:
             error("unknown option `-%c'.", c);
             return -1;