CVS commit: src/usr.bin/radioctl

2011-09-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Sep  6 18:27:08 UTC 2011

Modified Files:
src/usr.bin/radioctl: radioctl.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/radioctl/radioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/radioctl/radioctl.c
diff -u src/usr.bin/radioctl/radioctl.c:1.12 src/usr.bin/radioctl/radioctl.c:1.13
--- src/usr.bin/radioctl/radioctl.c:1.12	Wed Aug 31 16:24:58 2011
+++ src/usr.bin/radioctl/radioctl.c	Tue Sep  6 18:27:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: radioctl.c,v 1.12 2011/08/31 16:24:58 plunky Exp $ */
+/* $NetBSD: radioctl.c,v 1.13 2011/09/06 18:27:08 joerg Exp $ */
 /* $OpenBSD: radioctl.c,v 1.5 2001/12/18 18:42:19 mickey Exp $ */
 /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */
 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: radioctl.c,v 1.12 2011/08/31 16:24:58 plunky Exp $");
+__RCSID("$NetBSD: radioctl.c,v 1.13 2011/09/06 18:27:08 joerg Exp $");
 #endif
 
 #include 
@@ -45,7 +45,7 @@
 #define RADIO_ENV	"RADIODEVICE"
 #define RADIODEVICE	"/dev/radio"
 
