summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/bucts/bucts.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/util/bucts/bucts.c b/util/bucts/bucts.c
index a89456c3e6..2bd1c5dbf9 100644
--- a/util/bucts/bucts.c
+++ b/util/bucts/bucts.c
@@ -38,6 +38,7 @@ enum {
};
enum {
+ BUCTS_UNINITIALIZED = -1,
BUCTS_UNSET = 0,
BUCTS_SET
};
@@ -297,7 +298,7 @@ out:
return ret;
}
-int main(int argc, char *argv[], const char *envp[])
+int main(int argc, char *argv[])
{
struct pci_access *pacc;
struct pci_dev *dev, *sb = NULL;
@@ -306,8 +307,7 @@ int main(int argc, char *argv[], const char *envp[])
#endif
int opt, option_index = 0;
int print_state = 0;
- int change_state = 0;
- int bucts_state;
+ int bucts_state = BUCTS_UNINITIALIZED;
static struct option long_options[] = {
{"unset", 0, 0, 'u'},
@@ -329,7 +329,7 @@ int main(int argc, char *argv[], const char *envp[])
long_options, &option_index)) != EOF) {
switch (opt) {
case 'u':
- if (change_state) {
+ if (bucts_state != BUCTS_UNINITIALIZED) {
printf("Invalid setting: multiple set/unset arguments\n");
exit(1);
}
@@ -338,10 +338,9 @@ int main(int argc, char *argv[], const char *envp[])
exit(1);
}
bucts_state = BUCTS_UNSET;
- change_state = 1;
break;
case 's':
- if (change_state) {
+ if (bucts_state != BUCTS_UNINITIALIZED) {
printf("Invalid setting: multiple set/unset arguments\n");
exit(1);
}
@@ -350,10 +349,9 @@ int main(int argc, char *argv[], const char *envp[])
exit(1);
}
bucts_state = BUCTS_SET;
- change_state = 1;
break;
case 'p':
- if (change_state) {
+ if (bucts_state != BUCTS_UNINITIALIZED) {
printf("Print and Set are mutually exclusive!\n");
exit(1);
}
@@ -418,7 +416,7 @@ int main(int argc, char *argv[], const char *envp[])
if (print_state)
print_status(rcba_addr, has_var_bb);
- if (change_state) {
+ if (bucts_state != BUCTS_UNINITIALIZED) {
set_bucts(rcba_addr, bucts_state);
print_status(rcba_addr, has_var_bb);
}