Changeset 1993 for trunk/src/kmk/dir.c


Ignore:
Timestamp:
Oct 29, 2008, 1:37:51 AM (17 years ago)
Author:
bird
Message:

Merged in current GNU Make code (CVS from 2008-10-28). Ref #55.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/dir.c

    r1980 r1993  
    11/* Directory hashing for GNU Make.
    22Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    44Foundation, Inc.
    55This file is part of GNU Make.
     
    77GNU Make is free software; you can redistribute it and/or modify it under the
    88terms of the GNU General Public License as published by the Free Software
    9 Foundation; either version 2, or (at your option) any later version.
     9Foundation; either version 3 of the License, or (at your option) any later
     10version.
    1011
    1112GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     
    1415
    1516You should have received a copy of the GNU General Public License along with
    16 GNU Make; see the file COPYING.  If not, write to the Free Software
    17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
     17this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1818
    1919#include "make.h"
     
    524524         Find its device and inode numbers, and look it up by them.  */
    525525
    526 #ifdef WINDOWS32
    527       /* Remove any trailing '\'.  Windows32 stat fails even on valid
    528          directories if they end in '\'. */
    529       if (p[-1] == '\\')
    530         ((char *)p)[-1] = '\0';
    531 #endif
    532 
    533526#ifdef VMS
    534527      r = vmsstat_dir (name, &st);
     528#elif defined(WINDOWS32)
     529      {
     530        char tem[MAXPATHLEN], *tstart, *tend;
     531
     532        /* Remove any trailing slashes.  Windows32 stat fails even on
     533           valid directories if they end in a slash. */
     534        memcpy (tem, name, p - name + 1);
     535        tstart = tem;
     536        if (tstart[1] == ':')
     537          tstart += 2;
     538        for (tend = tem + (p - name - 1);
     539             tend > tstart && (*tend == '/' || *tend == '\\');
     540             tend--)
     541          *tend = '\0';
     542
     543        r = stat (tem, &st);
     544      }
    535545#else
    536546      EINTRLOOP (r, stat (name, &st));
    537 #endif
    538 
    539 #ifdef WINDOWS32
    540       /* Put back the trailing '\'.  If we don't, we're permanently
    541          truncating the value!  */
    542       if (p[-1] == '\0')
    543         ((char *)p)[-1] = '\\';
    544547#endif
    545548
Note: See TracChangeset for help on using the changeset viewer.