|
|
1.1 root 1: /* con_out.cpp */
2:
3: /* Synchronet console output routines */
4:
1.1.1.2 ! root 5: /* $Id: con_out.cpp,v 1.32 2004/05/30 06:47:52 deuce Exp $ */
1.1 root 6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
1.1.1.2 ! root 11: * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
1.1 root 12: * *
13: * This program is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU General Public License for more details: gpl.txt or *
18: * http://www.fsf.org/copyleft/gpl.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38:
39: /**********************************************************************/
40: /* Functions that pertain to console i/o - color, strings, chars etc. */
41: /* Called from functions everywhere */
42: /**********************************************************************/
43:
44: #include "sbbs.h"
45:
46: /***************************************************/
47: /* Seven bit table for EXASCII to ASCII conversion */
48: /***************************************************/
1.1.1.2 ! root 49: static const char *sbtbl="CUeaaaaceeeiiiAAEaAooouuyOUcLYRfaiounNao?--24!<>"
1.1 root 50: "###||||++||++++++--|-+||++--|-+----++++++++##[]#"
51: "abrpEout*ono%0ENE+><rj%=o..+n2* ";
52:
53: /****************************************************************************/
1.1.1.2 ! root 54: /* Convert string from IBM extended ASCII to just ASCII */
! 55: /****************************************************************************/
! 56: char* DLLCALL ascii_str(uchar* str)
! 57: {
! 58: size_t i;
! 59:
! 60: for(i=0;str[i];i++)
! 61: if(str[i]&0x80)
! 62: str[i]=sbtbl[str[i]^0x80]; /* seven bit table */
! 63: else if(str[i]==CTRL_A /* ctrl-a */
! 64: && str[i+1]!=0) /* valid */
! 65: i++; /* skip the attribute code */
! 66:
! 67: return((char*)str);
! 68: }
! 69:
! 70: /****************************************************************************/
1.1 root 71: /* Outputs a NULL terminated string locally and remotely (if applicable) */
72: /* Handles ctrl-a characters */
73: /****************************************************************************/
74: int sbbs_t::bputs(char *str)
75: {
76: int i;
77: ulong l=0;
78:
1.1.1.2 ! root 79: if(online==ON_LOCAL && console&CON_L_ECHO) /* script running as event */
! 80: return(eprintf(LOG_INFO,"%s",str));
! 81:
1.1 root 82: while(str[l]) {
1.1.1.2 ! root 83: if(str[l]==CTRL_A /* ctrl-a */
! 84: && str[l+1]!=0) { /* valid */
1.1 root 85: ctrl_a(str[++l]); /* skip the ctrl-a */
86: l++; /* skip the attribute code */
1.1.1.2 ! root 87: continue;
! 88: }
1.1 root 89: if(str[l]=='@') { /* '@' */
90: if(str==mnestr /* Mnemonic string or */
91: || (str>=text[0] /* Straight out of TEXT.DAT */
92: && str<=text[TOTAL_TEXT-1])) {
1.1.1.2 ! root 93: i=show_atcode(str+l); /* return 0 if not valid @ code */
1.1 root 94: l+=i; /* i is length of code string */
95: if(i) /* if valid string, go to top */
1.1.1.2 ! root 96: continue;
! 97: }
1.1 root 98: for(i=0;i<TOTAL_TEXT;i++)
99: if(str==text[i])
100: break;
101: if(i<TOTAL_TEXT) { /* Replacement text */
1.1.1.2 ! root 102: i=show_atcode(str+l);
1.1 root 103: l+=i;
104: if(i)
1.1.1.2 ! root 105: continue;
! 106: }
! 107: }
! 108: outchar(str[l++]);
! 109: }
1.1 root 110: return(l);
111: }
112:
113: /****************************************************************************/
114: /* Outputs a NULL terminated string locally and remotely (if applicable) */
115: /* Does not expand ctrl-a characters (raw) */
116: /* Max length of str is 64 kbytes */
117: /****************************************************************************/
118: int sbbs_t::rputs(char *str)
119: {
120: ulong l=0;
121:
1.1.1.2 ! root 122: if(online==ON_LOCAL && console&CON_L_ECHO) /* script running as event */
! 123: return(eprintf(LOG_INFO,"%s",str));
! 124:
1.1 root 125: while(str[l])
126: outchar(str[l++]);
127: return(l);
128: }
129:
130: /****************************************************************************/
131: /* Performs printf() using bbs bputs function */
132: /****************************************************************************/
133: int sbbs_t::bprintf(char *fmt, ...)
134: {
135: va_list argptr;
1.1.1.2 ! root 136: char sbuf[4096];
1.1 root 137:
1.1.1.2 ! root 138: if(strchr(fmt,'%')==NULL)
1.1 root 139: return(bputs(fmt));
140: va_start(argptr,fmt);
1.1.1.2 ! root 141: vsnprintf(sbuf,sizeof(sbuf),fmt,argptr);
! 142: sbuf[sizeof(sbuf)-1]=0; /* force termination */
1.1 root 143: va_end(argptr);
144: return(bputs(sbuf));
145: }
146:
147: /****************************************************************************/
148: /* Performs printf() using bbs rputs function */
149: /****************************************************************************/
150: int sbbs_t::rprintf(char *fmt, ...)
151: {
152: va_list argptr;
1.1.1.2 ! root 153: char sbuf[4096];
1.1 root 154:
155: va_start(argptr,fmt);
1.1.1.2 ! root 156: vsnprintf(sbuf,sizeof(sbuf),fmt,argptr);
! 157: sbuf[sizeof(sbuf)-1]=0; /* force termination */
1.1 root 158: va_end(argptr);
159: return(rputs(sbuf));
160: }
161:
162: /****************************************************************************/
163: /* Outputs character locally and remotely (if applicable), preforming echo */
164: /* translations (X's and r0dent emulation) if applicable. */
165: /****************************************************************************/
166: void sbbs_t::outchar(char ch)
167: {
168: int i;
169:
170: if(console&CON_ECHO_OFF)
171: return;
172: if(ch==ESC)
173: outchar_esc=1;
174: else if(outchar_esc==1) {
175: if(ch=='[')
176: outchar_esc++;
177: else
1.1.1.2 ! root 178: outchar_esc=0;
! 179: }
1.1 root 180: else
181: outchar_esc=0;
182: if(useron.misc&NO_EXASCII && ch&0x80)
183: ch=sbtbl[(uchar)ch^0x80]; /* seven bit table */
184: if(ch==FF && lncntr>1 && !tos) {
185: lncntr=0;
186: CRLF;
1.1.1.2 ! root 187: if(!(sys_status&SS_PAUSEOFF)) {
! 188: pause();
! 189: while(lncntr && online && !(sys_status&SS_ABORT))
! 190: pause();
! 191: }
! 192: }
! 193: #if 0
1.1 root 194: if(sys_status&SS_CAP /* Writes to Capture File */
195: && (sys_status&SS_ANSCAP || (ch!=ESC /* && !lclaes() */)))
196: fwrite(&ch,1,1,capfile);
1.1.1.2 ! root 197: #endif
! 198: #if 0
1.1 root 199: if(console&CON_L_ECHO) {
1.1.1.2 ! root 200: if(console&CON_L_ECHOX && (uchar)ch>' ')
! 201: putch(password_char);
1.1 root 202: else if(cfg.node_misc&NM_NOBEEP && ch==BEL); /* Do nothing if beep */
203: else if(ch==BEL) {
204: sbbs_beep(2000,110);
1.1.1.2 ! root 205: nosound();
! 206: }
! 207: else putch(ch);
! 208: }
! 209: #endif
1.1 root 210:
211: if(online==ON_REMOTE && console&CON_R_ECHO) {
1.1.1.2 ! root 212: if(console&CON_R_ECHOX && (uchar)ch>' ') {
! 213: ch=text[YN][3];
! 214: if(text[YN][2]==0 || ch==0) ch='X';
! 215: }
1.1 root 216: if(ch==FF && useron.misc&ANSI) {
217: putcom("\x1b[2J\x1b[H"); /* clear screen, home cursor */
218: }
219: else {
1.1.1.2 ! root 220: if(ch==(char)TELNET_IAC && !(telnet_mode&TELNET_MODE_OFF))
! 221: outcom(TELNET_IAC); /* Must escape Telnet IAC char (255) */
1.1 root 222: i=0;
223: while(outcom(ch)&TXBOF && i<1440) { /* 3 minute pause delay */
224: if(!online)
225: break;
226: i++;
227: if(sys_status&SS_SYSPAGE)
228: sbbs_beep(i,80);
229: else
1.1.1.2 ! root 230: mswait(80);
! 231: }
1.1 root 232: if(i==1440) { /* timeout - beep flush outbuf */
233: i=rioctl(TXBC);
1.1.1.2 ! root 234: lprintf(LOG_NOTICE,"timeout(outchar) %04X %04X\r\n",i,rioctl(IOFO));
1.1 root 235: outcom(BEL);
1.1.1.2 ! root 236: rioctl(IOCS|PAUSE);
! 237: }
! 238: }
! 239: }
1.1 root 240: if(ch==LF) {
241: lncntr++;
242: lbuflen=0;
243: tos=0;
244: } else if(ch==FF) {
245: lncntr=0;
246: lbuflen=0;
247: tos=1;
248: } else {
249: if(!lbuflen)
250: latr=curatr;
251: if(lbuflen<LINE_BUFSIZE)
1.1.1.2 ! root 252: lbuf[lbuflen++]=ch;
! 253: }
1.1 root 254:
1.1.1.2 ! root 255: if(lncntr==rows-1 && ((useron.misc&UPAUSE) || sys_status&SS_PAUSEON)
! 256: && !(sys_status&SS_PAUSEOFF)) {
1.1 root 257: lncntr=0;
1.1.1.2 ! root 258: pause();
! 259: }
1.1 root 260: }
261:
262: void sbbs_t::center(char *instr)
263: {
264: char str[256];
265: int i,j;
266:
1.1.1.2 ! root 267: SAFECOPY(str,instr);
1.1 root 268: truncsp(str);
269: j=bstrlen(str);
270: for(i=0;i<(80-j)/2;i++)
1.1.1.2 ! root 271: outchar(' ');
1.1 root 272: bputs(str);
273: CRLF;
274: }
275:
1.1.1.2 ! root 276: void sbbs_t::clearline(void)
! 277: {
! 278: int i;
! 279:
! 280: outchar(CR);
! 281: if(useron.misc&ANSI)
! 282: rputs("\x1b[K");
! 283: else {
! 284: for(i=0;i<cols-1;i++)
! 285: outchar(' ');
! 286: outchar(CR);
! 287: }
! 288: }
! 289:
! 290: void sbbs_t::cursor_home(void)
! 291: {
! 292: if(useron.misc&ANSI)
! 293: rputs("\x1b[H");
! 294: else
! 295: outchar(FF);
! 296: }
! 297:
! 298: void sbbs_t::cursor_up(int count)
! 299: {
! 300: if(count<1)
! 301: return;
! 302: if(!(useron.misc&ANSI))
! 303: return;
! 304: if(count>1)
! 305: rprintf("\x1b[%dA",count);
! 306: else
! 307: rputs("\x1b[A");
! 308: }
! 309:
! 310: void sbbs_t::cursor_down(int count)
! 311: {
! 312: if(count<1)
! 313: return;
! 314: if(!(useron.misc&ANSI))
! 315: return;
! 316: if(count>1)
! 317: rprintf("\x1b[%dB",count);
! 318: else
! 319: rputs("\x1b[B");
! 320: }
! 321:
! 322: void sbbs_t::cursor_right(int count)
! 323: {
! 324: if(count<1)
! 325: return;
! 326: if(useron.misc&ANSI) {
! 327: if(count>1)
! 328: rprintf("\x1b[%dC",count);
! 329: else
! 330: rputs("\x1b[C");
! 331: } else {
! 332: for(int i=0;i<count;i++)
! 333: outchar(' ');
! 334: }
! 335: }
! 336:
! 337: void sbbs_t::cursor_left(int count)
! 338: {
! 339: if(count<1)
! 340: return;
! 341: if(useron.misc&ANSI) {
! 342: if(count>1)
! 343: rprintf("\x1b[%dD",count);
! 344: else
! 345: rputs("\x1b[D");
! 346: } else {
! 347: for(int i=0;i<count;i++)
! 348: outchar('\b');
! 349: }
! 350: }
! 351:
! 352: void sbbs_t::cleartoeol(void)
! 353: {
! 354: if(useron.misc&ANSI)
! 355: rputs("\x1b[K");
! 356: #if 0
! 357: else {
! 358: i=j=lclwx(); /* commented out */
! 359: while(i++<79)
! 360: outchar(' ');
! 361: while(j++<79)
! 362: outchar(BS);
! 363: }
! 364: #endif
! 365: }
1.1 root 366:
367: /****************************************************************************/
368: /* performs the correct attribute modifications for the Ctrl-A code */
369: /****************************************************************************/
370: void sbbs_t::ctrl_a(char x)
371: {
372: char tmp1[128],atr=curatr;
1.1.1.2 ! root 373: struct tm tm;
1.1 root 374:
1.1.1.2 ! root 375: if(x && (uchar)x<=CTRL_Z) { /* Ctrl-A through Ctrl-Z for users with MF only */
1.1 root 376: if(!(useron.flags1&FLAG(x+64)))
377: console^=(CON_ECHO_OFF);
1.1.1.2 ! root 378: return;
! 379: }
! 380: if((uchar)x>0x7f) {
1.1 root 381: if(useron.misc&ANSI)
1.1.1.2 ! root 382: cursor_right((uchar)x-0x7f);
! 383: return;
! 384: }
1.1 root 385: switch(toupper(x)) {
386: case '!': /* level 10 or higher */
387: if(useron.level<10)
388: console^=CON_ECHO_OFF;
389: break;
390: case '@': /* level 20 or higher */
391: if(useron.level<20)
392: console^=CON_ECHO_OFF;
393: break;
394: case '#': /* level 30 or higher */
395: if(useron.level<30)
396: console^=CON_ECHO_OFF;
397: break;
398: case '$': /* level 40 or higher */
399: if(useron.level<40)
400: console^=CON_ECHO_OFF;
401: break;
402: case '%': /* level 50 or higher */
403: if(useron.level<50)
404: console^=CON_ECHO_OFF;
405: break;
406: case '^': /* level 60 or higher */
407: if(useron.level<60)
408: console^=CON_ECHO_OFF;
409: break;
410: case '&': /* level 70 or higher */
411: if(useron.level<70)
412: console^=CON_ECHO_OFF;
413: break;
414: case '*': /* level 80 or higher */
415: if(useron.level<80)
416: console^=CON_ECHO_OFF;
417: break;
418: case '(': /* level 90 or higher */
419: if(useron.level<90)
420: console^=CON_ECHO_OFF;
421: break;
422: case ')': /* turn echo back on */
423: console&=~CON_ECHO_OFF;
424: break;
1.1.1.2 ! root 425: case '+': /* push current attribte */
! 426: if(attr_sp<(int)sizeof(attr_stack))
! 427: attr_stack[attr_sp++]=curatr;
! 428: break;
! 429: case '-': /* pop current attribute OR optimized "normal" */
! 430: if(attr_sp>0)
! 431: attr(attr_stack[--attr_sp]);
! 432: else /* turn off all attributes if */
! 433: if(atr&(HIGH|BLINK|BG_LIGHTGRAY)) /* high intensity, blink or */
! 434: attr(LIGHTGRAY); /* background bits are set */
1.1 root 435: break;
436: case '_': /* turn off all attributes if */
1.1.1.2 ! root 437: if(atr&(BLINK|BG_LIGHTGRAY)) /* blink or background is set */
1.1 root 438: attr(LIGHTGRAY);
439: break;
440: case 'P': /* Pause */
441: pause();
442: break;
443: case 'Q': /* Pause reset */
444: lncntr=0;
445: break;
446: case 'T': /* Time */
447: now=time(NULL);
1.1.1.2 ! root 448: localtime_r(&now,&tm);
! 449: bprintf("%02d:%02d %s"
! 450: ,tm.tm_hour==0 ? 12
! 451: : tm.tm_hour>12 ? tm.tm_hour-12
! 452: : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am");
1.1 root 453: break;
454: case 'D': /* Date */
455: now=time(NULL);
456: bputs(unixtodstr(&cfg,now,tmp1));
457: break;
458: case ',': /* Delay 1/10 sec */
459: mswait(100);
460: break;
461: case ';': /* Delay 1/2 sec */
462: mswait(500);
463: break;
464: case '.': /* Delay 2 secs */
465: mswait(2000);
466: break;
467: case 'S': /* Synchronize */
468: ASYNC;
469: break;
470: case 'L': /* CLS (form feed) */
471: CLS;
472: break;
473: case '>': /* CLREOL */
1.1.1.2 ! root 474: cleartoeol();
1.1 root 475: break;
476: case '<': /* Non-destructive backspace */
477: outchar(BS);
478: break;
479: case '[': /* Carriage return */
480: outchar(CR);
481: break;
482: case ']': /* Line feed */
483: outchar(LF);
484: break;
485: case 'A': /* Ctrl-A */
1.1.1.2 ! root 486: outchar(CTRL_A);
1.1 root 487: break;
488: case 'H': /* High intensity */
489: atr|=HIGH;
490: attr(atr);
491: break;
492: case 'I': /* Blink */
493: atr|=BLINK;
494: attr(atr);
495: break;
496: case 'N': /* Normal */
497: attr(LIGHTGRAY);
498: break;
499: case 'R':
500: atr=(atr&0xf8)|RED;
501: attr(atr);
502: break;
503: case 'G':
504: atr=(atr&0xf8)|GREEN;
505: attr(atr);
506: break;
507: case 'B':
508: atr=(atr&0xf8)|BLUE;
509: attr(atr);
510: break;
511: case 'W': /* White */
512: atr=(atr&0xf8)|LIGHTGRAY;
513: attr(atr);
514: break;
515: case 'C':
516: atr=(atr&0xf8)|CYAN;
517: attr(atr);
518: break;
519: case 'M':
520: atr=(atr&0xf8)|MAGENTA;
521: attr(atr);
522: break;
523: case 'Y': /* Yellow */
524: atr=(atr&0xf8)|BROWN;
525: attr(atr);
526: break;
527: case 'K': /* Black */
528: atr=(atr&0xf8)|BLACK;
529: attr(atr);
530: break;
531: case '0': /* Black Background */
1.1.1.2 ! root 532: atr=(atr&0x8f);
1.1 root 533: attr(atr);
534: break;
535: case '1': /* Red Background */
1.1.1.2 ! root 536: atr=(atr&0x8f)|(uchar)BG_RED;
1.1 root 537: attr(atr);
538: break;
539: case '2': /* Green Background */
1.1.1.2 ! root 540: atr=(atr&0x8f)|(uchar)BG_GREEN;
1.1 root 541: attr(atr);
542: break;
543: case '3': /* Yellow Background */
1.1.1.2 ! root 544: atr=(atr&0x8f)|(uchar)BG_BROWN;
1.1 root 545: attr(atr);
546: break;
547: case '4': /* Blue Background */
1.1.1.2 ! root 548: atr=(atr&0x8f)|(uchar)BG_BLUE;
1.1 root 549: attr(atr);
550: break;
551: case '5': /* Magenta Background */
1.1.1.2 ! root 552: atr=(atr&0x8f)|(uchar)BG_MAGENTA;
1.1 root 553: attr(atr);
554: break;
555: case '6': /* Cyan Background */
1.1.1.2 ! root 556: atr=(atr&0x8f)|(uchar)BG_CYAN;
1.1 root 557: attr(atr);
558: break;
559: case '7': /* White Background */
1.1.1.2 ! root 560: atr=(atr&0x8f)|(uchar)BG_LIGHTGRAY;
1.1 root 561: attr(atr);
1.1.1.2 ! root 562: break;
! 563: }
1.1 root 564: }
565:
566: /***************************************************************************/
567: /* Changes local and remote text attributes accounting for monochrome */
568: /***************************************************************************/
569: /****************************************************************************/
570: /* Sends ansi codes to change remote ansi terminal's colors */
571: /* Only sends necessary codes - tracks remote terminal's current attributes */
572: /* through the 'curatr' variable */
573: /****************************************************************************/
574: void sbbs_t::attr(int atr)
575: {
576:
577: if(!(useron.misc&ANSI))
578: return;
579: if(!(useron.misc&COLOR)) { /* eliminate colors if user doesn't have them */
580: if(atr&LIGHTGRAY) /* if any foreground bits set, set all */
581: atr|=LIGHTGRAY;
1.1.1.2 ! root 582: if(atr&BG_LIGHTGRAY) /* if any background bits set, set all */
! 583: atr|=BG_LIGHTGRAY;
! 584: if(atr&LIGHTGRAY && atr&BG_LIGHTGRAY)
1.1 root 585: atr&=~LIGHTGRAY; /* if background is solid, foreground is black */
586: if(!atr)
1.1.1.2 ! root 587: atr|=LIGHTGRAY; /* don't allow black on black */
! 588: }
1.1 root 589: if(curatr==atr) /* text hasn't changed. don't send codes */
590: return;
591:
592: if((!(atr&HIGH) && curatr&HIGH) || (!(atr&BLINK) && curatr&BLINK)
593: || atr==LIGHTGRAY) {
1.1.1.2 ! root 594: rputs(ansi(ANSI_NORMAL));
! 595: curatr=LIGHTGRAY;
! 596: }
1.1 root 597:
598: if(atr==LIGHTGRAY) /* no attributes */
599: return;
600:
601: if(atr&BLINK) { /* special attributes */
602: if(!(curatr&BLINK))
1.1.1.2 ! root 603: rputs(ansi(BLINK));
! 604: }
1.1 root 605: if(atr&HIGH) {
606: if(!(curatr&HIGH))
1.1.1.2 ! root 607: rputs(ansi(HIGH));
! 608: }
1.1 root 609:
610: if((atr&0x7)==BLACK) { /* foreground colors */
611: if((curatr&0x7)!=BLACK)
1.1.1.2 ! root 612: rputs(ansi(BLACK));
! 613: }
1.1 root 614: else if((atr&0x7)==RED) {
615: if((curatr&0x7)!=RED)
1.1.1.2 ! root 616: rputs(ansi(RED));
! 617: }
1.1 root 618: else if((atr&0x7)==GREEN) {
619: if((curatr&0x7)!=GREEN)
1.1.1.2 ! root 620: rputs(ansi(GREEN));
! 621: }
1.1 root 622: else if((atr&0x7)==BROWN) {
623: if((curatr&0x7)!=BROWN)
1.1.1.2 ! root 624: rputs(ansi(BROWN));
! 625: }
1.1 root 626: else if((atr&0x7)==BLUE) {
627: if((curatr&0x7)!=BLUE)
1.1.1.2 ! root 628: rputs(ansi(BLUE));
! 629: }
1.1 root 630: else if((atr&0x7)==MAGENTA) {
631: if((curatr&0x7)!=MAGENTA)
1.1.1.2 ! root 632: rputs(ansi(MAGENTA));
! 633: }
1.1 root 634: else if((atr&0x7)==CYAN) {
635: if((curatr&0x7)!=CYAN)
1.1.1.2 ! root 636: rputs(ansi(CYAN));
! 637: }
1.1 root 638: else if((atr&0x7)==LIGHTGRAY) {
639: if((curatr&0x7)!=LIGHTGRAY)
1.1.1.2 ! root 640: rputs(ansi(LIGHTGRAY));
! 641: }
1.1 root 642:
1.1.1.2 ! root 643: if((atr&0x70)==0) { /* background colors */
! 644: if((curatr&0x70)!=0)
! 645: rputs(ansi(BG_BLACK));
! 646: }
! 647: else if((atr&0x70)==BG_RED) {
! 648: if((curatr&0x70)!=BG_RED)
! 649: rputs(ansi(BG_RED));
! 650: }
! 651: else if((atr&0x70)==BG_GREEN) {
! 652: if((curatr&0x70)!=BG_GREEN)
! 653: rputs(ansi(BG_GREEN));
! 654: }
! 655: else if((atr&0x70)==BG_BROWN) {
! 656: if((curatr&0x70)!=BG_BROWN)
! 657: rputs(ansi(BG_BROWN));
! 658: }
! 659: else if((atr&0x70)==BG_BLUE) {
! 660: if((curatr&0x70)!=BG_BLUE)
! 661: rputs(ansi(BG_BLUE));
! 662: }
! 663: else if((atr&0x70)==BG_MAGENTA) {
! 664: if((curatr&0x70)!=BG_MAGENTA)
! 665: rputs(ansi(BG_MAGENTA));
! 666: }
! 667: else if((atr&0x70)==BG_CYAN) {
! 668: if((curatr&0x70)!=BG_CYAN)
! 669: rputs(ansi(BG_CYAN));
! 670: }
! 671: else if((atr&0x70)==BG_LIGHTGRAY) {
! 672: if((curatr&0x70)!=BG_LIGHTGRAY)
! 673: rputs(ansi(BG_LIGHTGRAY));
! 674: }
1.1 root 675:
676: curatr=atr;
677: }
678:
679: /****************************************************************************/
680: /* Checks to see if user has hit Pause or Abort. Returns 1 if user aborted. */
681: /* If the user hit Pause, waits for a key to be hit. */
682: /* Emulates remote XON/XOFF flow control on local console */
683: /* Preserves SS_ABORT flag state, if already set. */
684: /* Called from various listing procedures that wish to check for abort */
685: /****************************************************************************/
686: bool sbbs_t::msgabort()
687: {
1.1.1.2 ! root 688: static ulong counter;
! 689:
! 690: if(sys_status&SS_SYSPAGE && !(++counter%100))
1.1 root 691: sbbs_beep(sbbs_random(800),1);
692:
693: checkline();
694: if(sys_status&SS_ABORT)
695: return(true);
696: if(!online)
697: return(true);
698: return(false);
699: }
700:
701:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.