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