aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/power/acpi/common/getopt.c14
-rw-r--r--tools/power/acpi/tools/acpidump/apmain.c3
2 files changed, 8 insertions, 9 deletions
diff --git a/tools/power/acpi/common/getopt.c b/tools/power/acpi/common/getopt.c
index a302f52e4fd3..2f0f34a36db4 100644
--- a/tools/power/acpi/common/getopt.c
+++ b/tools/power/acpi/common/getopt.c
@@ -51,14 +51,12 @@
51 * "f|" - Option has required single-char sub-options 51 * "f|" - Option has required single-char sub-options
52 */ 52 */
53 53
54#include <stdio.h>
55#include <string.h>
56#include <acpi/acpi.h> 54#include <acpi/acpi.h>
57#include "accommon.h" 55#include "accommon.h"
58#include "acapps.h" 56#include "acapps.h"
59 57
60#define ACPI_OPTION_ERROR(msg, badchar) \ 58#define ACPI_OPTION_ERROR(msg, badchar) \
61 if (acpi_gbl_opterr) {fprintf (stderr, "%s%c\n", msg, badchar);} 59 if (acpi_gbl_opterr) {acpi_log_error ("%s%c\n", msg, badchar);}
62 60
63int acpi_gbl_opterr = 1; 61int acpi_gbl_opterr = 1;
64int acpi_gbl_optind = 1; 62int acpi_gbl_optind = 1;
@@ -113,7 +111,7 @@ int acpi_getopt_argument(int argc, char **argv)
113 * PARAMETERS: argc, argv - from main 111 * PARAMETERS: argc, argv - from main
114 * opts - options info list 112 * opts - options info list
115 * 113 *
116 * RETURN: Option character or EOF 114 * RETURN: Option character or ACPI_OPT_END
117 * 115 *
118 * DESCRIPTION: Get the next option 116 * DESCRIPTION: Get the next option
119 * 117 *
@@ -128,10 +126,10 @@ int acpi_getopt(int argc, char **argv, char *opts)
128 if (acpi_gbl_optind >= argc || 126 if (acpi_gbl_optind >= argc ||
129 argv[acpi_gbl_optind][0] != '-' || 127 argv[acpi_gbl_optind][0] != '-' ||
130 argv[acpi_gbl_optind][1] == '\0') { 128 argv[acpi_gbl_optind][1] == '\0') {
131 return (EOF); 129 return (ACPI_OPT_END);
132 } else if (strcmp(argv[acpi_gbl_optind], "--") == 0) { 130 } else if (ACPI_STRCMP(argv[acpi_gbl_optind], "--") == 0) {
133 acpi_gbl_optind++; 131 acpi_gbl_optind++;
134 return (EOF); 132 return (ACPI_OPT_END);
135 } 133 }
136 } 134 }
137 135
@@ -142,7 +140,7 @@ int acpi_getopt(int argc, char **argv, char *opts)
142 /* Make sure that the option is legal */ 140 /* Make sure that the option is legal */
143 141
144 if (current_char == ':' || 142 if (current_char == ':' ||
145 (opts_ptr = strchr(opts, current_char)) == NULL) { 143 (opts_ptr = ACPI_STRCHR(opts, current_char)) == NULL) {
146 ACPI_OPTION_ERROR("Illegal option: -", current_char); 144 ACPI_OPTION_ERROR("Illegal option: -", current_char);
147 145
148 if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') { 146 if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index 2a06a864c093..9c3b259aed2c 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -166,7 +166,8 @@ static int ap_do_options(int argc, char **argv)
166 166
167 /* Command line options */ 167 /* Command line options */
168 168
169 while ((j = acpi_getopt(argc, argv, AP_SUPPORTED_OPTIONS)) != EOF) 169 while ((j =
170 acpi_getopt(argc, argv, AP_SUPPORTED_OPTIONS)) != ACPI_OPT_END)
170 switch (j) { 171 switch (j) {
171 /* 172 /*
172 * Global options 173 * Global options