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

  1. Newsgroups: comp.sources.misc
  2. From: sandy@godzilla.Quotron.COM (Sanford Zelkovitz)
  3. Subject:  v32i023:  xbbs - A Bulletin Board System for System V, Part08/11
  4. Message-ID: <1992Sep9.045357.26577@sparky.imd.sterling.com>
  5. X-Md4-Signature: 67fd836527509ddb1b8861a97f6013b8
  6. Date: Wed, 9 Sep 1992 04:53:57 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: sandy@godzilla.Quotron.COM (Sanford Zelkovitz)
  10. Posting-number: Volume 32, Issue 23
  11. Archive-name: xbbs/part08
  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:  bbscarea.c bbscbult.c bbscmenu.c bbscsigs.c bbsczip.c
  19. #   chatbbs/chatbbs.c extra_info msgpack/msgpack.c purguser/purguser.c
  20. #   today/Makefile today/timetx.c
  21. # Wrapped by kent@sparky on Fri Sep  4 12:48:53 1992
  22. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  23. echo If this archive is complete, you will see the following message:
  24. echo '          "shar: End of archive 8 (of 11)."'
  25. if test -f 'bbscarea.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'bbscarea.c'\"
  27. else
  28.   echo shar: Extracting \"'bbscarea.c'\" \(5711 characters\)
  29.   sed "s/^X//" >'bbscarea.c' <<'END_OF_FILE'
  30. X/*------------------------------------------------------------------------
  31. X       Name: bbscarea.c
  32. X   Comments: Display file areas and select one
  33. X  ------------------------------------------------------------------------*/
  34. X
  35. X#include <stdio.h>
  36. X#include <string.h>
  37. X#include <ctype.h>
  38. X#include "bbscdef.h"
  39. X
  40. Xint             set_yet = FALSE;
  41. Xextern int      user_priv;
  42. X
  43. X
  44. Xchange_area(type) int 
  45. X    type;
  46. X{
  47. X    FILE           *fpt, *fopen();
  48. X    char           *fgets(), *getenv();
  49. X    char            choice[4];
  50. X#ifndef SYSV
  51. X    char            dir_priv_ascii[7];
  52. X#endif
  53. X#ifdef SYSV
  54. X    char            dir_priv_ascii[20];
  55. X#endif
  56. X    char           *buf_ptr;
  57. X    int             line_cnt, ret, i;
  58. X    int             index_value, ptr;
  59. X    int        allx;
  60. X
  61. X    if(type == -1)
  62. X        return;
  63. X
  64. X    if(type > 1000) {
  65. X        type -=1000;
  66. X        allx = 1;
  67. X    }
  68. X    else
  69. X        allx = 0;
  70. X
  71. Xdo_again:
  72. X    strcpy(buf128, AREAS);
  73. X
  74. X    if ((fpt = fopen(buf128, "r")) == NULL) {
  75. X        portsout("\n\rError Opening File Area List: Notify Sysop!\n\r");
  76. X        return (-1);
  77. X    }
  78. X    if(!type) {
  79. X        portsout("\n\r    Directory     Description                                      Upload Path\n\r");
  80. X        portsout("    ============= ==========================================       ============\n\r");
  81. X    }
  82. X    line_cnt = 0;
  83. X    while (fpt) {
  84. X        zfl(f_lines[line_cnt], 81);
  85. X        if ((fgets(f_lines[line_cnt], 80, fpt)) == NULL) {
  86. X            if (line_cnt == 0) {
  87. X                portsout("\n\rEOF Unexpected in File Area List: Notify Sysop!\n\r");
  88. X                return (-1);
  89. X            }
  90. X            break;    /* if not 1st line */
  91. X        }        /* end of if ((fgets)) */
  92. X        if (line_cnt > 0) {
  93. X            substr(f_lines[line_cnt], dir_priv_ascii, 57, 5);
  94. X            dir_priv[line_cnt] = atoi(dir_priv_ascii);
  95. X            if (dir_priv[line_cnt] > user_priv)
  96. X                goto next_read;
  97. X            strcpy(who_am_i, f_lines[line_cnt]);
  98. X            buf_ptr = who_am_i;
  99. X            buf_ptr += 56;
  100. X            for (ptr = 0; ptr < 5; ptr++)
  101. X                *buf_ptr++ = ' ';
  102. X            sprintf(buf128, "%2d) %s", line_cnt, who_am_i);
  103. X            if (!type) {
  104. X                strip(buf128);
  105. X                term_space(buf128);
  106. X                portsout(buf128);
  107. X                portsout("\n\r");
  108. X            }
  109. X        }
  110. Xnext_read:
  111. X        ++line_cnt;
  112. X    }            /* end of while (fpt) */
  113. X    if (set_yet && !type) {
  114. X        portsout(CRLF);
  115. X        portsout(" Q) Quit to Previous Menu");
  116. X    }
  117. X    if(!type)portsout(CRLF);
  118. X    fclose(fpt);
  119. X    if(!type)portsout(CRLF);
  120. X    if (line_cnt <= 1)
  121. X        return;
  122. X
  123. X    while (1) {
  124. X        if (!type) {
  125. X            portsout("Enter Selection ===> ");
  126. X            portsin_cmp(choice, 2, "Qq");
  127. X            portsout(CRLF);
  128. X            *choice = toupper(*choice);
  129. X
  130. X            if (*choice == 'Q' && set_yet)
  131. X                return (-1);
  132. X
  133. X
  134. X            index_value = atoi(choice);
  135. X        } else
  136. X            index_value = type;
  137. X        if(allx && index_value >= line_cnt)
  138. X            return(999);
  139. X        if (index_value > 0 && index_value < line_cnt) {
  140. X            if (dir_priv[index_value] <= user_priv) {
  141. X                parse_args(f_lines[index_value]);
  142. X                set_yet = TRUE;
  143. X                itoa(buf128, index_value);
  144. X                if( !allx) {
  145. X                    if(index_value > 9)
  146. X                        strcpy(l_f_base, buf128);
  147. X                    else {
  148. X                        strcpy(l_f_base, "0");
  149. X                        strcat(l_f_base, buf128);
  150. X                    }
  151. X                    rewritx();
  152. X                }
  153. X                return (0);
  154. X            }
  155. X        }
  156. X        if( type != 0 ) {
  157. X            type = 0;
  158. X            if(allx)
  159. X                return(99);
  160. X            portsout("\n\rInvalid directory request!\n\r");
  161. X            goto do_again;
  162. X        }
  163. X    }
  164. X}
  165. X
  166. Xallnew()
  167. X{
  168. X    char savef[99], saveu[99];
  169. X    char savea[99], savep[99];
  170. X    char strg[15], choice[5];
  171. X    int i, ret, choi;
  172. X    char *fileptr;
  173. X    strcpy(savef, f_pathname);
  174. X    strcpy(saveu, u_pathname);
  175. X    strcpy(savea, area_name);
  176. X    strcpy(savep, f_pathtext);
  177. X    bbsmenu(5,0);
  178. X    portsin(choice, 1);
  179. X    portsout(CRLF);
  180. X    switch(choice[0]) {
  181. X    case ('L'):
  182. X    case ('l'):
  183. X        choi = 1;
  184. X        portsout("\n\r\n\rInput file name substring (max 14 characters): ");
  185. X        portsin(strg, 14);
  186. X        ret = strlen(strg);
  187. X        portsout(CRLF);
  188. X        if (!ret)
  189. X            return;
  190. X        fileptr = strchr(strg, '*');
  191. X        if( fileptr != NULL ) {
  192. X            portsout("\n\rDo not use an asterisk as part of the string.\n\r\n\r");
  193. X            return;
  194. X        }
  195. X        break;
  196. X    case ('F'):
  197. X    case ('f'):
  198. X        choi = 2;
  199. X        break;
  200. X    case ('N'):
  201. X    case ('n'):
  202. X        choi = 3;
  203. X        break;
  204. X    case ('R'):
  205. X    case ('r'):
  206. X        choi = 4;
  207. X        break;
  208. X    default:
  209. X        return;
  210. X    }
  211. X    for( i=1001; i<1100; i++) {
  212. X        if (stop_that) {
  213. X            stop_that = FALSE;
  214. X            strcpy(f_pathname, savef);
  215. X            strcpy(u_pathname, saveu);
  216. X            strcpy(area_name, savea);
  217. X            strcpy(f_pathtext, savep);
  218. X            return;
  219. X        }
  220. X        ret = change_area(i);
  221. X        if (stop_that) {
  222. X            stop_that = FALSE;
  223. X            strcpy(f_pathname, savef);
  224. X            strcpy(u_pathname, saveu);
  225. X            strcpy(area_name, savea);
  226. X            strcpy(f_pathtext, savep);
  227. X            return;
  228. X        }
  229. X        if( ret == 999) {
  230. X            strcpy(f_pathname, savef);
  231. X            strcpy(u_pathname, saveu);
  232. X            strcpy(area_name, savea);
  233. X            strcpy(f_pathtext, savep);
  234. X            return;
  235. X        }
  236. X        if( ret == 99)
  237. X            continue;
  238. X        portsout("\n\r-------------------------------------------------------------------\n\r");
  239. X        portsout("\n\r\n\rFile listing for area '");
  240. X        portsout(area_name);
  241. X        portsout("'\n\r");
  242. X        switch(choi){
  243. X        case (1):
  244. X            file_loc(strg);
  245. X            break;
  246. X        case (2):
  247. X            file_l();
  248. X            break;
  249. X        case (3):
  250. X            file_n();
  251. X            break;
  252. X        case (4):
  253. X            file_r();
  254. X            break;
  255. X        }
  256. X    }
  257. X    strcpy(f_pathname, savef);
  258. X    strcpy(u_pathname, saveu);
  259. X    strcpy(area_name, savea);
  260. X    strcpy(f_pathtext, savep);
  261. X    return;
  262. X}
  263. X        
  264. X        
  265. X
  266. X
  267. X
  268. X
  269. Xparse_args(string)
  270. X    char           *string;
  271. X{
  272. X
  273. X    register char  *file_ptr, *name_ptr, *up_ptr, *desc_ptr;
  274. X    register int    i;
  275. X
  276. X    strcpy(f_pathname, ORGPATH);
  277. X    strcpy(u_pathname, ORGPATH);
  278. X    file_ptr = (f_pathname + strlen(f_pathname));
  279. X    up_ptr = (u_pathname + strlen(u_pathname));
  280. X
  281. X    name_ptr = area_name;
  282. X    desc_ptr = f_pathtext;
  283. X
  284. X    i = 0;
  285. X    while (string[i] != ' ') {
  286. X        *file_ptr = string[i];
  287. X        *name_ptr = string[i];
  288. X        ++file_ptr;
  289. X        ++name_ptr;
  290. X        ++i;
  291. X    }
  292. X    *file_ptr = '/';
  293. X    ++file_ptr;
  294. X    *file_ptr = '\0';
  295. X    *name_ptr = '\0';
  296. X
  297. X    for (i = 14; i < 61; ++i) {
  298. X        *desc_ptr = string[i];
  299. X        ++desc_ptr;
  300. X    }
  301. X    *desc_ptr = '\0';
  302. X
  303. X    i = 63;
  304. X    while ((string[i] != ' ') && (string[i] != '\n')) {
  305. X        *up_ptr = string[i];
  306. X        ++up_ptr;
  307. X        ++i;
  308. X    }
  309. X    *up_ptr = '/';
  310. X    ++up_ptr;
  311. X    *up_ptr = '\0';
  312. X}
  313. END_OF_FILE
  314.   if test 5711 -ne `wc -c <'bbscarea.c'`; then
  315.     echo shar: \"'bbscarea.c'\" unpacked with wrong size!
  316.   fi
  317.   # end of 'bbscarea.c'
  318. fi
  319. if test -f 'bbscbult.c' -a "${1}" != "-c" ; then 
  320.   echo shar: Will not clobber existing file \"'bbscbult.c'\"
  321. else
  322.   echo shar: Extracting \"'bbscbult.c'\" \(5079 characters\)
  323.   sed "s/^X//" >'bbscbult.c' <<'END_OF_FILE'
  324. X/*------------------------------------------------------------------------
  325. X       Name: bbscbult.c
  326. X   Comments: Display file areas and select one
  327. X  ------------------------------------------------------------------------*/
  328. X
  329. X#include <stdio.h>
  330. X#include <string.h>
  331. X#include <ctype.h>
  332. X#include <sys/types.h>
  333. X#include <sys/stat.h>
  334. X#include <time.h>
  335. X#include "bbscdef.h"
  336. X
  337. X
  338. Xextern int      user_priv;
  339. Xlong        atol();
  340. Xstatic int    indexb[99];
  341. Xstatic int    first_b_r = 1;
  342. X
  343. Xchange_bult()
  344. X{
  345. X    FILE           *fpt, *fopen();
  346. X    char           *fgets(), *getenv();
  347. X    char            choice[4];
  348. X#ifndef SYSV
  349. X    char            dir_priv_ascii[7];
  350. X#endif
  351. X#ifdef SYSV
  352. X    char            dir_priv_ascii[20];
  353. X#endif
  354. X    char           *buf_ptr;
  355. X    int             line_cnt, ret, i;
  356. X    int             index_value, ptr;
  357. X    int        j, k;
  358. X    int             length;
  359. X
  360. X    if(first_b_r)
  361. X        {
  362. X        first_b_r = 0;
  363. X        for(j=0; j<99; j++)
  364. X            indexb[j]=0;
  365. X        }
  366. X
  367. X    substr(z_date, z_mm, 1, 2);
  368. X    substr(z_date, z_dd, 4, 2);
  369. X    substr(z_date, z_yy, 7, 2);
  370. X    xmm = atol(z_mm);
  371. X    xdd = atol(z_dd);
  372. X    xyy = atol(z_yy);
  373. X    old_long_date = (xyy*10000L) + (xmm*100L) + xdd;
  374. X    while (1) {
  375. X
  376. Xdo_again:
  377. X    strcpy(buf128, BULLETINS);
  378. X
  379. X    if ((fpt = fopen(buf128, "r")) == NULL) {
  380. X        portsout("\n\r\n\rThere are no bulletins today!\n\r\n\r");
  381. X        return ;
  382. X    }
  383. X    portsout("\n\r\n\r\n\r                  *******************************\n\r");
  384. X    portsout("                  * Available Bulletins to Read *\n\r");
  385. X    portsout("                  *******************************\n\r\n\r");
  386. X    portsout("\n\r    Bulletin      Description                                      \n\r");
  387. X    portsout("    ============= ========================================== \n\r");
  388. X
  389. X    line_cnt = 0;
  390. X    while (fpt) {
  391. X        zfl(f_lines[line_cnt], 81);
  392. X        if ((fgets(f_lines[line_cnt], 80, fpt)) == NULL) {
  393. X            if (line_cnt == 0) {
  394. X                portsout("\n\rEOF Unexpected in Bulletin List: Notify Sysop!\n\r");
  395. X                return;
  396. X            }
  397. X            break;    /* if not 1st line */
  398. X        }        /* end of if ((fgets)) */
  399. X        if (line_cnt > 0) {
  400. X            length = strlen(f_lines[line_cnt]);
  401. X            length -= 57;
  402. X            if(length > 6)
  403. X                length = 6;
  404. X            substr(f_lines[line_cnt], dir_priv_ascii, 57, length);
  405. X            dir_priv[line_cnt] = atoi(dir_priv_ascii);
  406. X            if (dir_priv[line_cnt] > user_priv)
  407. X                goto next_read;
  408. X            strcpy(who_am_i, f_lines[line_cnt]);
  409. X            buf_ptr = who_am_i;
  410. X            buf_ptr += 56;
  411. X            for (ptr = 0; ptr < 5; ptr++)
  412. X                *buf_ptr++ = ' ';
  413. X            *buf_ptr = '\0';
  414. X            sprintf(buf128, "%2d) %s", line_cnt, who_am_i);
  415. X            strip(buf128);
  416. X            term_space(buf128);
  417. X            portsout(buf128);
  418. X            portsout("\n\r");
  419. X        }
  420. Xnext_read:
  421. X        ++line_cnt;
  422. X    }            /* end of while (fpt) */
  423. X    if (line_cnt <= 1)
  424. X        {
  425. X        portsout("\n\r\n\rThere are no bulletins today!\n\r\n\r");
  426. X        return;
  427. X        }
  428. X    portsout(CRLF);
  429. X    portsout(" Q) Quit --- exit bulletin section");
  430. X    portsout(CRLF);
  431. X    fclose(fpt);
  432. X    portsout(CRLF);
  433. X    strcpy(buf128,"The following bulletins are new for you since the last day you called:  ");
  434. X    j = strlen(buf128);
  435. X    portsout(buf128);
  436. X    for (index_value=1; index_value<line_cnt; index_value++)
  437. X        {
  438. X        if(dir_priv[index_value] <= user_priv)
  439. X            {
  440. X            check_new(f_lines[index_value], index_value);
  441. X            k = strlen(buf128);
  442. X            j+=k;
  443. X            if( j >= 72)
  444. X                {
  445. X                j = 0;
  446. X                portsout(CRLF);
  447. X                }
  448. X            }
  449. X        }
  450. X    portsout(CRLF);
  451. X    portsout(CRLF);
  452. X        portsout("Enter Selection ===> ");
  453. X        portsin_cmp(choice, 2, "Qq");
  454. X        portsout(CRLF);
  455. X        *choice = toupper(*choice);
  456. X
  457. X        if (*choice == 'Q')
  458. X            return;
  459. X
  460. X
  461. X        index_value = atoi(choice);
  462. X        if (index_value > 0 && index_value < line_cnt) {
  463. X            if (dir_priv[index_value] <= user_priv) {
  464. X                parse_bul(f_lines[index_value]);
  465. X                indexb[index_value -1] = 1;
  466. X                continue;
  467. X            }
  468. X        }
  469. X    }
  470. X}
  471. X
  472. X
  473. X
  474. X
  475. X
  476. Xparse_bul(string)
  477. X    char           *string;
  478. X{
  479. X
  480. X    register char  *file_ptr, *xptr;
  481. X    register int    i;
  482. X
  483. X    strcpy(buf128, ORGPATH);
  484. X    file_ptr = (buf128 + strlen(buf128));
  485. X
  486. X    i = 0;
  487. X    while (string[i] != ' ') {
  488. X        *file_ptr = string[i];
  489. X        ++file_ptr;
  490. X        ++i;
  491. X    }
  492. X    *file_ptr = '\0';
  493. X    cmd_p(buf128);
  494. X
  495. X}
  496. Xcheck_new(string, indexer)
  497. X    char           *string;
  498. X    int        indexer;
  499. X{
  500. X    static char *dater[]={ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  501. X        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", };
  502. X    char        timeptr[30];
  503. X    int        result, j, k;
  504. X    struct    stat stater;
  505. X
  506. X    register char  *file_ptr, *xptr;
  507. X    register int    i;
  508. X
  509. X    if(indexb[indexer-1])
  510. X        {
  511. X        file_ptr = buf128;
  512. X        *file_ptr = '\0';
  513. X        return;
  514. X        }
  515. X
  516. X    strcpy(buf128, ORGPATH);
  517. X    file_ptr = (buf128 + strlen(buf128));
  518. X
  519. X    i = 0;
  520. X    while (string[i] != ' ') {
  521. X        *file_ptr = string[i];
  522. X        ++file_ptr;
  523. X        ++i;
  524. X    }
  525. X    *file_ptr = '\0';
  526. X    file_ptr = buf128;
  527. X    result = stat(buf128, &stater);
  528. X    if(result)
  529. X        {
  530. X        *file_ptr='\0';
  531. X        return;
  532. X        }
  533. X    xmm = stater.st_mtime;
  534. X    strcpy(timeptr, ctime(&xmm));
  535. X    substr(timeptr, buf128, 5,3);
  536. X    substr(timeptr, z_dd, 9, 2);
  537. X    substr(timeptr, z_yy, 23,2);
  538. X    xdd = atol(z_dd);
  539. X    xyy = atol(z_yy);
  540. X    for ( result =0; result < 12; result++)
  541. X        {
  542. X        i = strcmp(buf128, dater[result]);
  543. X        if(!i)
  544. X            {
  545. X            xmm = (long) result +1;
  546. X            new_long_date = (xyy*10000L) + (xmm*100L) + xdd;
  547. X            if(new_long_date >= old_long_date)
  548. X                {
  549. X                itoa(buf128, indexer);
  550. X                strcat(buf128, ", ");
  551. X                portsout(buf128);
  552. X                }
  553. X            else
  554. X                 *file_ptr='\0';
  555. X            return;
  556. X            }
  557. X        }
  558. X        *file_ptr='\0';
  559. X}
  560. END_OF_FILE
  561.   if test 5079 -ne `wc -c <'bbscbult.c'`; then
  562.     echo shar: \"'bbscbult.c'\" unpacked with wrong size!
  563.   fi
  564.   # end of 'bbscbult.c'
  565. fi
  566. if test -f 'bbscmenu.c' -a "${1}" != "-c" ; then 
  567.   echo shar: Will not clobber existing file \"'bbscmenu.c'\"
  568. else
  569.   echo shar: Extracting \"'bbscmenu.c'\" \(6772 characters\)
  570.   sed "s/^X//" >'bbscmenu.c' <<'END_OF_FILE'
  571. X#include "bbsc12.h"
  572. X
  573. Xchar menubuf[1024], xmenubuf[64];
  574. Xint menu_items;
  575. X
  576. Xcheckoption(menubuf, xmenubuf, menu,menustr,priv,menu_items)
  577. Xchar    menubuf[];
  578. Xchar    xmenubuf[];
  579. Xchar    menu[];
  580. Xchar    menustr[];
  581. Xint    priv;
  582. Xint     *menu_items;
  583. X{
  584. X    
  585. X    
  586. X    if(user_priv >= priv) {
  587. X        strcat(menubuf, menustr);
  588. X        if(*menu_items!=0)
  589. X            strcat(xmenubuf, ",");
  590. X        strcat(xmenubuf, menu);
  591. X        
  592. X        (*menu_items)++;
  593. X        if((*menu_items % 4) == 0) 
  594. X            strcat(menubuf, "\n\r");
  595. X        
  596. X    }
  597. X}
  598. X
  599. Xbbsmenu(type, aid)
  600. Xint type, aid;
  601. X{
  602. X    menubuf[0]='\0';
  603. X    xmenubuf[0]='\0';
  604. X    menu_items = 0;
  605. X    switch(type) {
  606. X        case(1):
  607. X            checkoption(menubuf, xmenubuf, "M",
  608. X                "M(essage section), ", mpMS, &menu_items);
  609. X            checkoption(menubuf, xmenubuf, "F",
  610. X                "F(ile section),    ", mpE, &menu_items);
  611. X            checkoption(menubuf, xmenubuf, "V",
  612. X                "V(ersion),         ", 1, &menu_items);
  613. X            checkoption(menubuf, xmenubuf, "H",
  614. X                "H(umor),           ", mpH, &menu_items);
  615. X            checkoption(menubuf, xmenubuf, "T",
  616. X                "T(oggle page),     ", mpT, &menu_items);
  617. X            checkoption(menubuf, xmenubuf, "B",
  618. X                "B(ulletins),       ", mpB, &menu_items);
  619. X            checkoption(menubuf, xmenubuf, "A",
  620. X                "A(dditional),      ", mpA, &menu_items);
  621. X            checkoption(menubuf, xmenubuf, "N",
  622. X                "N(ew user msg),    ", mpN, &menu_items);
  623. X            checkoption(menubuf, xmenubuf, "X",
  624. X                "e(X)pert toggle,   ", mpX, &menu_items);
  625. X            checkoption(menubuf, xmenubuf, "W",
  626. X                "W(elcome message), ", mpW, &menu_items);
  627. X            checkoption(menubuf, xmenubuf, "D",
  628. X                "D(aily info),      ", mpD, &menu_items);
  629. X            checkoption(menubuf, xmenubuf, "U",
  630. X                "U(nix),            ", mpU, &menu_items);
  631. X            checkoption(menubuf, xmenubuf, "R",
  632. X                "R(ead files),      ", mpRF, &menu_items);
  633. X            checkoption(menubuf, xmenubuf, "P",
  634. X                "P(assword change), ", mpP, &menu_items);
  635. X            checkoption(menubuf, xmenubuf, "C",
  636. X                "C(hat request),    ", mpCHAT, &menu_items);
  637. X            checkoption(menubuf, xmenubuf, "Q",
  638. X                "Q(uestionaire),    ", mpQUEST, &menu_items);
  639. X            checkoption(menubuf, xmenubuf, "Z",
  640. X                "Z(ip mail),        ", mpY, &menu_items);
  641. X            checkoption(menubuf, xmenubuf, "O",
  642. X                "c(O)nference,      ", mpCONF, &menu_items);
  643. X            checkoption(menubuf, xmenubuf, "E",
  644. X                "in conferenc(E),   ", mpCONF, &menu_items);
  645. X            checkoption(menubuf, xmenubuf, "L",
  646. X                "L(ogged on),       ", mpL, &menu_items);
  647. X            checkoption(menubuf, xmenubuf, "G",
  648. X                "G(oodbye),         ", mpG, &menu_items);
  649. X            checkoption(menubuf, xmenubuf, "S",
  650. X                "u(S)enet access,   ", mpUSENET, &menu_items);
  651. X            checkoption(menubuf, xmenubuf, "I",
  652. X                "s(I)g access,      ", 1, &menu_items);
  653. X            checkoption(menubuf, xmenubuf, " or ? ",
  654. X                "? --- help.        ", mpZ, &menu_items);
  655. X            break;
  656. X
  657. X        case (2):
  658. X            checkoption(menubuf, xmenubuf, "A",
  659. X                "A(rea change),     ", 1, &menu_items);
  660. X            checkoption(menubuf, xmenubuf, "K",
  661. X                "K(ill message),    ", aid, &menu_items);
  662. X            checkoption(menubuf, xmenubuf, "Q",
  663. X                "Q(uick scan),      ", mpQ, &menu_items);
  664. X            checkoption(menubuf, xmenubuf, "S",
  665. X                "S(can messages),   ", mpS, &menu_items);
  666. X            checkoption(menubuf, xmenubuf, "R",
  667. X                "R(ead messages),   ", mpR, &menu_items);
  668. X            checkoption(menubuf, xmenubuf, "Y",
  669. X                "Y(our messages),   ", mpY, &menu_items);
  670. X            checkoption(menubuf, xmenubuf, "C",
  671. X                "C(heck messages),  ", mpC, &menu_items);
  672. X            checkoption(menubuf, xmenubuf, "E",
  673. X                "E(nter messages),  ", mpE, &menu_items);
  674. X            checkoption(menubuf, xmenubuf, "N",
  675. X                "e(N)ter blocked,   ", mpE, &menu_items);
  676. X            if( !sigreturn)
  677. X                checkoption(menubuf, xmenubuf, "M",
  678. X                    "M(ain menu),       ", 1, &menu_items);
  679. X            else
  680. X                checkoption(menubuf, xmenubuf, "M",
  681. X                    "M(ain SIG menu),   ", 1, &menu_items);
  682. X            checkoption(menubuf, xmenubuf, "G",
  683. X                "G(oodbye),         ", mpG, &menu_items);
  684. X            checkoption(menubuf, xmenubuf, "X",
  685. X                "e(X)pert toggle,   ", mpX, &menu_items);
  686. X            checkoption(menubuf, xmenubuf, "B",
  687. X                "B(atch read sel),  ", mpR, &menu_items);
  688. X            checkoption(menubuf, xmenubuf, "T",
  689. X                "T(oggle page),     ", mpT, &menu_items);
  690. X            checkoption(menubuf, xmenubuf, " or ? ",
  691. X                "? --- help.        ", mpZ, &menu_items);
  692. X            break;
  693. X
  694. X
  695. X        case (3):
  696. X
  697. X            checkoption(menubuf, xmenubuf, "A",
  698. X                "A(rea change),     ", 1, &menu_items);
  699. X            if( !sigreturn)
  700. X                checkoption(menubuf, xmenubuf, "M",
  701. X                    "M(ain menu),       ", 1, &menu_items);
  702. X            else
  703. X                checkoption(menubuf, xmenubuf, "M",
  704. X                    "M(ain SIG menu),   ", 1, &menu_items);
  705. X            checkoption(menubuf, xmenubuf, "U",
  706. X                "U(pload),          ", fpU, &menu_items);
  707. X            checkoption(menubuf, xmenubuf, "D",
  708. X                "D(ownload),        ", fpD, &menu_items);
  709. X            checkoption(menubuf, xmenubuf, "F",
  710. X                "F(ile list),       ", fpL, &menu_items);
  711. X            checkoption(menubuf, xmenubuf, "R",
  712. X                "R(aw list),        ", fpR, &menu_items);
  713. X            checkoption(menubuf, xmenubuf, "N",
  714. X                "N(ew file list),   ", fpL, &menu_items);
  715. X            checkoption(menubuf, xmenubuf, "Z",
  716. X                "Z(ip file menu)    ", fpL, &menu_items);
  717. X            checkoption(menubuf, xmenubuf, "L",
  718. X                "L(ocate files),    ", fpL, &menu_items);
  719. X            checkoption(menubuf, xmenubuf, "C",
  720. X                "C(ontent of),      ", fpL, &menu_items);
  721. X            checkoption(menubuf, xmenubuf, "X",
  722. X                "e(X)pert toggle,   ", mpX, &menu_items);
  723. X            checkoption(menubuf, xmenubuf, "T",
  724. X                "T(oggle page),     ", mpT, &menu_items);
  725. X            checkoption(menubuf, xmenubuf, "G",
  726. X                "G(oodbye),         ", mpG, &menu_items);
  727. X            checkoption(menubuf, xmenubuf, "S",
  728. X                "S(ummary of dir),  ", mpG, &menu_items);
  729. X            checkoption(menubuf, xmenubuf, " or ? ",
  730. X                "? --- help.        ", mpZ, &menu_items);
  731. X            break;
  732. X        case (4):
  733. X            checkoption(menubuf, xmenubuf, "M",
  734. X                "M(essage section), ", mpMS, &menu_items);
  735. X            checkoption(menubuf, xmenubuf, "F",
  736. X                "F(ile section),    ", mpE, &menu_items);
  737. X            checkoption(menubuf, xmenubuf, "A",
  738. X                "A(dditional),      ", mpA, &menu_items);
  739. X            checkoption(menubuf, xmenubuf, "L",
  740. X                "L(eave SIGs),      ", 1, &menu_items);
  741. X            checkoption(menubuf, xmenubuf, "X",
  742. X                "e(X)pert toggle,   ", mpX, &menu_items);
  743. X            checkoption(menubuf, xmenubuf, "T",
  744. X                "T(oggle page),     ", mpT, &menu_items);
  745. X            checkoption(menubuf, xmenubuf, "G",
  746. X                "G(oodbye),         ", mpG, &menu_items);
  747. X            checkoption(menubuf, xmenubuf, " or ? ",
  748. X                "? --- help.        ", mpZ, &menu_items);
  749. X            break;
  750. X        case (5):
  751. X            checkoption(menubuf, xmenubuf, "F",
  752. X                "F(ile list),       ", fpL, &menu_items);
  753. X            checkoption(menubuf, xmenubuf, "R",
  754. X                "R(aw list),        ", fpR, &menu_items);
  755. X            checkoption(menubuf, xmenubuf, "N",
  756. X                "N(ew file list),   ", fpL, &menu_items);
  757. X            checkoption(menubuf, xmenubuf, "L",
  758. X                "L(ocate files)     ", fpL, &menu_items);
  759. X            break;
  760. X        default:
  761. X            return;
  762. X
  763. X        }
  764. X        if(type == 5)
  765. X            strcat(menubuf, "\n\r");
  766. X        else
  767. X            strcat(menubuf, "\n\r\n\r");
  768. X        if(!xpert) {
  769. X            portsout(CRLF);
  770. X            portsout(menubuf);
  771. X        }
  772. X        portsout("Commands: ");
  773. X        portsout(xmenubuf);
  774. X        portsout("===> ");
  775. X}
  776. END_OF_FILE
  777.   if test 6772 -ne `wc -c <'bbscmenu.c'`; then
  778.     echo shar: \"'bbscmenu.c'\" unpacked with wrong size!
  779.   fi
  780.   # end of 'bbscmenu.c'
  781. fi
  782. if test -f 'bbscsigs.c' -a "${1}" != "-c" ; then 
  783.   echo shar: Will not clobber existing file \"'bbscsigs.c'\"
  784. else
  785.   echo shar: Extracting \"'bbscsigs.c'\" \(7161 characters\)
  786.   sed "s/^X//" >'bbscsigs.c' <<'END_OF_FILE'
  787. X/*------------------------------------------------------------------------
  788. X       Name: bbscsigs.c
  789. X   Comments: Display file areas and select one
  790. X  ------------------------------------------------------------------------*/
  791. X
  792. X
  793. X#include <stdio.h>
  794. X#include <string.h>
  795. X#include <ctype.h>
  796. X#include <signal.h>
  797. X#include "bbscdef.h"
  798. X#include <sys/locking.h>
  799. X
  800. X
  801. Xextern int      user_priv;
  802. Xextern int    first_time_in;
  803. Xextern int    first_msg_in;
  804. Xextern int    sigreturn;
  805. Xextern char     port_id[4];
  806. Xextern char    callers[99];
  807. Xextern timer(), mon_toggle(), sys_toggle(), chat(), hanged();
  808. X
  809. Xchar    save_info[99];
  810. X
  811. Xsig_access()
  812. X{
  813. X    FILE           *fpt, *fopen();
  814. X    char           *fgets(), *getenv();
  815. X    char            choice[4];
  816. X#ifndef SYSV
  817. X    char            dir_priv_ascii[7];
  818. X#endif
  819. X#ifdef SYSV
  820. X    char            dir_priv_ascii[20];
  821. X#endif
  822. X    char        signame[32], sigdisc[30], sigtype[10];
  823. X    int             line_cnt, ret, i;
  824. X    int             index_value, ptr;
  825. X    int             length;
  826. X    int        x1, x2;
  827. X
  828. X    sigreturn = 1;
  829. X    while (1) {
  830. X
  831. Xdo_again:
  832. X    strcpy(buf128, SIGS);
  833. X
  834. X    if ((fpt = fopen(buf128, "r")) == NULL) {
  835. X        portsout("\n\r\n\rThere are no SPECIAL INTEREST GROUPS today!\n\r\n\r");
  836. X        return ;
  837. X    }
  838. X        portsout("\n\r\n\r\n\r                  *********************************\n\r");
  839. X        portsout("                * Available Special Interest GROUPS *\n\r");
  840. X        portsout("                  *********************************\n\r\n\r");
  841. X        portsout("\n\r                SIGs                     Description           Type\n\r");
  842. X        portsout("    ============================== ======================     =======\n\r");
  843. X
  844. X    line_cnt = 0;
  845. X    while (fpt) {
  846. X        zfl(f_lines[line_cnt], 83);
  847. X        if ((fgets(f_lines[line_cnt], 82, fpt)) == NULL) {
  848. X            if (line_cnt == 0) {
  849. X                portsout("\n\rEOF Unexpected in Function List: Notify Sysop!\n\r");
  850. X                return;
  851. X            }
  852. X            break;    /* if not 1st line */
  853. X        }        /* end of if ((fgets)) */
  854. X        if (line_cnt > 0) {
  855. X            length = strlen(f_lines[line_cnt]);
  856. X            length -= 74;
  857. X            if(length > 6)
  858. X                length = 6;
  859. X            substr(f_lines[line_cnt], dir_priv_ascii, 74, length);
  860. X            dir_priv[line_cnt] = atoi(dir_priv_ascii);
  861. X            if (dir_priv[line_cnt] > user_priv)
  862. X                goto next_read;
  863. X            substr(f_lines[line_cnt], signame, 1, 30);
  864. X            substr(f_lines[line_cnt], sigdisc, 52,22);
  865. X            x1 = strlen(signame);
  866. X            for(x2=x1; x2 < 30; x2++)
  867. X                strcat(signame, " ");
  868. X            x1 = strlen(sigdisc);
  869. X            for(x2=x1; x2 < 26; x2++)
  870. X                strcat(sigdisc," ");
  871. X            if(f_lines[line_cnt][78] == '*')
  872. X                strcpy(sigtype, "private");
  873. X            else
  874. X                strcpy(sigtype, "public");
  875. X            sprintf(who_am_i, "%s %s %s", signame, sigdisc, sigtype);
  876. X
  877. X
  878. X            strip(who_am_i);
  879. X            sprintf(buf128, "%2d) %s", line_cnt, who_am_i);
  880. X            strip(buf128);
  881. X            term_space(buf128);
  882. X                portsout(buf128);
  883. X                portsout("\n\r");
  884. X        }
  885. Xnext_read:
  886. X        ++line_cnt;
  887. X    }            /* end of while (fpt) */
  888. X    if (line_cnt <= 1)
  889. X        {
  890. X        portsout("\n\r\n\rThere are no SPECIAL INTEREST GROUPS today!\n\r\n\r");
  891. X        return;
  892. X        }
  893. X        portsout(CRLF);
  894. X        portsout(" Q) Quit --- exit SIG function section");
  895. X        portsout(CRLF);
  896. X    fclose(fpt);
  897. X        portsout(CRLF);
  898. X
  899. X        portsout("Enter Selection ===> ");
  900. X        portsin_cmp(choice, 2, "Qq");
  901. X        portsout(CRLF);
  902. X        *choice = toupper(*choice);
  903. X
  904. X        if (*choice == 'Q')
  905. X            return;
  906. X
  907. X        index_value = atoi(choice);
  908. X        if (index_value > 0 && index_value < line_cnt) {
  909. X            if (dir_priv[index_value] <= user_priv) {
  910. X                parse_sig(f_lines[index_value]);
  911. X                if(!active) {
  912. X                    sigreturn = 0;
  913. X                    return;
  914. X                }
  915. X                continue;
  916. X            }
  917. X        }
  918. X    }
  919. X}
  920. X
  921. X
  922. X
  923. X
  924. X
  925. Xparse_sig(string, sn, sd, st )
  926. X    char           *string;
  927. X{
  928. X
  929. X    register char  *file_ptr, *xptr;
  930. X    register int    i, private;
  931. X    char tempr[100], temps[100], tempt[100], tempu[100], tempv[100];
  932. X    char tempw[100];
  933. X    char sigfile[99];
  934. X    char firstz[20], lastz[20];
  935. X    extern int fds;
  936. X    FILE *sigptr;
  937. X
  938. X    file_ptr = buf128;
  939. X    substr(string, buf128, 1, 50);
  940. X    strip(buf128);
  941. X    term_space(buf128);
  942. X    if(string[78] != '*')
  943. X        private = 0;
  944. X    else
  945. X        private = 1;
  946. X    strcpy(tempr, ORGPATH);
  947. X    file_ptr = (tempr + strlen(tempr));
  948. X    i = 0;
  949. X    who_am_I[0] = '\0';
  950. X    xptr = who_am_I;
  951. X    while ( string[i] != ' ') {
  952. X        *file_ptr = string[i];
  953. X        *xptr = string[i];
  954. X        file_ptr++;
  955. X        xptr++;
  956. X        i++;
  957. X    }
  958. X    *file_ptr = '\0';
  959. X    *xptr = '\0';
  960. X    strcat(tempr, "/");
  961. X    strcpy(temps, tempr);
  962. X    strcpy(tempt, tempr);
  963. X    strcpy(tempv, tempr);
  964. X    strcpy(tempw, tempr);
  965. X    strcpy(tempu, ORGPATH);
  966. X    strcat(tempu, "helpsig.bbs");
  967. X    strcat(tempt, "sigwelcome.bbs");
  968. X    strcat(tempv, "sigentry.bbs");
  969. X    strcat(tempw, "features.bbs");
  970. X    strcat(temps, "files/");
  971. X    strcat(tempr, "msgs/");
  972. X    strcpy( sigfile, ORGPATH);
  973. X    strcat( sigfile, who_am_I);
  974. X    strcat( sigfile, ".bbs");
  975. X    sigptr = fopen(sigfile, "r");
  976. X    if( sigptr == NULL ) {
  977. X        portsout("\n\r\n\rThat SIG is not available today.\n\r");
  978. X        return;
  979. X    }
  980. X    while(1) {
  981. X        if( fscanf( sigptr, "%s%s", firstz, lastz) == EOF ) {
  982. X            fclose(sigptr);
  983. X            if(private) {
  984. X                portsout("\n\rThis is a private SIG and your are not listed as a member.\n\r");
  985. X                sigptr = fopen(tempv, "r");
  986. X                if(sigptr != NULL)
  987. X                    cmd_p(tempv);
  988. X                fclose(sigptr);
  989. X                return;
  990. X                }
  991. X            portsout("\n\rYou are being registered into this SIG.\n\r");
  992. X            sigptr = fopen(sigfile, "a");
  993. X            fds = fileno(sigptr);
  994. X            rewind(sigptr);
  995. X            locking(fds, LK_LOCK, 0L);
  996. X            fprintf( sigptr, "%s %s\n", w_fname, w_lname);
  997. X            rewind(sigptr);
  998. X            locking(fds, LK_UNLCK, 0L);
  999. X            fclose( sigptr);
  1000. X            break;
  1001. X        }
  1002. X        if (( strcmp(firstz, w_fname) == 0) &&
  1003. X              (strcmp(lastz, w_lname) == 0)) {
  1004. X            portsout("\n\rYou are listed in this SIG.\n\r");
  1005. X            fclose( sigptr );
  1006. X            break;
  1007. X        }
  1008. X    }    
  1009. X    strcpy(save_info, who_am_I);
  1010. X    if(private)
  1011. X        strcat(save_info, "        - A Private SIG -");
  1012. X    else
  1013. X        strcat(save_info, "        - A Public SIG -");
  1014. X    sigptr = fopen(tempt, "r");
  1015. X    if( sigptr != NULL ) {
  1016. X        portsout(CRLF);
  1017. X        portsout(CRLF);
  1018. X        cmd_p(tempt);
  1019. X    }
  1020. X    fclose(sigptr);
  1021. X    if ((sigptr = fopen(callers, "a")) == NULL) {    /* create or open for
  1022. X                                     * append */
  1023. X        portsout(CRLF);
  1024. X        portsout("Can't open/create callers file!");
  1025. X        portsout(CRLF);
  1026. X        return;
  1027. X    }
  1028. X        i = fprintf(sigptr, "%s %s ","   Entered SIG ", save_info);
  1029. X        if (i < 0) {
  1030. X            portsout(CRLF);
  1031. X            portsout("Caller file has problem writing");
  1032. X            portsout(CRLF);
  1033. X        } else {
  1034. X            fputs("\n", sigptr);
  1035. X        }
  1036. X        fclose(sigptr);
  1037. X    while (1) {
  1038. X        if(!active)
  1039. X            return;
  1040. X        cmd_t();
  1041. X        portsout("\n\rSIG = ");
  1042. X        portsout(save_info);
  1043. X        portsout(CRLF);
  1044. X        bbsmenu(4,0);
  1045. X        portsin(firstz, 1);
  1046. X        portsout(CRLF);
  1047. X        *firstz = toupper(*firstz);
  1048. X        switch(firstz[0]) {
  1049. X        case ('A'):
  1050. X            if( !privmsg(mpZ))
  1051. X                break;
  1052. X            additional(tempw);
  1053. X            break;
  1054. X        case ('G'):
  1055. X            if( !privmsg(mpG))
  1056. X                break;
  1057. X            cmd_c();
  1058. X            break;
  1059. X        case ('?'):
  1060. X            if( !privmsg(mpZ))
  1061. X                break;
  1062. X            cmd_p(tempu);
  1063. X            break;
  1064. X        case ('M'):
  1065. X            if( !privmsg(mpMS))
  1066. X                break;
  1067. X            strcpy(m_pathname, tempr);
  1068. X            first_msg_in = FALSE;
  1069. X            hdrread();
  1070. X            check_mail();
  1071. X            msg_section(mpK);
  1072. X            break;
  1073. X        case ('F'):
  1074. X            if( !privmsg(mpF))
  1075. X                break;
  1076. X            strcpy(f_pathname, temps);
  1077. X            strcpy(u_pathname, temps);
  1078. X            first_time_in = FALSE;
  1079. X            cmd_f();
  1080. X            break;
  1081. X        case ('L'):
  1082. X            return;
  1083. X            break;
  1084. X        case ('X'):
  1085. X            if( !privmsg(mpX))
  1086. X                break;
  1087. X            cmd_x();
  1088. X            break;
  1089. X        case ('T'):
  1090. X            if( !privmsg(mpT))
  1091. X                break;
  1092. X            toggle = !toggle;
  1093. X            if (toggle ) 
  1094. X                portsout("\n\rStop Mode\n\r");
  1095. X            else
  1096. X                portsout("\n\rContinuous Mode\n\r");
  1097. X        default:
  1098. X            break;
  1099. X        }
  1100. X    }
  1101. X}
  1102. END_OF_FILE
  1103.   if test 7161 -ne `wc -c <'bbscsigs.c'`; then
  1104.     echo shar: \"'bbscsigs.c'\" unpacked with wrong size!
  1105.   fi
  1106.   # end of 'bbscsigs.c'
  1107. fi
  1108. if test -f 'bbsczip.c' -a "${1}" != "-c" ; then 
  1109.   echo shar: Will not clobber existing file \"'bbsczip.c'\"
  1110. else
  1111.   echo shar: Extracting \"'bbsczip.c'\" \(5093 characters\)
  1112.   sed "s/^X//" >'bbsczip.c' <<'END_OF_FILE'
  1113. X#include <stdio.h>
  1114. X#include <string.h>
  1115. X#include <ctype.h>
  1116. X#include "bbscdef.h"
  1117. X
  1118. X
  1119. Xchar            save_old_m[99];
  1120. Xextern int      user_priv, last_msg_read, read_flag, read_number, reply_sw;
  1121. Xextern int      first_msg_in, blocked_m;
  1122. Xint             cont_read;
  1123. Xint             contin;
  1124. Xint             zip;
  1125. X
  1126. X
  1127. Xparse_zip(string)
  1128. X    char           *string;
  1129. X{
  1130. X
  1131. X    register char  *file_ptr, *xptr;
  1132. X    register int    i;
  1133. X
  1134. X    strcpy(m_pathname, ORGPATH);
  1135. X    file_ptr = (m_pathname + strlen(m_pathname));
  1136. X    xptr = who_am_I;
  1137. X
  1138. X    i = 0;
  1139. X    while (string[i] != ' ') {
  1140. X        *file_ptr = string[i];
  1141. X        *xptr = string[i];
  1142. X        ++xptr;
  1143. X        ++file_ptr;
  1144. X        ++i;
  1145. X    }
  1146. X    *file_ptr = '/';
  1147. X    ++file_ptr;
  1148. X    *file_ptr = '\0';
  1149. X    *xptr = '\0';
  1150. X
  1151. X}
  1152. Xcmd_z()
  1153. X{
  1154. X    FILE           *fpt, *fopen();
  1155. X    char           *fgets(), *getenv();
  1156. X    char            choice[4];
  1157. X#ifndef SYSV
  1158. X    char            dir_priv_ascii[7];
  1159. X#endif
  1160. X#ifdef SYSV
  1161. X    char            dir_priv_ascii[20];
  1162. X#endif
  1163. X    char           *buf_ptr, *file_ptr, *char_ptr;
  1164. X    int             line_cnt, ret, i;
  1165. X    int             index_value, ptr;
  1166. X    int             length, strl, ii;
  1167. X    int             read_type;
  1168. X    int             ret_type;
  1169. X
  1170. X    strcpy(buf128, MSGS);
  1171. X    strcpy(save_old_m, m_pathname);
  1172. X    first_msg_in = TRUE;
  1173. X    read_type = 0;
  1174. X    stop_that = FALSE;
  1175. X    zip = TRUE;
  1176. X    portsout("\n\r\n\rY(our messages) or N(ew messages) Y/n? ");
  1177. X    portsin(choice, 1);
  1178. X    portsout(CRLF);
  1179. X    if (choice[0] == 'n' || choice[0] == 'N') {
  1180. X        read_type = 1;
  1181. X        cont_read = 0;
  1182. X        portsout("C(ontinous read) or S(ingle at a time) c/S? ");
  1183. X        portsin(choice, 1);
  1184. X        portsout(CRLF);
  1185. X        if (choice[0] == 'c' || choice[0] == 'C') {
  1186. X            cont_read = 1;
  1187. X            contin = TRUE;
  1188. X        }
  1189. X    }
  1190. X    if ((fpt = fopen(buf128, "r")) == NULL) {
  1191. X        portsout("\n\rError Opening File Area List: Notify Sysop!\n\r");
  1192. X        zip = FALSE;
  1193. X        return (-1);
  1194. X    }
  1195. X    line_cnt = 0;
  1196. X    while (fpt) {
  1197. X        zfl(f_lines[line_cnt], 81);
  1198. X        if ((fgets(f_lines[line_cnt], 80, fpt)) == NULL) {
  1199. X            if (line_cnt == 0) {
  1200. X                portsout("\n\rEOF Unexpected in Message Area List: Notify Sysop!\n\r");
  1201. X                zip = FALSE;
  1202. X                return (-1);
  1203. X            }
  1204. X            break;    /* if not 1st line */
  1205. X        }        /* end of if ((fgets)) */
  1206. X        if (line_cnt > 0) {
  1207. X            length = strlen(f_lines[line_cnt]);
  1208. X            length -= 57;
  1209. X            if (length > 6)
  1210. X                length = 6;
  1211. X            substr(f_lines[line_cnt], dir_priv_ascii, 57, length);
  1212. X            strl = strlen(dir_priv_ascii);
  1213. X            if (strl == 0) {
  1214. X                portsout("\n\rError reading privilege level\n\r");
  1215. X                exit(1);
  1216. X            }
  1217. X            dir_priv[line_cnt] = atoi(dir_priv_ascii);
  1218. X            if (dir_priv[line_cnt] > user_priv)
  1219. X                goto next_read;
  1220. X            strcpy(who_am_i, f_lines[line_cnt]);
  1221. X            buf_ptr = who_am_i;
  1222. X            buf_ptr += 56;
  1223. X            for (ptr = 0; ptr < 5; ptr++)
  1224. X                *buf_ptr++ = ' ';
  1225. X            *buf_ptr = '\0';
  1226. X            sprintf(buf128, "%2d) %s", line_cnt, who_am_i);
  1227. X        }
  1228. Xnext_read:
  1229. X        ++line_cnt;
  1230. X    }            /* end of while (fpt) */
  1231. X    fclose(fpt);
  1232. X
  1233. X    if (line_cnt <= 1) {
  1234. X        zip = FALSE;
  1235. X        return;
  1236. X    }
  1237. X    for (index_value = 1; index_value < line_cnt; index_value++) {
  1238. X        if (dir_priv[index_value] <= user_priv) {
  1239. X            if (stop_that)
  1240. X                goto dats_all;
  1241. X            parse_zip(f_lines[index_value]);
  1242. X            hdrread();
  1243. X            portsout("\n\rSwitching to area '");
  1244. X            portsout(who_am_I);
  1245. X            portsout("'\n\r");
  1246. X            ret_type = 1;
  1247. X            if (!read_type)
  1248. X                cmd_y();
  1249. X            else
  1250. X                ret_type = new_msgs();
  1251. X            if (ret_type == 0 || ret_type == ERROR)
  1252. X                goto dats_all;
  1253. X            portsout("\n\r*************************************************\n\r");
  1254. X        }
  1255. X    }
  1256. Xdats_all:
  1257. X    strcpy(m_pathname, save_old_m);
  1258. X    i = strlen(m_pathname);
  1259. X    if (i > 0) {
  1260. X        hdrread();
  1261. X        set_first_read();
  1262. X    }
  1263. X    if (contin == TRUE && cont_read == 1)
  1264. X        contin = FALSE;
  1265. X    stop_that = FALSE;
  1266. X    zip = FALSE;
  1267. X}
  1268. Xint
  1269. Xnew_msgs()
  1270. X{
  1271. X    int             rc, fd, q_msg;
  1272. X    int             t1;
  1273. X    char            chr[2];
  1274. X    int             new_msg;
  1275. X    int             how;
  1276. X    set_first_read();
  1277. X    new_msg = last_msg_read + 1;
  1278. X    q_msg = new_msg;
  1279. X    read_flag = TRUE;
  1280. X    if ((fd = msgopen(0)) == ERROR) {
  1281. X        zip = FALSE;
  1282. X        return (ERROR);
  1283. X    }
  1284. X    how = 1;
  1285. X    while ((rc = msgreadx(fd, q_msg++)) != ERROR) {
  1286. X        if (rc == 0 || rc == -10) {
  1287. X            continue;
  1288. X        }
  1289. X        read_number = atoi(msg_no);
  1290. X        cmd_r();
  1291. X        last_msg_read = read_number;
  1292. X        set_write();
  1293. X        if (cont_read == 1)
  1294. X            goto cont_rd;
  1295. X        if (user_priv >= mpE) {
  1296. X            portsout("\n\rDo you wish to reply to this message? (y/N): ");
  1297. X            portsin(chr, 1);
  1298. X            portsout(CRLF);
  1299. X            if (chr[0] == 'Y' || chr[0] == 'y') {
  1300. X                portsout("\n\rDo you wish to use blocked (right justified) format?  (y/N: ");
  1301. X                portsin(chr, 1);
  1302. X                portsout(CRLF);
  1303. X                if (chr[0] == 'y' || chr[0] == 'Y') 
  1304. X                    blocked_m = 1;
  1305. X                else
  1306. X                    blocked_m = 0;
  1307. X                reply_sw = TRUE;
  1308. X                strcpy(msg_to, msg_from);
  1309. X                strcpy(x_pathandfile, "(R) ");
  1310. X                strcat(x_pathandfile, msg_subject);
  1311. X                substr(x_pathandfile, msg_subject, 1, 20);
  1312. X                cmd_e();
  1313. X                reply_sw = FALSE;
  1314. X            }
  1315. X        }
  1316. X        portsout("\n\r\n\rContinue reading messages within this message base? (Y/n): ");
  1317. X        portsin(chr, 1);
  1318. X        portsout(CRLF);
  1319. X        if (chr[0] == 'n' || chr[0] == 'N')
  1320. X            break;
  1321. Xcont_rd:    if (stop_that) {
  1322. X            stop_that = FALSE;
  1323. X            read_flag = FALSE;
  1324. X            how = 0;
  1325. X            break;
  1326. X        }
  1327. X        if (cont_read == 1) {
  1328. X            portsout(CRLF);
  1329. X            portsout("----------------------------------------");
  1330. X        }
  1331. X        portsout(CRLF);
  1332. X    }
  1333. X    read_flag = FALSE;
  1334. X    msgclose(fd);
  1335. X    return (how);
  1336. X}
  1337. END_OF_FILE
  1338.   if test 5093 -ne `wc -c <'bbsczip.c'`; then
  1339.     echo shar: \"'bbsczip.c'\" unpacked with wrong size!
  1340.   fi
  1341.   # end of 'bbsczip.c'
  1342. fi
  1343. if test -f 'chatbbs/chatbbs.c' -a "${1}" != "-c" ; then 
  1344.   echo shar: Will not clobber existing file \"'chatbbs/chatbbs.c'\"
  1345. else
  1346.   echo shar: Extracting \"'chatbbs/chatbbs.c'\" \(4201 characters\)
  1347.   sed "s/^X//" >'chatbbs/chatbbs.c' <<'END_OF_FILE'
  1348. X/*
  1349. X *  This program allows the "sysop" to communicate with the bbs user(s) that
  1350. X *  is/are on the system. Only one chat can be performed at a time. While the
  1351. X *  chat is in progress, any other user that is on the system who requests a
  1352. X *  chat will automatically be notified that the sysop is presently chatting
  1353. X *  or has "turned off" the chat. To turn off the chat, just generate a null
  1354. X *  length file called /tmp/ttydev and the bbs software will do the rest.
  1355. X * 
  1356. X *  Usage of the program is as follows:   chatbbs device_name
  1357. X *
  1358. X *  Please note that the device_name DOES NOT include the path ( /dev/ ). An
  1359. X *  example of the usage is as follows:  chatbbs tty1A
  1360. X *
  1361. X *  To TERMINATE the chat, just depress the ESCAPE key ( esc --- '\033' ) and
  1362. X *  the chat will terminate.
  1363. X *
  1364. X *  The sequence that the bbs software uses is as follows:
  1365. X *
  1366. X *  SIGPIPE ------ Go into chat
  1367. X *  SIGUSR1 ------ Exit chat
  1368. X *
  1369. X *  Please note that SIGUSR1 is also used to toggle the local monitoring of the
  1370. X *  bbs user. The bbs software will determine what to do when it intercepts
  1371. X *  SIGUSR1.
  1372. X *
  1373. X *
  1374. X *  FOR SysV.4, compile the code using a -DES54 ( cc -DES54 chatbbs.c -o chatbbs
  1375. X *
  1376. X *
  1377. X *  Sanford J. Zelkovitz    XBBS  714-821-9671
  1378. X *
  1379. X */
  1380. X#include <stdio.h>
  1381. X#include <string.h>
  1382. X#include <signal.h>
  1383. X#include "chat.h"
  1384. Xint             kill();
  1385. Xint             atoi();
  1386. Xmain(argc, argv) 
  1387. X    int        argc;
  1388. X    char           *argv[];
  1389. X{
  1390. X    FILE           *indev;
  1391. X    FILE           *outdev;
  1392. X    char            buffer[30];
  1393. X    char           *tty, *buffer_ptr, *ttyname();
  1394. X    char            temp[50], char_pid[30];
  1395. X    int             ch;
  1396. X    int             handle, i, pid;
  1397. X    int             ret_kill;
  1398. X#ifdef ESIX54
  1399. X    char        tmpbuffer[100];
  1400. X    FILE        *ttz;
  1401. X    char        x1[20], x2[20], x3[20], x4[20], x5[20], x6[20];
  1402. X    int        major, minor;
  1403. X#endif
  1404. X    setbuf(stdin, NULL);
  1405. X    setbuf(stdout, NULL);
  1406. X    if (argc != 2) {
  1407. X        printf("\nError in usage, should be: chatbbs device.\n");
  1408. X        exit(1);
  1409. X    }
  1410. X    strcpy(buffer, "/dev/");
  1411. X    strcat(buffer, argv[1]);
  1412. X    printf("\nDevice driver = %s\n", buffer);
  1413. X    tty = ttyname(1);
  1414. X#ifdef ESIX54
  1415. X    unlink("/dev/bbschatter");
  1416. X    sprintf(tmpbuffer, "ls -l %s > /tmp/chatinfo", tty);
  1417. X    system(tmpbuffer);
  1418. X    ttz = fopen("/tmp/chatinfo", "r");
  1419. X    (void) fscanf(ttz, "%s%s%s%s%s%s", x1, x2, x3, x4, x5, x6);
  1420. X    fclose(ttz);
  1421. X    major = atoi(x5);
  1422. X    minor = atoi(x6);
  1423. X    printf( "major = %d    minor = %d\n", major, minor);
  1424. X    sprintf(tmpbuffer, "/etc/mknod /dev/bbschatter c %d %d", major, minor);
  1425. X    system(tmpbuffer);
  1426. X    system("chmod 666 /dev/bbschatter");
  1427. X    system("chown bbs /dev/bbschatter");
  1428. X#endif
  1429. X    if ((indev = fopen("/tmp/ttydev", "w")) == NULL) {
  1430. X        printf("\nError opening /tmp/ttydev!\n");
  1431. X        exit(1);
  1432. X    }
  1433. X#ifdef ESIX54
  1434. X    (void) fprintf(indev, "%s\n", "/dev/bbschatter");
  1435. X#else
  1436. X    (void) fprintf(indev, "%s\n", tty);
  1437. X#endif
  1438. X    fclose(indev);
  1439. X    if ((outdev = fopen(buffer, "r+")) == NULL) {
  1440. X        unlink("/tmp/ttydev");
  1441. X        unlink("/dev/bbschatter");
  1442. X        printf("\nError opening BBS user's device driver!\n");
  1443. X        exit(1);
  1444. X    }
  1445. X    setbuf(outdev, NULL);
  1446. X    strcpy(temp, "/tmp/pid");
  1447. X    i = strlen(buffer);
  1448. X    buffer_ptr = buffer;
  1449. X    buffer_ptr = buffer_ptr + i - 2;
  1450. X    strcat(temp, buffer_ptr);
  1451. X    if ((indev = fopen(temp, "r")) == NULL) {
  1452. X        unlink("/tmp/ttydev");
  1453. X        unlink("/dev/bbschatter");
  1454. X        printf("\nError opening pid file!\n");
  1455. X        exit(1);
  1456. X    }
  1457. X    (void) fscanf(indev, "%s", char_pid);
  1458. X    fclose(indev);
  1459. X    pid = atoi(char_pid);
  1460. X    ret_kill = kill(pid, SIGPIPE);
  1461. X    if (ret_kill == -1) {
  1462. X        printf("\nIllegal pid????\n");
  1463. X        unlink("/tmp/ttydev");
  1464. X        unlink("/dev/bbschatter");
  1465. X        exit(1);
  1466. X    }
  1467. X    sleep(2);
  1468. X    setraw();
  1469. X    while (1) {
  1470. X        ch = getc(stdin);
  1471. X        ch &= '\377';
  1472. X        if (ch == '\033')
  1473. X            break;
  1474. X        putchar(ch);
  1475. X        putc(ch, outdev);
  1476. X        if (ch == '\n') {
  1477. X            ch = '\r';
  1478. X            putchar(ch);
  1479. X            putc(ch, outdev);
  1480. X        }
  1481. X        if (ch == '\r') {
  1482. X            ch = '\n';
  1483. X            putchar(ch);
  1484. X            putc(ch, outdev);
  1485. X        }
  1486. X        if (ch == '\b') {
  1487. X            ch = ' ';
  1488. X            putchar(ch);
  1489. X            putc(ch, outdev);
  1490. X            ch = '\b';
  1491. X            putchar(ch);
  1492. X            putc(ch, outdev);
  1493. X        }
  1494. X    }
  1495. X    ch = '\r';
  1496. X    putchar(ch);
  1497. X    putc(ch, outdev);
  1498. X    ch = '\n';
  1499. X    for (i = 0; i <= 5; i++) {
  1500. X        putchar(ch);
  1501. X        putc(ch, outdev);
  1502. X    }
  1503. X    fclose(outdev);
  1504. X    restore();
  1505. X    unlink("/tmp/ttydev");
  1506. X    unlink("/dev/bbschatter");
  1507. X    ret_kill = kill(pid, SIGUSR1);
  1508. X    if (ret_kill == -1) {
  1509. X        printf("\nIllegal pid????\n");
  1510. X        exit(1);
  1511. X    }
  1512. X}
  1513. END_OF_FILE
  1514.   if test 4201 -ne `wc -c <'chatbbs/chatbbs.c'`; then
  1515.     echo shar: \"'chatbbs/chatbbs.c'\" unpacked with wrong size!
  1516.   fi
  1517.   # end of 'chatbbs/chatbbs.c'
  1518. fi
  1519. if test -f 'extra_info' -a "${1}" != "-c" ; then 
  1520.   echo shar: Will not clobber existing file \"'extra_info'\"
  1521. else
  1522.   echo shar: Extracting \"'extra_info'\" \(7654 characters\)
  1523.   sed "s/^X//" >'extra_info' <<'END_OF_FILE'
  1524. X               Extra Information On How the BBS Operates
  1525. X
  1526. X1) All errors that are detected that would normally go to stderr are sent,
  1527. X   instead to a file called /tmp/errors_out. Under normal conditions, this
  1528. X   file should always have a 0 length.
  1529. X
  1530. X2) The file, callers.bbs, contains a time log of all of your bbs callers.
  1531. X   In addition to the name and time, all uploads and downloads are logged
  1532. X   into this file. If a file is uploaded as "SYSOP ONLY", the description of
  1533. X   the file is also added to callers.bbs instead of files.bbs. This way, you
  1534. X   can still get the description.
  1535. X
  1536. X3) A file, /tmp/files, is generated for each and every L(ist) command that is
  1537. X   requested. This is a temporary file which is sent to the user.
  1538. X
  1539. X4) The file, users.bbs, contains the list of all of your users, with their
  1540. X   passwords, first time called, last time called, and their address in the
  1541. X   form of city and state.
  1542. X
  1543. X5) The file, messages.bbs, contain all of the messages. There are three codes
  1544. X   used within this file : 0 - The message is active and not confidential
  1545. X                           5 - The message is active and is confidential
  1546. X                           9 - The message was deleted 
  1547. X   ( Note: if you wish to reactivate a deleted message, just change the "9"
  1548. X           to either a "0" or "5" ).
  1549. X   ( A program will be available soon to "squeeze" the message file and
  1550. X     remove deleted messages )
  1551. X6) The file, crossref.bbs, contains the cross reference table between the
  1552. X   message number and file record number. This way, RAPID message access
  1553. X   is achieved. Presently, you can have up to 1000 messages within the system.
  1554. X   ( active and deleted )
  1555. X
  1556. X7) The file, bulletin.bbs, contains your bulletin which is printed out
  1557. X   whenever a user logs into the bbs or with the B command from the main
  1558. X   menu.
  1559. X
  1560. X8) The file, header.bbs, contains the information to add the NEXT message
  1561. X   into the message file. This way, a search is not required to find the
  1562. X   proper entry point.
  1563. X
  1564. X9) The file, files.bbs, contains the download file information
  1565. X
  1566. XA) The file, help.bbs, contains the HELP information for your users.
  1567. X
  1568. XB) The file, humor.bbs, contains the humor file for your users!
  1569. X
  1570. XC) The file, lastcall.bbs, contains the information about your last user
  1571. X   on the system.
  1572. X
  1573. XD) The file, newuser.bbs, contains the message you output to new users.
  1574. X
  1575. XE) The file, system.bbs, contains the terminate message you output to the
  1576. X   user when he "logs off".
  1577. X
  1578. XF) The file, welcome.bbs, contains the "welcome" message you output when
  1579. X   the user logs in. Please note that this is sent prior to the bulletin
  1580. X   and may be your message of the day.
  1581. X
  1582. X
  1583. X
  1584. X
  1585. XA quick note on how files are handled when they are uploaded. 
  1586. X
  1587. XFiles are sent, depending on the protocol used, either to your FILES 
  1588. Xdirectory or to your /usr/bbs directory. In the case of the files
  1589. Xbeing sent to /usr/bbs ( KERMIT UPLOAD ), they will be moved to FILES
  1590. Xafter the transfer is completed. If the file(s) is/are marked as
  1591. XSYSOP ONLY, they will be moved to your BBS directory to insure complete
  1592. Xprivacy. Therefore, even if your user knows the name of the file, he
  1593. Xcan not get to it!
  1594. X
  1595. X
  1596. XWarning! DO NOT try to modify the following files with an editor like
  1597. Xvi: users.bbs, header.bbs, crossref.bbs, messages.bbs since they are
  1598. XNOT truely ASCII files and the files WILL BE damaged. In the case of
  1599. Xcrossref.bbs, no ASCII information is even stored in it ( binary file ).
  1600. X************************************************************************
  1601. XUSER SIGNALS that are used:
  1602. X1) SIGUSR1 Toggles the local monitoring of the BBS. An example of the SHELL
  1603. X   Script that can be used is "toggle". This file can be found in the
  1604. X   download section.
  1605. X2) SIGUSR2 Toggles the privileges and time of the present user on the system.
  1606. X   The time and privilege level is set to maximum so CARE should be used
  1607. X   with this option since the user can now enter into Unix/Xenix with the
  1608. X   U option in the main menu. An example of a SHELL SCRIPT that can be used
  1609. X   is "systoggle". This file can be found in the download section.
  1610. X*************************************************************************
  1611. XNew features added on October 12, 1986:
  1612. XThree new .bbs files have been added: filepriv.bbs, mainpriv.bbs, and
  1613. Xuserpriv.bbs.
  1614. X1) filepriv.bbs contains the privileges assigned to the file menu options.
  1615. X   The file simply contains the letter and privilege assigned to the letter.
  1616. X   The range of privileges can vary between 0 and 32767. The privileges are
  1617. X   all relative so you may want to limit the range from 1 to 9. Warning,
  1618. X   be sure that the G option is ALWAYS lower than the lowest individual
  1619. X   privilege so you user can log off! An example of the file can be found
  1620. X   in this download section called filepriv.bbs.
  1621. X2) mainpriv.bbs contains the privileges assigned to the main menu options.
  1622. X   It is in the same form as filepriv.bbs. An example of the file can be
  1623. X   downloaded and is called mainpriv.bbs.
  1624. X3) userpriv.bbs is a dynamically created/appended file which contains the
  1625. X   individual user privileges along with their "delta time" allocation.
  1626. X   The file contains entries for each of your users in the form of:
  1627. X    FIRSTNAME LASTNAME PRIVILEGE_LEVEL DELTA_TIME EXTRA_KBYTES
  1628. X    An example of a particular user maybe as follows:
  1629. X    John Smith 5 600 5
  1630. X    Basically, the above user has a privilege level of 5 and has 10 additional
  1631. X    minutes allowed over the default time (RUNTIME in bbscdef.h). Also, he has
  1632. X    an extra 5 kilobytes of downloading allowed ( added to MAXKBYTES in
  1633. X    bbscdef.h ).
  1634. X    An entry may also look like this:
  1635. X    Joe Blow 2 -2400 -50
  1636. X    This means that the above user has a privilege level of 2 and has
  1637. X    been disallowed 40 minutes from the default time. If the default
  1638. X    time is set at 60 minutes, his total usage time is only 20 minutes.
  1639. X    His maximum allowable download in bytes has also been reduced by
  1640. X    50K!
  1641. X    The default privilege level can be found in bbscdef.h and is called
  1642. X    NEWPRIV.
  1643. X
  1644. X***************************************************************************
  1645. XNew features added on October 14, 1986
  1646. X    The sysop, by using SIGUSR2, can now give the present user temporary
  1647. X    maximum privileges and time on the system. Since this is a "toggle",
  1648. X    by issuing this signal again, the user will be returned back to the
  1649. X    logon time limits and privileges. An example of a SHELL SCRIPT that can
  1650. X    be used is systoggle.
  1651. X    You can now allow users to enter into Xenix/Unix! Care should be given
  1652. X    when allocating the user such high privileges. This is the U option
  1653. X    in the main menu. A suggestion would be to give this privilege the
  1654. X    maximum allowed in this BBS, 32767. Remember, when SIGUSR2 is issued,
  1655. X    that user WILL HAVE that privilege!
  1656. X
  1657. X***************************************************************************
  1658. X                       New Nov 9th, 1986
  1659. XYou must now have multiple versions of files.bbs. One, each, for EVERY
  1660. Xdownload directory and it must be in that directory. The files.bbs file
  1661. Xmust only contain the file listing for that particular directory!
  1662. X***************************************************************************
  1663. X                       New Nov 12, 1986
  1664. X
  1665. XNow, there are multiple message bases. The three files, crossref.bbs,
  1666. Xheader.bbs, and messages.bbs are stored in each different message base.
  1667. X***************************************************************************
  1668. X                       New Dec 8, 1986
  1669. X
  1670. XA response time variable has been added to the bbs software. This variable
  1671. Xis defined in bbscdef.h as WAITTIME. On this system, it is set to 300
  1672. Xseconds or 5 minutes. 
  1673. END_OF_FILE
  1674.   if test 7654 -ne `wc -c <'extra_info'`; then
  1675.     echo shar: \"'extra_info'\" unpacked with wrong size!
  1676.   fi
  1677.   # end of 'extra_info'
  1678. fi
  1679. if test -f 'msgpack/msgpack.c' -a "${1}" != "-c" ; then 
  1680.   echo shar: Will not clobber existing file \"'msgpack/msgpack.c'\"
  1681. else
  1682.   echo shar: Extracting \"'msgpack/msgpack.c'\" \(4971 characters\)
  1683.   sed "s/^X//" >'msgpack/msgpack.c' <<'END_OF_FILE'
  1684. X#include "packdef.h"
  1685. X#include <stdio.h>
  1686. X#include <sys/types.h>
  1687. X#include <sys/stat.h>
  1688. X#include <signal.h>
  1689. X#include <fcntl.h>
  1690. X#include <sgtty.h>
  1691. X#include <string.h>
  1692. X#include <ctype.h>
  1693. X#include <pwd.h>
  1694. X
  1695. Xstatic char     linkh[150], linkm[150], linkc[150];
  1696. Xstatic char     header[150], messages[150], crossref[150];
  1697. Xstatic char     newheader[150], newmsg[150], newxref[150];
  1698. Xstatic char     log[150], newlog[150];
  1699. Xstatic int      table[1001];
  1700. Xstatic int      goodmsg;
  1701. Xstatic char     foo[150];
  1702. X
  1703. Xmain()
  1704. X{
  1705. X    struct passwd  *p;
  1706. X    struct passwd  *getpwnam();
  1707. X    char           *ptr;
  1708. X    int             counter, result;
  1709. X    strcpy(foo, "bbs");
  1710. X    while (1) {
  1711. X        setpwent();
  1712. X        p = getpwnam(foo);
  1713. X        if (p == NULL) {
  1714. X            printf("Unable to locate user %s, please enter the proper name: ", foo);
  1715. X            scanf("%s", foo);
  1716. X            endpwent();
  1717. X        } else
  1718. X            break;
  1719. X    }
  1720. X    strcpy(foo, p->pw_shell);
  1721. X    ptr = strrchr(foo, '/');
  1722. X    if (ptr == NULL) {
  1723. X        printf("ERROR in shell location!\n");
  1724. X        exit(1);
  1725. X    }
  1726. X    ptr++;
  1727. X    *ptr = '\0';
  1728. X    strcpy(ORGPATH, foo);
  1729. X    strcpy(MSGS, ORGPATH);
  1730. X    strcat(MSGS, MSGS1);
  1731. X
  1732. X    for (counter = 1; counter < 100; counter++) {
  1733. X
  1734. X        result = change_msga(counter);
  1735. X        if (result != 1)
  1736. X            exit(0);
  1737. X        goodmsg = 0;
  1738. X        strcpy(linkh, m_pathname);
  1739. X        strcat(linkh, LINKH);
  1740. X        strcpy(log, m_pathname);
  1741. X        strcat(log, MSGLOG);
  1742. X        strcpy(newlog, m_pathname);
  1743. X        strcat(newlog, NEWLOG);
  1744. X        strcpy(linkm, m_pathname);
  1745. X        strcat(linkm, LINKM);
  1746. X        strcpy(linkc, m_pathname);
  1747. X        strcat(linkc, LINKC);
  1748. X        strcpy(header, m_pathname);
  1749. X        strcat(header, HEADER);
  1750. X        strcpy(messages, m_pathname);
  1751. X        strcat(messages, MESSAGES);
  1752. X        strcpy(crossref, m_pathname);
  1753. X        strcat(crossref, CROSSREF);
  1754. X        strcpy(newheader, m_pathname);
  1755. X        strcat(newheader, NEWHEADER);
  1756. X        strcpy(newmsg, m_pathname);
  1757. X        strcat(newmsg, NEWMSG);
  1758. X        strcpy(newxref, m_pathname);
  1759. X        strcat(newxref, NEWXREF);
  1760. X        remove();
  1761. X        hdrreadr();
  1762. X        hdrreadw();
  1763. X        hdrwrt();
  1764. X        cmd_s();
  1765. X        nlog();
  1766. X        rename();
  1767. X    }
  1768. X
  1769. X}
  1770. X
  1771. X
  1772. Xsavemsg()
  1773. X{                /* save a message */
  1774. X    int             fd;
  1775. X
  1776. X
  1777. X    if ((fd = msgopenw(2)) == ERROR) {    /* open i/o */
  1778. X        return (ERROR);
  1779. X    }
  1780. X    msgwrt(fd);        /* write the message */
  1781. X    msgclose(fd);
  1782. X
  1783. X    strcpy(h_date, msg_date);
  1784. X    hdrwrt();        /* update the header file */
  1785. X}
  1786. X/* end of function         */
  1787. X
  1788. Xcmd_s()
  1789. X{
  1790. X    int             q_msg, msgn, fd, msgnmbr, rc;
  1791. X    msgnmbr = 1;
  1792. X    for (fd = 0; fd <= 1000; fd++)
  1793. X        table[fd] = 0;
  1794. X    if ((fd = msgopenr(0)) == ERROR) {    /* open input */
  1795. X        return (ERROR);
  1796. X    }
  1797. X    q_msg = 1;
  1798. X    hdrreadr();
  1799. X    while ((rc = msgread(fd, q_msg++)) != ERROR) {    /* read until eof or
  1800. X                             * error */
  1801. X        msgn = q_msg - 1;
  1802. X        if (rc == 0) {
  1803. X            goto lpp;    /* not a valid msg */
  1804. X        }
  1805. X        reduce();
  1806. X        hdrreadw();
  1807. X        goodmsg = 1;
  1808. X        printf("\n%s%d\n", "Saving new message number ", msgnmbr);
  1809. X        table[msgn] = msgnmbr;
  1810. X        msgnmbr++;
  1811. X        savemsg();
  1812. Xlpp:
  1813. X        hdrreadr();
  1814. X    }
  1815. X    if (!goodmsg) {
  1816. X        strcpy(msg_delete, "5");
  1817. X        reduce();
  1818. X        hdrreadw();
  1819. X        table[msgn] = msgnmbr;
  1820. X        savemsg();
  1821. X    }
  1822. X    msgclose(fd);
  1823. X}
  1824. Xreduce()
  1825. X{
  1826. X    int             len;
  1827. X    len = strlen(msg_text);
  1828. X    len--;
  1829. X    while (msg_text[len] == 32) {
  1830. X        msg_text[len] = '\0';
  1831. X        len--;
  1832. X    }
  1833. X}
  1834. Xnlog()
  1835. X{
  1836. X    FILE           *input, *output;
  1837. X    char            firstz[20], lastz[20], msgz[7];
  1838. X    char            buffer[99], qwerty[10];
  1839. X    int             i, newi;
  1840. X    qwerty[0] = '\0';
  1841. X    if ((input = fopen(log, "r")) == NULL) {
  1842. X        printf("\nError opening message.log???\n");
  1843. X        exit(1);
  1844. X    }
  1845. X    if ((output = fopen(newlog, "w")) == NULL) {
  1846. X        printf("\nError opening Omessage.log??\n");
  1847. X        exit(1);
  1848. X    }
  1849. X    while (fscanf(input, "%s%s%s", firstz, lastz, msgz) != EOF) {
  1850. X        i = atoi(msgz);
  1851. X        while (1) {
  1852. X            if (table[i] || !i)
  1853. X                break;
  1854. X            --i;
  1855. X        }
  1856. X        newi = table[i];
  1857. X        itoa(qwerty, newi);
  1858. X        strcpy(buffer, firstz);
  1859. X        strcat(buffer, " ");
  1860. X        strcat(buffer, lastz);
  1861. X        strcat(buffer, " ");
  1862. X        strcat(buffer, qwerty);
  1863. X        i = strlen(qwerty);
  1864. X        i = 6 - i;
  1865. X        while (i) {
  1866. X            strcat(buffer, "_");
  1867. X            --i;
  1868. X        }
  1869. X        fprintf(output, "%s\n", buffer);
  1870. X    }
  1871. X    fclose(input);
  1872. X    fclose(output);
  1873. X}
  1874. Xrename()
  1875. X{
  1876. X    int             result;
  1877. X    printf("\nRenaming files ...............");
  1878. X    result = unlink(linkh);
  1879. X    result = unlink(linkm);
  1880. X    result = unlink(linkc);
  1881. X    result = link(log, linkh);
  1882. X    result = unlink(log);
  1883. X    result = link(newlog, log);
  1884. X    result = unlink(newlog);
  1885. X    result = link(linkh, newlog);
  1886. X    result = unlink(linkh);
  1887. X    result = link(header, linkh);
  1888. X    result = link(messages, linkm);
  1889. X    result = link(crossref, linkc);
  1890. X    result = unlink(header);
  1891. X    result = unlink(messages);
  1892. X    result = unlink(crossref);
  1893. X    result = link(newheader, header);
  1894. X    result = link(newmsg, messages);
  1895. X    result = link(newxref, crossref);
  1896. X    result = unlink(newheader);
  1897. X    result = unlink(newmsg);
  1898. X    result = unlink(newxref);
  1899. X    result = link(linkh, newheader);
  1900. X    result = link(linkm, newmsg);
  1901. X    result = link(linkc, newxref);
  1902. X    result = unlink(linkh);
  1903. X    result = unlink(linkm);
  1904. X    result = unlink(linkc);
  1905. X    strcpy(msg_text, CHMOD);
  1906. X    strcat(msg_text, m_pathname);
  1907. X    strcat(msg_text, CHMOD1);
  1908. X    result = system(msg_text);
  1909. X    printf("DONE\n");
  1910. X}
  1911. Xremove()
  1912. X{
  1913. X    int             result;
  1914. X    result = unlink(newheader);
  1915. X    result = unlink(newmsg);
  1916. X    result = unlink(newxref);
  1917. X}
  1918. X/* end of function         */
  1919. END_OF_FILE
  1920.   if test 4971 -ne `wc -c <'msgpack/msgpack.c'`; then
  1921.     echo shar: \"'msgpack/msgpack.c'\" unpacked with wrong size!
  1922.   fi
  1923.   # end of 'msgpack/msgpack.c'
  1924. fi
  1925. if test -f 'purguser/purguser.c' -a "${1}" != "-c" ; then 
  1926.   echo shar: Will not clobber existing file \"'purguser/purguser.c'\"
  1927. else
  1928.   echo shar: Extracting \"'purguser/purguser.c'\" \(4375 characters\)
  1929.   sed "s/^X//" >'purguser/purguser.c' <<'END_OF_FILE'
  1930. X#include <stdio.h>
  1931. X#include <string.h>
  1932. X#include <pwd.h>
  1933. X
  1934. Xstruct name_list {
  1935. X    char fname[99] ;
  1936. X    char lname[99] ;
  1937. X    struct name_list *next ;
  1938. X} ;
  1939. X
  1940. Xstruct name_list *nlhead ;
  1941. X
  1942. Xvoid add_to_nl();
  1943. Xvoid clean_up_nl() ;
  1944. X
  1945. Xmain()
  1946. X{
  1947. XFILE *inbuf, *outbuf;
  1948. Xstruct passwd *pw ;
  1949. Xint code;
  1950. Xint count;
  1951. Xchar infile[99], outfile[99];
  1952. Xchar cut_off[99] ;
  1953. Xchar u_fname[99], u_lname[99], u_password[99], u_time1[99];
  1954. Xchar u_date1[99], u_time2[99], u_date2[99], u_city[99];
  1955. Xchar l_m_base[5], l_f_base[5], xprt[3], toggle[3];
  1956. Xlong priv, l1, l2 ;
  1957. X
  1958. Xnlhead = (struct name_list *)NULL ;
  1959. Xprintf("\nPurguser : a user purge by date program for XBBS\n");
  1960. Xprintf("by Chuck Brandt 89.10.12 CIMTECHNOLOGIES XBBS (515)232-0072\n");
  1961. Xprintf("This program will remove users who have not logged on your XBBS\n");
  1962. Xprintf("since the date you specify.  It modifies users.bbs and userpriv.bbs\n");
  1963. Xprintf("and saves backups of each file with an additional extension of .o\n");
  1964. Xprintf("If you don't want to do this press <DEL> now!\n") ;
  1965. X
  1966. Xprintf("\nInput the full path name of the user file: ");
  1967. Xscanf("%s", outfile);
  1968. Xprintf("\n");
  1969. Xprintf("\nEnter cut off date in the form MM/DD/YY: ") ;
  1970. Xscanf("%s", cut_off) ;
  1971. Xprintf("\n") ;
  1972. Xstrcpy(infile,outfile) ;
  1973. Xstrcat(infile,".o") ;
  1974. Xunlink(infile) ;
  1975. Xlink(outfile,infile) ;
  1976. Xunlink(outfile) ;
  1977. Xif((inbuf = fopen(infile, "r" )) == NULL) {
  1978. X    printf("\n\rError opening input users file.\n\r");
  1979. X    exit(1);
  1980. X}
  1981. Xif((outbuf = fopen(outfile, "w" )) == NULL) {
  1982. X    printf("\n\rError opening output users file.\n\r");
  1983. X    exit(1);
  1984. X}
  1985. X
  1986. Xwhile(1) {
  1987. X    code = fscanf(inbuf,"%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~\n",
  1988. X    u_fname, u_lname, u_password, u_time1, u_date1,
  1989. X    u_time2, u_date2, u_city, l_m_base, l_f_base, xprt, toggle);
  1990. X    if(code < 12 ) break;
  1991. X    if ((date_compare(cut_off,u_date2)) <= 0) 
  1992. X        fprintf(outbuf,"%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~%s~\n",
  1993. X        u_fname, u_lname, u_password, u_time1, u_date1,
  1994. X        u_time2, u_date2, u_city, l_m_base, l_f_base, xprt, toggle);
  1995. X    else
  1996. X        add_to_nl( u_fname, u_lname ) ;
  1997. X}
  1998. X
  1999. Xfclose(inbuf);
  2000. Xfclose(outbuf) ;
  2001. Xchmod(outfile,0660) ;
  2002. Xpw = getpwnam("bbs") ;
  2003. X
  2004. Xif (pw != (struct passwd *)NULL) 
  2005. X    chown(outfile,pw->pw_uid,pw->pw_gid) ;    
  2006. X
  2007. X/* update userpriv.bbs */
  2008. Xprintf("\nInput the full path name of the userpriv file: ");
  2009. Xscanf("%s", outfile);
  2010. Xprintf("\n");
  2011. Xstrcpy(infile,outfile) ;
  2012. Xstrcat(infile,".o") ;
  2013. Xunlink(infile) ;
  2014. Xlink(outfile,infile) ;
  2015. Xunlink(outfile) ;
  2016. Xif((inbuf = fopen(infile, "r" )) == NULL) {
  2017. X    printf("\n\rError opening input userpriv file.\n\r");
  2018. X    exit(1);
  2019. X}
  2020. Xif((outbuf = fopen(outfile, "w" )) == NULL) {
  2021. X    printf("\n\rError opening output userpriv file.\n\r");
  2022. X    exit(1);
  2023. X}
  2024. Xwhile (1) {
  2025. X    code = fscanf(inbuf,"%s %s %ld %ld %ld\n",u_fname, u_lname, &priv, &l1, &l2) ;    
  2026. X    if (code != 5) break ;
  2027. X    if (!in_list(u_fname, u_lname))
  2028. X        fprintf(outbuf,"%s %s %ld %ld %ld\n",u_fname, u_lname, priv, l1, l2) ;
  2029. X}
  2030. Xclean_up_nl() ;
  2031. Xfclose(inbuf);
  2032. Xfclose(outbuf) ;
  2033. Xchmod(outfile,0660) ;
  2034. Xpw = getpwnam("bbs") ;
  2035. X
  2036. Xif (pw != (struct passwd *)NULL) 
  2037. X    chown(outfile,pw->pw_uid,pw->pw_gid) ;    
  2038. X    
  2039. X}
  2040. X
  2041. Xvoid add_to_nl( first, last ) 
  2042. Xchar *first, *last ;
  2043. X{
  2044. Xstruct name_list *cur, *new ;
  2045. X
  2046. Xnew = (struct name_list *)malloc(sizeof(struct name_list)) ;
  2047. Xif (new == (struct name_list *)NULL) {
  2048. X    fprintf(stderr,"purguser : ran out of memory!\n") ;
  2049. X    return;
  2050. X}
  2051. Xnew->next = (struct name_list *)NULL ;
  2052. Xstrcpy(new->fname,first) ;
  2053. Xstrcpy(new->lname,last) ;
  2054. X
  2055. Xif (nlhead == (struct name_list *)NULL)  {
  2056. X    nlhead = new ;
  2057. X    return ;
  2058. X}
  2059. Xcur = nlhead ;
  2060. Xwhile (cur->next != (struct name_list *)NULL)
  2061. X    cur = cur->next ;
  2062. Xcur->next = new ;
  2063. Xreturn ;
  2064. X}
  2065. X
  2066. Xint in_list(first, last)
  2067. Xchar *first, *last ;
  2068. X{
  2069. Xstruct name_list *cur ;
  2070. X
  2071. Xcur = nlhead ;
  2072. Xwhile (cur) {
  2073. X    if ((!strcmp(first,cur->fname)) && (!strcmp(last,cur->lname)))
  2074. X        return(1) ;
  2075. X    cur = cur->next ;
  2076. X}
  2077. Xreturn(0) ;
  2078. X}
  2079. X
  2080. Xvoid clean_up_nl()
  2081. X{
  2082. Xstruct name_list *cur, *pv ;
  2083. X
  2084. Xcur = nlhead ;
  2085. Xwhile (cur) {
  2086. X    pv = cur ;
  2087. X    cur = cur->next ;
  2088. X    free(pv) ;
  2089. X}
  2090. X}
  2091. X
  2092. Xint date_compare( d1, d2 )
  2093. Xchar *d1, *d2 ;
  2094. X{
  2095. Xint mon1, day1, yr1, mon2, day2, yr2 ;
  2096. X
  2097. Xsscanf(d1,"%d/%d/%d", &mon1, &day1, &yr1) ;
  2098. Xsscanf(d2,"%d/%d/%d", &mon2, &day2, &yr2) ;
  2099. Xyr1 = yr1 + 1900 ;
  2100. Xyr2 = yr2 + 1900 ;
  2101. X
  2102. Xif (yr1 == yr2) {
  2103. X    if (mon1 == mon2) {
  2104. X        if (day1 == day2) 
  2105. X            return(0) ;
  2106. X        else { 
  2107. X            if (day1 > day2) 
  2108. X                return(1) ;
  2109. X            else 
  2110. X                return(-1) ;
  2111. X        }
  2112. X    }
  2113. X    else  {
  2114. X              if (mon1 > mon2) 
  2115. X            return(1) ;
  2116. X         else 
  2117. X            return(-1) ;
  2118. X    }
  2119. X}
  2120. Xif (yr1 > yr2) return(1) ;
  2121. Xelse return(-1) ;
  2122. X}
  2123. END_OF_FILE
  2124.   if test 4375 -ne `wc -c <'purguser/purguser.c'`; then
  2125.     echo shar: \"'purguser/purguser.c'\" unpacked with wrong size!
  2126.   fi
  2127.   # end of 'purguser/purguser.c'
  2128. fi
  2129. if test -f 'today/Makefile' -a "${1}" != "-c" ; then 
  2130.   echo shar: Will not clobber existing file \"'today/Makefile'\"
  2131. else
  2132.   echo shar: Extracting \"'today/Makefile'\" \(466 characters\)
  2133.   sed "s/^X//" >'today/Makefile' <<'END_OF_FILE'
  2134. X##
  2135. X#    Makefile for very verbose date command (today).
  2136. X#
  2137. XHOME    = /users/sun3/jad
  2138. XBINDIR    = ${HOME}/bin
  2139. XCFLAGS    = -Ox
  2140. XTODAY    = datetx.o moontx.o nbrtxt.o timetx.o today.o sun.o
  2141. XPOTM    = moontx.o potm.o
  2142. XBIN    = potm today
  2143. XLIB    = -lm
  2144. X
  2145. Xall:    ${BIN}
  2146. Xpotm:    ${POTM}
  2147. X    cc ${CFLAGS} -o $@ ${POTM} ${LIB}
  2148. Xtoday:    ${TODAY}
  2149. X    cc ${CFLAGS} -o $@ ${TODAY} ${LIB}
  2150. Xmoontx.o:    moontx.h
  2151. X
  2152. Xinstall:    all
  2153. X    mv -f ${BIN} ${BINDIR}
  2154. X    rm -f ,* *.o ERRS core a.out
  2155. X
  2156. Xclean:
  2157. X    rm -f ${BIN} a.out core ERRS ,* *.o
  2158. END_OF_FILE
  2159.   if test 466 -ne `wc -c <'today/Makefile'`; then
  2160.     echo shar: \"'today/Makefile'\" unpacked with wrong size!
  2161.   fi
  2162.   # end of 'today/Makefile'
  2163. fi
  2164. if test -f 'today/timetx.c' -a "${1}" != "-c" ; then 
  2165.   echo shar: Will not clobber existing file \"'today/timetx.c'\"
  2166. else
  2167.   echo shar: Extracting \"'today/timetx.c'\" \(5255 characters\)
  2168.   sed "s/^X//" >'today/timetx.c' <<'END_OF_FILE'
  2169. X/*
  2170. X *              Convert Time to a Readable Format.
  2171. X *
  2172. X * Synopsis:
  2173. X *
  2174. X *      char    *timetxt(buffer, hour, minute, second, daylight);
  2175. X *      char    *buffer;        -- Where output goes
  2176. X *      int     hour;           -- Hour,        range is 0 to 24
  2177. X *      int     minute;         -- Minute,      range is -1 to 59
  2178. X *      int     second;         -- Seconds,     range is -1 to 59
  2179. X *      int     daylight;       -- Daylight savings time if non-zero.
  2180. X *
  2181. X * Note: if minute or second is less than zero, the value is not calculated.
  2182. X * This distinguishes between "unknown seconds" and "exactly no seconds."
  2183. X * If hour is less than zero, a null string is returned.
  2184. X * Timetxt converts the time to a null-trailed string.  It returns a pointer
  2185. X * to the first free byte (i.e. the null);
  2186. X *
  2187. X * The output follows the syntax of Robert J. Lurtsema, and includes:
  2188. X *
  2189. X *      In twenty-five seconds, the time will be ten minutes before noon.
  2190. X *
  2191. X *
  2192. X * External routines called:
  2193. X *
  2194. X *      nbrtxt          (Number to ascii conversion)
  2195. X *      copyst          (String copy routine)
  2196. X */
  2197. X
  2198. Xextern char     *nbrtxt();
  2199. Xextern char     *copyst();
  2200. X
  2201. Xchar *timetxt(buffer, hour, minute, second, daylight)
  2202. Xchar    *buffer;                        /* Output buffer                */
  2203. Xint     hour;                           /* Hours 00 - 23                */
  2204. Xint     minute;                         /* Minutes                      */
  2205. Xint     second;                         /* Seconds                      */
  2206. Xint     daylight;                       /* Non-zero if savings time     */
  2207. X/*
  2208. X * Output time of day.
  2209. X */
  2210. X{
  2211. X    char            *op;            /* Output pointer               */
  2212. X    register int    late;           /* after hour or afternoon      */
  2213. X    register int    sec;        /* Seconds temp            */
  2214. X    char        *stuff();    /* Buffer stuffer        */
  2215. X
  2216. X    op = buffer;                    /* Setup buffer pointer         */
  2217. X    if (hour < 0) {            /* If it's a dummy call,    */
  2218. X        *op = 0;        /* Return a null string        */
  2219. X        return(op);
  2220. X    }
  2221. X    if (daylight == 0101010) {      /* Secret flag                  */
  2222. X        op = copyst(op, "The big hand is on the ");
  2223. X        op = nbrtxt(op, (((minute + 2 + second/30)/5 + 11)%12)+1, 0);
  2224. X        op = copyst(op," and the little hand is on the ");
  2225. X        op = nbrtxt(op, ((hour + 11) % 12) + 1, 0);
  2226. X        return(copyst(op, ".  "));
  2227. X    }
  2228. X    /*
  2229. X     * Check if the time is more than 30 minutes past the hour.
  2230. X     * If so, output the time before the next hour.
  2231. X     */
  2232. X    if (minute < 0) second = (-2);  /* No minutes means no seconds  */
  2233. X    else if ((late = (minute > 30 || (minute == 30 && second > 0)))) {
  2234. X        if (second > 0) {       /* Before next hour             */
  2235. X            second = 60 - second;
  2236. X            minute += 1;    /* Diddle the minute, too       */
  2237. X        }
  2238. X        minute = 60 - minute;   /* Minutes before next hour     */
  2239. X        hour += 1;              /* Frobozz next hour getter     */
  2240. X    }
  2241. X    /*
  2242. X     * Decisions, decisions:
  2243. X     *    Minutes    Seconds =>
  2244. X     *      00      00    Exactly Noon
  2245. X     *      00      01    One second after noon
  2246. X     *      01      00    Exactly one minute after noon
  2247. X     *      30      00    Exactly half past noon
  2248. X     *      59      00    Exactly one minute before noon
  2249. X     *      59      59    In one second, the time will be noon
  2250. X     */
  2251. X    if (late > 0 && second > 0) {
  2252. X        op = stuff(op, second, 1, "In ", " second");
  2253. X        op = copyst(op, ", the time will be ");
  2254. X        sec = -2;        /* We've done seconds already    */
  2255. X    }
  2256. X    else if (daylight != -1) {
  2257. X        op = copyst(op, "The time is ");
  2258. X        sec = second;        /* Seconds still to be done    */
  2259. X    }
  2260. X    if (sec == 0) {
  2261. X        op = copyst(op, "exactly ");
  2262. X        if (minute == 30)
  2263. X            op = copyst(op, "half past ");
  2264. X        else    op = stuff(op, minute, 1, " ", " minute");
  2265. X    }
  2266. X    else {                /* Non exact or missing seconds    */
  2267. X        op = stuff(op, minute, 0, " ",     " minute");
  2268. X        if(second > 0)
  2269. X            op = stuff(op, sec, (sec > 0),  " and ", " second");
  2270. X    }
  2271. X    op = copyst(op, (minute < 0 || (minute == 0 && late)
  2272. X            || (second == 0
  2273. X                && ((minute == 0 && late == 0)
  2274. X                    || minute == 30))) ? " "
  2275. X        : (late) ? " before " : " after ");
  2276. X    /*
  2277. X     * Hours are not quite so bad
  2278. X     */
  2279. X    if (hour == 0 || hour == 24)
  2280. X        op = copyst(op, "midnight");
  2281. X    else if (hour == 12)
  2282. X        op = copyst(op, "noon");
  2283. X    else {
  2284. X        if (late = (hour > 12))
  2285. X            hour = hour - 12;
  2286. X        op = nbrtxt(op, hour, 0);
  2287. X        op = copyst(op, (late) ? " PM" : " AM");
  2288. X    }
  2289. X    if (daylight != -1) 
  2290. X        op = copyst(op, (daylight)
  2291. X        ? ", Pacific Daylight Time.  "
  2292. X        : ", Pacific Standard Time.  ");
  2293. X    return(op);
  2294. X}
  2295. X
  2296. Xstatic char *
  2297. Xstuff(buffer, value, flag, leading, trailing)
  2298. Xchar    *buffer;                        /* Output goes here             */
  2299. Xint     value;                          /* The value to print if > 0    */
  2300. Xint     flag;                           /* flag is set to print leading */
  2301. Xchar    *leading;                       /* preceeded by ...             */
  2302. Xchar    *trailing;                      /* and followed by ...          */
  2303. X/*
  2304. X * If value <= zero, output nothing. Else, output "leading" value "trailing".
  2305. X * Note: leading is output only if flag is set.
  2306. X * If value is not one, output an "s", too.
  2307. X */
  2308. X{
  2309. X    register char   *op;            /* Output pointer               */
  2310. X
  2311. X    op = buffer;                    /* Setup buffer pointer         */
  2312. X    if (value > 0) {
  2313. X        if (flag)
  2314. X            op = copyst(op, leading);
  2315. X        op = nbrtxt(op, value, 0);
  2316. X        op = copyst(op, trailing);
  2317. X        if (value != 1)
  2318. X            op = copyst(op, "s");
  2319. X    }
  2320. X    return(op);
  2321. X}
  2322. END_OF_FILE
  2323.   if test 5255 -ne `wc -c <'today/timetx.c'`; then
  2324.     echo shar: \"'today/timetx.c'\" unpacked with wrong size!
  2325.   fi
  2326.   # end of 'today/timetx.c'
  2327. fi
  2328. echo shar: End of archive 8 \(of 11\).
  2329. cp /dev/null ark8isdone
  2330. MISSING=""
  2331. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2332.     if test ! -f ark${I}isdone ; then
  2333.     MISSING="${MISSING} ${I}"
  2334.     fi
  2335. done
  2336. if test "${MISSING}" = "" ; then
  2337.     echo You have unpacked all 11 archives.
  2338.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2339. else
  2340.     echo You still must unpack the following archives:
  2341.     echo "        " ${MISSING}
  2342. fi
  2343. exit 0
  2344. exit 0 # Just in case...
  2345.