[PATCH] Help in pccardctl, misc fixes

Pavel Roskin proski at gnu.org
Mon Aug 29 22:56:05 EDT 2005


Hello!

This patch against pcmciautils 008 does following.

Makefile:
-fno-builtin is removed from WARNINGS.  It suppresses useful warnings
such as incorrect format in printf().  VERSION is added to CFLAGS.

src/lex_config.l:
VERSION symbol is undefined to avoid conflict with token VERSION.

src/yacc_config.y:
Likewise.

src/pccardctl.c:
print_header() shows package name and version.  print_help() shows usage
and supported commands.

Signed-off-by: Pavel Roskin <proski at gnu.org>


--- Makefile
+++ Makefile
@@ -102,12 +102,12 @@
 # check if compiler option is supported
 cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
 
-WARNINGS := -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wsign-compare
+WARNINGS := -Wall -Wchar-subscripts -Wpointer-arith -Wsign-compare
 WARNINGS += $(call cc-supports,-Wno-pointer-sign)
 WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
 WARNINGS += -Wshadow
 
-CFLAGS := -pipe
+CFLAGS := -pipe -DVERSION=\"$(VERSION)\"
 YFLAGS := -d
 
 HEADERS = \
--- src/lex_config.l
+++ src/lex_config.l
@@ -15,6 +15,7 @@
  */
 
 #undef src
+#undef VERSION
 
 #include <stdio.h>
 #include <stdlib.h>
--- src/pccardctl.c
+++ src/pccardctl.c
@@ -187,12 +187,31 @@ static int pccardctl_info(unsigned long 
 }
 
 static void print_header(void) {
-	printf("pccardctl (C) 2004 Dominik Brodowski, (C) 1999 David A. Hinds\n");
+	printf("pcmciautils %s\n", VERSION);
+	printf("Copyright (C) 2004 Dominik Brodowski, (C) 1999 David A. Hinds\n");
 	printf("Report errors and bugs to <linux-pcmcia at lists.infradead.org>, please.\n");
 }
 
+static char *cmdname[] = {
+	"insert",
+	"eject",
+	"suspend",
+	"resume",
+	"reset",
+	"info",
+	"status",
+	"config",
+	"ident",
+};
+
 static void print_help(void) {
-	/* TBD */
+	int i;
+
+	printf("Usage: pccardctl COMMAND\n");
+	printf("Supported commands are:\n");
+	for (i = 0; i < sizeof(cmdname)/sizeof(cmdname[0]); i++) {
+		printf("\t%s\n", cmdname[i]);
+	}
 }
 
 static void print_unknown_arg(void) {
@@ -221,18 +240,6 @@ enum {
 	NCMD
 };
 
-static char *cmdname[] = {
-	"insert",
-	"eject",
-	"suspend",
-	"resume",
-	"reset",
-	"info",
-	"status",
-	"config",
-	"ident",
-};
-
 
 int main(int argc, char **argv) {
 	extern char *optarg;
--- src/yacc_config.y
+++ src/yacc_config.y
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 
 #include "startup.h"
+#undef VERSION
 
 /* If bison: generate nicer error messages */ 
 #define YYERROR_VERBOSE 1


-- 
Regards,
Pavel Roskin



More information about the linux-pcmcia mailing list