aboutsummaryrefslogtreecommitdiffstats
path: root/source/common
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-03-20 18:17:33 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-03-20 18:17:33 +0000
commitb81dc021b3e3311e46f9e81de4f09855536e8147 (patch)
tree3fa3a8ab860459d0b2c9768eed9142052be1ced3 /source/common
parent5437485bdb98c4b00f15969e013c454426e9c862 (diff)
downloadsrc-b81dc021b3e3311e46f9e81de4f09855536e8147.tar.gz
src-b81dc021b3e3311e46f9e81de4f09855536e8147.zip
Import ACPICA 20120320.vendor/acpica/20120320
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=233237 svn path=/vendor-sys/acpica/20120320/; revision=233238; tag=vendor/acpica/20120320
Diffstat (limited to 'source/common')
-rw-r--r--source/common/adisasm.c48
-rw-r--r--source/common/getopt.c31
2 files changed, 69 insertions, 10 deletions
diff --git a/source/common/adisasm.c b/source/common/adisasm.c
index 2509ca67e948..cc583767e643 100644
--- a/source/common/adisasm.c
+++ b/source/common/adisasm.c
@@ -75,6 +75,10 @@ LsSetupNsList (
/* Local prototypes */
+static UINT32
+AdGetFileSize (
+ FILE *File);
+
static void
AdCreateTableHeader (
char *Filename,
@@ -160,6 +164,38 @@ static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
/*******************************************************************************
*
+ * FUNCTION: AdGetFileSize
+ *
+ * PARAMETERS: File - Open file handle
+ *
+ * RETURN: File Size
+ *
+ * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
+ *
+ ******************************************************************************/
+
+static UINT32
+AdGetFileSize (
+ FILE *File)
+{
+ UINT32 FileSize;
+ long Offset;
+
+
+ Offset = ftell (File);
+
+ fseek (File, 0, SEEK_END);
+ FileSize = (UINT32) ftell (File);
+
+ /* Restore file pointer */
+
+ fseek (File, Offset, SEEK_SET);
+ return (FileSize);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AdInitialize
*
* PARAMETERS: None
@@ -380,8 +416,10 @@ AdAmlDisassemble (
"FieldName : FieldValue\n */\n\n");
AcpiDmDumpDataTable (Table);
- fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n",
- Table->Signature, DisasmFilename);
+ fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n",
+ Table->Signature);
+ fprintf (stderr, "Formatted output: %s - %u bytes\n",
+ DisasmFilename, AdGetFileSize (File));
}
else
{
@@ -490,9 +528,9 @@ AdAmlDisassemble (
if (AcpiGbl_DbOpt_disasm)
{
AdDisplayTables (Filename, Table);
- fprintf (stderr,
- "Disassembly completed, written to \"%s\"\n",
- DisasmFilename);
+ fprintf (stderr, "Disassembly completed\n");
+ fprintf (stderr, "ASL Output: %s - %u bytes\n",
+ DisasmFilename, AdGetFileSize (File));
}
}
diff --git a/source/common/getopt.c b/source/common/getopt.c
index b253e8a01d6a..80d80811746b 100644
--- a/source/common/getopt.c
+++ b/source/common/getopt.c
@@ -49,7 +49,8 @@
#include "accommon.h"
#include "acapps.h"
-#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);}
+#define ACPI_OPTION_ERROR(msg, badchar) \
+ if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);}
int AcpiGbl_Opterr = 1;
@@ -87,12 +88,12 @@ AcpiGetopt(
argv[AcpiGbl_Optind][0] != '-' ||
argv[AcpiGbl_Optind][1] == '\0')
{
- return(EOF);
+ return (EOF);
}
else if (strcmp (argv[AcpiGbl_Optind], "--") == 0)
{
AcpiGbl_Optind++;
- return(EOF);
+ return (EOF);
}
}
@@ -105,7 +106,7 @@ AcpiGetopt(
if (CurrentChar == ':' ||
(OptsPtr = strchr (opts, CurrentChar)) == NULL)
{
- ERR (": illegal option -- ", CurrentChar);
+ ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar);
if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0')
{
@@ -126,7 +127,7 @@ AcpiGetopt(
}
else if (++AcpiGbl_Optind >= argc)
{
- ERR (": option requires an argument -- ", CurrentChar);
+ ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar);
CurrentCharPtr = 1;
return ('?');
@@ -156,6 +157,26 @@ AcpiGetopt(
CurrentCharPtr = 1;
}
+ /* Option has a required single-char argument? */
+
+ else if (*OptsPtr == '|')
+ {
+ if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
+ {
+ AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)];
+ }
+ else
+ {
+ ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar);
+
+ CurrentCharPtr = 1;
+ return ('?');
+ }
+
+ AcpiGbl_Optind++;
+ CurrentCharPtr = 1;
+ }
+
/* Option with no arguments */
else