- changed URL:/Source0
[packages/aliases2cdbm.git] / aliases2cdbm-tolower.patch
1 diff -Nur aliases2cdbm-1.0.org/aliases2cdbm.c aliases2cdbm-1.0/aliases2cdbm.c
2 --- aliases2cdbm-1.0.org/aliases2cdbm.c Sat Feb 13 10:56:11 1999
3 +++ aliases2cdbm-1.0/aliases2cdbm.c     Fri Oct 26 11:36:53 2001
4 @@ -40,6 +40,7 @@
5  "  Usage: %s [<filename> [<filename>...]]\n"
6  "         %s {-h|--help}\n"
7  "         %s {-V|--version}\n"
8 +"         %s {-l|--tolower}\n"
9  "\n"
10  "  Input:\n"
11  "      One or more text files in `/etc/aliases' syntax.\n"
12 @@ -59,6 +60,8 @@
13  "\n"
14  ;
15  
16 +static int istolower;
17 +
18  void version(void)
19  {
20     printf(version_info, VERSION);
21 @@ -66,7 +69,7 @@
22  
23  void usage(void)
24  {
25 -   printf(usage_info, prog_name, prog_name, prog_name);
26 +   printf(usage_info, prog_name, prog_name, prog_name, prog_name);
27     exit(1);
28  }
29  
30 @@ -352,13 +355,21 @@
31             }
32            if (!in_val)
33             {
34 -              val_len = trim_trailing_space(&val, &val_index, 1);
35 +              int i;
36 +               val_len = trim_trailing_space(&val, &val_index, 1);
37                if ((NULL == val) || (0 >= val_len))
38                 {
39                    error_count++;
40                    error_empty_value(filename, (line_count - 1), key);
41                    continue;
42                 }
43 +              for(i=0; i<key_len && istolower==1; i++)
44 +              {
45 +               if(isalpha(key[i]))
46 +               {
47 +                       key[i]=tolower(key[i]);
48 +               }
49 +              }
50                print_alias(outfile, key, key_len, val, val_len);
51             }
52         }
53 @@ -441,6 +452,7 @@
54  {
55     int i;
56     
57 +   istolower=0;
58     for (i = 1; i < argc; i++)
59      {
60         if ('-' != argv[i][0])
61 @@ -461,6 +473,12 @@
62            version();
63            exit(1);
64         }
65 +       else if ((0 == strcmp(argv[i], "-l")) ||
66 +               (0 == strcmp(argv[i], "-tolower")) ||
67 +               (0 == strcmp(argv[i], "--tolower")))
68 +       {
69 +           istolower=1;
70 +       }
71         else if (0 == strcmp(argv[i], "-"))
72         {
73            /* '-' is a filename meaning stdin;
This page took 0.065927 seconds and 3 git commands to generate.