diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-11 18:53:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-11 18:53:52 +0000 |
commit | 3f4357f701bd93523718fad49f37ca46a1bf7b7c (patch) | |
tree | d5bb381a2c97d21f3a239000de6dadce20e8ab62 | |
parent | d50c1064a55a09bd16da6a333beabca9f69f31b5 (diff) |
remove unused variables and functions
-rw-r--r-- | bin/ksh/exec.c | 4 | ||||
-rw-r--r-- | bin/ksh/history.c | 11 | ||||
-rw-r--r-- | bin/ksh/main.c | 10 | ||||
-rw-r--r-- | bin/ksh/proto.h | 4 | ||||
-rw-r--r-- | bin/ksh/sh.h | 3 | ||||
-rw-r--r-- | bin/ksh/shf.c | 62 | ||||
-rw-r--r-- | bin/ksh/shf.h | 4 |
7 files changed, 8 insertions, 90 deletions
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c index 20f0223504e..9f33d13f291 100644 --- a/bin/ksh/exec.c +++ b/bin/ksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.42 2005/09/11 18:02:27 otto Exp $ */ +/* $OpenBSD: exec.c,v 1.43 2005/12/11 18:53:51 deraadt Exp $ */ /* * execute command tree @@ -1246,7 +1246,7 @@ struct select_menu_info { char *const *args; int arg_width; int num_width; -} info; +}; static char *select_fmt_entry(void *arg, int i, char *buf, int buflen); diff --git a/bin/ksh/history.c b/bin/ksh/history.c index 339a4d95de0..9a90b5deb00 100644 --- a/bin/ksh/history.c +++ b/bin/ksh/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.31 2005/07/31 16:12:52 espie Exp $ */ +/* $OpenBSD: history.c,v 1.32 2005/12/11 18:53:51 deraadt Exp $ */ /* * command history @@ -43,7 +43,6 @@ static char **hist_get_oldest(void); static void histbackup(void); static char **current; /* current position in history[] */ -static int curpos; /* current index in history[] */ static char *hname; /* current name of history file */ static int hstarted; /* set after hist_init() called */ static Source *hist_source; @@ -435,23 +434,15 @@ histpos(void) } int -histN(void) -{ - return curpos; -} - -int histnum(int n) { int last = histptr - history; if (n < 0 || n >= last) { current = histptr; - curpos = last; return last; } else { current = &history[n]; - curpos = n; return n; } } diff --git a/bin/ksh/main.c b/bin/ksh/main.c index e8ef8228942..08cdf121084 100644 --- a/bin/ksh/main.c +++ b/bin/ksh/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.39 2005/12/11 18:53:51 deraadt Exp $ */ /* * startup, main loop, environments and error handling @@ -745,11 +745,3 @@ is_restricted(char *name) /* accepts rsh, rksh, rpdksh, pdrksh, etc. */ return (p = strchr(name, 'r')) && strstr(p, "sh"); } - -void -aerror(Area *ap, const char *msg) -{ - internal_errorf(1, "alloc: %s", msg); - errorf(null); /* this is never executed - keeps gcc quiet */ - /*NOTREACHED*/ -} diff --git a/bin/ksh/proto.h b/bin/ksh/proto.h index 38d33b91b1e..67b3b1bfbd6 100644 --- a/bin/ksh/proto.h +++ b/bin/ksh/proto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.h,v 1.27 2005/10/06 06:39:36 otto Exp $ */ +/* $OpenBSD: proto.h,v 1.28 2005/12/11 18:53:51 deraadt Exp $ */ /* * prototypes for PD-KSH @@ -89,7 +89,6 @@ int c_fc(char **); void sethistsize(int); void sethistfile(const char *); char ** histpos(void); -int histN(void); int histnum(int); int findhist(int, int, const char *, int); int findhistrel(const char *); @@ -167,7 +166,6 @@ void newenv(int); void quitenv(struct shf *); void cleanup_parents_env(void); void cleanup_proc_env(void); -void aerror(Area *, const char *) __attribute__((__noreturn__)); /* misc.c */ void setctypes(const char *, int); void initctypes(void); diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index 501cddb40fe..34ab84b7f79 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.28 2005/10/04 20:35:11 otto Exp $ */ +/* $OpenBSD: sh.h,v 1.29 2005/12/11 18:53:51 deraadt Exp $ */ /* * Public Domain Bourne/Korn shell @@ -221,7 +221,6 @@ EXTERN char shell_flags [FNFLAGS]; EXTERN char null [] I__(""); /* null value for variable */ EXTERN char space [] I__(" "); EXTERN char newline [] I__("\n"); -EXTERN char slash [] I__("/"); enum temp_type { TT_HEREDOC_EXP, /* expanded heredoc */ diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c index ef503f1abbb..31bd0f39a86 100644 --- a/bin/ksh/shf.c +++ b/bin/ksh/shf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shf.c,v 1.13 2005/03/30 17:16:37 deraadt Exp $ */ +/* $OpenBSD: shf.c,v 1.14 2005/12/11 18:53:51 deraadt Exp $ */ /* * Shell file I/O routines @@ -265,22 +265,6 @@ shf_sclose(struct shf *shf) return (char *) s; } -/* Flush and free file structure, don't close file descriptor */ -int -shf_finish(struct shf *shf) -{ - int ret = 0; - - if (shf->fd >= 0) - ret = shf_flush(shf); - if (shf->flags & SHF_ALLOCS) - afree(shf, shf->areap); - else if (shf->flags & SHF_ALLOCB) - afree(shf->buf, shf->areap); - - return ret; -} - /* Un-read what has been read but not examined, or write what has been * buffered. Returns 0 for success, EOF for (write) error. */ @@ -437,50 +421,6 @@ shf_fillbuf(struct shf *shf) return 0; } -/* Seek to a new position in the file. If writing, flushes the buffer - * first. If reading, optimizes small relative seeks that stay inside the - * buffer. Returns 0 for success, EOF otherwise. - */ -int -shf_seek(struct shf *shf, off_t where, int from) -{ - if (shf->fd < 0) { - errno = EINVAL; - return EOF; - } - - if (shf->flags & SHF_ERROR) { - errno = shf->errno_; - return EOF; - } - - if ((shf->flags & SHF_WRITING) && shf_emptybuf(shf, EB_READSW) == EOF) - return EOF; - - if (shf->flags & SHF_READING) { - if (from == SEEK_CUR && - (where < 0 ? -where >= shf->rbsize - shf->rnleft : - where < shf->rnleft)) { - shf->rnleft -= where; - shf->rp += where; - return 0; - } - shf->rnleft = 0; - shf->rp = shf->buf; - } - - shf->flags &= ~(SHF_EOF | SHF_READING | SHF_WRITING); - - if (lseek(shf->fd, where, from) < 0) { - shf->errno_ = errno; - shf->flags |= SHF_ERROR; - return EOF; - } - - return 0; -} - - /* Read a buffer from shf. Returns the number of bytes read into buf, * if no bytes were read, returns 0 if end of file was seen, EOF if * a read error occurred. diff --git a/bin/ksh/shf.h b/bin/ksh/shf.h index 4f1c7203564..234d1510ea1 100644 --- a/bin/ksh/shf.h +++ b/bin/ksh/shf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */ +/* $OpenBSD: shf.h,v 1.6 2005/12/11 18:53:51 deraadt Exp $ */ #ifndef SHF_H # define SHF_H @@ -66,9 +66,7 @@ struct shf *shf_sopen(char *, int, int, struct shf *); int shf_close(struct shf *); int shf_fdclose(struct shf *); char *shf_sclose(struct shf *); -int shf_finish(struct shf *); int shf_flush(struct shf *); -int shf_seek(struct shf *, off_t, int); int shf_read(char *, int, struct shf *); char *shf_getse(char *, int, struct shf *); int shf_getchar(struct shf *s); |