/* ************************************************************* */
-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)
} else {
strncpy(bufnew, bannerstrmangle(bufnew, "$USERNAME", "[Anonymous]"), 80);
}
- strncpy(bufnew, bannerfuncmangle(bufnew, "$ESC", bannermangler_func_esc), 80);
banner_addline(ban, bufnew);
}
# - $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