PERFORCE change 157008 for review
Gabor Kovesdan
gabor at FreeBSD.org
Sun Feb 1 13:46:52 PST 2009
http://perforce.freebsd.org/chv.cgi?CH=157008
Change 157008 by gabor at gabor_server on 2009/02/01 21:46:39
- Add some lines for the upcoming -B flag
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/diff/diff.c#18 edit
.. //depot/projects/soc2008/gabor_textproc/diff/diff.h#7 edit
.. //depot/projects/soc2008/gabor_textproc/diff/diffreg.c#9 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/diff/diff.c#18 (text+ko) ====
@@ -45,7 +45,7 @@
#include "diff.h"
-int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag;
+int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag;
int sflag, tflag, Tflag, wflag, uniflag, strip_cr;
int format, status;
int fcase_behave = FCASE_SENSITIVE;
@@ -67,7 +67,7 @@
NOOP_OPT
};
-#define OPTIONS "0123456789abC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwX:x:"
+#define OPTIONS "0123456789abBC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwX:x:"
static struct option longopts[] = {
{ "ignore-file-name-case", no_argument, NULL, FCASE_IGNORE_OPT },
{ "no-ignore-file-name-case", no_argument, NULL, FCASE_SENSITIVE_OPT },
@@ -80,8 +80,7 @@
{ "to-file", required_argument, NULL, TOFILE_OPT },
{ "help", no_argument, NULL, HELP_OPT },
{ "text", no_argument, NULL, 'a' },
-/* XXX: UNIMPLEMENTED
- { "ignore-blank-lines", no_argument, NULL, 'B' }, */
+ { "ignore-blank-lines", no_argument, NULL, 'B' },
{ "ignore-space-change", no_argument, NULL, 'b' },
{ "context", optional_argument, NULL, 'C' },
{ "ifdef", required_argument, NULL, 'D' },
@@ -169,6 +168,8 @@
case 'b':
bflag = 1;
break;
+ case 'B':
+ Bflag = 1;
case 'C':
case 'c':
format = D_CONTEXT;
==== //depot/projects/soc2008/gabor_textproc/diff/diff.h#7 (text+ko) ====
@@ -82,7 +82,7 @@
struct excludes *next;
};
-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
+extern int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
sflag, tflag, Tflag, wflag, uniflag, strip_cr;
extern int format, status;
extern int fcase_behave;
==== //depot/projects/soc2008/gabor_textproc/diff/diffreg.c#9 (text+ko) ====
@@ -766,7 +766,7 @@
ixnew[j] = ctnew += skipline(f2);
j++;
}
- if (bflag || wflag || iflag || strip_cr) {
+ if (bflag || Bflag || wflag || iflag || strip_cr) {
for (;;) {
c = getc(f1);
d = getc(f2);
@@ -779,6 +779,11 @@
(c == '\n' && d == EOF))) {
break;
}
+ // XXX: Bflag
+ while (Bflag && isspace(c))
+ c = skipline(f1);
+ while (Bflag && isspace(d))
+ d = skipline(f2);
ctold++;
ctnew++;
while ((strip_cr) && (c == '\r') && (d == '\n'))
@@ -1229,7 +1234,7 @@
sum = 1;
space = 0;
- if (!bflag && !wflag) {
+ if (!bflag && !Bflag && !wflag) {
if (iflag)
for (i = 0; (t = getc(f)) != '\n'; i++) {
if (t == '\r' && strip_cr)
@@ -1275,6 +1280,8 @@
return (0);
/* FALLTHROUGH */
case '\n':
+ if (Bflag && space == 0 && i == 0)
+ continue;
break;
}
break;
@@ -1284,6 +1291,7 @@
* There is a remote possibility that we end up with a zero sum.
* Zero is used as an EOF marker, so return 1 instead.
*/
+ printf("HASH: %d\n", (sum == 0 ? 1 : sum));
return (sum == 0 ? 1 : sum);
}
More information about the p4-projects
mailing list