Merge from vendor branch GCC:
[dragonfly.git] / gnu / usr.bin / cvs / cvs / diff.c.patch
1 $DragonFly: src/gnu/usr.bin/cvs/cvs/Attic/diff.c.patch,v 1.2 2005/03/13 11:43:07 corecode Exp $
2 --- /usr/src/contrib/cvs-1.12.11/src/diff.c     2005-01-05 22:17:43.000000000 +0100
3 +++ diff.c      2005-03-06 23:43:51.000000000 +0100
4 @@ -47,6 +47,7 @@
5  static char *diff_rev1, *diff_rev2;
6  /* Command line dates, from -D option.  Malloc'd.  */
7  static char *diff_date1, *diff_date2;
8 +static char *diff_join1, *diff_join2;
9  static char *use_rev1, *use_rev2;
10  static int have_rev1_label, have_rev2_label;
11  
12 @@ -265,6 +266,8 @@
13      diff_rev2 = NULL;
14      diff_date1 = NULL;
15      diff_date2 = NULL;
16 +    diff_join1 = NULL;
17 +    diff_join2 = NULL;
18  
19      optind = 0;
20      /* FIXME: This should really be allocating an argv to be passed to diff
21 @@ -275,7 +278,7 @@
22       * to diff.
23       */
24      while ((c = getopt_long (argc, argv,
25 -              "+abcdefhilnpstuwy0123456789BHNRTC:D:F:I:L:U:W:k:r:",
26 +              "+abcdefhij:lnpstuwy0123456789BHNRTC:D:F:I:L:U:W:k:r:",
27                              longopts, &option_index)) != -1)
28      {
29         switch (c)
30 @@ -338,6 +341,26 @@
31                     free (options);
32                 options = RCS_check_kflag (optarg);
33                 break;
34 +           case 'j':
35 +               {
36 +                   char *ptr;
37 +                   char *cpy = strdup(optarg);
38 +
39 +                   if ((ptr = strchr(optarg, ':')) != NULL)
40 +                       *ptr++ = 0;
41 +                   if (diff_rev2 != NULL || diff_date2 != NULL)
42 +                       error (1, 0, "no more than two revisions/dates can be specified");
43 +                   if (diff_rev1 != NULL || diff_date1 != NULL) {
44 +                       diff_join2 = cpy;
45 +                       diff_rev2 = optarg;
46 +                       diff_date2 = ptr ? Make_Date(ptr) : NULL;
47 +                   } else {
48 +                       diff_join1 = cpy;
49 +                       diff_rev1 = optarg;
50 +                       diff_date1 = ptr ? Make_Date(ptr) : NULL;
51 +                   }
52 +               }
53 +               break;
54             case 'r':
55                 if (diff_rev2 != NULL || diff_date2 != NULL)
56                     error (1, 0,
57 @@ -386,13 +409,17 @@
58         send_option_string (opts);
59         if (options[0] != '\0')
60             send_arg (options);
61 -       if (diff_rev1)
62 +       if (diff_join1)
63 +           option_with_arg ("-j", diff_join1);
64 +       else if (diff_rev1)
65             option_with_arg ("-r", diff_rev1);
66 -       if (diff_date1)
67 +       else if (diff_date1)
68             client_senddate (diff_date1);
69 -       if (diff_rev2)
70 +       if (diff_join2)
71 +           option_with_arg ("-j", diff_join2);
72 +       else if (diff_rev2)
73             option_with_arg ("-r", diff_rev2);
74 -       if (diff_date2)
75 +       else if (diff_date2)
76             client_senddate (diff_date2);
77         send_arg ("--");
78  
79 @@ -406,12 +433,9 @@
80  
81         send_to_server ("diff\012", 0);
82          err = get_responses_and_close ();
83 -       free (options);
84 -       options = NULL;
85 -       return err;
86 -    }
87 +    } else
88  #endif
89 -
90 +    {
91      if (diff_rev1 != NULL)
92         tag_check_valid (diff_rev1, argc, argv, local, 0, "", false);
93      if (diff_rev2 != NULL)
94 @@ -428,7 +452,7 @@
95             ( diff_fileproc, diff_filesdoneproc, diff_dirproc,
96               diff_dirleaveproc, NULL, argc, argv, local,
97               which, 0, CVS_LOCK_READ, (char *) NULL, 1, (char *) NULL );
98 -
99 +    }
100      /* clean up */
101      free (options);
102      options = NULL;
103 @@ -437,6 +461,10 @@
104         free (diff_date1);
105      if (diff_date2 != NULL)
106         free (diff_date2);
107 +    if (diff_join1 != NULL)
108 +       free (diff_join1);
109 +    if (diff_join2 != NULL)
110 +        free (diff_join2);
111  
112      return (err);
113  }