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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [java/] [win32-host.c] - Blame information for rev 717

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 715 jeremybenn
/* Platform-Specific Win32 Functions
2
   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
3
 
4
This file is part of GCC.
5
 
6
GCC is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 3, or (at your option)
9
any later version.
10
 
11
GCC is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
GNU General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GCC; see the file COPYING3.  If not see
18
<http://www.gnu.org/licenses/>.
19
 
20
Java and all Java-based marks are trademarks or registered trademarks
21
of Sun Microsystems, Inc. in the United States and other countries.
22
The Free Software Foundation is independent of Sun Microsystems, Inc.  */
23
 
24
/* Written by Mohan Embar <gnustuff@thisiscool.com>, March 2003. */
25
 
26
 
27
#include "config.h"
28
#include "system.h"
29
#include "coretypes.h"
30
#include "jcf.h"
31
 
32
#ifdef WIN32
33
 
34
#define WIN32_LEAN_AND_MEAN
35
#include <windows.h>
36
#undef WIN32_LEAN_AND_MEAN
37
 
38
/* Simulate an open() failure with ENOENT */
39
static int
40
file_not_found (void);
41
 
42
static int
43
file_not_found (void)
44
{
45
  errno = ENOENT;
46
  return -1;
47
}
48
 
49
int
50
jcf_open_exact_case (const char *filename, int oflag)
51
{
52
  int filename_len = strlen (filename);
53
  int found_file_len;
54
  HANDLE found_file_handle;
55
  WIN32_FIND_DATA fd;
56
 
57
  /* See if we can find this file. */
58
  found_file_handle = FindFirstFile (filename, &fd);
59
  if (found_file_handle == INVALID_HANDLE_VALUE)
60
    return file_not_found ();
61
  FindClose (found_file_handle);
62
 
63
  found_file_len = strlen (fd.cFileName);
64
 
65
  /* This should never happen. */
66
  if (found_file_len > filename_len)
67
    return file_not_found ();
68
 
69
  /* Here, we're only actually comparing the filename and not
70
     checking the case of any containing directory components.
71
     Although we're not fully obeying our contract, checking
72
     all directory components would be tedious and time-consuming
73
     and it's a pretty safe assumption that mixed-case package
74
     names are a fringe case.... */
75
  if (filename_cmp (filename + filename_len - found_file_len, fd.cFileName))
76
    {
77
      /* Reject this because it is not a perfect-case match. */
78
      /* printf("************\nRejected:\n%s\n%s\n************\n\n", filename, fd.cFileName); */
79
      return file_not_found ();
80
    }
81
  else
82
    {
83
      return open (filename, oflag);
84
    }
85
}
86
 
87
#endif /* WIN32 */

powered by: WebSVN 2.1.0

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