diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2004-12-30 12:20:28 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2004-12-30 12:20:28 -0500 |
commit | bed9a2c79bfdde6e4ec89d9d02a5d6e88ae12f79 (patch) | |
tree | dd916bd7c1040bd69a1fe9f9ed1aa98d44ca623d /src/LYStrings.c | |
parent | b52ca53f448d0f9c01708a6ce2b03be3a71d3993 (diff) | |
download | lynx-snapshots-bed9a2c79bfdde6e4ec89d9d02a5d6e88ae12f79.tar.gz |
snapshot of project "lynx", label v2-8-6dev_9
Diffstat (limited to 'src/LYStrings.c')
-rw-r--r-- | src/LYStrings.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/LYStrings.c b/src/LYStrings.c index 365d48c9..14897d65 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -692,28 +692,22 @@ int LYmbcsstrlen(const char *str, #undef GetChar #ifdef USE_SLANG -#ifdef VMS +#if defined(VMS) #define GetChar() ttgetc() -#else -#ifdef __DJGPP__ -#ifdef DJGPP_KEYHANDLER -#define GetChar getxkey -#else -#define GetChar SLkp_getkey -#endif /* DJGPP_KEYHANDLER */ -#else -#ifdef __CYGWIN__ +#elif defined(__DJGPP__) +#define GetChar() getxkey() /* HTDos.c */ +#elif defined(__CYGWIN__) #define GetChar SLkp_getkey #else #define GetChar (int)SLang_getkey -#endif /* __CYGWIN__ */ -#endif /* __DJGPP__ */ -#endif /* VMS */ -#endif /* USE_SLANG */ - -#if !defined(GetChar) && defined(NCURSES) +#endif +#else /* curses */ +#if defined(DJGPP) +#define GetChar() (djgpp_idle_loop(), wgetch(LYtopwindow())) +#elif defined(NCURSES) #define GetChar() wgetch(LYtopwindow()) #endif +#endif #if !defined(GetChar) && defined(PDCURSES) && defined(PDC_BUILD) && PDC_BUILD >= 2401 /* PDCurses sends back key-modifiers that we don't use, but would waste time @@ -2573,6 +2567,20 @@ BOOLEAN LYRemoveNewlines(char *buffer) } /* + * Remove leading/trailing whitespace from a string, reduce runs of embedded + * whitespace to single blanks. + */ +char *LYReduceBlanks(char *buffer) +{ + if (non_empty(buffer)) { + LYTrimLeading(buffer); + LYTrimTrailing(buffer); + convert_to_spaces(buffer, TRUE); + } + return buffer; +} + +/* * Remove ALL whitespace from a string (including embedded blanks), and returns * a pointer to the end of the trimmed string. */ @@ -5759,7 +5767,7 @@ int LYReadCmdKey(int mode) switch (len = (tmp - src)) { case 4: if (!strncasecomp(src, "exit", 4)) - exit(0); + exit_immediately(0); break; case 3: if (!strncasecomp(src, "key", 3)) { |