PERFORCE change 144625 for review
Gabor Kovesdan
gabor at FreeBSD.org
Fri Jul 4 14:22:39 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=144625
Change 144625 by gabor at gabor_server on 2008/07/04 14:22:18
- Add --no-ignore-file-name-case (default)
- First try to add --ignore-file-name-case, doesn't work correctly yet
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/diff/diff.c#8 edit
.. //depot/projects/soc2008/gabor_textproc/diff/diff.h#4 edit
.. //depot/projects/soc2008/gabor_textproc/diff/diffdir.c#4 edit
Differences ...
==== //depot/projects/soc2008/gabor_textproc/diff/diff.c#8 (text+ko) ====
@@ -47,6 +47,7 @@
int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag;
int sflag, tflag, Tflag, wflag;
int format, status;
+int fcase_behave = FCASE_SENSITIVE;
unsigned long long context;
char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
struct stat stb1, stb2;
@@ -55,14 +56,16 @@
enum {
HELP_OPT = CHAR_MAX + 1,
- NORMAL_OPT
+ NORMAL_OPT,
+ FCASE_SENSITIVE_OPT,
+ FCASE_IGNORE_OPT
};
#define OPTIONS "0123456789abC: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 },
/* XXX: UNIMPLEMENTED
- { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE },
- { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE },
{ "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, */
{ "normal", no_argument, NULL, NORMAL_OPT },
/* XXX: UNIMPLEMENTED
@@ -249,6 +252,10 @@
case 'x':
push_excludes(optarg);
break;
+ case FCASE_SENSITIVE_OPT:
+ break;
+ case FCASE_IGNORE_OPT:
+ fcase_behave = FCASE_IGNORE;
case NORMAL_OPT:
/* compatibility, this is the default */
break;
==== //depot/projects/soc2008/gabor_textproc/diff/diff.h#4 (text+ko) ====
@@ -70,6 +70,13 @@
#define D_SKIPPED1 8 /* path1 was a special file */
#define D_SKIPPED2 9 /* path2 was a special file */
+/*
+ * Values of the the filename case-sensitivity
+ */
+
+#define FCASE_SENSITIVE 0 /* Case-sensitive */
+#define FCASE_IGNORE 1 /* Case-insensitive */
+
struct excludes {
char *pattern;
struct excludes *next;
@@ -78,6 +85,7 @@
extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag,
sflag, tflag, Tflag, wflag;
extern int format, status;
+extern int fcase_behave;
extern unsigned long long context;
extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
extern struct stat stb1, stb2;
==== //depot/projects/soc2008/gabor_textproc/diff/diffdir.c#4 (text+ko) ====
@@ -108,8 +108,12 @@
dent1 = *dp1;
dent2 = *dp2;
- pos = dent1 == NULL ? 1 : dent2 == NULL ? -1 :
- strcmp(dent1->d_name, dent2->d_name);
+ if (fcase_behave == FCASE_SENSITIVE)
+ pos = dent1 == NULL ? 1 : dent2 == NULL ? -1 :
+ strcmp(dent1->d_name, dent2->d_name);
+ else
+ pos = dent1 == NULL ? 1 : dent2 == NULL ? -1 :
+ strcasecmp(dent1->d_name, dent2->d_name);
if (pos == 0) {
/* file exists in both dirs, diff it */
diffit(dent1, path1, dirlen1, path2, dirlen2);
More information about the p4-projects
mailing list