Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit dc095e99 authored by rswindell's avatar rswindell

Define and use new sbbs_t functions: ansi_gotoxy(), ansi_save() and

ansi_restore() in place of dumb macros that don't check the current terminal
support.
parent 8a928095
......@@ -159,3 +159,30 @@ bool sbbs_t::ansi_getxy(int* x, int* y)
return(true);
}
bool sbbs_t::ansi_gotoxy(int x, int y)
{
if(term_supports(ANSI)) {
rprintf("\x1b[%d;%dH",y,x);
return true;
}
return false;
}
bool sbbs_t::ansi_save(void)
{
if(term_supports(ANSI)) {
rputs("\x1b[s");
return true;
}
return false;
}
bool sbbs_t::ansi_restore(void)
{
if(term_supports(ANSI)) {
rputs("\x1b[u");
return true;
}
return false;
}
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -1140,7 +1140,7 @@ js_pushxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return(JS_FALSE);
rc=JS_SUSPENDREQUEST(cx);
sbbs->ANSI_SAVE();
sbbs->ansi_save();
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
}
......@@ -1155,7 +1155,7 @@ js_popxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return(JS_FALSE);
rc=JS_SUSPENDREQUEST(cx);
sbbs->ANSI_RESTORE();
sbbs->ansi_restore();
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
}
......@@ -1182,7 +1182,7 @@ js_gotoxy(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
}
rc=JS_SUSPENDREQUEST(cx);
sbbs->GOTOXY(x,y);
sbbs->ansi_gotoxy(x,y);
JS_RESUMEREQUEST(cx, rc);
return(JS_TRUE);
}
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -280,7 +280,7 @@ public:
char dszlog[127]; /* DSZLOG enviornment variable */
int keybuftop,keybufbot; /* Keyboard input buffer pointers (for ungetkey) */
char keybuf[KEY_BUFSIZE]; /* Keyboard input buffer */
char keybuf[KEY_BUFSIZE]; /* Keyboard input buffer */
ushort node_connection;
char connection[LEN_MODEM+1]; /* Connection Description */
......@@ -379,7 +379,10 @@ public:
/* ansi_term.cpp */
const char * ansi(int atr); /* Returns ansi escape sequence for atr */
bool ansi_getxy(int* x, int* y);
bool ansi_gotoxy(int x, int y);
bool ansi_getxy(int* x, int* y);
bool ansi_save(void);
bool ansi_restore(void);
void ansi_getlines(void);
/* Command Shell Methods */
......@@ -708,7 +711,7 @@ public:
bool errormsg_inside;
void errormsg(int line, const char *file, const char* action, const char *object
,ulong access, const char *extinfo=NULL);
/* qwk.cpp */
bool qwklogon;
ulong qwkmail_last;
......@@ -870,9 +873,9 @@ extern "C" {
/* date_str.c */
DLLEXPORT char * DLLCALL zonestr(short zone);
DLLEXPORT time_t DLLCALL dstrtounix(scfg_t*, char *str);
DLLEXPORT time_t DLLCALL dstrtounix(scfg_t*, char *str);
DLLEXPORT char * DLLCALL unixtodstr(scfg_t*, time_t, char *str);
DLLEXPORT char * DLLCALL sectostr(uint sec, char *str);
DLLEXPORT char * DLLCALL sectostr(uint sec, char *str);
DLLEXPORT char * DLLCALL hhmmtostr(scfg_t* cfg, struct tm* tm, char* str);
DLLEXPORT char * DLLCALL timestr(scfg_t* cfg, time_t intime, char* str);
DLLEXPORT when_t DLLCALL rfc822date(char* p);
......@@ -896,13 +899,13 @@ extern "C" {
DLLEXPORT BOOL DLLCALL fcompare(char* fn1, char* fn2);
DLLEXPORT BOOL DLLCALL backup(char *org, int backup_level, BOOL ren);
DLLEXPORT void DLLCALL refresh_cfg(scfg_t* cfg);
/* scfglib1.c */
DLLEXPORT char * DLLCALL prep_dir(char* base, char* dir, size_t buflen);
/* logfile.cpp */
DLLEXPORT BOOL DLLCALL hacklog(scfg_t* cfg, char* prot, char* user, char* text
DLLEXPORT BOOL DLLCALL hacklog(scfg_t* cfg, char* prot, char* user, char* text
,char* host, SOCKADDR_IN* addr);
DLLEXPORT BOOL DLLCALL spamlog(scfg_t* cfg, char* prot, char* action, char* reason
,char* host, char* ip_addr, char* to, char* from);
......@@ -1025,7 +1028,7 @@ extern "C" {
,user_t* user, char* html_index_file
,subscan_t* subscan);
/* js_file_area.c */
DLLEXPORT JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_t* cfg
DLLEXPORT JSObject* DLLCALL js_CreateFileAreaObject(JSContext* cx, JSObject* parent, scfg_t* cfg
,user_t* user, char* html_index_file);
/* js_msg_area.c */
......@@ -1103,7 +1106,7 @@ BOOL md(char *path);
/* ver.cpp */
char* socklib_version(char* str, char* winsock_ver);
/* sortdir.cpp */
int fnamecmp_a(char **str1, char **str2); /* for use with resort() */
int fnamecmp_d(char **str1, char **str2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment