home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume32 / xbbs / part06 < prev    next >
Encoding:
Text File  |  1992-09-08  |  63.2 KB  |  2,190 lines

  1. Newsgroups: comp.sources.misc
  2. From: sandy@godzilla.Quotron.COM (Sanford Zelkovitz)
  3. Subject:  v32i021:  xbbs - A Bulletin Board System for System V, Part06/11
  4. Message-ID: <1992Sep9.045245.26424@sparky.imd.sterling.com>
  5. X-Md4-Signature: 18316296d9955cb9461b7d60b6bf2455
  6. Date: Wed, 9 Sep 1992 04:52:45 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: sandy@godzilla.Quotron.COM (Sanford Zelkovitz)
  10. Posting-number: Volume 32, Issue 21
  11. Archive-name: xbbs/part06
  12. Environment: SYSV, Xenix
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  bbscdef.h bbscqust.c purge_mvfil.sh today/today.c
  19. #   xbbsgen/xbbsgen.c ymod.c
  20. # Wrapped by kent@sparky on Fri Sep  4 12:48:51 1992
  21. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  22. echo If this archive is complete, you will see the following message:
  23. echo '          "shar: End of archive 6 (of 11)."'
  24. if test -f 'bbscdef.h' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'bbscdef.h'\"
  26. else
  27.   echo shar: Extracting \"'bbscdef.h'\" \(8247 characters\)
  28.   sed "s/^X//" >'bbscdef.h' <<'END_OF_FILE'
  29. X/*
  30. X        bbscdef.h
  31. X
  32. X        Global defines and storage definitions for use by
  33. X        BBSc system.
  34. X        Last modification date: Mar  21, 1990
  35. X                  Version 7.91 and above!
  36. X
  37. X*/
  38. X
  39. X
  40. X
  41. X/* --------------------------------------------------------------------- */
  42. X#include <stdio.h>
  43. X#define MAXLINE 82
  44. X#define CPMEOF 0x1a
  45. X#define TRUE      1
  46. X#define FALSE     0
  47. X#define ERROR    -1
  48. X#define OK        1
  49. X#define READ      0
  50. X#define WRITE     1
  51. X#define UPDATE    2
  52. X#define STDIN     0
  53. X#define STDOUT    1
  54. X/* --------------------------------------------------------------------- */
  55. X
  56. X#define ESC       0x1b
  57. X#define CR        0x0d
  58. X#define LF        0x0a
  59. X#define BELL      0x07                  /* Avon calling */
  60. X#define CRLF      "\r\n"                /* <cr><lf> */
  61. X#define CTL_D     0x04                  /* <ctl-d> */
  62. X#define CTL_K     0x0b                  /* <ctl-k> */
  63. X#define CTL_X     0x18                  /* <ctl-x> */
  64. X
  65. X
  66. X#define IF_MONITOR TRUE                 /* Set True if you want to monitor
  67. X                                           the input/output on another
  68. X                                           device                     */
  69. X/*      defines used by the bbscfile.c routine     */
  70. X
  71. X#define MSG1MAX 102             /* max. piece of message to put in 128 */
  72. X                                /*  byte chunk of msg file */
  73. X#define MSGSECT 128             /* size of message sector */
  74. X
  75. X/*                      end of defines used by the bbscfile.c routine */
  76. X#define MESSAGES  "messages.bbs"        /* file name */
  77. X#define HEADER    "header.bbs"
  78. X#define MSGLOG    "messages.log"
  79. X#define BBSMAIL   "/usr/spool/mail/bbsuser"             /* group mail */
  80. X#define CROSSREF  "crossref.bbs"
  81. X#define FILES     "files.bbs"
  82. X#define TMPFILE   "/tmp/files"
  83. X#define FLIST     "/tmp/flist"
  84. X#define STDERR    "/tmp/error_out"
  85. X#define SYSTTY    "/tmp/ttydev"
  86. Xchar FOO[10];
  87. Xchar TAR[50];
  88. Xchar ZCAT[50];
  89. Xchar ARC[50];
  90. Xchar ZIP[50];
  91. Xchar MONITOR[30];               /* Monitor device */
  92. Xchar CONSOLE[30];               /* The main console */
  93. Xchar WELCOME[50];       /* file name */
  94. Xchar BULLETINS[50];     /* file name */
  95. Xchar NEWUSER[50];       /* file name */
  96. Xchar SYSTEM[50];        /* file name */
  97. Xchar CALLERS[50];       /* file name */
  98. Xchar LASTCALL[50];      /* file name */
  99. Xchar USERS[50];         /* file name */
  100. Xchar QUESTION[50];
  101. Xchar LISTFILES[50];
  102. Xchar ANSWER[50];
  103. Xchar UNIXMSG[50];
  104. Xchar DLMSG[50];         /* Download message */
  105. Xchar HUMOR[50];         /* file name */
  106. Xchar HELP[50];          /* file name */
  107. Xchar HELPFILE[50];
  108. Xchar HELPMSG[50];
  109. Xchar USERPRIV[50];
  110. Xchar MAINPRIV[50];
  111. Xchar FILEPRIV[50];
  112. Xchar ADDITN[50];
  113. Xchar TODAY[99];
  114. Xchar ORGPATH[50];
  115. Xchar AREAS[50];
  116. Xchar SIGS[50];
  117. Xchar MSGS[50];
  118. Xchar USRBBS[50];
  119. Xchar RB[50];
  120. Xchar SB[50];
  121. Xchar RZ[50];
  122. Xchar SZ[50];
  123. Xchar CRCR[50];
  124. Xchar CRCS[50];
  125. Xchar YMDR[50];
  126. Xchar YMDS[50];
  127. Xchar YMS[50];
  128. Xchar YMR[50];
  129. Xchar KS[50];
  130. Xchar KRA[50];
  131. Xchar KRE[50];
  132. Xchar SEAR[50];
  133. Xchar SEAS[50];
  134. Xchar SYSOP[30]; 
  135. Xchar SHELL[30];
  136. Xint LOGTIME;    /* Login Time    */
  137. Xint RUNTIME;    /* Usage Time    */
  138. Xint WAITTIME;   /* Response Time */
  139. Xint NEWPRIV;
  140. Xint MAXPRIV;
  141. Xint MAXSEC;
  142. Xint MAXKBYTE;
  143. X
  144. X
  145. X                                /* global variables */
  146. Xchar    portin();               /* in routine returns a character */
  147. Xchar    *gb4sin();              /* returns pointer to character */
  148. X
  149. XFILE    *inbuf ;                /* handy input buffer pointer */
  150. XFILE    *otbuf ;                /* another handy buffer pointer */
  151. XFILE    *itbuf ;                /* pointer used to read/write user file */
  152. XFILE    *rdstatbuf;
  153. XFILE    *wtstatbuf;
  154. XFILE    *STDerr;
  155. X
  156. Xchar    w_fname[25];            /* first name on signon */
  157. Xchar    w_lname[25];            /* last  name on signon */
  158. Xchar    w_password[13];         /* password   on signon */
  159. Xchar    *passptr;               /* ptr to password */
  160. X
  161. X                                /* define user file fields */
  162. Xchar    u_fname[25];
  163. Xchar    u_lname[25];
  164. Xchar    u_password[13];
  165. Xchar    u_time1[12];            /* first time on system */
  166. Xchar    u_date1[9];             /* first date on system */
  167. Xchar    u_time2[12];            /* last  time on system */
  168. Xchar    u_date2[9];             /* last  date on system */
  169. Xchar    u_city[31];             /* city, state */
  170. X
  171. Xchar    z_date[9];
  172. Xchar    z_time[9];
  173. X                                /* define message file fields   */
  174. Xchar    msg_no[12];             /* message number */
  175. Xchar    msg_date[10];           /* date of message */
  176. Xchar    msg_time[16];           /* time of message */
  177. Xchar    msg_to[22];             /* who message is to */
  178. Xchar    msg_from[22];           /* who message is from */
  179. Xchar    msg_pass[12];           /* password */
  180. Xchar    msg_subject[22];        /* what it's all about */
  181. X#define MAX_MSG_LINES   99
  182. Xchar    msg_text[(MAX_MSG_LINES * 74)+74];         /* text of message MAX_MSG_LINES lines */
  183. X                                /*  by 72 wide */
  184. Xchar    msg_delete[3];          /* indicates msg status */
  185. X                                /*  0 = active */
  186. X                                /*  9 = deleted */
  187. X                                /*  5 = active private */
  188. Xchar    pubpriv[2];             /* temporary message type */
  189. X
  190. Xchar    z_mm[3];
  191. Xchar    z_dd[3];
  192. Xchar    z_yy[3];
  193. Xchar    buf128[384];
  194. X
  195. Xchar    l_m_base[3];
  196. Xchar    l_f_base[3];
  197. Xchar    xprt_a[2];
  198. Xchar    tggl_a[2];
  199. X
  200. Xint     maxkbyte,
  201. X        logtime,
  202. X        runtime,
  203. X        waittime,
  204. X        newpriv;
  205. Xint     mon_handle;             /* Monitor Handle */
  206. Xint     debug;                  /* switch for debug mode */
  207. Xint     offline;                /* switch for offline mode */
  208. Xint     xpert;                  /* switch */
  209. Xint     toggle;                 /* switch for list mode */
  210. Xint     which_timer;
  211. Xint     char_in_passwd;         /* Number of characters in the password */
  212. Xint     if_monitor;
  213. Xint     in_the_buffer;
  214. Xint     active;                 /* indicates if logged on */
  215. Xint     statcnt;                /* count used for status routines */
  216. Xint     stop_that;              /* switch - true indicates ctl-K */
  217. X                                /*  or K received in portout routine */
  218. X                                /* date/time fields - used by bbsclock.c */
  219. X/*
  220. X ****************** Start of Priv Table *********************
  221. X*/
  222. Xint     mpB,
  223. X        mpK,
  224. X        mpE,
  225. X        mpG,
  226. X        mpN,
  227. X        mpQ,
  228. X        mpR,
  229. X        mpS,
  230. X        mpW,
  231. X        mpM,
  232. X        mpX,
  233. X        mpF,
  234. X        mpC,
  235. X        mpH,
  236. X        mpT,
  237. X        mpD,
  238. X        mpY,
  239. X        mpP,
  240. X        mpA,
  241. X        mpU,
  242. X        mpCHAT,
  243. X        mpQUEST,
  244. X        mpMS,
  245. X        mpRF,
  246. X        mpCONF,
  247. X    mpUSENET,
  248. X        mpL,
  249. X        mpZ;
  250. Xint     fpL,
  251. X        fpU,
  252. X        fpD,
  253. X        fpM,
  254. X        fpG,
  255. X        fpR;
  256. X/*
  257. X **************** End of Priv Table *******************
  258. X*/
  259. Xchar    mm[3];
  260. Xchar    dd[3];
  261. Xchar    yy[3];
  262. Xchar    month[20];              /* ie. January */
  263. Xchar    day[3];                 /* dd */
  264. Xchar    year[5];                /* 19yy */
  265. Xchar    date[30];               /* ie. January 31, 1983 */ 
  266. Xchar    week[20];               /* day of week Monday, Tuesday... */
  267. Xchar    ttime[12];              /* time of day  HH:MM:SS xM */
  268. X                                /*          where x = A or P */
  269. X
  270. X/*                      variables used by the bbscfile.c routine */
  271. X
  272. Xchar    h_next_msg[10];         /* next avail. message # */
  273. Xchar    h_date[10];             /* last update date of header file */
  274. Xchar    h_act_msg[10];
  275. Xchar    jnk[2];
  276. Xint     lnctx;
  277. Xint     chat_in_progress;
  278. Xint     stop_chat;
  279. Xint     h_act;
  280. Xint     h_next;                 /* next avail. message # in integer */
  281. Xlong    xtable[1000];
  282. Xlong    save_d_pos;
  283. X
  284. Xlong    d_pos;
  285. Xlong    old_long_date;
  286. Xlong    new_long_date;
  287. Xlong    xmm;
  288. Xlong    xdd;
  289. Xlong    xyy;
  290. Xchar    f_pathname[99];
  291. Xchar    u_pathname[99];
  292. Xchar    m_pathname[99];
  293. Xchar    c_pathname[99];
  294. Xchar    area_name[80];
  295. Xchar    f_pathtext[80];
  296. X
  297. X/*                      end of variables used by bbscfile.c */
  298. X/*         Variables used by xmodem.c               */
  299. Xchar    x_filename[99];         /* filename */
  300. Xchar    x_pathandfile[512];      /* the full string */
  301. Xchar    who_am_i[99];
  302. Xchar    who_am_I[99];
  303. Xchar    f_lines[99][83];
  304. Xint     dir_priv[99];
  305. X
  306. X                        /* end of globals */
  307. X
  308. X/* end of program */
  309. END_OF_FILE
  310.   if test 8247 -ne `wc -c <'bbscdef.h'`; then
  311.     echo shar: \"'bbscdef.h'\" unpacked with wrong size!
  312.   fi
  313.   # end of 'bbscdef.h'
  314. fi
  315. if test -f 'bbscqust.c' -a "${1}" != "-c" ; then 
  316.   echo shar: Will not clobber existing file \"'bbscqust.c'\"
  317. else
  318.   echo shar: Extracting \"'bbscqust.c'\" \(10548 characters\)
  319.   sed "s/^X//" >'bbscqust.c' <<'END_OF_FILE'
  320. X#include <string.h>
  321. X#include <ctype.h>
  322. X#include <stdio.h>
  323. X#include <sys/types.h>
  324. X#include <sys/locking.h>
  325. X#include <sys/stat.h>
  326. X#include "bbscdef.h"
  327. Xstruct stat statbuf;
  328. Xchar QST_FILE[50];
  329. X/*
  330. X    The following questionnaire commands are available for usage:
  331. X    Command           Description
  332. X      !               Output the rest of the line and wait for an input
  333. X      ^               Same as '!' except strlen of input must be > 0
  334. X      @               Output the rest of the line and send a \n\r
  335. X      &               Same as '@' without a terminal \n\r
  336. X      $               Input line
  337. X      *               Same as '$' except strlen of input must be > 0
  338. X      %               Output \n\r
  339. X      Y || y          Output line and set flag true if answer is a Y or y
  340. X      N || n          Output line and set flag true if answer is an N or n
  341. X      {               Start conditional response based on flag = true
  342. X      }               End conditional response
  343. X      /               Exit questionnaire - normally used as a conditional
  344. X                      statement
  345. X
  346. X      The COMMAND is in column one of line
  347. X*/
  348. Xquestion(typeofqst)
  349. Xint typeofqst;
  350. X{
  351. X        int result, fds, var;
  352. X        char *ptr;
  353. X        var = FALSE;
  354. X    result=change_qst(0, typeofqst);
  355. X        if( result != 0)
  356. X        {
  357. X                portsout("\n\rThere is NO questionnaire today!\n\r");
  358. X                return;
  359. X        }
  360. X        if((inbuf=fopen(QST_FILE,"r")) == NULL)
  361. X        {
  362. X                portsout("\n\rThat questionnaire was not found -- notify the sysop!\n\r");
  363. X                return;
  364. X        }
  365. X        if((otbuf=fopen(ANSWER,"a+")) == NULL)
  366. X        {
  367. X                portsout("\n\rError opening answer file!\n\r");
  368. X                exit (1);
  369. X        }
  370. X        fds = fileno(otbuf);
  371. X        rewind (otbuf);
  372. X        locking(fds, LK_LOCK, 0L);
  373. X    lseek(fds, 0L, 2);
  374. X        fprintf(otbuf,"%s\n","***********************************************");
  375. X        fprintf(otbuf, "%s %s    %s %s %s\n", w_fname, w_lname, week, date, ttime);
  376. Xnext_qloop:
  377. X        while ((fgets(buf128, 80, inbuf)) != NULL )
  378. X        {
  379. X                strip(buf128);
  380. X                if(buf128[0] == '$')
  381. X                {
  382. X                        portsout("\n\r? ");
  383. X                        portsin(buf128,80);
  384. X                        fprintf(otbuf, "%s\n", buf128);
  385. X                        continue;
  386. X                }
  387. X                if(buf128[0] == '*')
  388. X                {
  389. X            while (1) {
  390. X                               portsout("\n\r? ");
  391. X                               portsin(buf128,80);
  392. X                if( strlen(buf128) > 0 )
  393. X                    break;
  394. X                portsout("\n\rInput is required.");
  395. X            }
  396. X            
  397. X                           fprintf(otbuf, "%s\n", buf128);
  398. X                        continue;
  399. X                }
  400. X                if(buf128[0] == '!')
  401. X                {
  402. X                        ptr = buf128 + 1;
  403. X                        portsout(CRLF);
  404. X                        portsout(ptr);
  405. X                        portsout(" ? ");
  406. X                        portsin(buf128,80);
  407. X                        fprintf(otbuf, "%s\n", buf128);
  408. X                        continue;
  409. X                }
  410. X                if(buf128[0] == '^')
  411. X                {
  412. X                        ptr = buf128 + 1;
  413. X                        portsout(CRLF);
  414. X                        portsout(ptr);
  415. X                        portsout(" ? ");
  416. X            while(1) {
  417. X                            portsin(buf128,80);
  418. X                if( strlen(buf128) > 0 )
  419. X                    break;
  420. X                portsout("\n\rInput is required.");
  421. X                               portsout("\n\r? ");
  422. X            }
  423. X                        fprintf(otbuf, "%s\n", buf128);
  424. X                        continue;
  425. X                }
  426. X                if(buf128[0] == '@')
  427. X                {
  428. X                        ptr = buf128 + 1;
  429. X                        portsout(CRLF);
  430. X                        portsout(ptr);
  431. X                        portsout(CRLF);
  432. X                        continue;
  433. X                }
  434. X                if(buf128[0] == '&')
  435. X                {
  436. X                        ptr = buf128 + 1;
  437. X                        portsout(CRLF);
  438. X                        portsout(ptr);
  439. X                        continue;
  440. X                }
  441. X                if(buf128[0] == '%' )
  442. X                {
  443. X                        portsout(CRLF);
  444. X                        continue;
  445. X                }
  446. X                if(buf128[0] == 'y' || buf128[0] == 'Y')
  447. X                {
  448. X                        ptr = buf128 + 1;
  449. X                        portsout(CRLF);
  450. X                        portsout(ptr);
  451. X                        portsout(" ? ");
  452. X                        portsin(buf128,1);
  453. X                        if(buf128[0] == 'Y' || buf128[0] == 'y') var = TRUE;
  454. X                        else var = FALSE;
  455. X                        continue;
  456. X                }
  457. X                if(buf128[0] == 'n' || buf128[0] == 'N')
  458. X                {
  459. X                        ptr = buf128 + 1;
  460. X                        portsout(CRLF);
  461. X                        portsout(ptr);
  462. X                        portsout(" ? ");
  463. X                        portsin(buf128,1);
  464. X                        if(buf128[0] == 'N' || buf128[0] == 'n') var = TRUE;
  465. X                        else var = FALSE;
  466. X                        continue;
  467. X                }
  468. X                if(buf128[0] == '/')
  469. X                {
  470. X                        rewind(otbuf);
  471. X                        locking(fds, LK_UNLCK, 0L);
  472. X                        fclose(inbuf);
  473. X                        fclose(otbuf);
  474. X                        return;
  475. X                }
  476. X                if(buf128[0] == '{' && var == TRUE ) continue;
  477. X                if(buf128[0] == '{')
  478. X                {
  479. X                        while ((fgets(buf128, 80, inbuf)) != NULL )
  480. X                        {
  481. X                                strip(buf128);
  482. X                                if(buf128[0] == '}')
  483. X                                goto next_qloop;
  484. X                        }
  485. X                        rewind(otbuf);
  486. X                        locking(fds, LK_UNLCK, 0L);
  487. X                        fclose(inbuf);
  488. X                        fclose(otbuf);
  489. X                        return;
  490. X                }
  491. X                if(buf128[0] == '}') continue;
  492. X        }
  493. X        rewind(otbuf);
  494. X        locking(fds, LK_UNLCK, 0L);
  495. X        fclose(inbuf);
  496. X        fclose(otbuf);
  497. X}
  498. X
  499. X
  500. Xint             set_yet_q = TRUE;
  501. Xextern int      user_priv;
  502. X
  503. X
  504. Xint change_qst( type, typeofqst ) int type, typeofqst;
  505. X{
  506. X        FILE           *fpt, *fopen();
  507. X        char           *fgets(), *getenv();
  508. X        char            choice[4];
  509. X#ifndef SYSV
  510. X        char            dir_priv_ascii[7];
  511. X#endif
  512. X#ifdef SYSV
  513. X        char            dir_priv_ascii[20];
  514. X#endif
  515. X
  516. X        char           *buf_ptr;
  517. X        int             line_cnt, ret, i;
  518. X        int             index_value, ptr;
  519. X        int             length;
  520. X
  521. X
  522. Xdo_again:
  523. X        strcpy(buf128, QUESTION);
  524. X
  525. X        if ((fpt = fopen(buf128, "r")) == NULL) {
  526. X                portsout("\n\rError Opening Questionnaire List: Notify Sysop!\n\r");
  527. X                return (-1);
  528. X        }
  529. X        if(!type) {
  530. X        portsout("\n\r    Questionnaire     Description                                      \n\r");
  531. X        portsout("    ============= ========================================== \n\r");
  532. X        }
  533. X
  534. X        line_cnt = 0;
  535. X        while (fpt) {
  536. X        zfl(f_lines[line_cnt], 81);
  537. X                if ((fgets(f_lines[line_cnt], 80, fpt)) == NULL) {
  538. X                        if (line_cnt == 0) {
  539. X                                portsout("\n\rEOF Unexpected in Questionnaire List: Notify Sysop!\n\r");
  540. X                                return (-1);
  541. X                        }
  542. X                        break;  /* if not 1st line */
  543. X                }               /* end of if ((fgets)) */
  544. X                if (line_cnt > 0) {
  545. X                        length = strlen(f_lines[line_cnt]);
  546. X                        length -= 57;
  547. X                        if(length > 6)
  548. X                                length = 6;
  549. X                        substr(f_lines[line_cnt], dir_priv_ascii, 57, length);
  550. X                        dir_priv[line_cnt] = atoi(dir_priv_ascii);
  551. X                        if (dir_priv[line_cnt] > user_priv)
  552. X                                goto next_read;
  553. X                        strcpy(who_am_i, f_lines[line_cnt]);
  554. X                        buf_ptr = who_am_i;
  555. X                        buf_ptr += 56;
  556. X                        for (ptr = 0; ptr < 6; ptr++)
  557. X                                *buf_ptr++ = ' ';
  558. X            *buf_ptr='\0';
  559. X                        sprintf(buf128, "%2d) %s", line_cnt, who_am_i);
  560. X                        if(!type) {
  561. X                        strip(buf128);
  562. X                        term_space(buf128);
  563. X                        portsout(buf128);
  564. X                        portsout("\n\r");
  565. X                        }
  566. X                }
  567. Xnext_read:
  568. X                ++line_cnt;
  569. X        }                       /* end of while (fpt) */
  570. X        if (line_cnt <= 1)
  571. X                return;
  572. X        if (set_yet_q && !type) {
  573. X                portsout(CRLF);
  574. X    if(!typeofqst)
  575. X                portsout(" Q) Quit to Previous Menu");
  576. X        }
  577. X        if(!type)portsout(CRLF);
  578. X        fclose(fpt);
  579. X        if(!type)portsout(CRLF);
  580. X
  581. X        while (1) {
  582. X                if(!type) {
  583. X                portsout("Enter Selection ===> ");
  584. X        if(!typeofqst)
  585. X                   portsin_cmp(choice, 2, "Qq");
  586. X        else
  587. X            portsin(choice, 2);
  588. X                portsout(CRLF);
  589. X                *choice = toupper(*choice);
  590. X
  591. X                if (*choice == 'Q' && set_yet_q && !typeofqst)
  592. X                        return (-1);
  593. X
  594. X
  595. X                index_value = atoi(choice);
  596. X                }
  597. X                else index_value = type;
  598. X                if (index_value > 0 && index_value < line_cnt) {
  599. X                        if (dir_priv[index_value] <= user_priv) {
  600. X                                parse2arg(f_lines[index_value]);
  601. X                                set_yet_q = TRUE;
  602. X                                return (0);
  603. X                        }
  604. X                }
  605. X                if( type != 0 ) {
  606. X                        type = 0;
  607. X                        portsout("\n\rInvalid Questionnaire request!\n\r");
  608. X                        goto do_again;
  609. X                }
  610. X        }
  611. X}
  612. X
  613. X
  614. X
  615. X
  616. X
  617. Xparse2arg(string)
  618. X        char           *string;
  619. X{
  620. X
  621. X        register char  *file_ptr, *xptr;
  622. X        register int    i;
  623. X
  624. X        strcpy(QST_FILE, ORGPATH);
  625. X        file_ptr = (QST_FILE + strlen(QST_FILE));
  626. X
  627. X        i = 0;
  628. X        while (string[i] != ' ') {
  629. X                *file_ptr = string[i];
  630. X                ++file_ptr;
  631. X                ++i;
  632. X        }
  633. X        *file_ptr = '\0';
  634. X    strcpy(ANSWER, QST_FILE);
  635. X    strcat(QST_FILE, ".qst");
  636. X    strcat(ANSWER, ".ans");
  637. X
  638. X}
  639. END_OF_FILE
  640.   if test 10548 -ne `wc -c <'bbscqust.c'`; then
  641.     echo shar: \"'bbscqust.c'\" unpacked with wrong size!
  642.   fi
  643.   # end of 'bbscqust.c'
  644. fi
  645. if test -f 'purge_mvfil.sh' -a "${1}" != "-c" ; then 
  646.   echo shar: Will not clobber existing file \"'purge_mvfil.sh'\"
  647. else
  648.   echo shar: Extracting \"'purge_mvfil.sh'\" \(10136 characters\)
  649.   sed "s/^X//" >'purge_mvfil.sh' <<'END_OF_FILE'
  650. X
  651. XHere are the latest copies of the XBBS Sysop's utilities purge & mvfile.sh.
  652. XYou should find that they will run without modification with the exception of
  653. Xpurge which will require you to correct the path to allign.
  654. X
  655. X
  656. X===================  B E G I N N I N G    O F   P U R G E   ====================
  657. X:
  658. X# trap " put clean-up code here" 1 2 3 15
  659. X#purge
  660. X#    This script will assist the XBBS system operator in maintaining
  661. X#    the users lists.
  662. X#
  663. X#    Copyright Dighera Data Services  July 20, 1987
  664. X#
  665. X
  666. X# This command should assure that the user.bbs file has been 'alligned',
  667. X# then prompt the sysop for a date, range of dates, name, or other search
  668. X# criteria, present matching users names individually and ask if they should be
  669. X# purged, if yes, then purge their records from: user.bbs, userpriv.bbs, and 
  670. X# messages.log in each of the message directories.  The deletion is most easily
  671. X# accomplished with grep -vf , sed, awk, or ed.
  672. X
  673. XNAME="`basename $0`"                # The Name of this Script
  674. XHOMEDIR="`grep '^bbs:' /etc/passwd | awk -F\":\" '{print $6}'`"    # XBBS home dir
  675. XBINDIR="`head -21 $HOMEDIR/.config.bbs | tail -1`"        # XBBS binaries
  676. XUSERFIL="`head -7 $HOMEDIR/.config.bbs | tail -1`"        # Users dBASE
  677. XPRIVFIL="`head -13 $HOMEDIR/.config.bbs | tail -1`"        # Privlege File
  678. XMSGMENU="`head -23 $HOMEDIR/.config.bbs | tail -1`"        # Message Areas
  679. XMSGLOG="messages.log"                        # Message Log 
  680. Xexport NAME HOMEDIR BINDIR USERFIL PRIVFIL MSGMENU MSGLOG
  681. Xecho "\014\n\n\n\tX B B S    U S E R    P U R G E    M E N U \n\n"
  682. X#
  683. X#  Save a copy of all files that will be modified
  684. X#
  685. Xif [ -f ${USERFIL}.o ]
  686. Xthen
  687. X    echo "${USERFIL}.o exists.  Ok to overwrite it? \c"
  688. X    read ANS
  689. X    case $ANS in
  690. X        [yY]*) :;;
  691. X        *) echo "${NAME}: Aborting ..."; exit 1;;
  692. X    esac
  693. Xelse
  694. X    cp $USERFIL ${USERFIL}.o
  695. Xfi
  696. Xif [ -f ${PRIVFIL}.o ]
  697. Xthen
  698. X    echo "${PRIVFIL}.o exists.  Ok to overwrite it? \c"
  699. X    read ANS
  700. X    case $ANS in
  701. X        [yY]*) :;;
  702. X        *) echo "${NAME}: Aborting ..."; exit 1;;
  703. X    esac
  704. Xelse
  705. X    cp $PRIVFIL ${PRIVFIL}.o
  706. Xfi
  707. X#
  708. X# Allign the users file
  709. X#
  710. XFLAG=0; export FLAG
  711. Xecho "\nAllinging $USERFIL file ...\nPlease stand by ...\c"
  712. Xecho "$USERFIL" >/tmp/$NAME.tmp
  713. X# You will have put the path to your allign program here
  714. X#$BINDIR/allign/allign </tmp/$NAME.tmp 2>&1 > /dev/null || (echo "${NAME}: cannot allign, aborting ..."; FLAG=1)
  715. X$USERFIL/allign </tmp/$NAME.tmp 2>&1 > /dev/null || (echo "${NAME}: cannot allign, aborting ..."; FLAG=1)
  716. Xrm -f /tmp/$NAME.tmp
  717. Xif [ $FLAG -eq 1 ];then exit 1;fi
  718. X#
  719. X# Display Menu
  720. X#
  721. Xecho "\014"
  722. Xcat << EOT
  723. X
  724. X
  725. X        X B B S   U S E R    P U R G E    M E N U
  726. X
  727. X
  728. X    N.  Purge Users by NAME
  729. X    D.  Purge Users by DATE
  730. X    C.  Purge Users that have ONLY CALLED ONCE
  731. X    P.  Purge Users by PRIVLEGE LEVEL
  732. X    B.  Purge Users by PRIVLEGE LEVEL & ONLY CALLED ONCE
  733. X
  734. X    Q.  Quit to Unix
  735. X?
  736. XEOT
  737. Xread CHOICE
  738. Xcase $CHOICE in 
  739. X    [nN]*) echo "${NAME}: This command is not implemented yet";;
  740. X    [dD]*) echo "${NAME}: This command is not implemented yet";;
  741. X# 
  742. X# Find all user records with first-session-date = last-session-date, and
  743. X# present them for deletion from users data base.
  744. X#
  745. X    [cC]*) echo "\nSearching $USERFIL for One-time-callers...\c";
  746. X        rm -f /tmp/$NAME.found /tmp/$NAME.prv.rm /tmp/$NAME.priv > /dev/null 2>&1 ;
  747. X        awk -F"~" '$5 == $7 {print}' $USERFIL >> /tmp/$NAME.found && echo "Search Completed!";
  748. X# This trap needs to address processing the other files created by split
  749. X        if [ `wc -l /tmp/$NAME.found | awk '{print $1}'` -gt 900 ]
  750. X        then
  751. X            echo "File contains more than 900 lines; being split.."
  752. X            split /tmp/$NAME.found /tmp/$NAME.found.
  753. X            cp /tmp/$NAME.found.aa /tmp/$NAME.found
  754. X        fi;
  755. X        echo "Please stand by ... \c";
  756. X        for I in `awk -F"~" '{print $1"~"$2"~"}' /tmp/$NAME.found`
  757. X        do
  758. X            J="`echo \"$I\" | awk -F\"~\" '{print $1, $2, }'`"
  759. X            export J
  760. X            echo "\nPriv Record: \c"
  761. X            fgrep "$J" $PRIVFIL | tee /tmp/$NAME.priv
  762. X            if [ -s /tmp/$NAME/priv ]; then echo "\007";fi
  763. X            echo "User Record: \c"
  764. X            fgrep "$I" /tmp/$NAME.found
  765. X            echo "\n\tRemove (y,N,p,q)? \c"; read REMOVE
  766. X            case $REMOVE in
  767. X                [yY]*) echo "$I" >> /tmp/$NAME.rm;
  768. X                      cat /tmp/$NAME.priv >> /tmp/$NAME.prv.rm;;
  769. X                [pP]*) break;;
  770. X                [bB]*) echo "Not yet emplemented";;
  771. X                [qQ]*) exit 1;; # Add exit & clean up code here
  772. X                *) continue;;
  773. X            esac
  774. X            echo
  775. X        done;
  776. X        rm -f /tmp/$NAME.found /tmp/$NAME.priv;
  777. X        #
  778. X        # Create Purged  USERFIL
  779. X        #
  780. X    # This trap needs to address processing the other files created by split
  781. X        if [ `wc -l /tmp/$NAME.rm | awk '{print $1}'` -gt 200 ]
  782. X        then
  783. X            echo "File contains more than 200 lines; being split.."
  784. X            split /tmp/$NAME.rm /tmp/$NAME.rm.
  785. X            cp /tmp/$NAME.rm.aa /tmp/$NAME.rm
  786. X        fi
  787. X        fgrep -vf /tmp/$NAME.rm $USERFIL >${USERFIL}NEW;
  788. X        cp ${USERFIL}NEW $USERFIL && rm ${USERFIL}NEW;
  789. X        #
  790. X        # Create Purged PRIVFIL
  791. X        #
  792. X    # This trap needs to address processing the other files created by split
  793. X        if [ `wc -l /tmp/$NAME.prv.rm | awk '{print $1}'` -gt 200 ]
  794. X        then
  795. X            echo "File contains more than 200 lines; being split.."
  796. X            split /tmp/$NAME.prv.rm /tmp/$NAME.prv.rm.
  797. X            cp /tmp/$NAME.prv.rm.aa /tmp/$NAME.prv.rm
  798. X        fi
  799. X        fgrep -vf /tmp/$NAME.prv.rm $PRIVFIL >${PRIVFIL}NEW;
  800. X        cp ${PRIVFIL}NEW $PRIVFIL && rm ${PRIVFIL}NEW;
  801. X        #
  802. X        # Create Purged MSGFIL
  803. X        #
  804. X        for J in `awk 'NR > 1 {print $1}' $MSGMENU`
  805. X        do
  806. X            cd $BINDIR/$J
  807. X            fgrep -vf /tmp/$NAME.prv.rm $MSGLOG >${MSGLOG}NEW
  808. X            cp $MSGLOG o$MSGLOG && (cp ${MSGLOG}NEW $MSGLOG; rm ${MSGLOG}NEW)
  809. X        done;
  810. X        # add clean-up code here
  811. X        rm /tmp/$NAME.rm /tmp/$NAME.prv.rm;;
  812. X    [pP]*) echo "${NAME}: This command is not implemented yet";;
  813. X    [qQ]*) exit 0;;
  814. X    *) ;;
  815. Xesac
  816. Xexec $0
  817. X# trap 1 2 3 15
  818. X============================  E N D    O F    P U R G E  ====================
  819. X
  820. X===================  B E G I N N I N G    O F    M V F I L E . S H  ======
  821. X:
  822. X#mvfile.sh     Version 1.0 Beta
  823. X#    This Bourn shell script will assist the Sysop in moving
  824. X#    files that have been uploaded by XBBS users to their 
  825. X#    respective directories.
  826. X#
  827. X#    Copyright Dighera Data Services September 5, 1987
  828. X#
  829. X
  830. XNAME=`basename $0`    # The name of this program
  831. XSRCDIR=""        # Directory name containing files to be moved
  832. XDESTDIR=""        # Directory name that will receive file
  833. XJUNKDIR=/usr/tmp    # Destination for junked files
  834. XFLINE=""        # Line from files.bbs that describes file
  835. XHOMEDIR="`grep '^bbs:' /etc/passwd | awk -F\":\" '{print $6}'`"    # XBBS home dir
  836. XORGDIR=`cat $HOMEDIR/.config.bbs | awk 'NR == 21 {print}' -`    # XBBS Origin 
  837. XAREAS_BBS=`cat $HOMEDIR/.config.bbs | awk 'NR == 22 {print}' -`    # File w/ areas
  838. XAREAS=`cat $AREAS_BBS | awk 'NR > 1 { print $1 }'`    # All file areas
  839. X# AREA_NO=`expr \`wc -l $AREAS_BBS | awk '{print $1}'\` - 1`
  840. Xset $AREAS
  841. XAREA_NO=$#
  842. XMENU="cat /usr/tmp/$NAME.mnu"
  843. Xexport NAME HOMEDIR ORGDIR AREAS_BBS AREAS AREA_NO SRCDIR FLINE DESTDIR MENU SORT DAYS
  844. Xtrap "echo \"\007$0: Aborted\"; eval rm /usr/tmp/$NAME.mnu; exit 2" 1 2
  845. X
  846. X#    Make Menu File
  847. Xecho "\014\n\t    X B B S    F I L E    D I S P E R S A L    M E N U\n\n" > /usr/tmp/$NAME.mnu
  848. Xecho "\t\tEnter the Number of Your Choice --\n" >> /usr/tmp/$NAME.mnu
  849. Xfor I
  850. Xdo
  851. X    echo "$I" >> /usr/tmp/$NAME.mu
  852. Xdone
  853. Xcat /usr/tmp/$NAME.mu | pr -3t -n -o8 >>/usr/tmp/$NAME.mnu
  854. Xecho >> /usr/tmp/$NAME.mnu
  855. Xrm /usr/tmp/$NAME.mu
  856. X
  857. X#
  858. X#    Main Program Begins
  859. X#
  860. Xcd $ORGDIR    # No doubt this is the cause of the exec $0's failing
  861. X$MENU
  862. Xecho "Enter the Number of the Source Directory\ncontaining the files you wish to move: \c"
  863. Xread SRCDIR
  864. Xcase $SRCDIR in
  865. X  1[123] | [0123456789]) SRCDIR=`echo $AREAS | awk '{print $'$SRCDIR'}'`;;
  866. X  *) echo "Invalid Input\007"; sleep 3; exec $0;;     # Bug here $0
  867. Xesac
  868. X# This section needs work !!!!!!!!!!!!!!!!!!!!!
  869. Xwhile true
  870. Xdo
  871. X   head -6 /usr/tmp/$NAME.mnu
  872. X   cat << EOT
  873. X
  874. X    1.  Sort $SRCDIR ALPHABETICALLY (default)
  875. X    2.  Sort $SRCDIR REVERSED ALPHABETICAL
  876. X    3.  Sort $SRCDIR BEGINNING with Specific Characters
  877. X    4.  Sort $SRCDIR OLDest first
  878. X    5.  Sort $SRCDIR NEWest first
  879. X    6.  Show $SRCDIR files LESS THAN A NUMBER OF DAYS OLD
  880. X    7.  Show $SRCDIR files MORE THAN A NUMBER OF DAYS OLD
  881. X?
  882. XEOT
  883. X   read CHOICE
  884. X   case $CHOICE in
  885. X    1) CMD="ls $SRCDIR"; break;;
  886. X    2) CMD="ls -r $SRCDIR"; break;;
  887. X# The choice below only returns ONE filename; bug
  888. X    3) echo "\n\tEnter characters for begining of file name \c"; read SORT;
  889. X        CMD='basename `ls $SRCDIR/$SORT*`'; break;;
  890. X    4) CMD="ls -tr $SRCDIR"; break;;
  891. X    5) CMD="ls -t $SRCDIR"; break;;
  892. X# The two choices below don't fine any filenames; bug
  893. X    6) echo "Enter the NUMBER of DAYS";read DAYS; CMD="find $SRCDIR -ctime -$DAYS -print"; break;;
  894. X    7) echo "Enter the NUMBER of DAYS";read DAYS; CMD="find $SRCDIR -ctime +$DAYS -print"; break;;
  895. X    *) CMD="ls $SRCDIR"; break;;
  896. X   esac
  897. Xdone
  898. X#
  899. X#    Main Loop
  900. X#
  901. Xecho "$CMD"
  902. Xfor J in `eval "$CMD"`
  903. Xdo
  904. X   if [ ! -f $SRCDIR/$J ] ;then continue; fi    # Don't process directories
  905. X   $MENU
  906. X   echo "\tQ.\tQuit to Unix\n\tN.\tNext File (don't move this one)\n\tJ.\tJunk this File (in $JUNKDIR)\n"
  907. X   FLINE="`grep ^$J $SRCDIR/files.bbs || (echo \"\007$0: File $J probabily not referenced in $SRCDIR/files.bbs.\"; sleep 3; continue)`"
  908. X   test `echo "$FLINE" | wc -l` -gt 1 && (echo "\007$0: File $J probabily referenced more than once in $SRCDIR/files.bbs"; sleep 3 ; continue)
  909. X   echo "Move?: $FLINE\n"
  910. X   ls -la $SRCDIR/$J
  911. X   echo "\nEnter the Number of the Distination Directory: \c"
  912. X   read CHOICE
  913. X   case $CHOICE in
  914. X     [qQ]*) exit;;
  915. X     [nN]*) continue;;
  916. X    [jJ]*) mv $SRCDIR/$J $JUNKDIR;
  917. X         grep -v "$FLINE" $SRCDIR/files.bbs > /usr/tmp/$NAME.$$ || (echo " $0: grep error" ; sleep 3; continue);
  918. X        if [ -s /usr/tmp/$NAME.$$ ] ;then cp /usr/tmp/$NAME.$$ $SRCDIR/files.bbs
  919. X        else echo "\007$0: 0 length file error"; exit 1 ; fi
  920. X        rm /usr/tmp/$NAME.$$;
  921. X        echo $FLINE >> $JUNKDIR/files.bbs;;
  922. X     [0-9] | 1[0-2]) DESTDIR=`echo $AREAS | awk '{print $'$CHOICE'}'`;
  923. X         grep -v "$FLINE" $SRCDIR/files.bbs > /usr/tmp/$NAME.$$ || (echo " $0: grep error" ; sleep 3; continue);
  924. X        mv $SRCDIR/$J $DESTDIR;
  925. X        if [ -s /usr/tmp/$NAME.$$ ] ;then cp /usr/tmp/$NAME.$$ $SRCDIR/files.bbs
  926. X        else echo "\007$0: 0 length file error"; exit 1 ; fi
  927. X        rm /usr/tmp/$NAME.$$;
  928. X         echo $FLINE >> $DESTDIR/files.bbs;;
  929. X# Add edit option here for $DESTDIR/files.bbs
  930. X     *) echo "\007Your entery '$CHOICE' is not amoung the valid choices. Continuing ..."; sleep 2 ;;
  931. X   esac
  932. Xdone
  933. Xrm /usr/tmp/$NAME.mnu
  934. Xtrap 1 2 3 9 15
  935. X===========================  E N D    O F    M V F I L E . S H   =============
  936. X
  937. END_OF_FILE
  938.   if test 10136 -ne `wc -c <'purge_mvfil.sh'`; then
  939.     echo shar: \"'purge_mvfil.sh'\" unpacked with wrong size!
  940.   fi
  941.   # end of 'purge_mvfil.sh'
  942. fi
  943. if test -f 'today/today.c' -a "${1}" != "-c" ; then 
  944.   echo shar: Will not clobber existing file \"'today/today.c'\"
  945. else
  946.   echo shar: Extracting \"'today/today.c'\" \(10080 characters\)
  947.   sed "s/^X//" >'today/today.c' <<'END_OF_FILE'
  948. X/*
  949. X *            T O D A Y
  950. X *
  951. X * time of day
  952. X *
  953. X * Define UNIX for "native" Unix
  954. X */
  955. X
  956. X/*)BUILD    $(PROGRAM)    = today
  957. X        $(FILES)    = { today datetx timetx nbrtxt moontx }
  958. X        $(TKBOPTIONS)    = {
  959. X            TASK    = ...TOD
  960. X        }
  961. X*/
  962. X
  963. X#ifdef    DOCUMENTATION
  964. X
  965. Xtitle    today    Date and Time in English
  966. Xindex        Date and Time in English
  967. X
  968. Xsynopsis
  969. X
  970. X    today [-] [x] | [date]
  971. X
  972. Xdescription
  973. X
  974. X    Today prints the date, time, and phase of the moon in English.
  975. X    The following options are available:
  976. X    .lm +8
  977. X    .s.i -8;- or x    Read date strings from the standard input file.
  978. X    .s.i -8;date    Print information for the indicated date.
  979. X    .s.lm -8
  980. X    Date and time information is given in ISO numeric notation.  For
  981. X    example, November 6, 1980 would be represented as "801106".  If
  982. X    a time is needed, it would be appended to the date, using 24-hour
  983. X    notation: "801106110402" would be a time which is exact to the
  984. X    second.  To specify the century, the two-digit century number
  985. X    may be preceeded by '+' as in "+18801106".
  986. X    .s
  987. X    Non-numeric separators between the various fields are permitted:
  988. X    "+1776.07.04-11:15:21".  Note that the full two digit entry must be
  989. X    given.
  990. X    .s
  991. X    If no parameter is given, today outputs the current date and time.
  992. X
  993. Xdiagnostics
  994. X
  995. X    .lm +8
  996. X    .s.i -8;Bad parameters or date out of range in ...
  997. X    .s
  998. X    An input date or time is incorrect.
  999. X    .lm -8
  1000. X
  1001. Xauthor
  1002. X
  1003. X    Martin Minow
  1004. X
  1005. Xbugs
  1006. X
  1007. X    The algorithm is only valid for the Gregorian calender.
  1008. X
  1009. X#endif
  1010. X
  1011. X#define    APRIL_FOOLS
  1012. X
  1013. Xint    __narg    =    1;        /* No prompt if no args        */
  1014. X#define LINEWIDTH       72              /* Width of line                */
  1015. X
  1016. X#include <stdio.h>
  1017. X#include <time.h>
  1018. X#include <ctype.h>
  1019. X#undef NULL
  1020. X
  1021. X#define    NULL        0
  1022. X#define    EOS        0
  1023. X#define    FALSE        0
  1024. X#define    TRUE        1
  1025. X
  1026. Xint day_month[] = {            /* Needed for dotexttime()      */
  1027. X    0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
  1028. X};
  1029. Xint     ccpos;                          /* Current line position        */
  1030. Xchar    lastbyte;                       /* Memory for output()          */
  1031. Xchar    line[100];                      /* Data line for input function */
  1032. Xchar    *valptr;                        /* Needed for number converter  */
  1033. Xchar    wordbuffer[LINEWIDTH];          /* Buffer for output function   */
  1034. Xchar    *wordptr = wordbuffer;          /* Free byte in wordbuffer      */
  1035. Xchar    linebuffer[LINEWIDTH+2];    /* Output text buffer        */
  1036. Xchar    *lineptr = linebuffer;        /* Free byte in linebuffer    */
  1037. Xint     polish;                         /* Funny mode flag              */
  1038. Xint    sunrise;            /* Sunrise print flag        */
  1039. X
  1040. Xextern  char    *datetxt();             /* Date getter                  */
  1041. Xextern  char    *timetxt();             /* Time of day getter           */
  1042. Xextern  char    *moontxt();             /* Phase of the moon getter     */
  1043. X
  1044. Xmain(argc, argv)
  1045. Xint     argc;
  1046. Xchar    *argv[];
  1047. X/*
  1048. X * Driver for time routines.  Usage:
  1049. X *
  1050. X *      today                   Prints current time of day in readable form,
  1051. X *                              followed by a cookie.
  1052. X *
  1053. X *      today {+cc}yymmddhhmmss Prints indicated time of day.
  1054. X *                              Note, hh, mm, ss may be omitted.
  1055. X *                              For example:
  1056. X *                                today 401106     = Nov. 6, 1940
  1057. X *                                today +19401106  = Nov. 6, 1940
  1058. X *                                today 4011061015 = Nov. 6, 1940 10:15 AM
  1059. X *
  1060. X *      today -                 Data is read from the standard input and
  1061. X *      today x                 output as needed.  The format of each
  1062. X *                              line is identical to the command format.
  1063. X *                ("today x" is needed for vms.)
  1064. X */
  1065. X
  1066. X{
  1067. X    ccpos = 0;                      /* New line now                 */
  1068. X    wordptr = wordbuffer;           /* Nothing buffered             */
  1069. X    lineptr = linebuffer;        /* Nothing in output buffer too    */
  1070. X    polish = 0;            /* Normal mode            */
  1071. X    if (argc > 1 && tolower(argv[1][0]) == 'p') {
  1072. X        polish = 1;
  1073. X        argc--;
  1074. X        argv++;
  1075. X    }
  1076. X    sunrise = 0;
  1077. X    if (argc > 1 && tolower(argv[1][0]) == 's') {
  1078. X        sunrise = 1;
  1079. X        argc--;
  1080. X        argv++;
  1081. X    }
  1082. X
  1083. X    if (argc == 1) sunrise = 1;
  1084. X
  1085. X    if (argc == 2 && ((argv[1][0] == '-') || (argv[1][0] | 040) == 'x')) {
  1086. X        while (!getline()) {    /* Read and print times */
  1087. X            dotexttime(line);
  1088. X        }
  1089. X        return;
  1090. X    }
  1091. X    else if (argc > 1) {
  1092. X        if (dotexttime(argv[1]) == 0)
  1093. X            return;
  1094. X    }
  1095. X    /*
  1096. X     * Here if no parameters or an error in the parameter field.
  1097. X     */
  1098. X    dotime();            /* Print the time.              */
  1099. X    output("\n");               /* Space before cookie          */
  1100. X#ifdef    UNIX
  1101. X    execl(COOKIEPROGRAM, "cookie", 0);
  1102. X#endif
  1103. X}
  1104. X
  1105. Xdotime()
  1106. X/*
  1107. X * Print the time of day for Unix or VMS native mode.
  1108. X */
  1109. X{
  1110. X    long    tvec;                   /* Buffer for time function     */
  1111. X    struct  tm *localtime();    /* Unix time decompile function */
  1112. X    struct  tm *p;            /* Local pointer to time of day */
  1113. X    int     year;
  1114. X    int     month;
  1115. X    time(&tvec);                     /* Get the time of day          */
  1116. X    p = localtime(&tvec);           /* Make it more understandable  */
  1117. X    year = p->tm_year + 1900;
  1118. X    month = p->tm_mon + 1;
  1119. X#ifdef    APRIL_FOOLS
  1120. X    if (month == 4 && p->tm_mday == 1)
  1121. X        polish = !polish;
  1122. X#endif
  1123. X    process(year, month, p->tm_mday, p->tm_hour,
  1124. X             p->tm_min, p->tm_sec, p->tm_isdst);
  1125. X}
  1126. X
  1127. Xdotexttime(text)
  1128. Xchar    *text;                          /* Time text                    */
  1129. X/*
  1130. X * Create the time values and print them, return 1 on error.
  1131. X */
  1132. X
  1133. X{
  1134. X    int     epoch;                  /* Which century                */
  1135. X    int     year;
  1136. X    int     month;
  1137. X    int     day;
  1138. X    int     hour;
  1139. X    int     minute;
  1140. X    int     second;
  1141. X    int     leapyear;
  1142. X
  1143. X    valptr = text;                          /* Setup for getval()   */
  1144. X    while (*valptr == ' ') valptr++;        /* Leading blanks skip  */
  1145. X    if (*valptr != '+')
  1146. X        epoch = 1900;                   /* Default for now      */
  1147. X    else {
  1148. X        valptr++;
  1149. X        if ((epoch = getval(-1, 00, 99)) < 0) goto bad;
  1150. X        epoch *= 100;                   /* Make it a real epoch */
  1151. X    }
  1152. X
  1153. X    if ((year = getval(-1, 00, 99)) < 0) goto bad;
  1154. X    year += epoch;
  1155. X    leapyear = ((year%4) == 0) && (((year%400) == 0) || (year%100 != 0));
  1156. X    if ((month = getval(-1, 1, 12)) < 0) goto bad;
  1157. X    if ((day = getval(-1, 1,
  1158. X        (month == 2 && leapyear) ? 29 : day_month[month])) < 0)
  1159. X            goto bad;
  1160. X    if ((hour = getval(-2, 0, 23)) == -1) goto bad;
  1161. X    if ((minute = getval(-2, 0, 59)) == -1) goto bad;
  1162. X    if ((second = getval(-2, 0, 59)) == -1) goto bad;
  1163. X    process(year, month, day, hour, minute, second, 0);
  1164. X    return(0);                /* Normal exit        */
  1165. X
  1166. Xbad:    output("Bad parameters or date out of range in \"");
  1167. X    output(text);
  1168. X    output("\" after scanning \"");
  1169. X    *valptr = '\0';
  1170. X    output(text);
  1171. X    output("\".\n");
  1172. X    return(1);                /* Error exit        */
  1173. X}
  1174. X
  1175. Xstatic    char    outline[500];        /* Output buffer                */
  1176. X
  1177. Xprocess(year, month, day, hour, minute, second, daylight)
  1178. Xint     year;                           /* Year        1900 = 1900    */
  1179. Xint     month;                          /* Month    January = 1    */
  1180. Xint     day;                            /* Day        1 = 1        */
  1181. Xint    hour;                /* Hour        0 .. 23        */
  1182. Xint    minute;                /* Minute    0 .. 59        */
  1183. Xint    second;                /* Second    0 .. 59        */
  1184. Xint    daylight;            /* Daylight savings time if 1    */
  1185. X/*
  1186. X * Output the information.  Note that the parameters are within range.
  1187. X */
  1188. X{
  1189. X
  1190. X    output("Today is ");
  1191. X    datetxt(outline, year, month, day);
  1192. X    output(outline);
  1193. X    output(".  ");
  1194. X    timetxt(outline, hour, minute, second,
  1195. X            (polish) ? 0101010 : daylight);
  1196. X    output(outline);
  1197. X    if (sunrise) {
  1198. X      int sunrh, sunrm, sunsh, sunsm;
  1199. X      sun(&sunrh, &sunrm, &sunsh, &sunsm);
  1200. X      output("Sunrise is at ");
  1201. X      timetxt(outline, sunrh, sunrm, -2, -1);
  1202. X      output(outline);
  1203. X      output("; sunset is at ");
  1204. X      timetxt(outline, sunsh, sunsm, -2, -1);
  1205. X      output(outline);
  1206. X      output(".  ");
  1207. X      }
  1208. X/*    output("The moon is ");            */
  1209. X/*    moontxt(outline, year, month, day);    */
  1210. X    moontxt(outline);    /* replaced by smarter version */
  1211. X    output(outline);
  1212. X    output(".\n");
  1213. X
  1214. X}
  1215. X
  1216. X
  1217. Xoutput(text)
  1218. Xchar    *text;                                  /* What to print        */
  1219. X/*
  1220. X * Output routine.  Text is output using put() so that lines are
  1221. X * not more than LINEWIDTH bytes long.  Current position is in global ccpos.
  1222. X * (put is equivalent to putchar() except that it is locally buffered.)
  1223. X */
  1224. X{
  1225. X    register char    *in;                    /* Current pos. in scan */
  1226. X    register char    c;                      /* Current character    */
  1227. X    register char    *wp;            /* Word pointer        */
  1228. X
  1229. X    in = text;
  1230. X    while (c = *in++) {
  1231. X        switch (c) {
  1232. X        case '\n':                      /* Force new line       */
  1233. X        case ' ':                       /* or a space seen      */
  1234. X            if ((wordptr-wordbuffer) + ccpos >= LINEWIDTH) {
  1235. X                put('\n');  /* Current word         */
  1236. X                ccpos = 0;      /* won't fit, dump it.  */
  1237. X            }
  1238. X            if (wordptr > wordbuffer) {
  1239. X                if (ccpos) {    /* Leading space needed */
  1240. X                    put(' ');
  1241. X                    ccpos++;
  1242. X                }
  1243. X                for (wp = wordbuffer; wp < wordptr;) {
  1244. X                    put(*wp++);
  1245. X                }
  1246. X                ccpos += (wordptr - wordbuffer);
  1247. X                wordptr = wordbuffer;    /* Empty buffer    */
  1248. X            }
  1249. X            if (c == '\n') {
  1250. X                put('\n');    /* Print a newline    */
  1251. X                ccpos = 0;    /* and reset the cursor    */
  1252. X            }
  1253. X            break;
  1254. X
  1255. X        default:
  1256. X            *wordptr++ = c;         /* Save piece of word   */
  1257. X        }
  1258. X    }
  1259. X}
  1260. X
  1261. Xput(c)
  1262. Xregister char    c;
  1263. X/*
  1264. X * Actual output routine
  1265. X */
  1266. X{
  1267. X    if (c == '\n' || (lineptr - linebuffer) >= LINEWIDTH) {
  1268. X        *lineptr = EOS;
  1269. X        puts(linebuffer);
  1270. X        lineptr = linebuffer;
  1271. X        if (c == '\n')
  1272. X            return;
  1273. X    }
  1274. X    *lineptr++ = c;
  1275. X} 
  1276. X
  1277. Xgetline()
  1278. X/*
  1279. X * Read text to global line[].  Return 1 on end of file, zero on ok.
  1280. X */
  1281. X{
  1282. X    register char *t;
  1283. X
  1284. X    return (gets(line) == NULL);
  1285. X}
  1286. X
  1287. Xgetval(flag, low, high)
  1288. Xint     flag;
  1289. Xint     low;
  1290. Xint     high;
  1291. X/*
  1292. X * Global valptr points to a 2-digit positive decimal integer.
  1293. X * Skip over leading non-numbers and return the value.
  1294. X * Return flag if text[0] == '\0'. Return -1 if the text is bad,
  1295. X * or if the value is out of the low:high range.
  1296. X */
  1297. X{
  1298. X    register int value;
  1299. X    register int i;
  1300. X    register int temp;
  1301. X
  1302. X    if (*valptr == '\0') return(flag);        /* Default?             */
  1303. X    while (*valptr && (*valptr < '0' || *valptr > '9')) *valptr++;
  1304. X                /* The above allows for 78.04.22 format */
  1305. X    for (value = i = 0; i < 2; i++) {
  1306. X        temp = *valptr++ - '0';
  1307. X        if (temp < 0 || temp > 9) return(-1);
  1308. X        value = (value*10) + temp;
  1309. X    }
  1310. X    return((value >= low && value <= high) ? value : -1);
  1311. X}
  1312. X
  1313. END_OF_FILE
  1314.   if test 10080 -ne `wc -c <'today/today.c'`; then
  1315.     echo shar: \"'today/today.c'\" unpacked with wrong size!
  1316.   fi
  1317.   # end of 'today/today.c'
  1318. fi
  1319. if test -f 'xbbsgen/xbbsgen.c' -a "${1}" != "-c" ; then 
  1320.   echo shar: Will not clobber existing file \"'xbbsgen/xbbsgen.c'\"
  1321. else
  1322.   echo shar: Extracting \"'xbbsgen/xbbsgen.c'\" \(10128 characters\)
  1323.   sed "s/^X//" >'xbbsgen/xbbsgen.c' <<'END_OF_FILE'
  1324. X#include <sys/types.h>
  1325. X#include <stdio.h>
  1326. X#include <string.h>
  1327. X#include <sys/stat.h>
  1328. X#define    TAR    "tar"
  1329. X#define    ARC    "arc"
  1330. X#define ZIP    "zip"
  1331. X#define CONFIG    "/.config.bbs"
  1332. Xstruct stat statbuf;
  1333. Xlong atol();
  1334. Xmain()
  1335. X{
  1336. X    FILE *instream;
  1337. X    char    buffer[99], user[99], temp[99], bbs_soft[99], config_file[99];
  1338. X    int    i, result;
  1339. X    long    j;
  1340. X    printf("\nInput the full path name for the users home directory: ");
  1341. X    scanf("%s", user);
  1342. X    printf("\n");
  1343. X    strcpy(config_file, user);
  1344. X    strcat(config_file, CONFIG);
  1345. X    result = stat(config_file, &statbuf);
  1346. X    if(!result)
  1347. X    {
  1348. X        printf("\nThere already is a configuration file, please delete it or rename it!\n");
  1349. X        exit(1);
  1350. X    }
  1351. X    if((instream=fopen(config_file,"w")) == NULL)
  1352. X    {
  1353. X        printf("\nError opening configuration file for generation!\n");
  1354. X        exit(1);
  1355. X    }
  1356. X    printf("\nInput the directory name where the bbs software can be found: ");
  1357. X    scanf("%s", bbs_soft);
  1358. X    printf("\n");
  1359. X    strcpy(buffer,bbs_soft);
  1360. X    strcat(buffer, "/welcome.bbs\n");
  1361. X    fprintf(instream, "%s", buffer);
  1362. X    strcpy(buffer,bbs_soft);
  1363. X    strcat(buffer, "/bulletin.bbs\n");
  1364. X    fprintf(instream, "%s", buffer);
  1365. X    strcpy(buffer,bbs_soft);
  1366. X    strcat(buffer, "/newuser.bbs\n");
  1367. X    fprintf(instream, "%s", buffer);
  1368. X    strcpy(buffer,bbs_soft);
  1369. X    strcat(buffer,"/system.bbs\n");
  1370. X    fprintf(instream, "%s", buffer);
  1371. X    strcpy(buffer, bbs_soft);
  1372. X    strcat(buffer, "/callers.bbs\n");
  1373. X    fprintf(instream, "%s", buffer);
  1374. X    strcpy(buffer, bbs_soft);
  1375. X    strcat(buffer, "/lastcall.bbs\n");
  1376. X    fprintf(instream, "%s", buffer);
  1377. X    strcpy(buffer, bbs_soft);
  1378. X    strcat(buffer, "/users.bbs");
  1379. X    result = stat(buffer, &statbuf);
  1380. X    if( result != 0 )
  1381. X    {
  1382. X        strcpy(temp, "> ");
  1383. X        strcat(temp, buffer);
  1384. X        (void)system(temp);
  1385. X        strcpy(temp, "chown bbs ");
  1386. X        strcat(temp, buffer);
  1387. X        strcat(temp, "; chgrp root ");
  1388. X        strcat(temp, buffer);
  1389. X        strcat(temp, "; chmod 660 ");
  1390. X        strcat(temp, buffer);
  1391. X        (void)system(temp);
  1392. X    }
  1393. X    fprintf(instream, "%s\n", buffer);
  1394. X    strcpy(buffer, bbs_soft);
  1395. X    strcat(buffer, "/unixmsg.bbs\n");
  1396. X    fprintf(instream, "%s", buffer);
  1397. X    strcpy(buffer, bbs_soft);
  1398. X    strcat(buffer, "/dlmsg.bbs\n");
  1399. X    fprintf(instream, "%s", buffer);
  1400. X    strcpy(buffer, bbs_soft);
  1401. X    strcat(buffer, "/humor.bbs\n");
  1402. X    fprintf(instream, "%s", buffer);
  1403. X    strcpy(buffer, bbs_soft);
  1404. X    strcat(buffer, "/help.bbs\n");
  1405. X    fprintf(instream, "%s", buffer);
  1406. X    strcpy(buffer, bbs_soft);
  1407. X    strcat(buffer, "/helpfile.bbs\n");
  1408. X    fprintf(instream, "%s", buffer);
  1409. X    strcpy(buffer, bbs_soft);
  1410. X    strcat(buffer, "/helpmsg.bbs\n");
  1411. X    fprintf(instream, "%s", buffer);
  1412. X    strcpy(buffer, bbs_soft);
  1413. X    strcat(buffer, "/userpriv.bbs");
  1414. X    result = stat(buffer, &statbuf);
  1415. X    if( result != 0 )
  1416. X    {
  1417. X        strcpy(temp, "> ");
  1418. X        strcat(temp, buffer);
  1419. X        (void)system(temp);
  1420. X        strcpy(temp, "chown bbs ");
  1421. X        strcat(temp, buffer);
  1422. X        strcat(temp, "; chgrp root ");
  1423. X        strcat(temp, buffer);
  1424. X        strcat(temp, "; chmod 660 ");
  1425. X        strcat(temp, buffer);
  1426. X        (void)system(temp);
  1427. X    }
  1428. X    fprintf(instream, "%s\n", buffer);
  1429. X    strcpy(buffer, bbs_soft);
  1430. X    strcat(buffer, "/mainpriv.bbs\n");
  1431. X    fprintf(instream, "%s", buffer);
  1432. X    strcpy(buffer, bbs_soft);
  1433. X    strcat(buffer, "/filepriv.bbs\n");
  1434. X    fprintf(instream, "%s", buffer);
  1435. X    strcpy(buffer, bbs_soft);
  1436. X    strcat(buffer, "/question.bbs\n");
  1437. X    fprintf(instream, "%s", buffer);
  1438. X    strcpy(buffer, bbs_soft);
  1439. X    strcat(buffer, "/answer.bbs\n");
  1440. X    fprintf(instream, "%s", buffer);
  1441. X    strcpy(buffer, bbs_soft);
  1442. X    strcat(buffer, "/features.bbs\n");
  1443. X    fprintf(instream, "%s", buffer);
  1444. X    strcpy(buffer, bbs_soft);
  1445. X    strcat(buffer, "/listfile.bbs\n");
  1446. X    fprintf(instream, "%s", buffer);
  1447. X    strcpy(buffer, bbs_soft);
  1448. X    strcat(buffer, "/today > /tmp/today\n");
  1449. X    fprintf(instream, "%s", buffer);
  1450. X    strcpy(buffer, bbs_soft);
  1451. X    strcat(buffer, "/\n");
  1452. X    fprintf(instream, "%s", buffer);
  1453. X    strcpy(buffer, bbs_soft);
  1454. X    strcat(buffer, "/areas.bbs\n");
  1455. X    fprintf(instream, "%s", buffer);
  1456. X    strcpy(buffer, bbs_soft);
  1457. X    strcat(buffer, "/msgareas.bbs\n");
  1458. X    fprintf(instream, "%s", buffer);
  1459. X    strcpy(buffer, user);
  1460. X    strcat(buffer, "/\n");
  1461. X    fprintf(instream, "%s", buffer);
  1462. X    printf("\nInput the full path name for checksum: ");
  1463. X    scanf("%s", temp);
  1464. X    strcpy(buffer, temp);
  1465. X    strcat(buffer, " r \n");
  1466. X    fprintf(instream, "%s", buffer);
  1467. X    strcpy(buffer, temp);
  1468. X    strcat(buffer, " s \n");
  1469. X    fprintf(instream, "%s", buffer);
  1470. X    printf("\nInput the full path name for crc: ");
  1471. X    scanf("%s", temp);
  1472. X    strcpy(buffer, temp);
  1473. X    strcat(buffer, " r \n");
  1474. X    fprintf(instream, "%s", buffer);
  1475. X    strcpy(buffer, temp);
  1476. X    strcat(buffer, " s \n");
  1477. X    fprintf(instream, "%s", buffer);
  1478. X    printf("\nInput the full path name for ymod: ");
  1479. X    scanf("%s", temp);
  1480. X    strcpy(buffer, temp);
  1481. X    strcat(buffer, " r \n");
  1482. X    fprintf(instream, "%s", buffer);
  1483. X    strcpy(buffer, temp);
  1484. X    strcat(buffer, " s \n");
  1485. X    fprintf(instream, "%s", buffer);
  1486. X    printf("\nInput the full path name for rb: ");
  1487. X    scanf("%s", temp);
  1488. X    strcpy(buffer, temp);
  1489. X    strcat(buffer, "\n");
  1490. X    fprintf(instream, "%s", buffer);
  1491. X    printf("\nInput the full path name for sb: ");
  1492. X    scanf("%s", temp);
  1493. X    strcpy(buffer, temp);
  1494. X    strcat(buffer, " -k \n");
  1495. X    fprintf(instream, "%s", buffer);
  1496. X    printf("\nInput the full path name for rz: ");
  1497. X    scanf("%s", temp);
  1498. X    strcpy(buffer, temp);
  1499. X    strcat(buffer, "\n");
  1500. X    fprintf(instream, "%s", buffer);
  1501. X    printf("\nInput the full path name for sz: ");
  1502. X    scanf("%s", temp);
  1503. X    strcpy(buffer, temp);
  1504. X    strcat(buffer, " \n");
  1505. X    fprintf(instream, "%s", buffer);
  1506. X    printf("\nInput the full path name for kermit: ");
  1507. X    scanf("%s", temp);
  1508. X    strcpy(buffer, temp);
  1509. X    strcat(buffer, " -i -q -s \n");
  1510. X    fprintf(instream, "%s", buffer);
  1511. X    strcpy(buffer, temp);
  1512. X    strcat(buffer, " -i -w -q -r\n");
  1513. X    fprintf(instream, "%s", buffer);
  1514. X    strcpy(buffer, "ls ");
  1515. X    strcat(buffer, user);
  1516. X    strcat(buffer, " > /tmp/flist\n");
  1517. X    fprintf(instream, "%s", buffer);
  1518. X    printf("\nInput the full path name for sealink: ");
  1519. X    scanf("%s", temp);
  1520. X    strcpy(buffer, temp);
  1521. X    strcat(buffer, " -r \n");
  1522. X    fprintf(instream, "%s", buffer);
  1523. X    strcpy(buffer, temp);
  1524. X    strcat(buffer, " -s \n");
  1525. X    fprintf(instream, "%s", buffer);
  1526. X    printf("\nInput the first name of the sysop: ");
  1527. X    scanf("%s", temp);
  1528. X    fix_name(temp);
  1529. X    strcpy(buffer, temp);
  1530. X    printf("\nInput the last name of the sysop: ");
  1531. X    scanf("%s", temp);
  1532. X    fix_name(temp);
  1533. X    strcat(buffer, " ");
  1534. X    strcat(buffer, temp);
  1535. X    fprintf(instream, "%s\n", buffer);
  1536. X    printf("\nInput the number of SECONDS you will allow for a login: ");
  1537. X    scanf("%s", temp);
  1538. X    j = atol(temp);
  1539. X    if(j < 60L ) j=60L;
  1540. X    if(j > 32767L) j=32767L;
  1541. X    sprintf(buffer, "%ld", j);
  1542. X    fprintf(instream, "%s\n", buffer);
  1543. X    printf("\nInput the number of SECONDS you will allow for usage: ");
  1544. X    scanf("%s", temp);
  1545. X    j = atol(temp);
  1546. X    if(j < 60L ) j=60L;
  1547. X    if(j > 32767L) j=32767L;
  1548. X    sprintf(buffer, "%ld", j);
  1549. X    fprintf(instream, "%s\n", buffer);
  1550. X    printf("\nInput the number of SECONDS you will allow for response: ");
  1551. X    scanf("%s", temp);
  1552. X    j = atol(temp);
  1553. X    if(j < 60L ) j=60L;
  1554. X    if(j > 32767L) j=32767L;
  1555. X    sprintf(buffer, "%ld", j);
  1556. X    fprintf(instream, "%s\n", buffer);
  1557. X    printf("\nInput the privilege level for new users: ");
  1558. X    scanf("%s", temp);
  1559. X    j = atol(temp);
  1560. X    if(j < 1L ) j=1L;
  1561. X    if(j > 32767L) j=32767L;
  1562. X    sprintf(buffer, "%ld", j);
  1563. X    fprintf(instream, "%s\n", buffer);
  1564. X    printf("\nInput the maximum privilege level allowed to users: ");
  1565. X    scanf("%s", temp);
  1566. X    j = atol(temp);
  1567. X    if(j < 1L ) j=1L;
  1568. X    if(j > 32767L) j=32767L;
  1569. X    sprintf(buffer, "%ld", j);
  1570. X    fprintf(instream, "%s\n", buffer);
  1571. X    printf("\nInput the maximum number of seconds allowed to users: ");
  1572. X    scanf("%s", temp);
  1573. X    j = atol(temp);
  1574. X    if(j < 1L ) j=1L;
  1575. X    if(j > 32767L) j=32767L;
  1576. X    sprintf(buffer, "%ld", j);
  1577. X    fprintf(instream, "%s\n", buffer);
  1578. X    printf("\nInput the daily number of KILOBYTES allowed to users: ");
  1579. X    scanf("%s", temp);
  1580. X    j = atol(temp);
  1581. X    if(j < 1L ) j=1L;
  1582. X    if(j > 32767L) j=32767L;
  1583. X    sprintf(buffer, "%ld", j);
  1584. X    fprintf(instream, "%s\n", buffer);
  1585. X    printf("\nInput the full path name for tar: ");
  1586. X    scanf("%s", temp);
  1587. X    strcpy(buffer, temp);
  1588. X    strcat(buffer, " -tvf \n");
  1589. X    fprintf(instream, "%s", buffer);
  1590. X    printf("\nInput the full path name for zcat( link to compress): ");
  1591. X    scanf("%s", temp);
  1592. X    strcpy(buffer, temp);
  1593. X    strcat(buffer, " \n");
  1594. X    fprintf(instream, "%s", buffer);
  1595. X/*
  1596. X *    Starting with version 7.102, external arc and zip programs are
  1597. X *    no longer needed! To be compatible with the older .config.bbs files,
  1598. X *    we will just put something there for old time sake!
  1599. X *
  1600. X *    printf("\nInput the full path name for arc: ");
  1601. X *    scanf("%s", temp);
  1602. X *    strcpy(buffer, temp);
  1603. X *    strcat(buffer, " -v \n");
  1604. X *    fprintf(instream, "%s", buffer);
  1605. X *    printf("\nInput the full path name for unzip: ");
  1606. X *    scanf("%s", temp);
  1607. X *    strcpy(buffer, temp);
  1608. X *    strcat(buffer, " -v \n");
  1609. X *    fprintf(instream, "%s", buffer);
  1610. X*/
  1611. X
  1612. X    fprintf(instream, "/usr/bin/arc -v \n");   /*  fake arc  */
  1613. X    fprintf(instream, "/usr/bin/zip -v \n");   /*  fake zip  */
  1614. X
  1615. X
  1616. X    printf("\nInput the full path name of the dev driver for local monitoring: ");
  1617. X    scanf("%s", buffer);
  1618. X    fprintf(instream, "%s\n", buffer);
  1619. X    printf("\nInput the full path name for the console device driver: ");
  1620. X    scanf("%s", buffer);
  1621. X    fprintf(instream, "%s\n", buffer);
  1622. X    printf("\nInput the full path name for the SHELL and command switch");
  1623. X    printf("\nyou wish to use for the U(nix) option in the main menu.");
  1624. X    printf("\nExample: /bin/sh ");
  1625. X    printf("\n?  ");
  1626. X    scanf("%s", buffer);
  1627. X    fprintf(instream, "%s -i\n", buffer);
  1628. Xlogloop:
  1629. X    printf("\nDo wish to have the software do a message scan when the user\n");
  1630. X    printf("logs on? 1=yes, 0=no ..... ");
  1631. X    scanf("%s", temp);
  1632. X    i = atoi(temp);
  1633. X    if( i > 1 || i < 0) goto logloop;
  1634. X    sprintf(buffer, "%d", i);
  1635. X    fprintf(instream, "%s\n", buffer);
  1636. X    printf("\nInput the full path name to be used for the USENET reader.\n");
  1637. X    printf("Example: /usr/bin/readnews : ");
  1638. X    scanf("%s", buffer);
  1639. X    fprintf(instream, "%s\n", buffer);
  1640. X    printf("\nInput the full path name to be used for the USENET poster.\n");
  1641. X    printf("Example: /usr/bin/postnews : ");
  1642. X    scanf("%s", buffer);
  1643. X    fprintf(instream, "%s\n", buffer);
  1644. X    fclose(instream);
  1645. X    printf("\n\n\nConfiguration file has been generated!\n\n\n");
  1646. X}
  1647. Xfix_name(adr) char *adr ;
  1648. X    {
  1649. X    char *adrs, *str_ptr;
  1650. X    char tempbf[30];
  1651. X    adrs = adr ;
  1652. X    while(*adrs)
  1653. X        {
  1654. X        *adrs = tolower(*adrs) ;
  1655. X        adrs++ ;
  1656. X        }
  1657. X    while (1)
  1658. X        {
  1659. X        str_ptr = strrchr(adr, ' ');
  1660. X        if(str_ptr == NULL) break;
  1661. X        *str_ptr++ = '\0';
  1662. X        strcpy(tempbf, adr);
  1663. X        strcat(tempbf, str_ptr);
  1664. X        strcpy(adr,tempbf);
  1665. X        }
  1666. X    *adr = toupper(*adr) ;
  1667. X    }
  1668. END_OF_FILE
  1669.   if test 10128 -ne `wc -c <'xbbsgen/xbbsgen.c'`; then
  1670.     echo shar: \"'xbbsgen/xbbsgen.c'\" unpacked with wrong size!
  1671.   fi
  1672.   # end of 'xbbsgen/xbbsgen.c'
  1673. fi
  1674. if test -f 'ymod.c' -a "${1}" != "-c" ; then 
  1675.   echo shar: Will not clobber existing file \"'ymod.c'\"
  1676. else
  1677.   echo shar: Extracting \"'ymod.c'\" \(9777 characters\)
  1678.   sed "s/^X//" >'ymod.c' <<'END_OF_FILE'
  1679. X/*
  1680. X * A version of Ward Christensen's file transfer protocol for
  1681. X * Unix System V or 4.2 bsd.
  1682. X *
  1683. X *        Emmet P. Gray, ..!ihnp4!uiucuxc!fthood!egray, 16 Aug 85
  1684. X *
  1685. X * Modified by Sanford Zelkovitz   08/18/86
  1686. X * Last modification date = 05/20/87
  1687. X */
  1688. X
  1689. X#define SV
  1690. X#undef  BSD
  1691. X
  1692. X#include <stdio.h>
  1693. X#include <signal.h>
  1694. X#include <sys/types.h>
  1695. X#include <sys/stat.h>
  1696. X#ifdef SV
  1697. X#include <termio.h>
  1698. X#endif
  1699. X#ifdef BSD
  1700. X#include <sgtty.h>
  1701. X#endif
  1702. X
  1703. X#define MAXERRORS 10            /* max number of times to retry */
  1704. X#define SECSIZE    1024            /* CP/M sector, transmission block */
  1705. X#define CPMEOF    26            /* End Of File (for CP/M) */
  1706. X#define SOH     1
  1707. X#define STX    2            /* Start Of Header */
  1708. X#define EOT    4            /* End Of Transmission */
  1709. X#define ACK    6            /* ACKnowledge */
  1710. X#define NAK    21            /* Negative AcKnowledge */
  1711. X#define CAN    24            /* CANcel */
  1712. X
  1713. Xint synchron;
  1714. Xint exit_return;
  1715. Xunsigned char crc1, crc2;
  1716. X#ifdef SV
  1717. Xstruct termio ttyhold;
  1718. X#endif
  1719. X#ifdef BSD
  1720. Xstruct sgttyb ttyhold;
  1721. X#endif
  1722. X
  1723. Xmain(argc, argv)
  1724. Xint argc;
  1725. Xchar *argv[];
  1726. X{
  1727. X    int msgstat;
  1728. X    char *tty, *ttyname();
  1729. X    struct stat stbuf;
  1730. X    exit_return=0;
  1731. X    if (argc != 3) {
  1732. X        usage();
  1733. X        exit(1);
  1734. X    }
  1735. X    tty = ttyname(1);
  1736. X    stat(tty, &stbuf); 
  1737. X    msgstat = (stbuf.st_mode & 0777);
  1738. X    chmod(tty, 0600);            /* mesg n */
  1739. X#ifdef SV
  1740. X    ioctl(0, TCGETA, &ttyhold);        /* get current settings */
  1741. X#endif
  1742. X#ifdef BSD
  1743. X    ioctl(0, TIOCGETP, &ttyhold);
  1744. X#endif
  1745. X    switch (*argv[1]) {
  1746. X        case 'r':
  1747. X            recvfile(argv[2]);
  1748. X            break;
  1749. X        case 's':
  1750. X            sendfile(argv[2]);
  1751. X            break;
  1752. X        default:
  1753. X            usage();
  1754. X    }
  1755. X#ifdef SV
  1756. X    ioctl(0, TCSETAF, &ttyhold);        /* restore settings */
  1757. X#endif
  1758. X#ifdef BSD
  1759. X    ioctl(0, TIOCSETP, &ttyhold);
  1760. X#endif
  1761. X    chmod(tty, msgstat);            /* restore mesg status */
  1762. X    exit(exit_return);
  1763. X}
  1764. X
  1765. X/* send a file to the remote */
  1766. Xsendfile(tfile)
  1767. Xchar *tfile;
  1768. X{
  1769. X    FILE *fp;
  1770. X    unsigned char chr, checksum, block, sector[SECSIZE];
  1771. X    int i, mode, nbytes, errcount, size, speed;
  1772. X    long min, sec;
  1773. X    static int baud[15] = {0, 50, 75, 110, 134, 150, 200,
  1774. X    300, 600, 1200, 1800, 2400, 4800, 9600, 19200};
  1775. X    struct stat sbuf;
  1776. X
  1777. X    if (!(fp = fopen(tfile, "r"))) {
  1778. X        fprintf(stderr, "xmodem: Can't open '%s' for read\r\n", tfile);
  1779. X        exit_return=1;
  1780. X        return;
  1781. X    }
  1782. X    stat(tfile, &sbuf);
  1783. X    size = (sbuf.st_size / 1024) + 1;
  1784. X#ifdef SV
  1785. X    speed = baud[ttyhold.c_cflag & 017];
  1786. X#endif
  1787. X#ifdef BSD
  1788. X    speed = baud[ttyhold.sg_ispeed];
  1789. X#endif
  1790. X    sec = size;
  1791. X    sec = sec * 1024L * 11L / speed;
  1792. X    min = sec / 60L;
  1793. X    sec = sec - min * 60L;
  1794. X    printf("File open: %d records\r\n", size);
  1795. X    printf("Send time: %ld min, %ld sec at %d baud\r\n", min, sec, speed);
  1796. X    printf("To cancel: use CTRL-X numerous times\r\n");
  1797. X    printf("Waiting ready signal\r\n");
  1798. X
  1799. X    rawmode();
  1800. X    errcount = 0;
  1801. X    mode = 0;
  1802. X    block = 1;
  1803. X    while (errcount < MAXERRORS) {
  1804. X        chr = getchar_t();
  1805. X        if (chr == NAK)            /* checksum mode */
  1806. X            break;
  1807. X        if (chr == 'C') {        /* CRC mode */
  1808. X            mode = 1;
  1809. X            break;
  1810. X        }
  1811. X        errcount++;
  1812. X    }
  1813. X    if (errcount == MAXERRORS) {
  1814. X        sleep(3);
  1815. X        fprintf(stderr, "xmodem: Timed out on acknowledge\r\n");
  1816. X        exit_return=1;
  1817. X        return;
  1818. X    }
  1819. X    while (nbytes = fread(sector, sizeof(sector[0]), SECSIZE, fp)) {
  1820. X        if (nbytes < SECSIZE) {        /* fill short sector */
  1821. X            for (i=nbytes; i < SECSIZE; i++)
  1822. X                sector[i] = CPMEOF;
  1823. X        }
  1824. X        errcount = 0;
  1825. X        while (errcount < MAXERRORS) {
  1826. X            putchar(STX);        /* the header */
  1827. X            putchar(block);        /* the block number */
  1828. X            chr = ~block;
  1829. X            putchar(chr);        /* it's complement */
  1830. X            checksum = 0;
  1831. X            crc1 = 0;
  1832. X            crc2 = 0;
  1833. X            for (i=0; i < SECSIZE; i++) {
  1834. X                putchar(sector[i]);
  1835. X                if (mode)
  1836. X                    update_crc(sector[i]);
  1837. X                else
  1838. X                    checksum += sector[i];
  1839. X            }
  1840. X            if (mode) {
  1841. X                update_crc(0);
  1842. X                update_crc(0);
  1843. X                putchar(crc1);
  1844. X                putchar(crc2);
  1845. X            }
  1846. X            else
  1847. X                putchar(checksum);
  1848. Xrec_loop:
  1849. X            chr = getchar_t();
  1850. X            if (chr == CAN) {
  1851. X                sleep(3);
  1852. X                fprintf(stderr,"\r\nxmodem: Abort request received\r\n");
  1853. X                exit_return=1;
  1854. X                return;
  1855. X            }
  1856. X            if (chr == ACK)
  1857. X                break;        /* got it! */
  1858. X            if (chr != NAK ) goto rec_loop;   /* noise on line? */
  1859. X            errcount++;
  1860. X        }
  1861. X        if (errcount == MAXERRORS) {
  1862. X            error();
  1863. X            exit_return=1;
  1864. X            return;
  1865. X        }
  1866. X        block++;
  1867. X    }
  1868. X    errcount = 0;
  1869. X    exit_return=1;
  1870. X    while (errcount < MAXERRORS) {
  1871. X        putchar(EOT);
  1872. X        if (getchar_t() == ACK)
  1873. X            {
  1874. X            exit_return=0;
  1875. X            break;
  1876. X            }
  1877. X        errcount++;
  1878. X    }
  1879. X    return;
  1880. X}
  1881. X
  1882. X/* receive a file from the remote */
  1883. Xrecvfile(tfile)
  1884. Xchar *tfile;
  1885. X{
  1886. X    FILE *fp;
  1887. X    unsigned char hdr, blk, cblk, tmp, cksum;
  1888. X    unsigned char c1, c2, sum, block, sector[SECSIZE];
  1889. X    int i, stop = 0, mode, errcount, resync();
  1890. X    long true_end;
  1891. X    char ans[40];
  1892. X
  1893. X    if (!access(tfile, 00)) {
  1894. X        while (1) {
  1895. X            printf("File already exists \r\n");
  1896. X                return;
  1897. X        }
  1898. X    }
  1899. X
  1900. X    if (!(fp = fopen(tfile, "w"))) {
  1901. X        fprintf(stderr, "xmodem: Can't open '%s' for write\r\n", tfile);
  1902. X        return;
  1903. X    }
  1904. X    printf("File open - ready to receive\r\n");
  1905. X    rawmode();
  1906. X    errcount = 0;
  1907. X    block = 1;
  1908. X    
  1909. X    sleep(10);
  1910. X    while (errcount < MAXERRORS) {
  1911. X        if (errcount < (MAXERRORS / 2)) {
  1912. X            putchar('C');        /* try CRC mode first */
  1913. X            mode = 1;
  1914. X        }
  1915. X        else {
  1916. X            putchar(NAK);        /* then checksum */
  1917. X            mode = 0;
  1918. X        }
  1919. X        if ((hdr = getchar_t()) == SOH) {
  1920. X            ungetc(SOH, stdin);
  1921. X            break;
  1922. X        }
  1923. X        if ( hdr == STX ) {
  1924. X            ungetc(STX, stdin);
  1925. X            break;
  1926. X        }
  1927. X        errcount++;
  1928. X    }
  1929. X    if (errcount == MAXERRORS) {
  1930. X        sleep(3);
  1931. X        fprintf(stderr, "\r\nxmodem: Timed out on acknowledge\r\n");
  1932. X        return;
  1933. X    }
  1934. X    errcount = 0;
  1935. X
  1936. X    while (errcount < MAXERRORS) {
  1937. X        hdr = getchar_t();
  1938. X        if (hdr == CAN) {
  1939. X            sleep(3);
  1940. X            fprintf(stderr, "\r\nxmodem: Abort request received\r\n");
  1941. X            return;
  1942. X        }
  1943. X        if (hdr == EOT)            /* done! */
  1944. X            break;
  1945. X        if (hdr != STX && hdr != SOH) {        /* read in junk for 6 seconds */
  1946. X            synchron = 0;        /*  to re-synchronized block */
  1947. X            signal(SIGALRM, resync);
  1948. X            alarm(6);
  1949. X            while(synchron == 0)
  1950. X                hdr = getchar();
  1951. X            goto nak;
  1952. X        }
  1953. X        blk = getchar_t();
  1954. X        cblk = getchar_t();
  1955. X        crc1 = 0;
  1956. X        crc2 = 0;
  1957. X        sum = 0;
  1958. X        for (i=0; i < SECSIZE; i++) {
  1959. X            sector[i] = getchar_t();
  1960. X            if (mode)
  1961. X                update_crc(sector[i]);
  1962. X            else
  1963. X                sum += sector[i];
  1964. X        }
  1965. X        if (mode) {
  1966. X            c1 = getchar_t();
  1967. X            c2 = getchar_t();
  1968. X        }
  1969. X        else
  1970. X            cksum = getchar_t();
  1971. X        if (blk != block && blk != (block - 1))
  1972. X            goto nak;
  1973. X        tmp = ~blk;
  1974. X        if (cblk != tmp)
  1975. X            goto nak;
  1976. X        if (mode) {
  1977. X            update_crc(0);
  1978. X            update_crc(0);
  1979. X            if (c1 != crc1 || c2 != crc2)
  1980. X                goto nak;
  1981. X        }
  1982. X        else {
  1983. X            if (cksum != sum)
  1984. X                goto nak;
  1985. X        }
  1986. X        if (block == blk) {
  1987. X            fflush(fp);
  1988. X            fwrite(sector, sizeof(sector[0]), SECSIZE, fp);
  1989. X        }
  1990. X        block = blk + 1;
  1991. X        putchar(ACK);            /* got it! */
  1992. X        errcount = 0;
  1993. X        continue;
  1994. X
  1995. X    nak:    putchar(NAK);            /* do it over */
  1996. X        errcount++;
  1997. X    }
  1998. X    if (errcount == MAXERRORS) {
  1999. X        error();
  2000. X        return;
  2001. X    }
  2002. X    putchar(ACK);
  2003. X    for (i = SECSIZE -1; i >= 0; i--) {    /* find true EOF */
  2004. X        if (sector[i] != CPMEOF) {
  2005. X            stop = i;
  2006. X            break;
  2007. X        }
  2008. X    }
  2009. X/*
  2010. X * Some CPM systems don't pad the end of the file with ^Z's so the file may
  2011. X * have junk at the end.  A conservative approach had to be taken in order
  2012. X * for Unix object code (where ^Z's may be valid data) to transfer properly.
  2013. X */
  2014. X    true_end = ftell(fp) - SECSIZE + stop +1;
  2015. X    fclose(fp);
  2016. X    truncate(tfile, true_end);
  2017. X    return;
  2018. X}
  2019. X
  2020. X/* give minimal usage message */
  2021. Xusage()
  2022. X{
  2023. X    fprintf(stderr, "Usage: xmodem [ s | r ] filename\r\n");
  2024. X    fprintf(stderr, "       options are 's' for send or 'r' for receive\r\n");
  2025. X    return;
  2026. X}
  2027. X
  2028. X/* exceeded the maximum number of retry's */
  2029. Xerror()
  2030. X{
  2031. X    putchar(CAN);
  2032. X    putchar(CAN);
  2033. X    putchar(CAN);
  2034. X    putchar(CAN);
  2035. X    sleep(3);
  2036. X    fprintf(stderr, "\r\nxmodem: Exceeded error limit...aborting\r\n");
  2037. X    return;
  2038. X}
  2039. X
  2040. X/* update the CRC bytes */
  2041. Xupdate_crc(c)
  2042. Xunsigned char c;
  2043. X{
  2044. X    int i, temp;
  2045. X    unsigned char carry, c_crc1, c_crc2;
  2046. X    for (i=0; i < 8; i++) {
  2047. X        temp = c * 2;
  2048. X        c = temp;            /* rotate left */
  2049. X        carry = ((temp > 255) ? 1 : 0);
  2050. X        temp = crc2 * 2;
  2051. X        crc2 = temp;
  2052. X        crc2 |= carry;            /* rotate with carry */
  2053. X        c_crc2 = ((temp > 255) ? 1 : 0);
  2054. X        temp = crc1 * 2;
  2055. X        crc1 = temp;
  2056. X        crc1 |= c_crc2;
  2057. X        c_crc1 = ((temp > 255) ? 1 : 0);
  2058. X        if (c_crc1) {
  2059. X            crc2 ^= 0x21;
  2060. X            crc1 ^= 0x10;
  2061. X        }
  2062. X    }
  2063. X    return;
  2064. X}
  2065. X
  2066. X/* getchar with a 10 sec time out */
  2067. Xgetchar_t()
  2068. X{
  2069. X    int force_it();
  2070. X    unsigned char c;
  2071. X    signal(SIGALRM, force_it);
  2072. X    alarm(10);                /* only have 10 sec... */
  2073. X    c = getchar();
  2074. X    alarm(0);
  2075. X    return(c);
  2076. X}
  2077. X
  2078. X/*
  2079. X * This code (and the resync() below) is the most machine dependent part
  2080. X * of the program.  The action of the signal SIGALRM during a read system
  2081. X * call is not well defined.  Some systems return the stack to the point
  2082. X * outside the system call, others inside the call itself.  Have fun...
  2083. X */
  2084. Xforce_it()
  2085. X{
  2086. X    unsigned char c;
  2087. X    c = CPMEOF;                /* arbitrary default char */
  2088. X#ifdef SV
  2089. X    ungetc(c, stdin);
  2090. X#endif
  2091. X#ifdef BSD
  2092. X    ioctl(0, TIOCSTI, &c);
  2093. X#endif
  2094. X    return;
  2095. X}
  2096. X
  2097. X/* truncate file to given length */
  2098. Xtruncate(path, length)
  2099. Xchar *path;
  2100. Xlong length;
  2101. X{
  2102. X    FILE *fp, *tempfp;
  2103. X    long i;
  2104. X    char c, string[80], *tempfile, *mktemp();
  2105. X    if (!(fp = fopen(path, "r"))) {
  2106. X        fprintf(stderr, "xmodem: Can't open '%s' for read\r\n", path);
  2107. X        return;
  2108. X    }
  2109. X    tempfile = mktemp("/tmp/trunXXXXXX");
  2110. X    if (!(tempfp = fopen(tempfile, "w"))) {
  2111. X        fprintf(stderr, "xmodem: Can't open temporary file\r\n");
  2112. X        return;
  2113. X    }
  2114. X    for (i=0; i < length; i++) {
  2115. X        c = fgetc(fp);
  2116. X        fputc(c, tempfp);
  2117. X    }
  2118. X    fclose(fp);
  2119. X    fclose(tempfp);
  2120. X    sprintf(string, "mv %s %s", tempfile, path);
  2121. X    system(string);
  2122. X    return;
  2123. X}
  2124. X
  2125. X/* put the stdin/stdout in the "raw" mode */
  2126. Xrawmode()
  2127. X{
  2128. X#ifdef SV
  2129. X    struct termio tbuf;
  2130. X    ioctl(0, TCGETA, &tbuf);
  2131. X    tbuf.c_cc[4] = 1;            /* VMIN */
  2132. X    tbuf.c_cc[5] = 0;            /* VTIME */
  2133. X    tbuf.c_iflag = 0;
  2134. X    tbuf.c_oflag = 0;
  2135. X    tbuf.c_lflag = 0;
  2136. X    tbuf.c_cflag &= ~CSIZE;
  2137. X    tbuf.c_cflag |= CS8;
  2138. X    tbuf.c_cflag &= ~PARENB;
  2139. X    ioctl(0, TCSETAF, &tbuf);
  2140. X    return;
  2141. X#endif
  2142. X#ifdef BSD
  2143. X    struct sgttyb sgbuf;
  2144. X    ioctl(0, TIOCGETP, &sgbuf);
  2145. X    sgbuf.sg_flags |= RAW;
  2146. X    sgbuf.sg_flags &= ~ECHO;
  2147. X    ioctl(0, TIOCSETP, &sgbuf);
  2148. X    return;
  2149. X#endif
  2150. X}
  2151. X
  2152. X/*  after 6 seconds of reading junk data... */
  2153. Xresync()
  2154. X{
  2155. X    char c;
  2156. X    synchron = 1;                /* set the flag */
  2157. X    c = SOH;
  2158. X#ifdef SV
  2159. X    ungetc(c, stdin);
  2160. X#endif
  2161. X#ifdef BSD
  2162. X    ioctl(0, TIOCSTI, &c);
  2163. X#endif
  2164. X    return;
  2165. X}
  2166. END_OF_FILE
  2167.   if test 9777 -ne `wc -c <'ymod.c'`; then
  2168.     echo shar: \"'ymod.c'\" unpacked with wrong size!
  2169.   fi
  2170.   # end of 'ymod.c'
  2171. fi
  2172. echo shar: End of archive 6 \(of 11\).
  2173. cp /dev/null ark6isdone
  2174. MISSING=""
  2175. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2176.     if test ! -f ark${I}isdone ; then
  2177.     MISSING="${MISSING} ${I}"
  2178.     fi
  2179. done
  2180. if test "${MISSING}" = "" ; then
  2181.     echo You have unpacked all 11 archives.
  2182.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2183. else
  2184.     echo You still must unpack the following archives:
  2185.     echo "        " ${MISSING}
  2186. fi
  2187. exit 0
  2188. exit 0 # Just in case...
  2189.