|
|
1.1 root 1: #line 1 "PUTMSG.C"
2:
3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
4:
5: #include "sbbs.h"
6:
7: /****************************************************************************/
8: /* Outputs a NULL terminated string locally and remotely (if applicable) */
9: /* checking for message aborts, pauses, ANSI escape and ^A sequences. */
10: /* Changes local text attributes if necessary. Max length of str is 4 gig */
11: /* Returns the last char of the buffer access.. 0 if not aborted. */
12: /* If P_SAVEATR bit is set in mode, the attributes set by the message */
13: /* will be the current attributes after the message is displayed, otherwise */
14: /* the attributes prior to diplaying the message are always restored. */
15: /* Ignores Ctrl-Z's */
16: /****************************************************************************/
17: char putmsg(char HUGE16 *str, int mode)
18: {
19: uchar tmpatr,tmp2[256],tmp3[128],*p,exatr=0;
20: int orgcon=console,i;
21: ulong l=0,sys_status_sav=sys_status;
22:
23: tmpatr=curatr; /* was lclatr(-1) */
24: if(!(mode&P_SAVEATR))
25: attr(LIGHTGRAY);
26: while(str[l] && (mode&P_NOABORT || !msgabort()) && online) {
27: if(str[l]==1) { /* Ctrl-Ax sequence */
28: if(str[l+1]=='"' && !(sys_status&SS_NEST_PF)) { /* Quote a file */
29: l+=2;
30: i=0;
31: while(i<12 && isprint(str[l]) && str[l]!='\\' && str[l]!='/')
32: tmp2[i++]=str[l++];
33: tmp2[i]=0;
34: sys_status|=SS_NEST_PF; /* keep it only one message deep! */
35: sprintf(tmp3,"%s%s",text_dir,tmp2);
36: printfile(tmp3,0);
37: sys_status&=~SS_NEST_PF; }
38: else if(toupper(str[l+1])=='Z') /* Ctrl-AZ==EOF */
39: break;
40: else {
41: ctrl_a(str[l+1]);
42: l+=2; } }
43: else if((str[l]=='`' || str[l]=='�') && str[l+1]=='[') {
44: outchar(ESC); /* Convert `[ and �[ to ESC[ */
45: l++; }
46: else if(sys_misc&SM_PCBOARD && str[l]=='@' && str[l+1]=='X'
47: && isxdigit(str[l+2]) && isxdigit(str[l+3])) {
48: sprintf(tmp2,"%.2s",str+l+2);
49: attr(ahtoul(tmp2));
50: exatr=1;
51: l+=4; }
52: else if(sys_misc&SM_WILDCAT && str[l]=='@' && str[l+3]=='@'
53: && isxdigit(str[l+1]) && isxdigit(str[l+2])) {
54: sprintf(tmp2,"%.2s",str+l+1);
55: attr(ahtoul(tmp2));
56: // exatr=1;
57: l+=4; }
58: else if(sys_misc&SM_RENEGADE && str[l]=='|' && isdigit(str[l+1])
59: && !(useron.misc&(RIP|WIP))) {
60: sprintf(tmp2,"%.2s",str+l+1);
61: i=atoi(tmp2);
62: if(i>=16) { /* setting background */
63: i-=16;
64: i<<=4;
65: i|=(curatr&0x0f); } /* leave foreground alone */
66: else
67: i|=(curatr&0xf0); /* leave background alone */
68: attr(i);
69: exatr=1;
70: l+=2; /* Skip |x */
71: if(isdigit(str[l]))
72: l++; } /* Skip second digit if it exists */
73: else if(sys_misc&SM_CELERITY && str[l]=='|' && isalpha(str[l+1])
74: && !(useron.misc&(RIP|WIP))) {
75: switch(str[l+1]) {
76: case 'k':
77: attr((curatr&0xf0)|BLACK);
78: break;
79: case 'b':
80: attr((curatr&0xf0)|BLUE);
81: break;
82: case 'g':
83: attr((curatr&0xf0)|GREEN);
84: break;
85: case 'c':
86: attr((curatr&0xf0)|CYAN);
87: break;
88: case 'r':
89: attr((curatr&0xf0)|RED);
90: break;
91: case 'm':
92: attr((curatr&0xf0)|MAGENTA);
93: break;
94: case 'y':
95: attr((curatr&0xf0)|YELLOW);
96: break;
97: case 'w':
98: attr((curatr&0xf0)|LIGHTGRAY);
99: break;
100: case 'd':
101: attr((curatr&0xf0)|BLACK|HIGH);
102: break;
103: case 'B':
104: attr((curatr&0xf0)|BLUE|HIGH);
105: break;
106: case 'G':
107: attr((curatr&0xf0)|GREEN|HIGH);
108: break;
109: case 'C':
110: attr((curatr&0xf0)|CYAN|HIGH);
111: break;
112: case 'R':
113: attr((curatr&0xf0)|RED|HIGH);
114: break;
115: case 'M':
116: attr((curatr&0xf0)|MAGENTA|HIGH);
117: break;
118: case 'Y': /* Yellow */
119: attr((curatr&0xf0)|YELLOW|HIGH);
120: break;
121: case 'W':
122: attr((curatr&0xf0)|LIGHTGRAY|HIGH);
123: break;
124: case 'S': /* swap foreground and background */
125: attr((curatr&0x07)<<4);
126: break; }
127: exatr=1;
128: l+=2; /* Skip |x */
129: } /* Skip second digit if it exists */
130: else if(sys_misc&SM_WWIV && str[l]==3 && isdigit(str[l+1])) {
131: exatr=1;
132: switch(str[l+1]) {
133: default:
134: attr(LIGHTGRAY);
135: break;
136: case '1':
137: attr(CYAN|HIGH);
138: break;
139: case '2':
140: attr(BROWN|HIGH);
141: break;
142: case '3':
143: attr(MAGENTA);
144: break;
145: case '4':
146: attr(LIGHTGRAY|HIGH|(BLUE<<4));
147: break;
148: case '5':
149: attr(GREEN);
150: break;
151: case '6':
152: attr(RED|HIGH|BLINK);
153: break;
154: case '7':
155: attr(BLUE|HIGH);
156: break;
157: case '8':
158: attr(BLUE);
159: break;
160: case '9':
161: attr(CYAN);
162: break; }
163: l+=2; }
164: else {
165: if(exatr && str[l]==LF) /* clear at newline for extra attr codes */
166: attr(LIGHTGRAY);
167: if(lclaes()) {
168: if(str[l]=='A' || str[l]=='B' || str[l]=='H' || str[l]=='J'
169: || str[l]=='f' || str[l]=='u') /* ANSI anim */
170: lncntr=0; /* so defeat pause */
171: if(str[l]=='"') {
172: l++; /* don't pass on keyboard reassignment */
173: continue; } }
174: if(str[l]=='!' && str[l+1]=='|' && useron.misc&(RIP|WIP)) /* RIP */
175: lncntr=0; /* so defeat pause */
176: if(str[l]==ESC && str[l+1]=='$') /* WIP command */
177: lncntr=0;
178: if(str[l]=='@' && !(mode&P_NOATCODES)) {
179: i=atcodes((char *)str+l); /* returns 0 if not valid @ code */
180: l+=i; /* i is length of code string */
181: if(i) /* if valid string, go to top */
182: continue; }
183: if(str[l]!=26)
184: outchar(str[l]);
185: l++; } }
186: //curatr=lclatr(-1); 01/29/96
187: if(!(mode&P_SAVEATR)) {
188: console=orgcon;
189: attr(tmpatr); }
190:
191: /* Restore original settings of Forced Pause On/Off */
192: sys_status&=~(SS_PAUSEOFF|SS_PAUSEON);
193: sys_status|=(sys_status_sav&(SS_PAUSEOFF|SS_PAUSEON));
194: return(str[l]);
195: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.