Merge from vendor branch GDB:
[dragonfly.git] / gnu / usr.bin / cvs / cvs / diff.c.patch
1 $DragonFly: src/gnu/usr.bin/cvs/cvs/Attic/diff.c.patch,v 1.3 2005/06/13 22:35:54 corecode Exp $
2 --- /usr/src/contrib/cvs-1.12.12/src/diff.c     2005-04-21 08:33:15.000000000 +0200
3 +++ diff.c      2005-06-13 23:32:45.000000000 +0200
4 @@ -52,6 +52,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 @@ -273,6 +274,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 @@ -283,7 +286,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 @@ -346,6 +349,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 || diff_date2)
56                     error (1, 0,
57 @@ -400,11 +423,15 @@
58         send_option_string (opts);
59         if (options[0] != '\0')
60             send_arg (options);
61 -       if (diff_orig1)
62 +       if (diff_join1)
63 +           option_with_arg ("-j", diff_join1);
64 +       else if (diff_orig1)
65             option_with_arg ("-r", diff_orig1);
66         else if (diff_date1)
67             client_senddate (diff_date1);
68 -       if (diff_orig2)
69 +       if (diff_join2)
70 +           option_with_arg ("-j", diff_join2);
71 +       else if (diff_orig2)
72             option_with_arg ("-r", diff_orig2);
73         else if (diff_date2)
74             client_senddate (diff_date2);
75 @@ -420,12 +447,9 @@
76  
77         send_to_server ("diff\012", 0);
78          err = get_responses_and_close ();
79 -       free (options);
80 -       options = NULL;
81 -       return err;
82 -    }
83 +    } else
84  #endif
85 -
86 +    {
87      if (diff_rev1 != NULL)
88         tag_check_valid (diff_rev1, argc, argv, local, 0, "", false);
89      if (diff_rev2 != NULL)
90 @@ -442,6 +466,7 @@
91                             diff_dirleaveproc, NULL, argc, argv, local,
92                             which, 0, CVS_LOCK_READ, NULL, 1, NULL);
93  
94 +    }
95      /* clean up */
96      free (options);
97      options = NULL;
98 @@ -450,6 +475,10 @@
99         free (diff_date1);
100      if (diff_date2 != NULL)
101         free (diff_date2);
102 +    if (diff_join1 != NULL)
103 +       free (diff_join1);
104 +    if (diff_join2 != NULL)
105 +        free (diff_join2);
106  
107      return err;
108  }