aslfiles.c revision 235945
1118611Snjl 2118611Snjl/****************************************************************************** 3118611Snjl * 4118611Snjl * Module Name: aslfiles - file I/O suppoert 5118611Snjl * 6118611Snjl *****************************************************************************/ 7118611Snjl 8217365Sjkim/* 9229989Sjkim * Copyright (C) 2000 - 2012, Intel Corp. 10118611Snjl * All rights reserved. 11118611Snjl * 12217365Sjkim * Redistribution and use in source and binary forms, with or without 13217365Sjkim * modification, are permitted provided that the following conditions 14217365Sjkim * are met: 15217365Sjkim * 1. Redistributions of source code must retain the above copyright 16217365Sjkim * notice, this list of conditions, and the following disclaimer, 17217365Sjkim * without modification. 18217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 19217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 20217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 21217365Sjkim * including a substantially similar Disclaimer requirement for further 22217365Sjkim * binary redistribution. 23217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 24217365Sjkim * of any contributors may be used to endorse or promote products derived 25217365Sjkim * from this software without specific prior written permission. 26118611Snjl * 27217365Sjkim * Alternatively, this software may be distributed under the terms of the 28217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 29217365Sjkim * Software Foundation. 30118611Snjl * 31217365Sjkim * NO WARRANTY 32217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 35217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 40217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 41217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 43217365Sjkim */ 44118611Snjl 45151937Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 46193529Sjkim#include <contrib/dev/acpica/include/acapps.h> 47118611Snjl 48118611Snjl#define _COMPONENT ACPI_COMPILER 49118611Snjl ACPI_MODULE_NAME ("aslfiles") 50118611Snjl 51151937Sjkim/* Local prototypes */ 52118611Snjl 53233250SjkimFILE * 54197104SjkimFlOpenIncludeWithPrefix ( 55197104Sjkim char *PrefixDir, 56197104Sjkim char *Filename); 57151937Sjkim 58197104Sjkim 59151937Sjkim#ifdef ACPI_OBSOLETE_FUNCTIONS 60151937SjkimACPI_STATUS 61151937SjkimFlParseInputPathname ( 62151937Sjkim char *InputFilename); 63151937Sjkim#endif 64151937Sjkim 65151937Sjkim 66118611Snjl/******************************************************************************* 67118611Snjl * 68118611Snjl * FUNCTION: AslAbort 69118611Snjl * 70118611Snjl * PARAMETERS: None 71118611Snjl * 72118611Snjl * RETURN: None 73118611Snjl * 74118611Snjl * DESCRIPTION: Dump the error log and abort the compiler. Used for serious 75118611Snjl * I/O errors 76118611Snjl * 77118611Snjl ******************************************************************************/ 78118611Snjl 79118611Snjlvoid 80151937SjkimAslAbort ( 81151937Sjkim void) 82118611Snjl{ 83118611Snjl 84234623Sjkim AePrintErrorLog (ASL_FILE_STDERR); 85118611Snjl if (Gbl_DebugFlag) 86118611Snjl { 87234623Sjkim /* Print error summary to stdout also */ 88118611Snjl 89234623Sjkim AePrintErrorLog (ASL_FILE_STDOUT); 90118611Snjl } 91118611Snjl 92151937Sjkim exit (1); 93118611Snjl} 94118611Snjl 95118611Snjl 96118611Snjl/******************************************************************************* 97118611Snjl * 98118611Snjl * FUNCTION: FlFileError 99118611Snjl * 100118611Snjl * PARAMETERS: FileId - Index into file info array 101118611Snjl * ErrorId - Index into error message array 102118611Snjl * 103118611Snjl * RETURN: None 104118611Snjl * 105118611Snjl * DESCRIPTION: Decode errno to an error message and add the entire error 106118611Snjl * to the error log. 107118611Snjl * 108118611Snjl ******************************************************************************/ 109118611Snjl 110118611Snjlvoid 111118611SnjlFlFileError ( 112118611Snjl UINT32 FileId, 113118611Snjl UINT8 ErrorId) 114118611Snjl{ 115118611Snjl 116151937Sjkim sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, 117151937Sjkim strerror (errno)); 118118611Snjl AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); 119118611Snjl} 120118611Snjl 121118611Snjl 122118611Snjl/******************************************************************************* 123118611Snjl * 124118611Snjl * FUNCTION: FlOpenFile 125118611Snjl * 126118611Snjl * PARAMETERS: FileId - Index into file info array 127118611Snjl * Filename - file pathname to open 128118611Snjl * Mode - Open mode for fopen 129118611Snjl * 130151937Sjkim * RETURN: None 131118611Snjl * 132118611Snjl * DESCRIPTION: Open a file. 133118611Snjl * NOTE: Aborts compiler on any error. 134118611Snjl * 135118611Snjl ******************************************************************************/ 136118611Snjl 137209746Sjkimvoid 138118611SnjlFlOpenFile ( 139118611Snjl UINT32 FileId, 140118611Snjl char *Filename, 141118611Snjl char *Mode) 142118611Snjl{ 143118611Snjl FILE *File; 144118611Snjl 145118611Snjl 146118611Snjl File = fopen (Filename, Mode); 147118611Snjl 148118611Snjl Gbl_Files[FileId].Filename = Filename; 149118611Snjl Gbl_Files[FileId].Handle = File; 150118611Snjl 151118611Snjl if (!File) 152118611Snjl { 153118611Snjl FlFileError (FileId, ASL_MSG_OPEN); 154118611Snjl AslAbort (); 155118611Snjl } 156118611Snjl} 157118611Snjl 158118611Snjl 159118611Snjl/******************************************************************************* 160118611Snjl * 161207344Sjkim * FUNCTION: FlGetFileSize 162207344Sjkim * 163207344Sjkim * PARAMETERS: FileId - Index into file info array 164207344Sjkim * 165207344Sjkim * RETURN: File Size 166207344Sjkim * 167207344Sjkim * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. 168207344Sjkim * 169207344Sjkim ******************************************************************************/ 170207344Sjkim 171207344SjkimUINT32 172207344SjkimFlGetFileSize ( 173207344Sjkim UINT32 FileId) 174207344Sjkim{ 175207344Sjkim FILE *fp; 176207344Sjkim UINT32 FileSize; 177228110Sjkim long Offset; 178207344Sjkim 179207344Sjkim 180207344Sjkim fp = Gbl_Files[FileId].Handle; 181228110Sjkim Offset = ftell (fp); 182207344Sjkim 183207344Sjkim fseek (fp, 0, SEEK_END); 184207344Sjkim FileSize = (UINT32) ftell (fp); 185207344Sjkim 186228110Sjkim /* Restore file pointer */ 187228110Sjkim 188228110Sjkim fseek (fp, Offset, SEEK_SET); 189207344Sjkim return (FileSize); 190207344Sjkim} 191207344Sjkim 192207344Sjkim 193207344Sjkim/******************************************************************************* 194207344Sjkim * 195118611Snjl * FUNCTION: FlReadFile 196118611Snjl * 197118611Snjl * PARAMETERS: FileId - Index into file info array 198118611Snjl * Buffer - Where to place the data 199118611Snjl * Length - Amount to read 200118611Snjl * 201118611Snjl * RETURN: Status. AE_ERROR indicates EOF. 202118611Snjl * 203118611Snjl * DESCRIPTION: Read data from an open file. 204118611Snjl * NOTE: Aborts compiler on any error. 205118611Snjl * 206118611Snjl ******************************************************************************/ 207118611Snjl 208118611SnjlACPI_STATUS 209118611SnjlFlReadFile ( 210118611Snjl UINT32 FileId, 211118611Snjl void *Buffer, 212118611Snjl UINT32 Length) 213118611Snjl{ 214118611Snjl UINT32 Actual; 215118611Snjl 216118611Snjl 217118611Snjl /* Read and check for error */ 218118611Snjl 219118611Snjl Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle); 220118611Snjl if (Actual != Length) 221118611Snjl { 222118611Snjl if (feof (Gbl_Files[FileId].Handle)) 223118611Snjl { 224118611Snjl /* End-of-file, just return error */ 225118611Snjl 226118611Snjl return (AE_ERROR); 227118611Snjl } 228118611Snjl 229118611Snjl FlFileError (FileId, ASL_MSG_READ); 230118611Snjl AslAbort (); 231118611Snjl } 232118611Snjl 233118611Snjl return (AE_OK); 234118611Snjl} 235118611Snjl 236118611Snjl 237118611Snjl/******************************************************************************* 238118611Snjl * 239118611Snjl * FUNCTION: FlWriteFile 240118611Snjl * 241118611Snjl * PARAMETERS: FileId - Index into file info array 242118611Snjl * Buffer - Data to write 243118611Snjl * Length - Amount of data to write 244118611Snjl * 245151937Sjkim * RETURN: None 246118611Snjl * 247118611Snjl * DESCRIPTION: Write data to an open file. 248118611Snjl * NOTE: Aborts compiler on any error. 249118611Snjl * 250118611Snjl ******************************************************************************/ 251118611Snjl 252118611Snjlvoid 253118611SnjlFlWriteFile ( 254118611Snjl UINT32 FileId, 255118611Snjl void *Buffer, 256118611Snjl UINT32 Length) 257118611Snjl{ 258118611Snjl UINT32 Actual; 259118611Snjl 260118611Snjl 261118611Snjl /* Write and check for error */ 262118611Snjl 263118611Snjl Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle); 264118611Snjl if (Actual != Length) 265118611Snjl { 266118611Snjl FlFileError (FileId, ASL_MSG_WRITE); 267118611Snjl AslAbort (); 268118611Snjl } 269118611Snjl} 270118611Snjl 271118611Snjl 272118611Snjl/******************************************************************************* 273118611Snjl * 274118611Snjl * FUNCTION: FlPrintFile 275118611Snjl * 276118611Snjl * PARAMETERS: FileId - Index into file info array 277118611Snjl * Format - Printf format string 278118611Snjl * ... - Printf arguments 279118611Snjl * 280118611Snjl * RETURN: None 281118611Snjl * 282118611Snjl * DESCRIPTION: Formatted write to an open file. 283118611Snjl * NOTE: Aborts compiler on any error. 284118611Snjl * 285118611Snjl ******************************************************************************/ 286118611Snjl 287118611Snjlvoid 288118611SnjlFlPrintFile ( 289118611Snjl UINT32 FileId, 290118611Snjl char *Format, 291118611Snjl ...) 292118611Snjl{ 293118611Snjl INT32 Actual; 294118611Snjl va_list Args; 295118611Snjl 296118611Snjl 297118611Snjl va_start (Args, Format); 298118611Snjl 299118611Snjl Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); 300193529Sjkim va_end (Args); 301193529Sjkim 302118611Snjl if (Actual == -1) 303118611Snjl { 304118611Snjl FlFileError (FileId, ASL_MSG_WRITE); 305118611Snjl AslAbort (); 306118611Snjl } 307118611Snjl} 308118611Snjl 309118611Snjl 310118611Snjl/******************************************************************************* 311118611Snjl * 312118611Snjl * FUNCTION: FlSeekFile 313118611Snjl * 314118611Snjl * PARAMETERS: FileId - Index into file info array 315118611Snjl * Offset - Absolute byte offset in file 316118611Snjl * 317151937Sjkim * RETURN: None 318118611Snjl * 319118611Snjl * DESCRIPTION: Seek to absolute offset 320118611Snjl * NOTE: Aborts compiler on any error. 321118611Snjl * 322118611Snjl ******************************************************************************/ 323118611Snjl 324118611Snjlvoid 325118611SnjlFlSeekFile ( 326118611Snjl UINT32 FileId, 327118611Snjl long Offset) 328118611Snjl{ 329118611Snjl int Error; 330118611Snjl 331118611Snjl 332118611Snjl Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET); 333118611Snjl if (Error) 334118611Snjl { 335118611Snjl FlFileError (FileId, ASL_MSG_SEEK); 336118611Snjl AslAbort (); 337118611Snjl } 338118611Snjl} 339118611Snjl 340118611Snjl 341118611Snjl/******************************************************************************* 342118611Snjl * 343118611Snjl * FUNCTION: FlCloseFile 344118611Snjl * 345118611Snjl * PARAMETERS: FileId - Index into file info array 346118611Snjl * 347151937Sjkim * RETURN: None 348118611Snjl * 349118611Snjl * DESCRIPTION: Close an open file. Aborts compiler on error 350118611Snjl * 351118611Snjl ******************************************************************************/ 352118611Snjl 353118611Snjlvoid 354118611SnjlFlCloseFile ( 355118611Snjl UINT32 FileId) 356118611Snjl{ 357118611Snjl int Error; 358118611Snjl 359118611Snjl 360118611Snjl if (!Gbl_Files[FileId].Handle) 361118611Snjl { 362118611Snjl return; 363118611Snjl } 364118611Snjl 365118611Snjl Error = fclose (Gbl_Files[FileId].Handle); 366118611Snjl if (Error) 367118611Snjl { 368118611Snjl FlFileError (FileId, ASL_MSG_CLOSE); 369118611Snjl AslAbort (); 370118611Snjl } 371118611Snjl 372233250Sjkim Gbl_Files[FileId].Handle = NULL; 373118611Snjl return; 374118611Snjl} 375118611Snjl 376118611Snjl 377118611Snjl/******************************************************************************* 378118611Snjl * 379118611Snjl * FUNCTION: FlSetLineNumber 380118611Snjl * 381118611Snjl * PARAMETERS: Op - Parse node for the LINE asl statement 382118611Snjl * 383118611Snjl * RETURN: None. 384118611Snjl * 385118611Snjl * DESCRIPTION: Set the current line number 386118611Snjl * 387118611Snjl ******************************************************************************/ 388118611Snjl 389118611Snjlvoid 390118611SnjlFlSetLineNumber ( 391234623Sjkim UINT32 LineNumber) 392118611Snjl{ 393118611Snjl 394234623Sjkim DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New line number %u (old %u)\n", 395234623Sjkim LineNumber, Gbl_LogicalLineNumber); 396234623Sjkim 397234623Sjkim Gbl_CurrentLineNumber = LineNumber; 398234623Sjkim Gbl_LogicalLineNumber = LineNumber; 399118611Snjl} 400118611Snjl 401118611Snjl 402118611Snjl/******************************************************************************* 403118611Snjl * 404234623Sjkim * FUNCTION: FlSetFilename 405234623Sjkim * 406234623Sjkim * PARAMETERS: Op - Parse node for the LINE asl statement 407234623Sjkim * 408234623Sjkim * RETURN: None. 409234623Sjkim * 410234623Sjkim * DESCRIPTION: Set the current filename 411234623Sjkim * 412234623Sjkim ******************************************************************************/ 413234623Sjkim 414234623Sjkimvoid 415234623SjkimFlSetFilename ( 416234623Sjkim char *Filename) 417234623Sjkim{ 418234623Sjkim 419234623Sjkim DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New filename %s (old %s)\n", 420234623Sjkim Filename, Gbl_Files[ASL_FILE_INPUT].Filename); 421234623Sjkim 422234623Sjkim Gbl_Files[ASL_FILE_INPUT].Filename = Filename; 423234623Sjkim} 424234623Sjkim 425234623Sjkim 426234623Sjkim/******************************************************************************* 427234623Sjkim * 428197104Sjkim * FUNCTION: FlAddIncludeDirectory 429197104Sjkim * 430197104Sjkim * PARAMETERS: Dir - Directory pathname string 431197104Sjkim * 432197104Sjkim * RETURN: None 433197104Sjkim * 434197104Sjkim * DESCRIPTION: Add a directory the list of include prefix directories. 435197104Sjkim * 436197104Sjkim ******************************************************************************/ 437197104Sjkim 438197104Sjkimvoid 439197104SjkimFlAddIncludeDirectory ( 440197104Sjkim char *Dir) 441197104Sjkim{ 442197104Sjkim ASL_INCLUDE_DIR *NewDir; 443197104Sjkim ASL_INCLUDE_DIR *NextDir; 444197104Sjkim ASL_INCLUDE_DIR *PrevDir = NULL; 445197104Sjkim UINT32 NeedsSeparator = 0; 446197104Sjkim size_t DirLength; 447197104Sjkim 448197104Sjkim 449197104Sjkim DirLength = strlen (Dir); 450197104Sjkim if (!DirLength) 451197104Sjkim { 452197104Sjkim return; 453197104Sjkim } 454197104Sjkim 455197104Sjkim /* Make sure that the pathname ends with a path separator */ 456197104Sjkim 457197104Sjkim if ((Dir[DirLength-1] != '/') && 458197104Sjkim (Dir[DirLength-1] != '\\')) 459197104Sjkim { 460197104Sjkim NeedsSeparator = 1; 461197104Sjkim } 462197104Sjkim 463197104Sjkim NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); 464197104Sjkim NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); 465197104Sjkim strcpy (NewDir->Dir, Dir); 466197104Sjkim if (NeedsSeparator) 467197104Sjkim { 468197104Sjkim strcat (NewDir->Dir, "/"); 469197104Sjkim } 470197104Sjkim 471197104Sjkim /* 472197104Sjkim * Preserve command line ordering of -I options by adding new elements 473197104Sjkim * at the end of the list 474197104Sjkim */ 475197104Sjkim NextDir = Gbl_IncludeDirList; 476197104Sjkim while (NextDir) 477197104Sjkim { 478197104Sjkim PrevDir = NextDir; 479197104Sjkim NextDir = NextDir->Next; 480197104Sjkim } 481197104Sjkim 482197104Sjkim if (PrevDir) 483197104Sjkim { 484197104Sjkim PrevDir->Next = NewDir; 485197104Sjkim } 486197104Sjkim else 487197104Sjkim { 488197104Sjkim Gbl_IncludeDirList = NewDir; 489197104Sjkim } 490197104Sjkim} 491197104Sjkim 492197104Sjkim 493197104Sjkim/******************************************************************************* 494197104Sjkim * 495235945Sjkim * FUNCTION: FlMergePathnames 496235945Sjkim * 497235945Sjkim * PARAMETERS: PrefixDir - Prefix directory pathname. Can be NULL or 498235945Sjkim * a zero length string. 499235945Sjkim * FilePathname - The include filename from the source ASL. 500235945Sjkim * 501235945Sjkim * RETURN: Merged pathname string 502235945Sjkim * 503235945Sjkim * DESCRIPTION: Merge two pathnames that (probably) have common elements, to 504235945Sjkim * arrive at a minimal length string. Merge can occur if the 505235945Sjkim * FilePathname is relative to the PrefixDir. 506235945Sjkim * 507235945Sjkim ******************************************************************************/ 508235945Sjkim 509235945Sjkimchar * 510235945SjkimFlMergePathnames ( 511235945Sjkim char *PrefixDir, 512235945Sjkim char *FilePathname) 513235945Sjkim{ 514235945Sjkim char *CommonPath; 515235945Sjkim char *Pathname; 516235945Sjkim char *LastElement; 517235945Sjkim 518235945Sjkim 519235945Sjkim DbgPrint (ASL_PARSE_OUTPUT, "Include: Prefix path - \"%s\"\n" 520235945Sjkim "Include: FilePathname - \"%s\"\n", 521235945Sjkim PrefixDir, FilePathname); 522235945Sjkim 523235945Sjkim /* 524235945Sjkim * If there is no prefix directory or if the file pathname is absolute, 525235945Sjkim * just return the original file pathname 526235945Sjkim */ 527235945Sjkim if (!PrefixDir || (!*PrefixDir) || 528235945Sjkim (*FilePathname == '/') || 529235945Sjkim (FilePathname[1] == ':')) 530235945Sjkim { 531235945Sjkim Pathname = ACPI_ALLOCATE (strlen (FilePathname) + 1); 532235945Sjkim strcpy (Pathname, FilePathname); 533235945Sjkim goto ConvertBackslashes; 534235945Sjkim } 535235945Sjkim 536235945Sjkim /* Need a local copy of the prefix directory path */ 537235945Sjkim 538235945Sjkim CommonPath = ACPI_ALLOCATE (strlen (PrefixDir) + 1); 539235945Sjkim strcpy (CommonPath, PrefixDir); 540235945Sjkim 541235945Sjkim /* 542235945Sjkim * Walk forward through the file path, and simultaneously backward 543235945Sjkim * through the prefix directory path until there are no more 544235945Sjkim * relative references at the start of the file path. 545235945Sjkim */ 546235945Sjkim while (*FilePathname && (!strncmp (FilePathname, "../", 3))) 547235945Sjkim { 548235945Sjkim /* Remove last element of the prefix directory path */ 549235945Sjkim 550235945Sjkim LastElement = strrchr (CommonPath, '/'); 551235945Sjkim if (!LastElement) 552235945Sjkim { 553235945Sjkim goto ConcatenatePaths; 554235945Sjkim } 555235945Sjkim 556235945Sjkim *LastElement = 0; /* Terminate CommonPath string */ 557235945Sjkim FilePathname += 3; /* Point to next path element */ 558235945Sjkim } 559235945Sjkim 560235945Sjkim /* 561235945Sjkim * Remove the last element of the prefix directory path (it is the same as 562235945Sjkim * the first element of the file pathname), and build the final merged 563235945Sjkim * pathname. 564235945Sjkim */ 565235945Sjkim LastElement = strrchr (CommonPath, '/'); 566235945Sjkim if (LastElement) 567235945Sjkim { 568235945Sjkim *LastElement = 0; 569235945Sjkim } 570235945Sjkim 571235945Sjkim /* Build the final merged pathname */ 572235945Sjkim 573235945SjkimConcatenatePaths: 574235945Sjkim Pathname = ACPI_ALLOCATE_ZEROED (strlen (CommonPath) + strlen (FilePathname) + 2); 575235945Sjkim if (LastElement && *CommonPath) 576235945Sjkim { 577235945Sjkim strcpy (Pathname, CommonPath); 578235945Sjkim strcat (Pathname, "/"); 579235945Sjkim } 580235945Sjkim strcat (Pathname, FilePathname); 581235945Sjkim ACPI_FREE (CommonPath); 582235945Sjkim 583235945Sjkim /* Convert all backslashes to normal slashes */ 584235945Sjkim 585235945SjkimConvertBackslashes: 586235945Sjkim UtConvertBackslashes (Pathname); 587235945Sjkim 588235945Sjkim DbgPrint (ASL_PARSE_OUTPUT, "Include: Merged Pathname - \"%s\"\n", 589235945Sjkim Pathname); 590235945Sjkim return (Pathname); 591235945Sjkim} 592235945Sjkim 593235945Sjkim 594235945Sjkim/******************************************************************************* 595235945Sjkim * 596197104Sjkim * FUNCTION: FlOpenIncludeWithPrefix 597197104Sjkim * 598197104Sjkim * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero 599197104Sjkim * length string. 600197104Sjkim * Filename - The include filename from the source ASL. 601197104Sjkim * 602197104Sjkim * RETURN: Valid file descriptor if successful. Null otherwise. 603197104Sjkim * 604197104Sjkim * DESCRIPTION: Open an include file and push it on the input file stack. 605197104Sjkim * 606197104Sjkim ******************************************************************************/ 607197104Sjkim 608233250SjkimFILE * 609197104SjkimFlOpenIncludeWithPrefix ( 610197104Sjkim char *PrefixDir, 611197104Sjkim char *Filename) 612197104Sjkim{ 613197104Sjkim FILE *IncludeFile; 614197104Sjkim char *Pathname; 615197104Sjkim 616197104Sjkim 617197104Sjkim /* Build the full pathname to the file */ 618197104Sjkim 619235945Sjkim Pathname = FlMergePathnames (PrefixDir, Filename); 620197104Sjkim 621235945Sjkim DbgPrint (ASL_PARSE_OUTPUT, "Include: Opening file - \"%s\"\n\n", 622197104Sjkim Pathname); 623197104Sjkim 624197104Sjkim /* Attempt to open the file, push if successful */ 625197104Sjkim 626197104Sjkim IncludeFile = fopen (Pathname, "r"); 627197104Sjkim if (IncludeFile) 628197104Sjkim { 629197104Sjkim /* Push the include file on the open input file stack */ 630197104Sjkim 631197104Sjkim AslPushInputFileStack (IncludeFile, Pathname); 632197104Sjkim return (IncludeFile); 633197104Sjkim } 634197104Sjkim 635197104Sjkim ACPI_FREE (Pathname); 636197104Sjkim return (NULL); 637197104Sjkim} 638197104Sjkim 639197104Sjkim 640197104Sjkim/******************************************************************************* 641197104Sjkim * 642118611Snjl * FUNCTION: FlOpenIncludeFile 643118611Snjl * 644118611Snjl * PARAMETERS: Op - Parse node for the INCLUDE ASL statement 645118611Snjl * 646118611Snjl * RETURN: None. 647118611Snjl * 648118611Snjl * DESCRIPTION: Open an include file and push it on the input file stack. 649118611Snjl * 650118611Snjl ******************************************************************************/ 651118611Snjl 652118611Snjlvoid 653118611SnjlFlOpenIncludeFile ( 654118611Snjl ACPI_PARSE_OBJECT *Op) 655118611Snjl{ 656197104Sjkim FILE *IncludeFile; 657197104Sjkim ASL_INCLUDE_DIR *NextDir; 658118611Snjl 659118611Snjl 660118611Snjl /* Op must be valid */ 661118611Snjl 662118611Snjl if (!Op) 663118611Snjl { 664118611Snjl AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 665118611Snjl Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, 666118611Snjl Gbl_InputByteCount, Gbl_CurrentColumn, 667118611Snjl Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node"); 668118611Snjl 669118611Snjl return; 670118611Snjl } 671118611Snjl 672118611Snjl /* 673118611Snjl * Flush out the "include ()" statement on this line, start 674118611Snjl * the actual include file on the next line 675118611Snjl */ 676234623Sjkim AslResetCurrentLineBuffer (); 677118611Snjl FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); 678118611Snjl Gbl_CurrentLineOffset++; 679118611Snjl 680118611Snjl 681197104Sjkim /* Attempt to open the include file */ 682197104Sjkim 683197104Sjkim /* If the file specifies an absolute path, just open it */ 684197104Sjkim 685197104Sjkim if ((Op->Asl.Value.String[0] == '/') || 686197104Sjkim (Op->Asl.Value.String[0] == '\\') || 687197104Sjkim (Op->Asl.Value.String[1] == ':')) 688118611Snjl { 689197104Sjkim IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); 690197104Sjkim if (!IncludeFile) 691197104Sjkim { 692197104Sjkim goto ErrorExit; 693197104Sjkim } 694118611Snjl return; 695118611Snjl } 696118611Snjl 697197104Sjkim /* 698197104Sjkim * The include filename is not an absolute path. 699197104Sjkim * 700197104Sjkim * First, search for the file within the "local" directory -- meaning 701197104Sjkim * the same directory that contains the source file. 702197104Sjkim * 703197104Sjkim * Construct the file pathname from the global directory name. 704197104Sjkim */ 705197104Sjkim IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); 706197104Sjkim if (IncludeFile) 707197104Sjkim { 708197104Sjkim return; 709197104Sjkim } 710118611Snjl 711197104Sjkim /* 712197104Sjkim * Second, search for the file within the (possibly multiple) directories 713197104Sjkim * specified by the -I option on the command line. 714197104Sjkim */ 715197104Sjkim NextDir = Gbl_IncludeDirList; 716197104Sjkim while (NextDir) 717197104Sjkim { 718197104Sjkim IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); 719197104Sjkim if (IncludeFile) 720197104Sjkim { 721197104Sjkim return; 722197104Sjkim } 723197104Sjkim 724197104Sjkim NextDir = NextDir->Next; 725197104Sjkim } 726197104Sjkim 727197104Sjkim /* We could not open the include file after trying very hard */ 728197104Sjkim 729197104SjkimErrorExit: 730197104Sjkim sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); 731197104Sjkim AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); 732118611Snjl} 733118611Snjl 734118611Snjl 735118611Snjl/******************************************************************************* 736118611Snjl * 737118611Snjl * FUNCTION: FlOpenInputFile 738118611Snjl * 739118611Snjl * PARAMETERS: InputFilename - The user-specified ASL source file to be 740118611Snjl * compiled 741118611Snjl * 742118611Snjl * RETURN: Status 743118611Snjl * 744118611Snjl * DESCRIPTION: Open the specified input file, and save the directory path to 745118611Snjl * the file so that include files can be opened in 746118611Snjl * the same directory. 747118611Snjl * 748118611Snjl ******************************************************************************/ 749118611Snjl 750118611SnjlACPI_STATUS 751118611SnjlFlOpenInputFile ( 752118611Snjl char *InputFilename) 753118611Snjl{ 754118611Snjl 755118611Snjl /* Open the input ASL file, text mode */ 756118611Snjl 757118611Snjl FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); 758118611Snjl AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; 759118611Snjl 760118611Snjl return (AE_OK); 761118611Snjl} 762118611Snjl 763118611Snjl 764118611Snjl/******************************************************************************* 765118611Snjl * 766118611Snjl * FUNCTION: FlOpenAmlOutputFile 767118611Snjl * 768118611Snjl * PARAMETERS: FilenamePrefix - The user-specified ASL source file 769118611Snjl * 770118611Snjl * RETURN: Status 771118611Snjl * 772118611Snjl * DESCRIPTION: Create the output filename (*.AML) and open the file. The file 773118611Snjl * is created in the same directory as the parent input file. 774118611Snjl * 775118611Snjl ******************************************************************************/ 776118611Snjl 777118611SnjlACPI_STATUS 778118611SnjlFlOpenAmlOutputFile ( 779118611Snjl char *FilenamePrefix) 780118611Snjl{ 781118611Snjl char *Filename; 782118611Snjl 783118611Snjl 784118611Snjl /* Output filename usually comes from the ASL itself */ 785118611Snjl 786118611Snjl Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; 787118611Snjl if (!Filename) 788118611Snjl { 789118611Snjl /* Create the output AML filename */ 790118611Snjl 791118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); 792118611Snjl if (!Filename) 793118611Snjl { 794151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME, 795151937Sjkim 0, 0, 0, 0, NULL, NULL); 796118611Snjl return (AE_ERROR); 797118611Snjl } 798118611Snjl } 799118611Snjl 800118611Snjl /* Open the output AML file in binary mode */ 801118611Snjl 802118611Snjl FlOpenFile (ASL_FILE_AML_OUTPUT, Filename, "w+b"); 803118611Snjl return (AE_OK); 804118611Snjl} 805118611Snjl 806118611Snjl 807118611Snjl/******************************************************************************* 808118611Snjl * 809118611Snjl * FUNCTION: FlOpenMiscOutputFiles 810118611Snjl * 811118611Snjl * PARAMETERS: FilenamePrefix - The user-specified ASL source file 812118611Snjl * 813118611Snjl * RETURN: Status 814118611Snjl * 815118611Snjl * DESCRIPTION: Create and open the various output files needed, depending on 816118611Snjl * the command line options 817118611Snjl * 818118611Snjl ******************************************************************************/ 819118611Snjl 820118611SnjlACPI_STATUS 821118611SnjlFlOpenMiscOutputFiles ( 822118611Snjl char *FilenamePrefix) 823118611Snjl{ 824118611Snjl char *Filename; 825118611Snjl 826118611Snjl 827209746Sjkim /* Create/Open a hex output file if asked */ 828209746Sjkim 829209746Sjkim if (Gbl_HexOutputFlag) 830209746Sjkim { 831209746Sjkim Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP); 832209746Sjkim if (!Filename) 833209746Sjkim { 834209746Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 835209746Sjkim 0, 0, 0, 0, NULL, NULL); 836209746Sjkim return (AE_ERROR); 837209746Sjkim } 838209746Sjkim 839209746Sjkim /* Open the hex file, text mode */ 840209746Sjkim 841209746Sjkim FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); 842209746Sjkim 843209746Sjkim AslCompilerSignon (ASL_FILE_HEX_OUTPUT); 844209746Sjkim AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); 845209746Sjkim } 846209746Sjkim 847209746Sjkim /* Create/Open a debug output file if asked */ 848209746Sjkim 849209746Sjkim if (Gbl_DebugFlag) 850209746Sjkim { 851209746Sjkim Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG); 852209746Sjkim if (!Filename) 853209746Sjkim { 854209746Sjkim AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, 855209746Sjkim 0, 0, 0, 0, NULL, NULL); 856209746Sjkim return (AE_ERROR); 857209746Sjkim } 858209746Sjkim 859209746Sjkim /* Open the debug file as STDERR, text mode */ 860209746Sjkim 861209746Sjkim /* TBD: hide this behind a FlReopenFile function */ 862209746Sjkim 863209746Sjkim Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; 864209746Sjkim Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = 865209746Sjkim freopen (Filename, "w+t", stderr); 866209746Sjkim 867233250Sjkim if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle) 868233250Sjkim { 869233250Sjkim AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, 870233250Sjkim 0, 0, 0, 0, NULL, NULL); 871233250Sjkim return (AE_ERROR); 872233250Sjkim } 873233250Sjkim 874209746Sjkim AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); 875209746Sjkim AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); 876209746Sjkim } 877209746Sjkim 878217365Sjkim /* Create/Open a listing output file if asked */ 879217365Sjkim 880217365Sjkim if (Gbl_ListingFlag) 881217365Sjkim { 882217365Sjkim Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING); 883217365Sjkim if (!Filename) 884217365Sjkim { 885217365Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 886217365Sjkim 0, 0, 0, 0, NULL, NULL); 887217365Sjkim return (AE_ERROR); 888217365Sjkim } 889217365Sjkim 890217365Sjkim /* Open the listing file, text mode */ 891217365Sjkim 892217365Sjkim FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); 893217365Sjkim 894217365Sjkim AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); 895217365Sjkim AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); 896217365Sjkim } 897217365Sjkim 898234623Sjkim /* Create the preprocessor output file if preprocessor enabled */ 899233250Sjkim 900234623Sjkim if (Gbl_PreprocessFlag) 901233250Sjkim { 902234623Sjkim Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR); 903234623Sjkim if (!Filename) 904234623Sjkim { 905234623Sjkim AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME, 906234623Sjkim 0, 0, 0, 0, NULL, NULL); 907234623Sjkim return (AE_ERROR); 908234623Sjkim } 909234623Sjkim 910234623Sjkim FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); 911233250Sjkim } 912233250Sjkim 913233250Sjkim /* All done for data table compiler */ 914233250Sjkim 915209746Sjkim if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) 916209746Sjkim { 917209746Sjkim return (AE_OK); 918209746Sjkim } 919209746Sjkim 920233250Sjkim /* Create/Open a combined source output file */ 921118611Snjl 922118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); 923118611Snjl if (!Filename) 924118611Snjl { 925151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 926151937Sjkim 0, 0, 0, 0, NULL, NULL); 927118611Snjl return (AE_ERROR); 928118611Snjl } 929118611Snjl 930118611Snjl /* 931118611Snjl * Open the source output file, binary mode (so that LF does not get 932118611Snjl * expanded to CR/LF on some systems, messing up our seek 933118611Snjl * calculations.) 934118611Snjl */ 935118611Snjl FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); 936118611Snjl 937233250Sjkim/* 938233250Sjkim// TBD: TEMP 939233250Sjkim// AslCompilerin = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; 940233250Sjkim*/ 941118611Snjl /* Create/Open a assembly code source output file if asked */ 942118611Snjl 943118611Snjl if (Gbl_AsmOutputFlag) 944118611Snjl { 945118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE); 946118611Snjl if (!Filename) 947118611Snjl { 948151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 949151937Sjkim 0, 0, 0, 0, NULL, NULL); 950118611Snjl return (AE_ERROR); 951118611Snjl } 952118611Snjl 953118611Snjl /* Open the assembly code source file, text mode */ 954118611Snjl 955118611Snjl FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); 956118611Snjl 957118611Snjl AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); 958118611Snjl AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); 959118611Snjl } 960118611Snjl 961118611Snjl /* Create/Open a C code source output file if asked */ 962118611Snjl 963118611Snjl if (Gbl_C_OutputFlag) 964118611Snjl { 965118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE); 966118611Snjl if (!Filename) 967118611Snjl { 968151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 969151937Sjkim 0, 0, 0, 0, NULL, NULL); 970118611Snjl return (AE_ERROR); 971118611Snjl } 972118611Snjl 973118611Snjl /* Open the C code source file, text mode */ 974118611Snjl 975118611Snjl FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); 976118611Snjl 977118611Snjl FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); 978118611Snjl AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); 979118611Snjl AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT); 980118611Snjl } 981118611Snjl 982118611Snjl /* Create/Open a assembly include output file if asked */ 983118611Snjl 984118611Snjl if (Gbl_AsmIncludeOutputFlag) 985118611Snjl { 986118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE); 987118611Snjl if (!Filename) 988118611Snjl { 989151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 990151937Sjkim 0, 0, 0, 0, NULL, NULL); 991118611Snjl return (AE_ERROR); 992118611Snjl } 993118611Snjl 994118611Snjl /* Open the assembly include file, text mode */ 995118611Snjl 996118611Snjl FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); 997118611Snjl 998118611Snjl AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); 999118611Snjl AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); 1000118611Snjl } 1001118611Snjl 1002118611Snjl /* Create/Open a C include output file if asked */ 1003118611Snjl 1004118611Snjl if (Gbl_C_IncludeOutputFlag) 1005118611Snjl { 1006118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE); 1007118611Snjl if (!Filename) 1008118611Snjl { 1009151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 1010151937Sjkim 0, 0, 0, 0, NULL, NULL); 1011118611Snjl return (AE_ERROR); 1012118611Snjl } 1013118611Snjl 1014118611Snjl /* Open the C include file, text mode */ 1015118611Snjl 1016118611Snjl FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); 1017118611Snjl 1018118611Snjl FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); 1019118611Snjl AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); 1020118611Snjl AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT); 1021118611Snjl } 1022118611Snjl 1023118611Snjl /* Create a namespace output file if asked */ 1024118611Snjl 1025118611Snjl if (Gbl_NsOutputFlag) 1026118611Snjl { 1027118611Snjl Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE); 1028118611Snjl if (!Filename) 1029118611Snjl { 1030151937Sjkim AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 1031151937Sjkim 0, 0, 0, 0, NULL, NULL); 1032118611Snjl return (AE_ERROR); 1033118611Snjl } 1034118611Snjl 1035118611Snjl /* Open the namespace file, text mode */ 1036118611Snjl 1037118611Snjl FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); 1038118611Snjl 1039118611Snjl AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); 1040118611Snjl AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); 1041118611Snjl } 1042118611Snjl 1043118611Snjl return (AE_OK); 1044118611Snjl} 1045118611Snjl 1046118611Snjl 1047151937Sjkim#ifdef ACPI_OBSOLETE_FUNCTIONS 1048151937Sjkim/******************************************************************************* 1049151937Sjkim * 1050151937Sjkim * FUNCTION: FlParseInputPathname 1051151937Sjkim * 1052151937Sjkim * PARAMETERS: InputFilename - The user-specified ASL source file to be 1053151937Sjkim * compiled 1054151937Sjkim * 1055151937Sjkim * RETURN: Status 1056151937Sjkim * 1057151937Sjkim * DESCRIPTION: Split the input path into a directory and filename part 1058151937Sjkim * 1) Directory part used to open include files 1059151937Sjkim * 2) Filename part used to generate output filenames 1060151937Sjkim * 1061151937Sjkim ******************************************************************************/ 1062151937Sjkim 1063151937SjkimACPI_STATUS 1064151937SjkimFlParseInputPathname ( 1065151937Sjkim char *InputFilename) 1066151937Sjkim{ 1067151937Sjkim char *Substring; 1068151937Sjkim 1069151937Sjkim 1070151937Sjkim if (!InputFilename) 1071151937Sjkim { 1072151937Sjkim return (AE_OK); 1073151937Sjkim } 1074151937Sjkim 1075151937Sjkim /* Get the path to the input filename's directory */ 1076151937Sjkim 1077151937Sjkim Gbl_DirectoryPath = strdup (InputFilename); 1078151937Sjkim if (!Gbl_DirectoryPath) 1079151937Sjkim { 1080151937Sjkim return (AE_NO_MEMORY); 1081151937Sjkim } 1082151937Sjkim 1083151937Sjkim Substring = strrchr (Gbl_DirectoryPath, '\\'); 1084151937Sjkim if (!Substring) 1085151937Sjkim { 1086151937Sjkim Substring = strrchr (Gbl_DirectoryPath, '/'); 1087151937Sjkim if (!Substring) 1088151937Sjkim { 1089151937Sjkim Substring = strrchr (Gbl_DirectoryPath, ':'); 1090151937Sjkim } 1091151937Sjkim } 1092151937Sjkim 1093151937Sjkim if (!Substring) 1094151937Sjkim { 1095151937Sjkim Gbl_DirectoryPath[0] = 0; 1096151937Sjkim if (Gbl_UseDefaultAmlFilename) 1097151937Sjkim { 1098151937Sjkim Gbl_OutputFilenamePrefix = strdup (InputFilename); 1099151937Sjkim } 1100151937Sjkim } 1101151937Sjkim else 1102151937Sjkim { 1103151937Sjkim if (Gbl_UseDefaultAmlFilename) 1104151937Sjkim { 1105151937Sjkim Gbl_OutputFilenamePrefix = strdup (Substring + 1); 1106151937Sjkim } 1107151937Sjkim *(Substring+1) = 0; 1108151937Sjkim } 1109151937Sjkim 1110151937Sjkim return (AE_OK); 1111151937Sjkim} 1112151937Sjkim#endif 1113151937Sjkim 1114151937Sjkim 1115