diff options
Diffstat (limited to 'source/compiler/aslutils.c')
| -rw-r--r-- | source/compiler/aslutils.c | 44 | 
1 files changed, 41 insertions, 3 deletions
| diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 47851bddad88..e73f22747429 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -46,7 +46,9 @@  #include "acdisasm.h"  #include "acnamesp.h"  #include "amlcode.h" -#include <acapps.h> +#include "acapps.h" +#include <sys/stat.h> +  #define _COMPONENT          ACPI_COMPILER          ACPI_MODULE_NAME    ("aslutils") @@ -65,6 +67,40 @@ UtAttachNameseg (      char                    *Name); +/****************************************************************************** + * + * FUNCTION:    UtQueryForOverwrite + * + * PARAMETERS:  Pathname            - Output filename + * + * RETURN:      TRUE if file does not exist or overwrite is authorized + * + * DESCRIPTION: Query for file overwrite if it already exists. + * + ******************************************************************************/ + +BOOLEAN +UtQueryForOverwrite ( +    char                    *Pathname) +{ +    struct stat             StatInfo; + + +    if (!stat (Pathname, &StatInfo)) +    { +        fprintf (stderr, "Target file \"%s\" already exists, overwrite? [y|n] ", +            Pathname); + +        if (getchar () != 'y') +        { +            return (FALSE); +        } +    } + +    return (TRUE); +} + +  /*******************************************************************************   *   * FUNCTION:    UtDisplaySupportedTables @@ -449,9 +485,11 @@ UtDisplaySummary (              if (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)              {                  FlPrintFile (FileId, -                    "%-14s %s - %u bytes, %u named objects, %u executable opcodes\n", +                    "%-14s %s - %u bytes, %u named objects, " +                    "%u executable opcodes\n",                      "AML Output:", -                    Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength, +                    Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, +                    FlGetFileSize (ASL_FILE_AML_OUTPUT),                      TotalNamedObjects, TotalExecutableOpcodes);              }          } | 
