Subject: bin/7993: [PATCH] dm: patch to use const
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm28@cam.ac.uk>
List: netbsd-bugs
Date: 07/14/1999 15:05:21
>Number:         7993
>Category:       bin
>Synopsis:       [PATCH] dm: patch to use const
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 14 14:50:03 1999
>Last-Modified:
>Originator:     Joseph S. Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release:        NetBSD-current of 1999-06-28
>Environment:
[
System: Linux decomino 2.2.10 #1 Mon Jun 14 07:48:53 UTC 1999 i686 unknown
Architecture: i686
]
>Description:

This patch makes dm use `const' where appropriate.

>How-To-Repeat:

>Fix:

diff -ruN dm/dm.c dm+/dm.c
--- dm/dm.c	Mon Sep 14 11:04:53 1998
+++ dm+/dm.c	Wed Jul 14 20:25:36 1999
@@ -71,9 +71,9 @@
 static char	*game,			/* requested game */
 		*gametty;		/* from tty? */
 
-void	c_day __P((char *, char *, char *));
-void	c_game __P((char *, char  *, char *, char *));
-void	c_tty __P((char *));
+void	c_day __P((const char *, const char *, const char *));
+void	c_game __P((const char *, const char  *, const char *, const char *));
+void	c_tty __P((const char *));
 const char *hour __P((int));
 double	load __P((void));
 int	main __P((int, char *[]));
@@ -168,9 +168,9 @@
  */
 void
 c_day(s_day, s_start, s_stop)
-	char *s_day, *s_start, *s_stop;
+	const char *s_day, *s_start, *s_stop;
 {
-	static char *days[] = {
+	static const char *const days[] = {
 		"sunday", "monday", "tuesday", "wednesday",
 		"thursday", "friday", "saturday",
 	};
@@ -196,7 +196,7 @@
  */
 void
 c_tty(tty)
-	char *tty;
+	const char *tty;
 {
 	static int first = 1;
 	static char *p_tty;
@@ -216,7 +216,7 @@
  */
 void
 c_game(s_game, s_load, s_users, s_priority)
-	char *s_game, *s_load, *s_users, *s_priority;
+	const char *s_game, *s_load, *s_users, *s_priority;
 {
 	static int found;
 
@@ -291,7 +291,7 @@
 hour(h)
 	int h;
 {
-	static char *hours[] = {
+	static const char *const hours[] = {
 	    "midnight", "1am", "2am", "3am", "4am", "5am",
 	    "6am", "7am", "8am", "9am", "10am", "11am",
 	    "noon", "1pm", "2pm", "3pm", "4pm", "5pm",

>Audit-Trail:
>Unformatted: