FreeBSD/sys/contrib/dev/acpica/compiler/prutils.c
/*******************************************************************************
 *
 * FUNCTION:    PrOpenIncludeFile
 *
 * PARAMETERS:  Filename            - Filename or pathname for include file
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Open an include file and push it on the input file stack.
 *
 ******************************************************************************/
PrOpenIncludeFile
PARAMETERS:  Filename            - Filename or pathname for include file

None.

Open an include file and push it on the input file stack.
PrOpenIncludeFile PARAMETERS : Filename - Filename or pathname for include file None . Open an include file and push it on the input file stack .
FILE *
PrOpenIncludeFile (
    char                    *Filename,
    char                    *OpenMode,
    char                    **FullPathname)
{
    FILE                    *IncludeFile;
    ASL_INCLUDE_DIR         *NextDir;
    Gbl_CurrentLineOffset++;
    if ((Filename[0] == '/')  ||
        (Filename[0] == '\\') ||
        (Filename[1] == ':'))
    {
        IncludeFile = PrOpenIncludeWithPrefix (
            "", Filename, OpenMode, FullPathname);
        if (!IncludeFile)
        {
            goto ErrorExit;
        }
        return (IncludeFile);
    }
    IncludeFile = PrOpenIncludeWithPrefix (
        Gbl_DirectoryPath, Filename, OpenMode, FullPathname);
    if (IncludeFile)
    {
        return (IncludeFile);
    }
    NextDir = Gbl_IncludeDirList;
    while (NextDir)
    {
        IncludeFile = PrOpenIncludeWithPrefix (
            NextDir->Dir, Filename, OpenMode, FullPathname);
        if (IncludeFile)
        {
            return (IncludeFile);
        }
        NextDir = NextDir->Next;
    }
ErrorExit:
    sprintf (Gbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno));
    PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0);
    return (NULL);
}
FILE * PrOpenIncludeFile ( char * Filename , char * OpenMode , char * * FullPathname ) { FILE * IncludeFile ; ASL_INCLUDE_DIR * NextDir ; Gbl_CurrentLineOffset ++ ; if ( ( Filename [ 0 ] == ' ' ) || ( Filename [ 0 ] == ' \\ ' ) || ( Filename [ 1 ] == ' ' ) ) { IncludeFile = PrOpenIncludeWithPrefix ( " " , Filename , OpenMode , FullPathname ) ; if ( ! IncludeFile ) { goto ErrorExit ; } return ( IncludeFile ) ; } IncludeFile = PrOpenIncludeWithPrefix ( Gbl_DirectoryPath , Filename , OpenMode , FullPathname ) ; if ( IncludeFile ) { return ( IncludeFile ) ; } NextDir = Gbl_IncludeDirList ; while ( NextDir ) { IncludeFile = PrOpenIncludeWithPrefix ( NextDir -> Dir , Filename , OpenMode , FullPathname ) ; if ( IncludeFile ) { return ( IncludeFile ) ; } NextDir = NextDir -> Next ; } ErrorExit : sprintf ( Gbl_MainTokenBuffer , " " , Filename , strerror ( errno ) ) ; PrError ( ASL_ERROR , ASL_MSG_INCLUDE_FILE_OPEN , 0 ) ; return ( NULL ) ; }
FUNCTION:    PrOpenIncludeFile
 PARAMETERS:  Filename            - Filename or pathname for include file
FUNCTION : PrOpenIncludeFile PARAMETERS : Filename - Filename or pathname for include file
/* Start the actual include file on the next line */ /* Attempt to open the include file */ /* If the file specifies an absolute path, just open it */ /*
     * The include filename is not an absolute path.
     *
     * First, search for the file within the "local" directory -- meaning
     * the same directory that contains the source file.
     *
     * Construct the file pathname from the global directory name.
     */ /*
     * Second, search for the file within the (possibly multiple)
     * directories specified by the -I option on the command line.
     */ /* We could not open the include file after trying very hard */