diff options
| author | jtc <jtc@NetBSD.org> | 1994-11-01 20:38:40 +0000 |
|---|---|---|
| committer | jtc <jtc@NetBSD.org> | 1994-11-01 20:38:40 +0000 |
| commit | cd439d82af9522ec662102dfebdc44875eb58bf4 (patch) | |
| tree | 78fe55729c4ac3d1f789a33cc7e4612c390ce28b /gnu/usr.bin/diff/dir.c | |
| parent | 0f8e6cf96801bbae057bcf623b51ab7d71b765e4 (diff) | |
Upgraded to diffutils 2.7.
Diffstat (limited to 'gnu/usr.bin/diff/dir.c')
| -rw-r--r-- | gnu/usr.bin/diff/dir.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/gnu/usr.bin/diff/dir.c b/gnu/usr.bin/diff/dir.c index b31eb633ff2..036a86f1128 100644 --- a/gnu/usr.bin/diff/dir.c +++ b/gnu/usr.bin/diff/dir.c @@ -1,5 +1,5 @@ /* Read, sort and compare two directories. Used for GNU DIFF. - Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -17,10 +17,6 @@ You should have received a copy of the GNU General Public License along with GNU DIFF; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef lint -static char *rcsid = "$Id: dir.c,v 1.4 1993/09/16 17:39:12 jtc Exp $"; -#endif - #include "diff.h" /* Read the directory named by DIR and store into DIRDATA a sorted vector @@ -79,7 +75,7 @@ dir_sort (dir, dirdata) while ((errno = 0, (next = readdir (reading)) != 0)) { char *d_name = next->d_name; - size_t d_size; + size_t d_size = NAMLEN (next) + 1; /* Ignore the files `.' and `..' */ if (d_name[0] == '.' @@ -89,7 +85,6 @@ dir_sort (dir, dirdata) if (excluded_filename (d_name)) continue; - d_size = strlen (d_name) + 1; while (data_alloc < data_used + d_size) dirdata->data = data = xrealloc (data, data_alloc *= 2); memcpy (data + data_used, d_name, d_size); @@ -103,7 +98,7 @@ dir_sort (dir, dirdata) errno = e; return -1; } -#if VOID_CLOSEDIR +#if CLOSEDIR_VOID closedir (reading); #else if (closedir (reading) != 0) @@ -133,7 +128,8 @@ static int compare_names (file1, file2) void const *file1, *file2; { - return strcmp (* (char const *const *) file1, * (char const *const *) file2); + return filename_cmp (* (char const *const *) file1, + * (char const *const *) file2); } /* Compare the contents of two directories named in FILEVEC[0] and FILEVEC[1]. @@ -186,9 +182,9 @@ diff_dirs (filevec, handle_file, depth) if (dir_start_file && depth == 0) { - while (*names0 && strcmp (*names0, dir_start_file) < 0) + while (*names0 && filename_cmp (*names0, dir_start_file) < 0) names0++; - while (*names1 && strcmp (*names1, dir_start_file) < 0) + while (*names1 && filename_cmp (*names1, dir_start_file) < 0) names1++; } @@ -199,7 +195,7 @@ diff_dirs (filevec, handle_file, depth) At the end of a dir, pretend the "next name" in that dir is very large. */ int nameorder = (!*names0 ? 1 : !*names1 ? -1 - : strcmp (*names0, *names1)); + : filename_cmp (*names0, *names1)); int v1 = (*handle_file) (name0, 0 < nameorder ? 0 : *names0++, name1, nameorder < 0 ? 0 : *names1++, depth + 1); |
