diff options
| author | christos <christos@NetBSD.org> | 2005-06-26 19:10:48 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2005-06-26 19:10:48 +0000 |
| commit | 6310b596914bf008bc95bd893d81a1fd07edaa52 (patch) | |
| tree | fcdee9db4252495348ed7917acb412dc9fc9fdbf /bin/ed | |
| parent | a397ec1f777627a012c825ec154201f7d2c3a65f (diff) | |
sprinkle a little const, and now everything compiles with WARNS=3
Diffstat (limited to 'bin/ed')
| -rw-r--r-- | bin/ed/buf.c | 6 | ||||
| -rw-r--r-- | bin/ed/cbc.c | 6 | ||||
| -rw-r--r-- | bin/ed/ed.h | 8 | ||||
| -rw-r--r-- | bin/ed/glbl.c | 9 | ||||
| -rw-r--r-- | bin/ed/io.c | 6 | ||||
| -rw-r--r-- | bin/ed/main.c | 12 |
6 files changed, 24 insertions, 23 deletions
diff --git a/bin/ed/buf.c b/bin/ed/buf.c index e60d44f456b..9d7f599840d 100644 --- a/bin/ed/buf.c +++ b/bin/ed/buf.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.24 2005/02/17 16:29:26 xtraeme Exp $ */ +/* $NetBSD: buf.c,v 1.25 2005/06/26 19:10:49 christos Exp $ */ /* buf.c: This file contains the scratch-file buffer routines for the ed line editor. */ @@ -33,7 +33,7 @@ #if 0 static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp"; #else -__RCSID("$NetBSD: buf.c,v 1.24 2005/02/17 16:29:26 xtraeme Exp $"); +__RCSID("$NetBSD: buf.c,v 1.25 2005/06/26 19:10:49 christos Exp $"); #endif #endif /* not lint */ @@ -206,7 +206,7 @@ int open_sbuf(void) { int u, fd; - char *tmp; + const char *tmp; size_t s; isbinary = newline_added = 0; diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 6882d82180a..add3c424dd0 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: cbc.c,v 1.17 2005/02/17 16:29:26 xtraeme Exp $ */ +/* $NetBSD: cbc.c,v 1.18 2005/06/26 19:10:49 christos Exp $ */ /* cbc.c: This file contains the encryption routines for the ed line editor */ /*- @@ -72,7 +72,7 @@ #if 0 static char *rcsid = "@(#)cbc.c,v 1.2 1994/02/01 00:34:36 alm Exp"; #else -__RCSID("$NetBSD: cbc.c,v 1.17 2005/02/17 16:29:26 xtraeme Exp $"); +__RCSID("$NetBSD: cbc.c,v 1.18 2005/06/26 19:10:49 christos Exp $"); #endif #endif /* not lint */ @@ -244,7 +244,7 @@ get_keyword(void) * print a warning message and, possibly, terminate */ void -des_error(char *s /* the message */) +des_error(const char *s /* the message */) { (void)sprintf(errmsg, "%s", s ? s : strerror(errno)); } diff --git a/bin/ed/ed.h b/bin/ed/ed.h index 87c3ebab63b..c8b863a7a06 100644 --- a/bin/ed/ed.h +++ b/bin/ed/ed.h @@ -1,4 +1,4 @@ -/* $NetBSD: ed.h,v 1.32 2005/02/17 16:29:26 xtraeme Exp $ */ +/* $NetBSD: ed.h,v 1.33 2005/06/26 19:10:49 christos Exp $ */ /* ed.h: type and constant definitions for the ed editor. */ /* @@ -202,7 +202,7 @@ void clear_undo_stack(void); int close_sbuf(void); int copy_lines(long); int delete_lines(long, long); -void des_error(char *); +void des_error(const char *); int display_lines(long, long, int); line_t *dup_line_node(line_t *); int exec_command(void); @@ -256,12 +256,12 @@ int set_active_node(line_t *); void set_des_key(char *); void signal_hup(int); void signal_int(int); -char *strip_escapes(char *); +char *strip_escapes(const char *); int substitute_matching_text(pattern_t *, line_t *, int, int); char *translit_text(char *, int, int, int); void unmark_line_node(line_t *); void unset_active_nodes(line_t *, line_t *); -long write_file(char *, char *, long, long); +long write_file(const char *, const char *, long, long); long write_stream(FILE *, long, long); /* global buffers */ diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c index 1ec8e07981e..207245c8a2e 100644 --- a/bin/ed/glbl.c +++ b/bin/ed/glbl.c @@ -1,4 +1,4 @@ -/* $NetBSD: glbl.c,v 1.5 2005/02/17 16:29:26 xtraeme Exp $ */ +/* $NetBSD: glbl.c,v 1.6 2005/06/26 19:10:49 christos Exp $ */ /* glob.c: This file contains the global command routines for the ed line editor */ @@ -33,7 +33,7 @@ #if 0 static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; #else -__RCSID("$NetBSD: glbl.c,v 1.5 2005/02/17 16:29:26 xtraeme Exp $"); +__RCSID("$NetBSD: glbl.c,v 1.6 2005/06/26 19:10:49 christos Exp $"); #endif #endif /* not lint */ @@ -87,11 +87,12 @@ exec_global(int interact, int gflag) int status; int n; char *cmd = NULL; - #ifdef BACKWARDS + char cmdp[] = "p\n"; + if (!interact) { if (!strcmp(ibufp, "\n")) - cmd = "p\n"; /* null cmd-list == `p' */ + cmd = cmdp; /* null cmd-list == `p' */ else if ((cmd = get_extended_line(&n, 0)) == NULL) return ERR; } diff --git a/bin/ed/io.c b/bin/ed/io.c index a54f8ee072f..f9434a84b1d 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.7 2005/02/17 16:29:26 xtraeme Exp $ */ +/* $NetBSD: io.c,v 1.8 2005/06/26 19:10:49 christos Exp $ */ /* io.c: This file contains the i/o routines for the ed line editor */ /*- @@ -32,7 +32,7 @@ #if 0 static char *rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp"; #else -__RCSID("$NetBSD: io.c,v 1.7 2005/02/17 16:29:26 xtraeme Exp $"); +__RCSID("$NetBSD: io.c,v 1.8 2005/06/26 19:10:49 christos Exp $"); #endif #endif /* not lint */ @@ -148,7 +148,7 @@ get_stream_line(FILE *fp) /* write_file: write a range of lines to a named file/pipe; return line count */ long -write_file(char *fn, char *mode, long n, long m) +write_file(const char *fn, const char *mode, long n, long m) { FILE *fp; long size; diff --git a/bin/ed/main.c b/bin/ed/main.c index c864e571402..c7282cc8e4e 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.16 2005/05/23 08:01:17 rillig Exp $ */ +/* $NetBSD: main.c,v 1.17 2005/06/26 19:10:49 christos Exp $ */ /* main.c: This file contains the main control and user-interface routines for the ed line editor. */ @@ -39,7 +39,7 @@ __COPYRIGHT( #if 0 static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; #else -__RCSID("$NetBSD: main.c,v 1.16 2005/05/23 08:01:17 rillig Exp $"); +__RCSID("$NetBSD: main.c,v 1.17 2005/06/26 19:10:49 christos Exp $"); #endif #endif /* not lint */ @@ -101,10 +101,10 @@ char old_filename[MAXPATHLEN + 1] = ""; /* default filename */ long current_addr; /* current address in editor buffer */ long addr_last; /* last address in editor buffer */ int lineno; /* script line number */ -char *prompt; /* command-line prompt */ -char *dps = "*"; /* default command-line prompt */ +const char *prompt; /* command-line prompt */ +const char *dps = "*"; /* default command-line prompt */ -char *usage = "usage: %s [-] [-sxE] [-p string] [name]\n"; +const char *usage = "usage: %s [-] [-sxE] [-p string] [name]\n"; /* ed: line editor */ int @@ -1318,7 +1318,7 @@ has_trailing_escape(char *s, char *t) /* strip_escapes: return copy of escaped string of at most length MAXPATHLEN */ char * -strip_escapes(char *s) +strip_escapes(const char *s) { static char *file = NULL; static int filesz = 0; |
