]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
File extension ".in" is a meta-extension.
authorBruno Haible <bruno@clisp.org>
Mon, 20 Oct 2003 10:02:11 +0000 (10:02 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:11:04 +0000 (12:11 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/xgettext.c

index 3980214c7377c2d8f395981792a66c6fa0ab8d83..b4ebe3a5912a6f8399f32c7aa2b41ae0069efc12 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-11  Bruno Haible  <bruno@clisp.org>
+
+       * xgettext.c (main): Drop suffix ".in" from input file name, if
+       present, before looking at the file extension.
+
 2003-10-09  Bruno Haible  <bruno@clisp.org>
 
        * format-awk.c: Include xalloc.h instead of xmalloc.h.
index 358449fd300af8bf19b2c0133280da010425b9ec..abfcd02c24b579f99f28524d86a1106908ce3a36 100644 (file)
@@ -595,23 +595,32 @@ This version was built without iconv()."),
   /* Process all input files.  */
   for (cnt = 0; cnt < file_list->nitems; ++cnt)
     {
-      const char *fname;
+      const char *filename;
       extractor_ty this_file_extractor;
 
-      fname = file_list->item[cnt];
+      filename = file_list->item[cnt];
 
       if (extractor.func)
        this_file_extractor = extractor;
       else
        {
+         const char *base;
+         char *reduced;
          const char *extension;
          const char *language;
 
+         base = strrchr (filename, '/');
+         if (!base)
+           base = filename;
+
+         reduced = xstrdup (base);
+         /* Remove a trailing ".in" - it's a generic suffix.  */
+         if (strlen (reduced) >= 3
+             && memcmp (reduced + strlen (reduced) - 3, ".in", 3) == 0)
+           reduced[strlen (reduced) - 3] = '\0';
+
          /* Work out what the file extension is.  */
-         extension = strrchr (fname, '/');
-         if (!extension)
-           extension = fname;
-         extension = strrchr (extension, '.');
+         extension = strrchr (reduced, '.');
          if (extension)
            ++extension;
          else
@@ -623,14 +632,16 @@ This version was built without iconv()."),
          if (language == NULL)
            {
              error (0, 0, _("\
-warning: file `%s' extension `%s' is unknown; will try C"), fname, extension);
+warning: file `%s' extension `%s' is unknown; will try C"), filename, extension);
              language = "C";
            }
          this_file_extractor = language_to_extractor (language);
+
+         free (reduced);
        }
 
       /* Extract the strings from the file.  */
-      extract_from_file (fname, this_file_extractor, mdlp);
+      extract_from_file (filename, this_file_extractor, mdlp);
     }
   string_list_free (file_list);