int main ( int argc, char *argv[]) { char *Filename; int AxAction; int Status; int j; Gbl_TableCount = 0; Gbl_TableListHead = NULL; AxAction = AX_EXTRACT_AML_TABLES; /* Default: DSDT & SSDTs */ ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); printf (ACPI_COMMON_SIGNON (AX_UTILITY_NAME)); if (argc < 2) { DisplayUsage (); return (0); } /* Command line options */ while ((j = AcpiGetopt (argc, argv, AX_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch (j) { case 'a': AxAction = AX_EXTRACT_ALL; /* Extract all tables found */ break; case 'l': AxAction = AX_LIST_ALL; /* List tables only, do not extract */ break; case 'm': AxAction = AX_EXTRACT_MULTI_TABLE; /* Make single file for all DSDT/SSDTs */ break; case 's': AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */ break; case 'v': /* -v: (Version): signon already emitted, just exit */ return (0); case 'h': default: DisplayUsage (); return (0); } /* Input filename is always required */ Filename = argv[AcpiGbl_Optind]; if (!Filename) { printf ("Missing required input filename\n"); return (-1); } /* Perform requested action */ switch (AxAction) { case AX_EXTRACT_ALL: Status = AxExtractTables (Filename, NULL, AX_OPTIONAL_TABLES); break; case AX_EXTRACT_MULTI_TABLE: Status = AxExtractToMultiAmlFile (Filename); break; case AX_LIST_ALL: Status = AxListTables (Filename); break; case AX_EXTRACT_SIGNATURE: Status = AxExtractTables (Filename, AcpiGbl_Optarg, AX_REQUIRED_TABLE); break; default: /* * Default output is the DSDT and all SSDTs. One DSDT is required, * any SSDTs are optional. */ Status = AxExtractTables (Filename, "DSDT", AX_REQUIRED_TABLE); if (Status) { return (Status); } Status = AxExtractTables (Filename, "SSDT", AX_OPTIONAL_TABLES); break; } return (Status); }
int main ( int argc, char *argv[]) { char *Filename; int Status; int j; printf (ACPI_COMMON_SIGNON ("ACPI Binary Table Extraction Utility")); if (argc < 2) { DisplayUsage (); return (0); } /* Command line options */ while ((j = AcpiGetopt (argc, argv, "ahls:")) != EOF) switch (j) { case 'a': AxAction = AX_EXTRACT_ALL; /* Extract all tables found */ break; case 'l': AxAction = AX_LIST_ALL; /* List tables only, do not extract */ break; case 's': AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */ break; case 'h': default: DisplayUsage (); return (0); } /* Input filename is always required */ Filename = argv[AcpiGbl_Optind]; if (!Filename) { printf ("Missing required input filename\n"); return (-1); } /* Perform requested action */ switch (AxAction) { case AX_EXTRACT_ALL: Status = AxExtractTables (Filename, NULL, AX_OPTIONAL_TABLES); break; case AX_LIST_ALL: Status = AxListTables (Filename); break; case AX_EXTRACT_SIGNATURE: Status = AxExtractTables (Filename, AcpiGbl_Optarg, AX_REQUIRED_TABLE); break; default: /* * Default output is the DSDT and all SSDTs. One DSDT is required, * any SSDTs are optional. */ Status = AxExtractTables (Filename, "DSDT", AX_REQUIRED_TABLE); if (Status) { return (Status); } Status = AxExtractTables (Filename, "SSDT", AX_OPTIONAL_TABLES); break; } return (Status); }