summaryrefslogtreecommitdiffstats
path: root/robots
diff options
context:
space:
mode:
Diffstat (limited to 'robots')
-rw-r--r--robots/auto.c16
-rw-r--r--robots/extern.c8
-rw-r--r--robots/init_field.c6
-rw-r--r--robots/main.c8
-rw-r--r--robots/move.c6
-rw-r--r--robots/query.c6
-rw-r--r--robots/robots.h10
-rw-r--r--robots/score.c11
8 files changed, 36 insertions, 35 deletions
diff --git a/robots/auto.c b/robots/auto.c
index 03842278..c0a15bf8 100644
--- a/robots/auto.c
+++ b/robots/auto.c
@@ -1,4 +1,4 @@
-/* $NetBSD: auto.c,v 1.3 1999/05/16 00:15:46 christos Exp $ */
+/* $NetBSD: auto.c,v 1.4 1999/09/08 21:17:56 jsm Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
static int distance __P((int, int, int, int));
static int xinc __P((int));
static int yinc __P((int));
-static char *find_moves __P((void));
+static const char *find_moves __P((void));
static COORD *closest_robot __P((int *));
static COORD *closest_heap __P((int *));
static char move_towards __P((int, int));
@@ -137,13 +137,14 @@ yinc(dir)
/* find_moves():
* Find possible moves
*/
-static char *
+static const char *
find_moves()
{
int x, y;
COORD test;
- char *m, *a;
- static char moves[] = ".hjklyubn";
+ const char *m;
+ char *a;
+ static const char moves[] = ".hjklyubn";
static char ans[sizeof moves];
a = ans;
@@ -167,10 +168,9 @@ find_moves()
}
*a = 0;
if(ans[0])
- a = ans;
+ return ans;
else
- a = "t";
- return a;
+ return "t";
}
/* closest_robot():
diff --git a/robots/extern.c b/robots/extern.c
index 80c2e909..395c021b 100644
--- a/robots/extern.c
+++ b/robots/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.5 1999/05/15 23:56:35 christos Exp $ */
+/* $NetBSD: extern.c,v 1.6 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: extern.c,v 1.5 1999/05/15 23:56:35 christos Exp $");
+__RCSID("$NetBSD: extern.c,v 1.6 1999/09/08 21:17:57 jsm Exp $");
#endif
#endif /* not lint */
@@ -63,8 +63,8 @@ bool Was_bonus = FALSE; /* Was a bonus last level */
char Cnt_move; /* Command which has preceded the count */
char Field[Y_FIELDSIZE][X_FIELDSIZE]; /* the playing field itslef */
-char *Next_move; /* Next move to be used in the pattern */
-char *Move_list = "YHBJNLUK";/* List of moves in the pattern */
+const char *Next_move; /* Next move to be used in the pattern */
+const char *Move_list = "YHBJNLUK";/* List of moves in the pattern */
char Run_ch; /* Character for the direction we are running */
int Count = 0; /* Command count */
diff --git a/robots/init_field.c b/robots/init_field.c
index a5fd9e25..57200a44 100644
--- a/robots/init_field.c
+++ b/robots/init_field.c
@@ -1,4 +1,4 @@
-/* $NetBSD: init_field.c,v 1.5 1997/10/12 14:09:57 lukem Exp $ */
+/* $NetBSD: init_field.c,v 1.6 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)init_field.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: init_field.c,v 1.5 1997/10/12 14:09:57 lukem Exp $");
+__RCSID("$NetBSD: init_field.c,v 1.6 1999/09/08 21:17:57 jsm Exp $");
#endif
#endif /* not lint */
@@ -54,7 +54,7 @@ init_field()
{
int i;
static bool first = TRUE;
- static char *desc[] = {
+ static const char *const desc[] = {
"Directions:",
"",
"y k u",
diff --git a/robots/main.c b/robots/main.c
index b1c2ff36..ce7f8cf5 100644
--- a/robots/main.c
+++ b/robots/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.8 1999/05/15 23:56:36 christos Exp $ */
+/* $NetBSD: main.c,v 1.9 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: main.c,v 1.8 1999/05/15 23:56:36 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.9 1999/09/08 21:17:57 jsm Exp $");
#endif
#endif /* not lint */
@@ -56,10 +56,10 @@ main(ac, av)
int ac;
char **av;
{
- char *sp;
+ const char *sp;
bool bad_arg;
bool show_only;
- extern char *Scorefile;
+ extern const char *Scorefile;
extern int Max_per_uid;
show_only = FALSE;
diff --git a/robots/move.c b/robots/move.c
index db08c84c..a74c6c76 100644
--- a/robots/move.c
+++ b/robots/move.c
@@ -1,4 +1,4 @@
-/* $NetBSD: move.c,v 1.8 1999/05/15 23:56:36 christos Exp $ */
+/* $NetBSD: move.c,v 1.9 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: move.c,v 1.8 1999/05/15 23:56:36 christos Exp $");
+__RCSID("$NetBSD: move.c,v 1.9 1999/09/08 21:17:57 jsm Exp $");
#endif
#endif /* not lint */
@@ -274,7 +274,7 @@ do_move(dy, dx)
*/
bool
eaten(pos)
- COORD *pos;
+ const COORD *pos;
{
int x, y;
diff --git a/robots/query.c b/robots/query.c
index e0ca5823..b89535e2 100644
--- a/robots/query.c
+++ b/robots/query.c
@@ -1,4 +1,4 @@
-/* $NetBSD: query.c,v 1.4 1997/10/12 14:10:01 lukem Exp $ */
+/* $NetBSD: query.c,v 1.5 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: query.c,v 1.4 1997/10/12 14:10:01 lukem Exp $");
+__RCSID("$NetBSD: query.c,v 1.5 1999/09/08 21:17:57 jsm Exp $");
#endif
#endif /* not lint */
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: query.c,v 1.4 1997/10/12 14:10:01 lukem Exp $");
*/
int
query(prompt)
- char *prompt;
+ const char *prompt;
{
int c, retval;
int y, x;
diff --git a/robots/robots.h b/robots/robots.h
index a93e07b4..3fcf5c1c 100644
--- a/robots/robots.h
+++ b/robots/robots.h
@@ -1,4 +1,4 @@
-/* $NetBSD: robots.h,v 1.10 1999/05/16 00:03:35 christos Exp $ */
+/* $NetBSD: robots.h,v 1.11 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -105,8 +105,8 @@ extern bool Dead, Full_clear, Jump, Newscore, Real_time, Running,
extern bool Pattern_roll, Stand_still;
#endif
-extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], *Next_move,
- *Move_list, Run_ch;
+extern char Cnt_move, Field[Y_FIELDSIZE][X_FIELDSIZE], Run_ch;
+extern const char *Next_move, *Move_list;
extern int Count, Level, Num_robots, Num_scrap, Num_scores, Score,
Start_level, Wait_bonus, Num_games;
@@ -123,7 +123,7 @@ void add_score __P((int));
bool another __P((void));
int cmp_sc __P((const void *, const void *));
bool do_move __P((int, int));
-bool eaten __P((COORD *));
+bool eaten __P((const COORD *));
void flush_in __P((void));
void get_move __P((void));
void init_field __P((void));
@@ -132,7 +132,7 @@ void make_level __P((void));
void move_robots __P((int));
bool must_telep __P((void));
void play_level __P((void));
-int query __P((char *));
+int query __P((const char *));
void quit __P((int)) __attribute__((__noreturn__));
void reset_count __P((void));
int rnd __P((int));
diff --git a/robots/score.c b/robots/score.c
index aacb07ec..c22a7463 100644
--- a/robots/score.c
+++ b/robots/score.c
@@ -1,4 +1,4 @@
-/* $NetBSD: score.c,v 1.7 1999/05/16 00:03:35 christos Exp $ */
+/* $NetBSD: score.c,v 1.8 1999/09/08 21:17:57 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,14 +38,14 @@
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: score.c,v 1.7 1999/05/16 00:03:35 christos Exp $");
+__RCSID("$NetBSD: score.c,v 1.8 1999/09/08 21:17:57 jsm Exp $");
#endif
#endif /* not lint */
# include "robots.h"
# include "pathnames.h"
-char *Scorefile = _PATH_SCORE;
+const char *Scorefile = _PATH_SCORE;
int Max_per_uid = MAX_PER_UID;
@@ -199,9 +199,10 @@ set_name(scp)
SCORE *scp;
{
PASSWD *pp;
+ static char unknown[] = "???";
if ((pp = getpwuid(scp->s_uid)) == NULL)
- pp->pw_name = "???";
+ pp->pw_name = unknown;
strncpy(scp->s_name, pp->pw_name, MAXNAME);
}
@@ -213,7 +214,7 @@ int
cmp_sc(s1, s2)
const void *s1, *s2;
{
- return ((SCORE *)s2)->s_score - ((SCORE *)s1)->s_score;
+ return ((const SCORE *)s2)->s_score - ((const SCORE *)s1)->s_score;
}
/*