-const char *varname[] = {
+static const char *varname[] = {
 	"search",
 #define OPTION_SEARCH		0x00
 	"volume",
@@ -77,9 +77,9 @@
 	u_int32_t value;
 };
 
-const char *onchar = "on";
+static const char *onchar = "on";
 #define ONCHAR_LEN	2
-const char *offchar = "off";
+static const char *offchar = "off";
 #define OFFCHAR_LEN	3
 
 static struct radio_info ri;
@@ -94,7 +94,7 @@
 static void	update_value(int, u_int *, u_int);
 
 static void warn_unsupported(int);
-static void	usage(void);
+__dead static void	usage(void);
 
 static void	show_verbose(const char *, int);
 static void	show_int_val(u_long, const char *, const char *, int);



CVS commit: src/usr.bin/radioctl

2011-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 21 08:57:40 UTC 2011

Modified Files:
src/usr.bin/radioctl: radioctl.c

Log Message:
use const char [] for format.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/radioctl/radioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/radioctl/radioctl.c
diff -u src/usr.bin/radioctl/radioctl.c:1.10 src/usr.bin/radioctl/radioctl.c:1.11
--- src/usr.bin/radioctl/radioctl.c:1.10	Wed Aug 17 09:12:39 2011
+++ src/usr.bin/radioctl/radioctl.c	Sun Aug 21 04:57:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: radioctl.c,v 1.10 2011/08/17 13:12:39 christos Exp $ */
+/* $NetBSD: radioctl.c,v 1.11 2011/08/21 08:57:40 christos Exp $ */
 /* $OpenBSD: radioctl.c,v 1.5 2001/12/18 18:42:19 mickey Exp $ */
 /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */
 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: radioctl.c,v 1.10 2011/08/17 13:12:39 christos Exp $");
+__RCSID("$NetBSD: radioctl.c,v 1.11 2011/08/21 08:57:40 christos Exp $");
 #endif
 
 #include 
@@ -360,7 +360,7 @@
  */
 static int
 parse_opt(char *s, struct opt_t *o) {
-#define	badvalue "bad value `%s'"
+	static const char badvalue[] = "bad value `%s'";
 	char *topt = NULL;
 	int slen, optlen;
 



CVS commit: src/usr.bin/radioctl

2011-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 17 13:12:39 UTC 2011

Modified Files:
src/usr.bin/radioctl: radioctl.c

Log Message:
fix non-literal format stringg.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/radioctl/radioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/radioctl/radioctl.c
diff -u src/usr.bin/radioctl/radioctl.c:1.9 src/usr.bin/radioctl/radioctl.c:1.10
--- src/usr.bin/radioctl/radioctl.c:1.9	Tue May 24 08:40:11 2011
+++ src/usr.bin/radioctl/radioctl.c	Wed Aug 17 09:12:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: radioctl.c,v 1.9 2011/05/24 12:40:11 joerg Exp $ */
+/* $NetBSD: radioctl.c,v 1.10 2011/08/17 13:12:39 christos Exp $ */
 /* $OpenBSD: radioctl.c,v 1.5 2001/12/18 18:42:19 mickey Exp $ */
 /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */
 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: radioctl.c,v 1.9 2011/05/24 12:40:11 joerg Exp $");
+__RCSID("$NetBSD: radioctl.c,v 1.10 2011/08/17 13:12:39 christos Exp $");
 #endif
 
 #include 
@@ -360,7 +360,7 @@
  */
 static int
 parse_opt(char *s, struct opt_t *o) {
-	const char *badvalue = "bad value `%s'";
+#define	badvalue "bad value `%s'"
 	char *topt = NULL;
 	int slen, optlen;
 



CVS commit: src/usr.bin/radioctl

2011-05-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue May 24 12:40:12 UTC 2011

Modified Files:
src/usr.bin/radioctl: radioctl.c

Log Message:
Properly use format strings.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/radioctl/radioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/radioctl/radioctl.c
diff -u src/usr.bin/radioctl/radioctl.c:1.8 src/usr.bin/radioctl/radioctl.c:1.9
--- src/usr.bin/radioctl/radioctl.c:1.8	Mon Apr 13 04:24:29 2009
+++ src/usr.bin/radioctl/radioctl.c	Tue May 24 12:40:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: radioctl.c,v 1.8 2009/04/13 04:24:29 lukem Exp $ */
+/* $NetBSD: radioctl.c,v 1.9 2011/05/24 12:40:11 joerg Exp $ */
 /* $OpenBSD: radioctl.c,v 1.5 2001/12/18 18:42:19 mickey Exp $ */
 /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */
 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: radioctl.c,v 1.8 2009/04/13 04:24:29 lukem Exp $");
+__RCSID("$NetBSD: radioctl.c,v 1.9 2011/05/24 12:40:11 joerg Exp $");
 #endif
 
 #include 
@@ -459,13 +459,13 @@
 		printf("%umkV", ri.lock);
 		break;
 	case OPTION_MUTE:
-		printf(ri.mute ? onchar : offchar);
+		printf("%s", ri.mute ? onchar : offchar);
 		break;
 	case OPTION_MONO:
-		printf(ri.stereo ? offchar : onchar);
+		printf("%s", ri.stereo ? offchar : onchar);
 		break;
 	case OPTION_STEREO:
-		printf(ri.stereo ? onchar : offchar);
+		printf("%s", ri.stereo ? onchar : offchar);
 		break;
 	case OPTION_VOLUME:
 	default:



CVS commit: src/usr.bin/radioctl

2009-04-12 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Mon Apr 13 04:24:29 UTC 2009

Modified Files:
src/usr.bin/radioctl: radioctl.c

Log Message:
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/radioctl/radioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/radioctl/radioctl.c
diff -u src/usr.bin/radioctl/radioctl.c:1.7 src/usr.bin/radioctl/radioctl.c:1.8
--- src/usr.bin/radioctl/radioctl.c:1.7	Thu May 11 01:24:14 2006
+++ src/usr.bin/radioctl/radioctl.c	Mon Apr 13 04:24:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: radioctl.c,v 1.7 2006/05/11 01:24:14 mrg Exp $ */
+/* $NetBSD: radioctl.c,v 1.8 2009/04/13 04:24:29 lukem Exp $ */
 /* $OpenBSD: radioctl.c,v 1.5 2001/12/18 18:42:19 mickey Exp $ */
 /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */
 
@@ -29,7 +29,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: radioctl.c,v 1.7 2006/05/11 01:24:14 mrg Exp $");
+__RCSID("$NetBSD: radioctl.c,v 1.8 2009/04/13 04:24:29 lukem Exp $");
 #endif
 
 #include 
@@ -97,8 +97,8 @@
 static void	usage(void);
 
 static void	show_verbose(const char *, int);
-static void	show_int_val(u_long, const char *, char *, int);
-static void	show_float_val(float, const char *, char *, int);
+static void	show_int_val(u_long, const char *, const char *, int);
+static void	show_float_val(float, const char *, const char *, int);
 static void	show_char_val(const char *, const char *, int);
 static int	str_to_opt(const char *);
 static u_long	str_to_long(char *, int);
@@ -110,7 +110,7 @@
 main(int argc, char **argv)
 {
 	struct opt_t opt;
-	char *radiodev = NULL;
+	const char *radiodev = NULL;
 	int rd = -1;
 	int optchar;
 	char *param = NULL;
@@ -378,7 +378,7 @@
 	/* Set only o->optval, the rest is missing */
 	if (slen == optlen) {
 		o->option = str_to_opt(s);
-		return o->option == OPTION_NONE ? 0 : 1;
+		return o->option == (int)OPTION_NONE ? 0 : 1;
 	}
 
 	if (optlen > slen - 2) {
@@ -394,7 +394,7 @@
 	}
 	strlcpy(topt, s, optlen);
 
-	if ((o->option = str_to_opt(topt)) == OPTION_NONE) {
+	if ((o->option = str_to_opt(topt)) == (int)OPTION_NONE) {
 		free(topt);
 		return 0;
 	}
@@ -443,7 +443,7 @@
 static void
 print_value(int optval)
 {
-	if (optval == OPTION_NONE)
+	if (optval == (int)OPTION_NONE)
 		return;
 
 	switch (optval) {
@@ -475,14 +475,14 @@
 }
 
 static void
-show_int_val(u_long val, const char *nick, char *append, int silent)
+show_int_val(u_long val, const char *nick, const char *append, int silent)
 {
 	show_verbose(nick, silent);
 	printf("%lu%s\n", val, append);
 }
 
 static void
-show_float_val(float val, const char *nick, char *append, int silent)
+show_float_val(float val, const char *nick, const char *append, int silent)
 {
 	show_verbose(nick, silent);
 	printf("%.2f%s\n", val, append);