Merge from vendor branch NCURSES:
[dragonfly.git] / gnu / usr.bin / cvs / cvs / parseinfo.c.patch
1 $DragonFly: src/gnu/usr.bin/cvs/cvs/Attic/parseinfo.c.patch,v 1.1 2005/03/01 23:18:32 corecode Exp $
2 Index: parseinfo.c
3 ===================================================================
4 RCS file: /space/cvs/dragonfly/src/contrib/cvs-1.12.9/src/parseinfo.c,v
5 retrieving revision 1.1
6 diff -u -r1.1 parseinfo.c
7 --- parseinfo.c 3 Aug 2004 18:08:51 -0000       1.1
8 +++ parseinfo.c 18 Nov 2004 16:47:34 -0000
9 @@ -220,15 +220,14 @@
10  
11     Returns 0 for success, negative value for failure.  Call
12     error(0, ...) on errors in addition to the return value.  */
13 +
14 +static int
15 +parse_config_file (const char *cvsroot, const char *config);
16 +
17  int
18  parse_config (char *cvsroot)
19  {
20 -    char *infopath;
21 -    FILE *fp_info;
22 -    char *line = NULL;
23 -    size_t line_allocated = 0;
24 -    size_t len;
25 -    char *p;
26 +    int ret;
27      /* FIXME-reentrancy: If we do a multi-threaded server, this would need
28         to go to the per-connection data structures.  */
29      static int parsed = 0;
30 @@ -238,9 +237,25 @@
31      if (parsed)
32         return 0;
33      parsed = 1;
34 +   
35 +    ret = parse_config_file (cvsroot, CVSROOTADM_CONFIG);
36 +    ret = parse_config_file (cvsroot, CVSROOTADM_OPTIONS) || ret;
37 +
38 +    return ret;
39 +}
40 +
41 +static int
42 +parse_config_file (const char *cvsroot, const char *config_name)
43 +{
44 +    char *infopath = NULL;
45 +    FILE *fp_info;
46 +    char *line = NULL;
47 +    size_t line_allocated = 0;
48 +    size_t len;
49 +    char *p;
50  
51      infopath = xmalloc (strlen (cvsroot)
52 -                       + sizeof (CVSROOTADM_CONFIG)
53 +                       + strlen (config_name)
54                         + sizeof (CVSROOTADM)
55                         + 10);
56      if (infopath == NULL)
57 @@ -253,7 +268,7 @@
58      strcat (infopath, "/");
59      strcat (infopath, CVSROOTADM);
60      strcat (infopath, "/");
61 -    strcat (infopath, CVSROOTADM_CONFIG);
62 +    strcat (infopath, config_name);
63  
64      fp_info = CVS_FOPEN (infopath, "r");
65      if (fp_info == NULL)
66 @@ -345,12 +360,14 @@
67                 goto error_return;
68             }
69         }
70 -       else if (strcmp (line, "LocalKeyword") == 0)
71 +       else if (strcmp (line, "LocalKeyword") == 0 ||
72 +               strcmp (line, "tag") == 0)
73         {
74             RCS_setlocalid(p);
75                 
76         }
77 -       else if (strcmp (line, "KeywordExpand") == 0)
78 +       else if (strcmp (line, "KeywordExpand") == 0 ||
79 +               strcmp (line, "tagexpand") == 0)
80         {
81             RCS_setincexc(p);
82                 
83 @@ -447,7 +464,11 @@
84                the new features.  */
85             error (0, 0, "%s: unrecognized keyword '%s'",
86                    infopath, line);
87 -           goto error_return;
88 +
89 +           /* Don't break processing on legacy CVSROOT/options keywords */
90 +           if (strcmp (line, "umask") != 0 &&
91 +               strcmp (line, "dlimit") != 0)
92 +               goto error_return;
93         }
94      }
95      if (ferror (fp_info))