Mailinglist Archive: radeonhd (699 mails)

< Previous Next >
[radeonhd] Patch: Improve online help of rhd_conntest
  • From: Joerg Mayer <jmayer@xxxxxxxxx>
  • Date: Fri, 2 Nov 2007 21:42:58 +0100
  • Message-id: <20071102204258.GM25274@xxxxxxxxxxxxxxxxxxxxxxxxx>

From c6d5cfdda68d2fc1e2bf9bba4ef95f529f027301 Mon Sep 17 00:00:00 2001
From: root <root@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Oct 2007 19:40:54 +0200
Subject: [PATCH] Improve online help.

---
utils/conntest/rhd_conntest.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/utils/conntest/rhd_conntest.c b/utils/conntest/rhd_conntest.c
index 594e2f4..5de37c7 100644
--- a/utils/conntest/rhd_conntest.c
+++ b/utils/conntest/rhd_conntest.c
@@ -1438,6 +1438,18 @@ InterpretATOMBIOS(unsigned char *base)
return TRUE;
}

+void
+printhelp(const char* progname, const char* message, const char* msgarg)
+{
+ if (message != NULL)
+ fprintf(stderr, "%s %s\n", message, msgarg);
+ fprintf(stderr, "Usage: %s [options] PCI-tag\n"
+ " Options: -d: dumpBios\n"
+ " -s: scanDDCBus\n"
+ " PCI-tag: bus:dev.func\n\n",
+ progname);
+}
+
/*
*
*/
@@ -1463,16 +1475,18 @@ main(int argc, char *argv[])
pci_scan_bus(pciAccess);

if (argc < 2) {
- fprintf(stderr, "Missing argument: please provide a PCI tag "
- "of the form: bus:dev.func\n");
+ printhelp(argv[0], "Missing argument: please provide a PCI tag\n", "");
return 1;
}

for (i = 1; i < argc; i++) {
if (!strncmp("-d",argv[i],3)) {
dumpBios = TRUE;
- } else if (!strncmp("-s",argv[i],3)){
+ } else if (!strncmp("-s",argv[i],3)) {
scanDDCBus = TRUE;
+ } else if (!strncmp("-",argv[i],1)) {
+ printhelp(argv[0], "Unknown option", argv[i]);
+ return 1;
} else {
ret = sscanf(argv[i], "%x:%x.%x", &bus, &dev, &func);
if (ret != 3) {
@@ -1484,9 +1498,8 @@ main(int argc, char *argv[])
}
}
if (ret != 3) {
- fprintf(stderr, "Unable to parse the PCI tag argument (%s)."
- " Please use: bus:dev.func\n", argv[i]);
- return 1;
+ printhelp(argv[0], "Unable to parse the PCI tag argument: ",
argv[i]);
+ return 1;
}
deviceSet = TRUE;
}
--
1.4.3.4

< Previous Next >
This Thread
Follow Ups