1408c1f17db44045b9b37e2c6ec6a4a7 aliases2cdbm-1.0.tar.gz
authorareq <areq@pld-linux.org>
Fri, 26 Oct 2001 10:15:45 +0000 (10:15 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
ecaea03aa2902500389c052ae07f338f  aliases2cdbm-tolower.patch

Changed files:
    aliases2cdbm-tolower.patch -> 1.1

aliases2cdbm-tolower.patch [new file with mode: 0644]

diff --git a/aliases2cdbm-tolower.patch b/aliases2cdbm-tolower.patch
new file mode 100644 (file)
index 0000000..8f804a1
--- /dev/null
@@ -0,0 +1,73 @@
+diff -Nur aliases2cdbm-1.0.org/aliases2cdbm.c aliases2cdbm-1.0/aliases2cdbm.c
+--- aliases2cdbm-1.0.org/aliases2cdbm.c        Sat Feb 13 10:56:11 1999
++++ aliases2cdbm-1.0/aliases2cdbm.c    Fri Oct 26 11:36:53 2001
+@@ -40,6 +40,7 @@
+ "  Usage: %s [<filename> [<filename>...]]\n"
+ "         %s {-h|--help}\n"
+ "         %s {-V|--version}\n"
++"         %s {-l|--tolower}\n"
+ "\n"
+ "  Input:\n"
+ "      One or more text files in `/etc/aliases' syntax.\n"
+@@ -59,6 +60,8 @@
+ "\n"
+ ;
++static int istolower;
++
+ void version(void)
+ {
+    printf(version_info, VERSION);
+@@ -66,7 +69,7 @@
+ void usage(void)
+ {
+-   printf(usage_info, prog_name, prog_name, prog_name);
++   printf(usage_info, prog_name, prog_name, prog_name, prog_name);
+    exit(1);
+ }
+@@ -352,13 +355,21 @@
+           }
+          if (!in_val)
+           {
+-             val_len = trim_trailing_space(&val, &val_index, 1);
++             int i;
++               val_len = trim_trailing_space(&val, &val_index, 1);
+              if ((NULL == val) || (0 >= val_len))
+               {
+                  error_count++;
+                  error_empty_value(filename, (line_count - 1), key);
+                  continue;
+               }
++             for(i=0; i<key_len && istolower==1; i++)
++             {
++              if(isalpha(key[i]))
++              {
++                      key[i]=tolower(key[i]);
++              }
++             }
+              print_alias(outfile, key, key_len, val, val_len);
+           }
+       }
+@@ -441,6 +452,7 @@
+ {
+    int i;
+    
++   istolower=0;
+    for (i = 1; i < argc; i++)
+     {
+        if ('-' != argv[i][0])
+@@ -461,6 +473,12 @@
+          version();
+          exit(1);
+       }
++       else if ((0 == strcmp(argv[i], "-l")) ||
++              (0 == strcmp(argv[i], "-tolower")) ||
++              (0 == strcmp(argv[i], "--tolower")))
++      {
++          istolower=1;
++      }
+        else if (0 == strcmp(argv[i], "-"))
+       {
+          /* '-' is a filename meaning stdin;
This page took 0.037107 seconds and 4 git commands to generate.