summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2008-10-26 08:26:51 +0000
committerJean Delvare <jdelvare@suse.de>2008-10-26 08:26:51 +0000
commit06d4ef0cd74b23b69fea5e17295e90f11a38f333 (patch)
tree11ca6dbae4d4f7e99ca43fa546ae1f7ccc9aa613
parent6543db2a0902be71e929aacde28bd70acbf3df40 (diff)
downloaddmidecode-git-06d4ef0cd74b23b69fea5e17295e90f11a38f333.tar.gz
Simplify the handling and documentation of mutually exclusive output
format options.
-rw-r--r--dmiopt.c24
-rw-r--r--man/dmidecode.815
2 files changed, 13 insertions, 26 deletions
diff --git a/dmiopt.c b/dmiopt.c
index 5d5cad1..4b35666 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -280,28 +280,16 @@ int parse_command_line(int argc, char * const argv[])
return -1;
}
- if(opt.type!=NULL && opt.string!=NULL)
+ /* Check for mutually exclusive output format options */
+ if((opt.string!=NULL)+(opt.type!=NULL)
+ +!!(opt.flags & FLAG_DUMP)+!!(opt.flags & FLAG_DUMP_BIN)>1)
{
- fprintf(stderr, "Options --string and --type are mutually exclusive\n");
+ fprintf(stderr, "Options --string, --type, --dump and --dump-bin are mutually exclusive\n");
return -1;
}
+ if(opt.flags & (FLAG_DUMP | FLAG_DUMP_BIN))
+ opt.flags&=~FLAG_QUIET;
- if((opt.flags & FLAG_DUMP) && opt.string!=NULL)
- {
- fprintf(stderr, "Options --string and --dump are mutually exclusive\n");
- return -1;
- }
-
- if((opt.flags & FLAG_DUMP) && (opt.flags & FLAG_QUIET))
- {
- fprintf(stderr, "Options --quiet and --dump are mutually exclusive\n");
- return -1;
- }
- if((opt.flags & FLAG_DUMP_BIN) && (opt.type!=NULL || opt.string!=NULL))
- {
- fprintf(stderr, "Options --dump-bin, --string and --type are mutually exclusive\n");
- return -1;
- }
if((opt.flags & FLAG_FROM_DUMP) && (opt.flags & FLAG_DUMP_BIN))
{
fprintf(stderr, "Options --from-dump and --dump-bin are mutually exclusive\n");
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index 932c5df..8e068da 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -62,8 +62,7 @@ Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR)
.TP
.BR "-q" ", " "--quiet"
Be less verbose. Unknown, inactive and \s-1OEM\s0-specific entries are not
-displayed. Meta-data and handle references are hidden. Mutually exclusive
-with \fB--dump\fR.
+displayed. Meta-data and handle references are hidden.
.TP
.BR "-s" ", " "--string KEYWORD"
Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR.
@@ -89,8 +88,7 @@ If \fBKEYWORD\fR is not provided or not valid, a list of all valid
keywords is printed and
.B dmidecode
exits with an error.
-This option cannot be used more than once, and implies \fB--quiet\fR.
-Mutually exclusive with \fB--type\fR and \fB--dump\fR.
+This option cannot be used more than once.
.TP
.BR "-t" ", " "--type TYPE"
Only display the entries of type \fBTYPE\fR. \fBTYPE\fR can be either a
@@ -105,29 +103,30 @@ If \fBTYPE\fR is not provided or not valid, a list of all valid keywords
is printed and
.B dmidecode
exits with an error.
-Mutually exclusive with \fB--string\fR.
.TP
.BR "-u" ", " "--dump"
Do not decode the entries, dump their contents as hexadecimal instead.
Note that this is still a text output, no binary data will be thrown upon
you. The strings attached to each entry are displayed as both
hexadecimal and \s-1ASCII\s0. This option is mainly useful for debugging.
-Mutually exclusive with \fB--quiet\fR and \fB--string\fR.
.TP
.BR " " " " "--dump-bin FILE"
Do not decode the entries, instead dump the DMI data to a file in binary
form. The generated file is suitable to pass to \fB--from-dump\fR
-later. Mutually exclusive with \fB--type\fR and \fB--string\fR.
+later.
.TP
.BR " " " " "--from-dump FILE"
Read the DMI data from a binary file previously generated using
-\fB--dump-bin\fR. Mutually exclusive with \fB--dump-bin\fR.
+\fB--dump-bin\fR.
.TP
.BR "-h" ", " "--help"
Display usage information and exit
.TP
.BR "-V" ", " "--version"
Display the version and exit
+.P
+Options --string, --type, --dump and --dump-bin
+determine the output format and are mutually exclusive.
.SH "DMI TYPES"
The \s-1SMBIOS\s0 specification defines the following \s-1DMI\s0 types: