|
|
1.1 root 1: /* SBBS.H */
2:
3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
4:
5: #ifndef _SBBS_H
6: #define _SBBS_H
7:
8: /****************************/
9: /* Standard library headers */
10: /****************************/
11:
12: #include <io.h>
13: #ifdef __TURBOC__
14: #include <dir.h>
15: #include <alloc.h>
16: #else
17: #include <malloc.h>
18: #endif
19:
20: #include <dos.h>
21: #include <mem.h>
22: #include <time.h>
23: #include <errno.h>
24: #include <stdio.h>
25: #include <conio.h>
26: #include <ctype.h>
27: #include <fcntl.h>
28: #include <share.h>
29: #include <stdarg.h>
30: #include <stdlib.h>
31: #include <string.h>
32: #include <process.h>
33: #include <sys\stat.h>
34:
35: #ifdef __OS2__
36: #define INCL_BASE
37: #include <os2.h>
38: #else
39: #include <bios.h>
40: #endif
41:
42: #define GLOBAL extern /* turn vars.c and scfgvars.c files into headers */
43: #ifdef SBBS
44: #include "vars.c"
45: #endif
46: #include "smblib.h"
47: #include "ars_defs.h"
48: #include "scfgvars.c"
49: #include "scfglib.h"
50: #include "riolib.h"
51: #include "riodefs.h"
52:
53: /***********************************************/
54: /* Prototypes of functions used ONLY with SBBS */
55: /***********************************************/
56:
57:
58: void lputc(int);
59: int lclatr(int);
60: uint lkbrd(int);
61: int lclaes(void);
62: void lclxy(int,int);
63: int lclwx(void);
64: int lclwy(void);
65: long lputs(char FAR16 *);
66:
67: #ifndef __FLAT__
68:
69: /* LCLOLL.ASM */
70: int lclini(int);
71:
72: #endif
73:
74: /* COMIO.C */
75: void putcom(char *str); /* Send string to com port */
76: void putcomch(char ch); /* Send single char to com port */
77: void mdmcmd(char *str); /* Send translated modem command to COM */
78: char getmdmstr(char *str, int sec); /* Returns chars */
79: void hangup(void); /* Hangup modem */
80: void offhook(void); /* Takes phone offhook */
81: void checkline(void); /* Checks if remote user has hungup */
82: void comini(void); /* initializes com port and sets baud */
83: void setrate(void); /* sets baud rate for current connect */
84:
85: /* DATIO.C */
86: void getuserdat(user_t *user); /* Fill userdat struct with user data */
87: void putuserdat(user_t user); /* Put userdat struct into user file */
88: void getuserrec(int usernumber, int start, char length, char *str);
89: void putuserrec(int usernumber, int start, char length, char *str);
90: ulong adjustuserrec(int usernumber, int start, char length, long adj);
91: void subtract_cdt(long amt);
92: void getrec(char *instr,int start,int length,char *outstr);
93: /* Retrieve a record from a string */
94: void putrec(char *outstr,int start,int length,char *instr);
95: /* Place a record into a string */
96: uint matchuser(char *str); /* Checks for a username match */
97: uint finduser(char *str);
98: uint lastuser(void);
99: char getage(char *birthdate);
100:
101: int sub_op(uint subnum);
102: ulong getlastmsg(uint subnum, ulong *ptr, time_t *t);
103: time_t getmsgtime(uint subnum, ulong ptr);
104: ulong getmsgnum(uint subnum, time_t t);
105: ulong getposts(uint subnum);
106:
107: int getfiles(uint dirnum);
108: int dir_op(uint dirnum);
109: int getuserxfers(int fromuser, int destuser, char *fname);
110: void rmuserxfers(int fromuser, int destuser, char *fname);
111: char *username(int usernumber, char *str);
112: uint gettotalfiles(uint dirnum);
113: void getnodeext(uint number, char *str);
114: void putnodeext(uint number, char *str);
115: void getnodedat(uint number, node_t *node, char lock);
116: void putnodedat(uint number, node_t node);
117: void putusername(int number, char *name);
118: void nodesync(void);
119: void getmsgptrs(void);
120: void putmsgptrs(void);
121: void getusrsubs(void);
122: void getusrdirs(void);
123: uint userdatdupe(uint usernumber, uint offset, uint datlen, char *dat
124: , char del);
125: void gettimeleft(void);
126:
127: /* FILIO.C */
128: char addfiledat(file_t *f);
129: void getfileixb(file_t *f);
130: void getfiledat(file_t *f);
131: void putfiledat(file_t f);
132: char uploadfile(file_t *f);
133: void downloadfile(file_t f);
134: void removefiledat(file_t f);
135: void fileinfo(file_t f);
136: void openfile(file_t f);
137: void closefile(file_t f);
138: void update_uldate(file_t f);
139: void putextdesc(uint dirnum, ulong datoffset, char *ext);
140: void getextdesc(uint dirnum, ulong datoffset, char *ext);
141: void viewfilecontents(file_t f);
142:
143: /* STR.C */
144: void userlist(char subonly);
145: char gettmplt(char *outstr, char *template, int mode);
146: void sif(char *fname, char *answers, long len); /* Synchronet Inteface File */
147: void sof(char *fname, char *answers, long len);
148: void create_sif_dat(char *siffile, char *datfile);
149: void read_sif_dat(char *siffile, char *datfile);
150: void printnodedat(uint number, node_t node);
151: void reports(void);
152: char inputnstime(time_t *dt);
153: char chkpass(char *pass, user_t user);
154: char *cmdstr(char *instr, char *fpath, char *fspec, char *outstr);
155: void getcomputer(char *computer);
156: void subinfo(uint subnum);
157: void dirinfo(uint dirnum);
158: char trashcan(char *insearch, char *name);
159: #ifdef SBBS
160: char *decrypt(ulong [],char *);
161: #endif
162:
163: /* MSGIO.C */
164: void automsg(void);
165: char writemsg(char *str, char *top, char *title, int mode, int subnum
166: ,char *dest);
167: char putmsg(char HUGE16 *str, int mode);
168: char msgabort(void);
169: void email(int usernumber, char *top, char *title, char mode);
170: void forwardmail(smbmsg_t *msg, ushort usernum);
171: char postmsg(uint subnum, smbmsg_t *msg, int wm_mode);
172: void removeline(char *str, char *str2, char num, char skip);
173: ulong msgeditor(char *buf, char *top, char *title);
174: void editfile(char *path);
175: void getsmsg(int usernumber);
176: void putsmsg(int usernumber, char *strin);
177: void getnmsg(void);
178: void putnmsg(int num, char *strin);
179: int loadmsg(smbmsg_t *msg, ulong number);
180: char HUGE16 *loadmsgtxt(smbmsg_t msg, int tails);
181: ushort chmsgattr(ushort attr);
182: void show_msgattr(ushort attr);
183: void show_msghdr(smbmsg_t msg);
184: void show_msg(smbmsg_t msg, int mode);
185: void msgtotxt(smbmsg_t msg, char *str, int header, int tails);
186: void quotemsg(smbmsg_t msg, int tails);
187: void putmsg_fp(FILE *fp, long length, int mode);
188: void editmsg(smbmsg_t *msg, uint subnum);
189: void remove_re(char *str);
190: void remove_ctrl_a(char *instr);
191:
192: /* MAIL.C */
193:
194: ulong loadmail(mail_t **mail, uint usernumber, int which, int mode);
195: int getmail(int usernumber, char sent);
196: int delmail(uint usernumber,int which);
197: void delfattach(uint to, char *title);
198: void telluser(smbmsg_t msg);
199: void delallmail(uint usernumber);
200: void readmail(uint usernumber, int sent);
201:
202: void bulkmail(uchar *ar);
203:
204: /* CONIO.C */
205: int bputs(char *str); /* BBS puts function */
206: int rputs(char *str); /* BBS raw puts function */
207: int lprintf(char *fmt, ...); /* local printf */
208: int bprintf(char *fmt, ...); /* BBS printf function */
209: int rprintf(char *fmt, ...); /* BBS raw printf function */
210: int getstr(char *str,int length, long mode);
211: void outchar(char ch); /* Output a char - check echo and emu. */
212: char r0dentch(char ch); /* Converts CH to r0dent CH */
213: char getkey(long mode); /* Waits for a key hit local or remote */
214: void ungetkey(char ch); /* Places 'ch' into the input buffer */
215: char inkey(int mode); /* Returns key if one has been hit */
216: char yesno(char *str);
217: char noyes(char *str);
218: void printfile(char *str, int mode);
219: void printtail(char *str, int lines, int mode);
220: void menu(char *code);
221: long getkeys(char *str, ulong max);
222: long getnum(ulong max);
223: void center(char *str);
224: int uselect(int add, int n, char *title, char *item, char *ar);
225: void statusline(void);
226: void pause(void);
227: void waitforsysop(char on);
228: void riosync(char abortable);
229: char validattr(char a);
230: char stripattr(char *str);
231: void redrwstr(char *strin, int i, int l, char mode);
232: void mnemonics(char *str);
233: void attr(int atr); /* Change local and remote text attributes */
234: void ctrl_a(char x); /* Peforms the Ctrl-Ax attribute changes */
235: int atcodes(char *code);
236: char *ansi(char atr); /* Returns ansi escape sequence for atr */
237: int whos_online(char listself);/* Lists active nodes, returns active nodes */
238:
239: /* LOGONOFF.C */
240: int login(char *str, char *pw);
241: char logon(void);
242: void logout(void);
243: void logoff(void);
244: void newuser(void); /* Get new user */
245: void backout(void);
246:
247: /* BBSIO.C */
248: char scanposts(uint subnum, char newscan, char *find); /* Scan sub-board */
249: int searchsub(uint subnum, char *search); /* Search for string on sub */
250: int searchsub_toyou(uint subnum);
251: char text_sec(void); /* Text sections */
252:
253: /* CHAT.C */
254: void localchat(void);
255: void chatsection(void);
256: void nodepage(void);
257: void nodemsg(void);
258: void guruchat(char *line, char *guru, int gurunum);
259: char guruexp(char **ptrptr, char *line);
260: void localguru(char *guru, int gurunum);
261: void packchatpass(char *pass, node_t *node);
262: char *unpackchatpass(char *pass, node_t node);
263: void sysop_page(void);
264: void privchat(void);
265:
266: /* MAIN.C */
267: void printstatslog(uint node);
268: ulong logonstats(void);
269: void logoffstats(void);
270: void getstats(char node, stats_t *stats);
271:
272: /* MISC.C */
273: void bail(int code); /* Exit */
274: char *ultoac(ulong l,char *str);
275: int bstrlen(char *str);
276: int nopen(char *str, int access);
277: FILE *fnopen(int *file, char *str,int access);
278: char *sectostr(uint sec, char *str); /* seconds to HH:MM:SS */
279: void truncsp(char *str); /* Truncates white spaces off end of str */
280: ulong ahtoul(char *str); /* Converts ASCII hex to ulong */
281: int pstrcmp(char **str1, char **str2); /* Compares pointers to pointers */
282: int strsame(char *str1, char *str2); /* Compares number of same chars */
283: void errormsg(int line, char *file, char action, char *object, ulong access);
284: int mv(char *src, char *dest, char copy); /* fast file move/copy function */
285: char chksyspass(int local);
286: char *timestr(time_t *intime); /* ASCII representation of time_t */
287: char *zonestr(short zone);
288: void dv_pause(void);
289: void secwait(int sec);
290: time_t ftimetounix(struct ftime f);
291: struct ftime unixtoftime(time_t unix);
292: time_t dstrtounix(char *str); /* ASCII date (MM/DD/YY) to unix conversion */
293: char *unixtodstr(time_t unix, char *str); /* Unix time to ASCII date */
294: char *hexplus(uint num, char *str); /* Hex plus for 3 digits up to 9000 */
295: uint hptoi(char *str);
296: int chk_ar(char *str, user_t user); /* checks access requirements */
297: ushort crc16(char *str);
298: ulong _crc32(char *str);
299: void ucrc16(uchar ch, ushort *rcrc);
300: int kbd_state(void);
301:
302: #ifndef __FLAT__
303: long lread(int file, char HUGE16 *buf, long bytes); /* Reads >32k files */
304: long lfread(char huge *buf, long bytes, FILE *fp);
305: long lwrite(int file, char HUGE16 *buf, long bytes); /* Writes >32k files */
306: #endif
307:
308: /* XFER.C */
309: int listfile(char *fname, char HUGE16 *buf, uint dirnum
310: , char *search, char letter, ulong datoffset);
311: int listfiles(uint dirnum, char *filespec, int tofile, char mode);
312: int listfileinfo(uint dirnum, char *filespec, char mode);
313: void batchmenu(void);
314: void temp_xfer(void);
315: void batch_add_list(char *list);
316: void notdownloaded(ulong size, time_t start, time_t end);
317: int viewfile(file_t f, int ext);
318:
319: /* XFERMISC.C */
320: void seqwait(uint devnum);
321: void listfiletofile(char *fname, char HUGE16 *buf, uint dirnum, int file);
322: void upload(uint dirnum);
323: char bulkupload(uint dirnum);
324: void extract(uint dirnum);
325: char *getfilespec(char *str);
326: int delfiles(char *path, char *spec);
327: char findfile(uint dirnum, char *filename);
328: char fexist(char *filespec);
329: long flength(char *filespec);
330: long fdate(char *filespec);
331: long fdate_dir(char *filespec);
332: char *padfname(char *filename, char *str);
333: char *unpadfname(char *filename, char *str);
334: char filematch(char *filename, char *filespec);
335: int protocol(char *cmdline, int cd);
336: void autohangup(void);
337: char checkprotlog(file_t f);
338: char checkfname(char *fname);
339: void viewfiles(uint dirnum, char *fspec);
340: char addtobatdl(file_t f);
341: int fnamecmp_a(char **str1, char **str2); /* for use with resort() */
342: int fnamecmp_d(char **str1, char **str2);
343: int fdatecmp_a(uchar **buf1, uchar **buf2);
344: int fdatecmp_d(uchar **buf1, uchar **buf2);
345: void resort(uint dirnum);
346: int create_batchup_lst(void);
347: int create_batchdn_lst(void);
348: int create_bimodem_pth(void);
349: void batch_upload(void);
350: void batch_download(int xfrprot);
351: void start_batch_download(void);
352: ulong create_filelist(char *name, char mode);
353:
354: /* XTRN.C */
355: int external(char *cmdline,char mode); /* Runs external program */
356: void xtrndat(char *name, char *dropdir, uchar type, ulong tleft);
357: char xtrn_sec(void); /* The external program section */
358: void exec_xtrn(uint xtrnnum); /* Executes online external program */
359: void user_event(char event); /* Executes user event(s) */
360: char xtrn_access(uint xnum); /* Does useron have access to xtrn? */
361: char *temp_cmd(void); /* Returns temp file command line */
362:
363: /* LOGIO.C */
364: void logentry(char *code,char *entry);
365: void log(char *str); /* Writes 'str' to node log */
366: void logch(char ch, char comma); /* Writes 'ch' to node log */
367: void logline(char *code,char *str); /* Writes 'str' on it's own line in log */
368: void logofflist(void); /* List of users logon activity */
369: void errorlog(char *text); /* Logs errors to ERROR.LOG and NODE.LOG */
370: #if DEBUG
371: void dlog(int line, char *file, char *text); /* Debug log file */
372: #endif
373:
374: /* QWK.C */
375: void qwk_sec(void);
376: char pack_qwk(char *packet, ulong *msgcnt, int prepack);
377: void unpack_qwk(char *packet,uint hubnum);
378:
379:
380: /* FIDO.C */
381: void netmail(char *into, char *subj, char mode);
382: void qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub);
383:
384: void inetmail(char *into, char *subj, char mode);
385: void qnetmail(char *into, char *subj, char mode);
386:
387: /* USEREDIT.C */
388: void useredit(int usernumber, int local);
389: void maindflts(user_t user);
390: void purgeuser(int usernumber);
391:
392: /* INITDATA.C */
393: void initdata(void);
394:
395: /* VER.C */
396: void ver(void);
397:
398: /* MAIN_SEC.C */
399: void main_sec(void);
400: void scanallsubs(char mode);
401: void scansubs(char mode);
402: void new_scan_cfg(ulong misc);
403: void new_scan_ptr_cfg(void);
404:
405: /* XFER_SEC.C */
406: void xfer_sec(void);
407: void scanalldirs(char mode);
408: void scandirs(char mode);
409:
410: /* MSWAIT.OBJ */
411:
412: void mswait(int msecs);
413:
414: #ifdef __OS2__
415: #define beep(f,d) DosBeep(f,d)
416: #else
417: void beep(int freq, int dur);
418: #endif
419:
420: void backslash(char *str);
421: void backslashcolon(char *str);
422: void getlines(void);
423: void strip_ctrl(char *str);
424: void strip_exascii(char *str);
425:
426: char wfc_events(time_t lastnodechk);
427: void catsyslog(int crash);
428: char waitforcall(void);
429: void quicklogonstuff(void);
430: char terminal(void);
431: void startup(int argc, char *argv[]);
432:
433: void crack_attempt(void);
434:
435: /*********************/
436: /* OS specific stuff */
437: /*********************/
438:
439: #ifdef __FLAT__
440:
441: #define lread(f,b,l) read(f,b,l)
442: #define lfread(b,l,f) fread(b,l,f)
443: #define lwrite(f,b,l) write(f,b,l)
444: #define lfwrite(b,l,f) fwrite(b,l,f)
445:
446: #endif
447:
448: #if (__BORLANDC__ > 0x0410)
449: #define _chmod(p,f,a) _rtl_chmod(p,f,a) // _chmod obsolete in 4.x
450: #endif
451:
452: #if defined(__OS2__)
453: #define lclini(x) window(1,1,80,x)
454: #define lclaes() conaes()
455: #define nosound() ;
456: #elif defined(__WIN32__)
457: #define lclini(x) window(1,1,80,x)
458: #define lclxy(x,y) gotoxy(x,y)
459: #define lclwy() wherey()
460: #define lclwx() wherex()
461: #define lputs cputs
462: #define nosound() ;
463: #elif defined(__FLAT__)
464: #define mswait(x) delay(x)
465: #endif
466:
467: #ifndef __OS2__
468: #define outcon(ch) lputc(ch)
469: #endif
470:
471:
472: #endif /* Don't add anything after this #endif statement */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.