From acfbf2781de606c8dde516b1b416519770bc9efc Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 9 Oct 2011 18:01:59 +0000 Subject: [PATCH] ...except ncurses prevents using escape sequences. Grh. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@616 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 50 --------------------------------------- examples/dgamelaunch.conf | 2 -- 2 files changed, 52 deletions(-) diff --git a/dgamelaunch.c b/dgamelaunch.c index fca1b08..463b958 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -369,55 +369,6 @@ idle_alarm_reset(void) /* ************************************************************* */ -char * -bannerfuncmangle(char *buf, char *fromstr, char *(*strmangler)(char *)) -{ - static char bufnew[81]; - char *loc; - char *b = buf; - char *bnpos = bufnew; - memset(bufnew, 0, 80); - - if (strstr(b, fromstr)) { - while ((loc = strstr(b, fromstr)) != NULL) { - char *fn = loc + strlen(fromstr); - if (*fn == '(') { - char *fn_end = strchr(fn, ')'); - if (fn_end) { - char funcparam[81]; - char *funcout; - fn++; - memset(funcparam, 0, 80); - memcpy(funcparam, fn, (fn_end - fn)); - funcout = (*strmangler)(funcparam); - memcpy(bnpos, b, (loc - b)); - bnpos += strlen(bnpos); - b = fn_end; - b++; - memcpy(bnpos, funcout, strlen(funcout)); - bnpos += strlen(funcout); - } - } - } - } - strcpy(bnpos, b); - return bufnew; -} - -char * -bannermangler_func_esc(char *str) -{ - static char buf[11]; - int len = strlen(str); - if (len > 7) len = 7; - buf[0] = '\x1b'; - buf[1] = '['; - strncpy((buf + 2), str, len); - buf[len+2] = 'm'; - buf[len+3] = '\0'; - return buf; -} - char * bannerstrmangle(char *buf, char *fromstr, char *tostr) @@ -576,7 +527,6 @@ loadbanner (char *fname, struct dg_banner *ban) } else { strncpy(bufnew, bannerstrmangle(bufnew, "$USERNAME", "[Anonymous]"), 80); } - strncpy(bufnew, bannerfuncmangle(bufnew, "$ESC", bannermangler_func_esc), 80); banner_addline(ban, bufnew); } diff --git a/examples/dgamelaunch.conf b/examples/dgamelaunch.conf index c1a1079..a5f92c0 100644 --- a/examples/dgamelaunch.conf +++ b/examples/dgamelaunch.conf @@ -58,8 +58,6 @@ bannervars = [ "$MOTDTIME" = "2011.10.08", # - $VERSION replaced with "dgamelaunch v" + dgl version number. # - $USERNAME replaced with logged-in user's name, or with "[Anonymous]" # - $INCLUDE(filename) the named file will be inserted here. -# - $ESC(code) Allows to use ECMA-48 SGR escape sequences, setting -# text color and attributes. will output "ESC [ code m" banner = "/dgl-banner" # The following two options are fairly insecure. They will force us to