OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [gcc/] [java/] [win32-host.c] - Diff between revs 715 and 783

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 715 Rev 783
/* Platform-Specific Win32 Functions
/* Platform-Specific Win32 Functions
   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
 
 
This file is part of GCC.
This file is part of GCC.
 
 
GCC is free software; you can redistribute it and/or modify
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
any later version.
 
 
GCC is distributed in the hope that it will be useful,
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
 
 
Java and all Java-based marks are trademarks or registered trademarks
Java and all Java-based marks are trademarks or registered trademarks
of Sun Microsystems, Inc. in the United States and other countries.
of Sun Microsystems, Inc. in the United States and other countries.
The Free Software Foundation is independent of Sun Microsystems, Inc.  */
The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 
 
/* Written by Mohan Embar <gnustuff@thisiscool.com>, March 2003. */
/* Written by Mohan Embar <gnustuff@thisiscool.com>, March 2003. */
 
 
 
 
#include "config.h"
#include "config.h"
#include "system.h"
#include "system.h"
#include "coretypes.h"
#include "coretypes.h"
#include "jcf.h"
#include "jcf.h"
 
 
#ifdef WIN32
#ifdef WIN32
 
 
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#undef WIN32_LEAN_AND_MEAN
 
 
/* Simulate an open() failure with ENOENT */
/* Simulate an open() failure with ENOENT */
static int
static int
file_not_found (void);
file_not_found (void);
 
 
static int
static int
file_not_found (void)
file_not_found (void)
{
{
  errno = ENOENT;
  errno = ENOENT;
  return -1;
  return -1;
}
}
 
 
int
int
jcf_open_exact_case (const char *filename, int oflag)
jcf_open_exact_case (const char *filename, int oflag)
{
{
  int filename_len = strlen (filename);
  int filename_len = strlen (filename);
  int found_file_len;
  int found_file_len;
  HANDLE found_file_handle;
  HANDLE found_file_handle;
  WIN32_FIND_DATA fd;
  WIN32_FIND_DATA fd;
 
 
  /* See if we can find this file. */
  /* See if we can find this file. */
  found_file_handle = FindFirstFile (filename, &fd);
  found_file_handle = FindFirstFile (filename, &fd);
  if (found_file_handle == INVALID_HANDLE_VALUE)
  if (found_file_handle == INVALID_HANDLE_VALUE)
    return file_not_found ();
    return file_not_found ();
  FindClose (found_file_handle);
  FindClose (found_file_handle);
 
 
  found_file_len = strlen (fd.cFileName);
  found_file_len = strlen (fd.cFileName);
 
 
  /* This should never happen. */
  /* This should never happen. */
  if (found_file_len > filename_len)
  if (found_file_len > filename_len)
    return file_not_found ();
    return file_not_found ();
 
 
  /* Here, we're only actually comparing the filename and not
  /* Here, we're only actually comparing the filename and not
     checking the case of any containing directory components.
     checking the case of any containing directory components.
     Although we're not fully obeying our contract, checking
     Although we're not fully obeying our contract, checking
     all directory components would be tedious and time-consuming
     all directory components would be tedious and time-consuming
     and it's a pretty safe assumption that mixed-case package
     and it's a pretty safe assumption that mixed-case package
     names are a fringe case.... */
     names are a fringe case.... */
  if (filename_cmp (filename + filename_len - found_file_len, fd.cFileName))
  if (filename_cmp (filename + filename_len - found_file_len, fd.cFileName))
    {
    {
      /* Reject this because it is not a perfect-case match. */
      /* Reject this because it is not a perfect-case match. */
      /* printf("************\nRejected:\n%s\n%s\n************\n\n", filename, fd.cFileName); */
      /* printf("************\nRejected:\n%s\n%s\n************\n\n", filename, fd.cFileName); */
      return file_not_found ();
      return file_not_found ();
    }
    }
  else
  else
    {
    {
      return open (filename, oflag);
      return open (filename, oflag);
    }
    }
}
}
 
 
#endif /* WIN32 */
#endif /* WIN32 */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.