From f460ded8b57d2844f959842fdc5abb476adbcd30 Mon Sep 17 00:00:00 2001 From: Mark Nudelman Date: Mon, 14 Jan 2002 17:06:21 +0000 Subject: [PATCH] Fix compilation for Windows. Remove some unreferenced variables. --- decode.c | 2 +- defines.ds | 6 ++++++ defines.o2 | 6 ++++++ defines.wn | 6 ++++++ filename.c | 27 ++++++--------------------- option.c | 1 - prompt.c | 2 -- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/decode.c b/decode.c index 39d71d70..1987153e 100644 --- a/decode.c +++ b/decode.c @@ -260,7 +260,7 @@ expand_special_keys(table, len) repl = special_key_str(fm[1]); klen = fm[2] & 0377; fm += klen; - if (repl == NULL || strlen(repl) > klen) + if (repl == NULL || (int) strlen(repl) > klen) repl = "\377"; while (*repl != '\0') *to++ = *repl++; diff --git a/defines.ds b/defines.ds index 444fd5d9..60073088 100644 --- a/defines.ds +++ b/defines.ds @@ -169,6 +169,12 @@ */ #define HAVE_SHELL 0 +/* + * Default shell metacharacters and meta-escape character. + */ +#define DEF_METACHARS "; *?\t\n'\"()<>|&" +#define DEF_METAESCAPE "" + /* * HAVE_DUP is 1 if your system has the dup() call. */ diff --git a/defines.o2 b/defines.o2 index f1bb8313..9df73fdd 100644 --- a/defines.o2 +++ b/defines.o2 @@ -150,6 +150,12 @@ */ #define HAVE_SHELL 0 +/* + * Default shell metacharacters and meta-escape character. + */ +#define DEF_METACHARS "; *?\t\n'\"()<>|&" +#define DEF_METAESCAPE "" + /* * HAVE_DUP is 1 if your system has the dup() call. */ diff --git a/defines.wn b/defines.wn index b9f8a46c..bb272547 100644 --- a/defines.wn +++ b/defines.wn @@ -151,6 +151,12 @@ */ #define HAVE_SHELL 0 +/* + * Default shell metacharacters and meta-escape character. + */ +#define DEF_METACHARS "; *?\t\n'\"()<>|&" +#define DEF_METAESCAPE "" + /* * HAVE_DUP is 1 if your system has the dup() call. */ diff --git a/filename.c b/filename.c index 7a870e2a..14c66167 100644 --- a/filename.c +++ b/filename.c @@ -64,11 +64,10 @@ extern char closequote; shell_unquote(str) char *str; { -#if SPACES_IN_FILENAMES char *name; char *p; - name = p = (char *) ecalloc(strlen(str), sizeof(char)); + name = p = (char *) ecalloc(strlen(str)+1, sizeof(char)); if (*str == openquote) { str++; @@ -95,9 +94,6 @@ shell_unquote(str) } *p = '\0'; return (name); -#else - return (save(str)); -#endif } /* @@ -106,16 +102,12 @@ shell_unquote(str) public char * get_meta_escape() { -#if HAVE_SHELL char *s; s = lgetenv("LESSMETAESCAPE"); if (s == NULL) s = DEF_METAESCAPE; return (s); -#else - return (""); -#endif } /* @@ -124,7 +116,6 @@ get_meta_escape() static char * metachars() { -#if HAVE_SHELL static char *mchars = NULL; if (mchars == NULL) @@ -134,9 +125,6 @@ metachars() mchars = DEF_METACHARS; } return (mchars); -#else - return (""); -#endif } /* @@ -156,7 +144,6 @@ metachar(c) shell_quote(s) char *s; { -#if HAVE_SHELL char *p; char *newstr; int len; @@ -225,9 +212,6 @@ shell_quote(s) *p = '\0'; } return (newstr); -#else /* HAVE_SHELL */ - return (save(s)); -#endif } /* @@ -677,6 +661,8 @@ lglob(filename) register char *p; register int len; register int n; + char *pathname; + char *qpathname; DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) GLOB_FIRST_NAME(filename, &fnd, handle); @@ -699,7 +685,7 @@ lglob(filename) if (qpathname != NULL) { n = strlen(qpathname); - while (p - gfilename + n >= len) + while (p - gfilename + n + 2 >= len) { /* * No room in current buffer. @@ -714,8 +700,9 @@ lglob(filename) p = gfilename + strlen(gfilename); } strcpy(p, qpathname); - p += n; free(qpathname); + p += n; + *p++ = ' '; } } while (GLOB_NEXT_NAME(handle, &fnd) == 0); @@ -894,8 +881,6 @@ close_altfile(altfilename, filename, pipefd) { #if HAVE_POPEN char *lessclose; - char *gfilename; - char *galtfilename; FILE *fd; char *cmd; diff --git a/option.c b/option.c index 9f8399fd..f5ee8648 100644 --- a/option.c +++ b/option.c @@ -549,7 +549,6 @@ optstring(s, p_str, printopt, validchars) char *validchars; { register char *p; - PARG parg; if (*s == '\0') { diff --git a/prompt.c b/prompt.c index 7296b03e..1c90a141 100644 --- a/prompt.c +++ b/prompt.c @@ -237,8 +237,6 @@ protochar(c, where, iseditproto) POSITION len; int n; IFILE h; - char *s; - char *escs; switch (c) {