=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.22 retrieving revision 1.23 diff -c -r1.22 -r1.23 *** src/usr.bin/cvs/file.c 2004/08/06 14:12:56 1.22 --- src/usr.bin/cvs/file.c 2004/08/06 14:55:56 1.23 *************** *** 1,4 **** ! /* $OpenBSD: file.c,v 1.22 2004/08/06 14:12:56 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: file.c,v 1.23 2004/08/06 14:55:56 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 99,104 **** --- 99,105 ---- static void cvs_file_freedir (struct cvs_dir *); static int cvs_file_sort (struct cvs_flist *, u_int); static int cvs_file_cmp (const void *, const void *); + static int cvs_file_cmpname (const char *, const char *); static CVSFILE* cvs_file_alloc (const char *, u_int); static CVSFILE* cvs_file_lget (const char *, int, CVSFILE *); *************** *** 202,215 **** int cvs_file_chkign(const char *file) { struct cvs_ignpat *ip; TAILQ_FOREACH(ip, &cvs_ign_pats, ip_list) { if (ip->ip_flags & CVS_IGN_STATIC) { ! if (strcmp(file, ip->ip_pat) == 0) return (1); } ! else if (fnmatch(ip->ip_pat, file, FNM_PERIOD) == 0) return (1); } --- 203,221 ---- int cvs_file_chkign(const char *file) { + int flags; struct cvs_ignpat *ip; + flags = FNM_PERIOD; + if (cvs_nocase) + flags |= FNM_CASEFOLD; + TAILQ_FOREACH(ip, &cvs_ign_pats, ip_list) { if (ip->ip_flags & CVS_IGN_STATIC) { ! if (cvs_file_cmpname(file, ip->ip_pat) == 0) return (1); } ! else if (fnmatch(ip->ip_pat, file, flags) == 0) return (1); } *************** *** 334,340 **** } TAILQ_FOREACH(sf, &(cf->cf_ddat->cd_files), cf_list) ! if (strcmp(pp, sf->cf_name) == 0) break; if (sf == NULL) return (NULL); --- 340,346 ---- } TAILQ_FOREACH(sf, &(cf->cf_ddat->cd_files), cf_list) ! if (cvs_file_cmpname(pp, sf->cf_name) == 0) break; if (sf == NULL) return (NULL); *************** *** 358,369 **** int cvs_file_attach(CVSFILE *parent, CVSFILE *file) { if (parent->cf_type != DT_DIR) return (-1); ! TAILQ_INSERT_HEAD(&(parent->cf_ddat->cd_files), file, cf_list); ! parent->cf_ddat->cd_nfiles++; file->cf_parent = parent; return (0); --- 364,384 ---- int cvs_file_attach(CVSFILE *parent, CVSFILE *file) { + struct cvs_dir *dp; + struct cvs_ent *ent; if (parent->cf_type != DT_DIR) return (-1); ! dp = parent->cf_ddat; ! ! /* if the parent doesn't have an entry for that file, create it */ ! if ((dp->cd_ent != NULL) && ! ((ent = cvs_ent_get(dp->cd_ent, file->cf_name)) == NULL)) { ! } ! ! TAILQ_INSERT_TAIL(&(dp->cd_files), file, cf_list); ! dp->cd_nfiles++; file->cf_parent = parent; return (0); *************** *** 614,620 **** CVSFILE *cf1, *cf2; cf1 = *(CVSFILE **)f1; cf2 = *(CVSFILE **)f2; ! return strcmp(cf1->cf_name, cf2->cf_name); } --- 629,635 ---- CVSFILE *cf1, *cf2; cf1 = *(CVSFILE **)f1; cf2 = *(CVSFILE **)f2; ! return cvs_file_cmpname(cf1->cf_name, cf2->cf_name); } *************** *** 752,755 **** --- 767,778 ---- } return (cfp); + } + + + static int + cvs_file_cmpname(const char *name1, const char *name2) + { + return (cvs_nocase == 0) ? (strcmp(name1, name2)) : + (strcasecmp(name1, name2)); }