4.104.114.84.95
Last change
on this file since a768168 was
d9b0b866,
checked in by Joel Sherrill <joel.sherrill@…>, on 10/11/01 at 13:16:24
|
2001-10-10 Joel Sherrill <joel@…>
- src/imfs/imfs_getchild.c: Correct length of static string
as reported by Ibragimov Ilya <ibr@…>.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /* |
---|
2 | * IMFS_find_match_in_dir() |
---|
3 | * |
---|
4 | * This routine returns the child name in the given directory. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.OARcorp.com/rtems/license.html. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <errno.h> |
---|
21 | #include <assert.h> |
---|
22 | #include "imfs.h" |
---|
23 | |
---|
24 | static char dotname[2] = "."; |
---|
25 | static char dotdotname[3] = ".."; |
---|
26 | |
---|
27 | IMFS_jnode_t *IMFS_find_match_in_dir( |
---|
28 | IMFS_jnode_t *directory, |
---|
29 | char *name |
---|
30 | ) |
---|
31 | { |
---|
32 | Chain_Node *the_node; |
---|
33 | Chain_Control *the_chain; |
---|
34 | IMFS_jnode_t *the_jnode; |
---|
35 | |
---|
36 | /* |
---|
37 | * Check for fatal errors. A NULL directory show a problem in the |
---|
38 | * the IMFS code. |
---|
39 | */ |
---|
40 | |
---|
41 | assert( directory ); |
---|
42 | if ( !name ) |
---|
43 | return 0; |
---|
44 | |
---|
45 | assert( name ); |
---|
46 | if ( !directory ) |
---|
47 | return 0; |
---|
48 | |
---|
49 | /* |
---|
50 | * Check for "." and ".." |
---|
51 | */ |
---|
52 | |
---|
53 | if ( !strcmp( name, dotname ) ) |
---|
54 | return directory; |
---|
55 | |
---|
56 | if ( !strcmp( name, dotdotname ) ) |
---|
57 | return directory->Parent; |
---|
58 | |
---|
59 | the_chain = &directory->info.directory.Entries; |
---|
60 | |
---|
61 | for ( the_node = the_chain->first; |
---|
62 | !_Chain_Is_tail( the_chain, the_node ); |
---|
63 | the_node = the_node->next ) { |
---|
64 | |
---|
65 | the_jnode = (IMFS_jnode_t *) the_node; |
---|
66 | |
---|
67 | if ( !strcmp( name, the_jnode->name ) ) |
---|
68 | return the_jnode; |
---|
69 | } |
---|
70 | |
---|
71 | return 0; |
---|
72 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.