home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sources / misc / 3912 < prev    next >
Encoding:
Text File  |  1992-09-08  |  63.4 KB  |  2,196 lines

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