~ubuntu-branches/ubuntu/natty/diffutils/natty

« back to all changes in this revision

Viewing changes to src/dir.c

  • Committer: Bazaar Package Importer
  • Author(s): Ian Jackson
  • Date: 2005-09-20 16:39:41 UTC
  • Revision ID: james.westby@ubuntu.com-20050920163941-514vxc8yc682ev00
Tags: 2.8.1-11ubuntu1
Applied patch to make --ignore-file-name-case work.
(Ubuntu 7291, Debian #300258.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Read, sort and compare two directories.  Used for GNU DIFF.
2
2
 
3
 
   Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002
4
 
   Free Software Foundation, Inc.
 
3
   Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1998, 2001, 2002,
 
4
   2004 Free Software Foundation, Inc.
5
5
 
6
6
   This file is part of GNU DIFF.
7
7
 
145
145
static int
146
146
compare_names (char const *name1, char const *name2)
147
147
{
148
 
  if (ignore_file_name_case)
149
 
    {
150
 
      int r = strcasecmp (name1, name2);
151
 
      if (r)
152
 
        return r;
153
 
    }
154
 
 
155
148
  if (locale_specific_sorting)
156
149
    {
157
150
      int r;
158
151
      errno = 0;
159
 
      r = strcoll (name1, name2);
 
152
      if (ignore_file_name_case)
 
153
        r = strcasecoll (name1, name2);
 
154
      else
 
155
        r = strcoll (name1, name2);
160
156
      if (errno)
161
157
        {
162
158
          error (0, errno, _("cannot compare file names `%s' and `%s'"),
163
159
                 name1, name2);
164
160
          longjmp (failed_strcoll, 1);
165
161
        }
166
 
      if (r)
167
 
        return r;
 
162
      return r;
168
163
    }
169
164
 
170
 
  return file_name_cmp (name1, name2);
 
165
  return (ignore_file_name_case
 
166
          ? strcasecmp (name1, name2)
 
167
          : file_name_cmp (name1, name2));
171
168
}
172
169
 
173
170
/* A wrapper for compare_names suitable as an argument for qsort.  */