source: rtems/c/src/exec/libfs/src/imfs/imfs_getchild.c @ d6b1d73

4.104.114.84.95
Last change on this file since d6b1d73 was d6b1d73, checked in by Joel Sherrill <joel.sherrill@…>, on 01/22/01 at 14:05:14

2001-01-22 Ralf Corsepius <corsepiu@…>

  • configure.in: Add src/imfs/config.h
  • src/imfs/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • src/imfs/.cvsignore: Add config.h and stamp-h
  • src/imfs/*.c: Add config.h support.
  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[07a3253d]1/*
2 *  IMFS_find_match_in_dir()
3 *
4 *  This routine returns the child name in the given directory.
5 *
[08311cc3]6 *  COPYRIGHT (c) 1989-1999.
[07a3253d]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
[d6b1d73]16#if HAVE_CONFIG_H
17#include "config.h"
18#endif
19
[07a3253d]20#include <errno.h>
21#include <assert.h>
22#include "imfs.h"
23
24static char dotname[2] = ".";
25static char dotdotname[2] = "..";
26
27IMFS_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  /*
[ec2328ee]37   *  Check for fatal errors.  A NULL directory show a problem in the
38   *  the IMFS code.
[07a3253d]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.