|
0
|
1 //=========================================================================== |
|
|
2 // |
|
|
3 // stdiosupp.cxx |
|
|
4 // |
|
|
5 // Helper C library functions for standard I/O |
|
|
6 // |
|
|
7 //=========================================================================== |
|
|
8 //####COPYRIGHTBEGIN#### |
|
|
9 // |
|
|
10 // ------------------------------------------- |
|
|
11 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
12 // Version 1.0 (the "License"); you may not use this file except in |
|
|
13 // compliance with the License. You may obtain a copy of the License at |
|
|
14 // http://sourceware.cygnus.com/ecos |
|
|
15 // |
|
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
18 // License for the specific language governing rights and limitations under |
|
|
19 // the License. |
|
|
20 // |
|
|
21 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
22 // September 30, 1998. |
|
|
23 // |
|
|
24 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
26 // ------------------------------------------- |
|
|
27 // |
|
|
28 //####COPYRIGHTEND#### |
|
|
29 //=========================================================================== |
|
|
30 //#####DESCRIPTIONBEGIN#### |
|
|
31 // |
|
|
32 // Author(s): jlarmour |
|
|
33 // Contributors: jlarmour@cygnus.co.uk |
|
|
34 // Date: 1998-02-13 |
|
|
35 // Purpose: |
|
|
36 // Description: |
|
|
37 // Usage: |
|
|
38 // |
|
|
39 //####DESCRIPTIONEND#### |
|
|
40 // |
|
|
41 //=========================================================================== |
|
|
42 |
|
|
43 // CONFIGURATION |
|
|
44 |
|
|
45 #include <pkgconf/libc.h> // Configuration header |
|
|
46 |
|
|
47 |
|
|
48 // Include the C library? And do we want the stdio stuff? |
|
|
49 #if defined(CYGPKG_LIBC) && defined(CYGPKG_LIBC_STDIO) |
|
|
50 |
|
|
51 // INCLUDES |
|
|
52 |
|
|
53 #include <cyg/infra/cyg_type.h> // Common project-wide type definitions |
|
|
54 #include <stddef.h> // NULL and size_t from compiler |
|
|
55 #include <cyg/devs/common/table.h> // Device table |
|
|
56 #include "clibincl/stringsupp.hxx" // _strncmp() and _strcmp() |
|
|
57 #include "clibincl/stdiosupp.hxx" // Header for this file |
|
|
58 |
|
|
59 |
|
|
60 struct Cyg_Device_Table_t * |
|
|
61 Cyg_libc_stdio_find_filename( const char *filename ) |
|
|
62 { |
|
|
63 int i; |
|
|
64 struct Cyg_Device_Table_t *dev=NULL; |
|
|
65 |
|
|
66 // Find the "file" in the device table |
|
|
67 if ( _strncmp( filename, "/dev/", 5) ) |
|
|
68 { |
|
|
69 return NULL; |
|
|
70 } // if |
|
|
71 |
|
|
72 // match the bit after the "/dev/" |
|
|
73 for (i=0; (Cyg_Device_Table[i].name != NULL); i++ ) |
|
|
74 { |
|
|
75 if ( !_strcmp( &filename[5], Cyg_Device_Table[i].name) ) |
|
|
76 { |
|
|
77 dev=&Cyg_Device_Table[i]; |
|
|
78 break; |
|
|
79 } |
|
|
80 } // for |
|
|
81 |
|
|
82 return dev; // dev will still be NULL if the filename wasn't found |
|
|
83 } // Cyg_libc_stdio_find_filename() |
|
|
84 |
|
|
85 |
|
|
86 #endif // if defined(CYGPKG_LIBC) && defined(CYGPKG_LIBC_STDIO) |
|
|
87 |
|
|
88 // EOF stdiosupp.cxx |