home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume42 / mbox / part09 < prev    next >
Internet Message Format  |  1994-03-29  |  93KB

  1. From: Volker.Schuermann@unnet.wupper.de (Volker Schuermann)
  2. Newsgroups: comp.sources.misc
  3. Subject: v42i032:  mbox - ix/MBox BBS, v2.1, Part09/12
  4. Date: 29 Mar 1994 21:08:19 -0600
  5. Organization: THE UNDERGROUND NETWORK
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2naqf3$isc@sparky.sterling.com>
  9. Reply-To: Volker Schuermann <Volker.Schuermann@unnet.wupper.de>
  10. X-Md4-Signature: 97bda153f85fc5f16e2ebdd338724ec7
  11.  
  12. Submitted-by: Volker.Schuermann@unnet.wupper.de (Volker Schuermann)
  13. Posting-number: Volume 42, Issue 32
  14. Archive-name: mbox/part09
  15. Environment: MINIX, ISC, ESIX, SVR3, LINUX, SVR4
  16. Supersedes: mbox: Volume 35, Issue 36-50
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then feed it
  20. # into a shell via "sh file" or similar.  To overwrite existing files,
  21. # type "sh file -c".
  22. # Contents:  mbox/MANIFEST mbox/cdrom/744476744
  23. #   mbox/contrib/wendy/getline.c mbox/contrib/wendy/misc.c
  24. #   mbox/contrib/wendy/rtf.c mbox/contrib/wendy/wendy.c
  25. #   mbox/src/cdrom.c mbox/src/getline.c mbox/src/languages/english.shh
  26. #   mbox/src/lesen.c mbox/src/suchen.c
  27. # Wrapped by kent@sparky on Thu Mar 24 21:48:36 1994
  28. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  29. echo If this archive is complete, you will see the following message:
  30. echo '          "shar: End of archive 9 (of 12)."'
  31. if test -f 'mbox/MANIFEST' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'mbox/MANIFEST'\"
  33. else
  34.   echo shar: Extracting \"'mbox/MANIFEST'\" \(8725 characters\)
  35.   sed "s/^X//" >'mbox/MANIFEST' <<'END_OF_FILE'
  36. X#---------------------------------------------------------------------------
  37. X#
  38. X#                      ix/MBox  M A N I F E S T
  39. X#             Bulletin Board System for UNIX(-Derivations)
  40. X#
  41. X#                          Volker Schuermann
  42. X#                     Wuppertal, FRG, 11.02.1994
  43. X#
  44. X#---------------------------------------------------------------------------
  45. X
  46. X~/mbox/MANIFEST                 You're looking at it, dude!
  47. X~/mbox/FAQ                      Frequently asked questions - might be helpful!
  48. X~/mbox/INSTALL                  A few installation hints - maybe vital!
  49. X~/mbox/Press.Kit                Information package (share it with friends ;-)
  50. X~/mbox/README                   So called "documentation"
  51. X~/mbox/VERY.IMPORTANT           A new users database and so on - have a look!!
  52. X~/mbox/cdrom                    DIRECTORY (see below)
  53. X~/mbox/contrib                  Contributed useful shell scripts (see below)
  54. X~/mbox/etc                      DIRECTROY (see below) 
  55. X~/mbox/lib                      DIRECTORY build up by MB-DAEMON
  56. X~/mbox/src                      DIRECTORY (see below)
  57. X~/mbox/stock                    DIRECTORY (see below)
  58. X~/mbox/tmp                      DIRECTORY for BBS temporaerly storage
  59. X~/mbox/usr                      DIRECTORY including users personal data
  60. X
  61. X~/mbox/cdrom/cdrom.mnt          List of directories mounted on CDROM drives
  62. X~/mbox/cdrom/?????????          A description for every CDROMs contents
  63. X
  64. X~/mbox/contrib/README.addrpat   Informations how to fix a mailers problem
  65. X~/mbox/contrib/README.instpd    Description how to get PD into the BBS world
  66. X~/mbox/contrib/addrpatch        Shell-Script to fix a mailers problem
  67. X~/mbox/contrib/instpd           Shell-Script to get Public Domain into the BBS
  68. X~/mbox/contrib/instpd.linux     Shell-Script especially for LINUX (see above)
  69. X~/mbox/contrib/instpd.perl      Perl-Script to get PD inside the BBS
  70. X~/mbox/contrib/termcap.color    New termcap entry - COLOR-ANSI codes
  71. X~/mbox/contrib/wendy            DIRECTORY (see below)
  72. X
  73. X~/mbox/cont*/*.perl/README      As it says ;-)
  74. X~/mbox/cont*/*.perl/descript.*  The same ...
  75. X~/mbox/cont*/*.perl/instpd.pl   Perl-Script to get PD into the BBS
  76. X
  77. X~/mbox/cont*/wendy/README       How to build up the RTF editor WENDY
  78. X~/mbox/cont*/wendy/Makefile     Adapt this to your system
  79. X~/mbox/cont*/wendy/block.c      C-Source
  80. X~/mbox/cont*/wendy/ctrl.c       C-Source
  81. X~/mbox/cont*/wendy/defs.h       Header file
  82. X~/mbox/cont*/wendy/echo.c       C-Source
  83. X~/mbox/cont*/wendy/english.hlp  WENDY helpfile, english
  84. X~/mbox/cont*/wendy/getch.c      C-Source        
  85. X~/mbox/cont*/wendy/getline.c    C-Source
  86. X~/mbox/cont*/wendy/misc.c       C-Source
  87. X~/mbox/cont*/wendy/rtf.c        C-Source
  88. X~/mbox/cont*/wendy/screen.c     C-Source
  89. X~/mbox/cont*/wendy/tools.c      C-Source
  90. X~/mbox/cont*/wendy/wendy.c      C-Source
  91. X~/mbox/cont*/wendy/wendy.dok    WENDY RTF test file
  92. X~/mbox/cont*/wendy/wendy.h      Header file
  93. X~/mbox/cont*/wendy/wendy.hlp    WENDY helpfile, german/deutsch
  94. X
  95. X~/mbox/etc/active               MB-DAEMONs internal NEWS active file
  96. X~/mbox/etc/alias.sh             If you use SMAIL, you should have a look!
  97. X~/mbox/etc/ansi.commands        ANSI headline for IBM-PC users
  98. X~/mbox/etc/ansi.help            ANSI headline for IBM-PC users
  99. X~/mbox/etc/ansi.portinfo        ANSI headline for IBM-PC users
  100. X~/mbox/etc/ansi.sysinfo         ANSI headline for IBM-PC users
  101. X~/mbox/etc/ansi.intro           ANSI headline for IBM-PC users
  102. X~/mbox/etc/ansi.users           ANSI headline for IBM-PC users
  103. X~/mbox/etc/guests.intro         BBS intro file for guests
  104. X~/mbox/etc/inews.sh             BBS learns here how to handle NEWS - look!
  105. X~/mbox/etc/intro                BBS intro file for users
  106. X~/mbox/etc/logo                 BBS logo (pre intro ;-)
  107. X~/mbox/etc/list.editors         List of editors - you have to change it!
  108. X~/mbox/etc/list.games           List of games - you have to have them ;-)
  109. X~/mbox/etc/list.packers         Archivers/Packers are declared here
  110. X~/mbox/etc/list.udc             User (i.e. Sysop!) defined commands
  111. X~/mbox/etc/list.terminals       Additional terminals - adjust the list!
  112. X~/mbox/etc/log.alltime          File containing a list of all-calls-ever
  113. X~/mbox/etc/log.calls            Calls are recorded in this file
  114. X~/mbox/etc/log.mbd              MB-DAEMON stores NEWS statistics here
  115. X~/mbox/etc/log.pd               Download statistics
  116. X~/mbox/etc/log.reflector        Logfile of the inbuild NEWS reflector   
  117. X~/mbox/etc/mbox.cmd             BBS commands - language dependend!
  118. X~/mbox/etc/mbox.hlp             Helpfile (long) - language dependend!
  119. X~/mbox/etc/mbox.seq             Number of calls - hands off!
  120. X~/mbox/etc/mbox.shh             Helpfile (short) - language dependend!
  121. X~/mbox/etc/mbox.who             Who's doing what? - might be empty!
  122. X~/mbox/etc/mbrsh                BBS-Shell - handles permissions correct
  123. X~/mbox/etc/pd.script            Upload shell script - maybe useful ...
  124. X~/mbox/etc/rmail.sh             BBS learns how to use your mailer - look!
  125. X~/mbox/etc/sysinfo              Informations about your BBS
  126. X~/mbox/etc/timezones            XMD uses this to calculate delivering time 
  127. X~/mbox/etc/tset                 How to change the shell TERM variable
  128. X~/mbox/etc/users.data           Users data base - backup pretty often!!!
  129. X~/mbox/etc/users.seq            Number of latest account - backup often!!!
  130. X~/mbox/etc/xmd.alias            XMD learns about users aliases here
  131. X
  132. X~/mbox/src/CROSSREF             Where to find functions?
  133. X~/mbox/src/HISTORY              My special changelog file - hands off!
  134. X~/mbox/src/Makefile             Have a very close look at this file!!!
  135. X~/mbox/src/admin.c              C-Source
  136. X~/mbox/src/baudrate.c           C-Source
  137. X~/mbox/src/befehl.c             C-Source
  138. X~/mbox/src/bled.c               C-Source
  139. X~/mbox/src/bled.doc             Helpfile of BLED (line editor)
  140. X~/mbox/src/chat.c               C-Source
  141. X~/mbox/src/control.c            C-Source
  142. X~/mbox/src/coreleft.c           C-Source
  143. X~/mbox/src/ctrlx.c              C-Source
  144. X~/mbox/src/defs.h               Header file
  145. X~/mbox/src/derror.c             C-Source
  146. X~/mbox/src/dis.c                C-Source
  147. X~/mbox/src/dstock.c             C-Source
  148. X~/mbox/src/faces.c              C-Source
  149. X~/mbox/src/games.c              C-Source
  150. X~/mbox/src/getch.c              C-Source
  151. X~/mbox/src/getline.c            C-Source
  152. X~/mbox/src/help.c               C-Source
  153. X~/mbox/src/intro.c              C-Source
  154. X~/mbox/src/know.better          SMALLTALK knowledge base, german/deutsch
  155. X~/mbox/src/languages            DIRECTORY (see below)
  156. X~/mbox/src/lesen.c              C-Source
  157. X~/mbox/src/lesen2.c             C-Source
  158. X~/mbox/src/loop.c               C-Source
  159. X~/mbox/src/mail.c               C-Source
  160. X~/mbox/src/main.c               C-Source
  161. X~/mbox/src/makro.c              C-Source
  162. X~/mbox/src/mb-daemon.c          C-Source
  163. X~/mbox/src/mbox.h               Header file
  164. X~/mbox/src/mbox.msg             Defines for text outputs - language dependend!
  165. X~/mbox/src/mbrsh.c              C-Source
  166. X~/mbox/src/misc.c               C-Source
  167. X~/mbox/src/misc2.c              C-Source
  168. X~/mbox/src/nerror.c             C-Source
  169. X~/mbox/src/patchlevel.h         Header file
  170. X~/mbox/src/pd.c                 C-Source
  171. X~/mbox/src/portinfo.c           C-Source
  172. X~/mbox/src/postfach.c           C-Source
  173. X~/mbox/src/proto.h              Prototypes - fairly incomplete!
  174. X~/mbox/src/show.c               C-Source
  175. X~/mbox/src/smalltalk.c          C-Source
  176. X~/mbox/src/smalltext.c          C-Source
  177. X~/mbox/src/subscribe.c          C-Source
  178. X~/mbox/src/suchen.c             C-Source
  179. X~/mbox/src/tools.c              C-Source
  180. X~/mbox/src/undef.c              C-Source
  181. X~/mbox/src/uptodate.c           C-Source
  182. X~/mbox/src/uudecode.c           C-Source
  183. X~/mbox/src/weiterl.c            C-Source
  184. X~/mbox/src/xmd.c                C-Source
  185. X
  186. X~/mbox/src/lang*/deutsch.cmd    Commands, german/deutsch        
  187. X~/mbox/src/lang*/deutsch.hlp    Helpfile, german/deutsch
  188. X~/mbox/src/lang*/deutsch.msg    Text outputs, german/deutsch
  189. X~/mbox/src/lang*/deutsch.shh    Shorthelp, german/deutsch
  190. X~/mbox/src/lang*/english.cmd    Commands, english
  191. X~/mbox/src/lang*/english.hlp    Helpfile, english
  192. X~/mbox/src/lang*/english.msg    Text, outputs english
  193. X~/mbox/src/lang*/english.shh    Shorthelp, english
  194. X~/mbox/src/lang*/francais.hlp   Helpfile, french/francais
  195. X~/mbox/src/lang*/francais.msg   Text outputs, french/francais
  196. X~/mbox/src/lang*/francais.shh   Shorthelp, french/francais
  197. X
  198. X~/mbox/stock/23.11.93.dax       Stock Exchange (de.etc.finanz) DAX Shares
  199. X~/mbox/stock/23.11.93.dj        Stock Exchange Dow Jones N.Y. Shares
  200. X~/mbox/stock/dax.wpkn           DAX WPKN
  201. X~/mbox/stock/dj.wpkn            Dow Jones WPKN
  202. X~/mbox/stock/index              List of indexes - you have to enter them!
  203. X
  204. END_OF_FILE
  205.   if test 8725 -ne `wc -c <'mbox/MANIFEST'`; then
  206.     echo shar: \"'mbox/MANIFEST'\" unpacked with wrong size!
  207.   fi
  208.   # end of 'mbox/MANIFEST'
  209. fi
  210. if test -f 'mbox/cdrom/744476744' -a "${1}" != "-c" ; then 
  211.   echo shar: Will not clobber existing file \"'mbox/cdrom/744476744'\"
  212. else
  213.   echo shar: Extracting \"'mbox/cdrom/744476744'\" \(357 characters\)
  214.   sed "s/^X//" >'mbox/cdrom/744476744' <<'END_OF_FILE'
  215. XGUUG *NIX Highlights (Augsut 1993)
  216. X
  217. X- Linux SLS V1.03 (Kernel 0.99.11)
  218. X- Utilities f. Linux
  219. X- 386BSD V0.1 Patchkit 0.2.4
  220. X- NetBSD V0.8
  221. X- Utilities f. 386BSD und NetBSD
  222. X- Berkeley Second Networking Distribution
  223. X- GNU gcc 2.4.5, emacs 19.17, make 3.68
  224. X- TeX 3.13
  225. X- RFCs (!!)
  226. X- X11R5 bis Patch 25
  227. X- X11 Programme, Tools, Utilities
  228. X- News-, Mail-, BBS-Software
  229. END_OF_FILE
  230.   if test 357 -ne `wc -c <'mbox/cdrom/744476744'`; then
  231.     echo shar: \"'mbox/cdrom/744476744'\" unpacked with wrong size!
  232.   fi
  233.   # end of 'mbox/cdrom/744476744'
  234. fi
  235. if test -f 'mbox/contrib/wendy/getline.c' -a "${1}" != "-c" ; then 
  236.   echo shar: Will not clobber existing file \"'mbox/contrib/wendy/getline.c'\"
  237. else
  238.   echo shar: Extracting \"'mbox/contrib/wendy/getline.c'\" \(7130 characters\)
  239.   sed "s/^X//" >'mbox/contrib/wendy/getline.c' <<'END_OF_FILE'
  240. X/* ix/MBox (getline.c) by Volker Schuermann, 04.12.1993
  241. X
  242. X   This C source code contains the following functions:
  243. X   #GL getline()         read a line, mind various parameters
  244. X   #GI getint()          read an integer
  245. X   #YN yesno()           yes or no?
  246. X   
  247. X   Contact <volkers@unnet.wupper.de> for help! */
  248. X
  249. X
  250. X
  251. X
  252. X
  253. X
  254. X
  255. X
  256. X#include <stdio.h>
  257. X
  258. X#ifdef _MBOX
  259. X#include "mbox.h"
  260. X#else
  261. X#define BS        8
  262. X#define CR        13
  263. X#define LF        10
  264. X#define FF        12
  265. X#define CTRL_X        24
  266. X#define CTRL_D        4
  267. X#define BELL        7
  268. X#define ESC        27
  269. X#define DEL        127
  270. X#define GBL06_MSG    'J'     
  271. X#define GBL07_MSG    'N'    
  272. X
  273. Xint UMLAUT = 0;
  274. X
  275. X#ifdef _SYS7
  276. X#define ENTER        13
  277. X#else
  278. X#define ENTER         10
  279. X#endif
  280. X
  281. X#ifndef _MINIX
  282. X#define UNSIGNED unsigned
  283. X#else
  284. X#define UNSIGNED
  285. X#endif
  286. X
  287. X#endif
  288. X
  289. X#ifndef STRING
  290. X#define STRING 85
  291. X#endif
  292. X
  293. X
  294. X
  295. X/* GL - Read a line.
  296. X
  297. X   [len]      ->  How many characters
  298. X   [mode]     ->     <0  =  7 Bit
  299. X                      0  =  Don't echo input (i.e. nothing is shown)
  300. X                      1  =  Echo input 
  301. X                      2  =  Show '*' instead of receiver characters
  302. X                      3  =  Show ':' as third and sixth character (time input)
  303. X                      4  =  Show '.' as third and sixth character (date input)
  304. X                      5  =  Only accept alphanumerical input
  305. X                     10  =  Show [bsc] [len] times before accepting any input
  306. X                    100  =  Only numeric input, '.' and ':' allowed
  307. X                   1000  =  Show [deftext] and [bsc] first
  308. X                  10000  =  If a number is the first input, return immediately
  309. X   [bsc]      ->  Print this to delete
  310. X   [deftext]  ->  To be displayed if [mode] >= 1000 */
  311. X
  312. Xstatic int endless;
  313. X
  314. XUNSIGNED char *getline(len, mode, bsc, deftext)
  315. Xint len, mode;
  316. Xint bsc;
  317. XUNSIGNED char deftext[];
  318. X{
  319. X  static UNSIGNED char gls[STRING];
  320. X  int c;
  321. X  int gli, gll;
  322. X  int delim = '\0';
  323. X  int matrix = 0;
  324. X  int echo = 1, numerics = 0, defmode = 0, letters = 0;
  325. X  int escape = 0;
  326. X  int lenmem = len;
  327. X  int lastwasblank = 0;
  328. X  int siebenbit = 0;
  329. X  
  330. X  if (mode < 0) {
  331. X    siebenbit++;
  332. X    mode *= -1;
  333. X  }
  334. X  if (mode > 10000) {
  335. X    escape++;
  336. X    mode -= 10000;
  337. X  }
  338. X  if (mode > 1000) {
  339. X    mode -= 1000;
  340. X    defmode++;
  341. X  }
  342. X  if (mode > 100) {
  343. X    mode -= 100;
  344. X    numerics++;
  345. X  }
  346. X  if (mode > 10) {
  347. X    mode -= 10;
  348. X    matrix++;
  349. X  }
  350. X  if (mode > 2) {
  351. X    switch(mode){
  352. X        case 3    : delim = ':';
  353. X              break;
  354. X        case 4  : delim = '.';        
  355. X              break;
  356. X         case 5  : letters++;
  357. X              break;
  358. X    }
  359. X    mode = 1;
  360. X  }
  361. X  echo = mode;
  362. X
  363. X  if (defmode != 0) {
  364. X    if((deftext[0] < 32) || (deftext[0] > 126)) deftext[0] = '\0';
  365. X    gll = strlen(deftext);
  366. X    lenmem = len - gll;
  367. X    if(deftext[0] != '\0'){
  368. X        sprintf(gls, "%s", deftext);
  369. X        printf("%s", deftext);
  370. X    }
  371. X    else gls[0] = '\0';
  372. X  }
  373. X  else {
  374. X    gll = 0;
  375. X    strcpy(gls, (UNSIGNED char *) "OOPS");
  376. X  }
  377. X
  378. X  if (matrix != 0) {
  379. X    for (gli = 0; gli < lenmem; gli++) {
  380. X        if (((gli == 2) || (gli == 5)) && (delim != '\0') && (gli != len)) {
  381. X            printf("%c", delim);
  382. X        }
  383. X        else {
  384. X            printf("%c", bsc);
  385. X        }
  386. X    }
  387. X    for (gli = 0; gli < lenmem; gli++) printf("%c", BS);
  388. X  }
  389. X
  390. X  do {
  391. X
  392. X    if (delim != '\0') {
  393. X        if (((gll == 2) || (gll == 5)) && (gll < len)){
  394. X            c = delim;
  395. X        }
  396. X        else {
  397. X            c = getint();  
  398. X        }
  399. X    }
  400. X    else {
  401. X        c = getint();  
  402. X    }        
  403. X
  404. X    if(siebenbit != 0){
  405. X        if(c > 127) c = 0;
  406. X    }
  407. X
  408. X    /*  LINUX' very strange keymaps ;-(                      */
  409. X    /*  DEL (= 127) will NOT work any longer! Never mind ... */
  410. X
  411. X     if (c == 127) c = BS;
  412. X
  413. X
  414. X
  415. X    if (c == ESC) {
  416. X        c = getint();  
  417. X        c = getint();  
  418. X        if ((c == 'A') || (c == 'B')) {
  419. X            if (c == 'A') endless++;
  420. X            if (c == 'B') endless--;
  421. X            if (endless < 1) endless = 9;
  422. X            if (endless > 9) endless = 1;
  423. X            sprintf(gls, "%d", endless);
  424. X            return (UNSIGNED char *) gls;
  425. X        }
  426. X        if (c == 'D') c = BS;
  427. X        if (c == 'C') c = ENTER;
  428. X    }
  429. X    if ((c == CTRL_X) || (c == CTRL_D) || (c == DEL)) {
  430. X        return (UNSIGNED char *) "<BREAK>";
  431. X    }
  432. X    if (c == FF) {
  433. X        printf("\\\n");
  434. X        c = 0;
  435. X    }
  436. X    if (c != ENTER) { 
  437. X        if ((c == BS) && (gll > 0)) {
  438. X            if (((gll == 3) || (gll == 6)) && (delim != '\0')) {
  439. X                gll -= 2;
  440. X                printf("%c%c%c%c", BS, BS, bsc, BS);
  441. X            } else {
  442. X                gll--;
  443. X                printf("%c%c%c", BS, bsc, BS);
  444. X            }
  445. X        }
  446. X        if (numerics == 0) {
  447. X            if (c >= 32) {
  448. X                if(letters != 0){
  449. X                    if((c < 'A') && (c != ' ')) c = 0;
  450. X                    if(c > 'z') c = 0;
  451. X                    if((c > 'Z') && (c < 'a')) c = 0;
  452. X
  453. X                    if(c == ' '){
  454. X                        if(lastwasblank != 0) c = 0;
  455. X                        lastwasblank++;
  456. X                    }
  457. X                    else{
  458. X                        if(c != 0) lastwasblank = 0;
  459. X                    }                
  460. X
  461. X                    if(c == 0)
  462. X                        printf("%c", BELL);
  463. X                }
  464. X                if(c != 0){
  465. X                    gls[gll] = c;
  466. X                    gll++;
  467. X                }
  468. X            }
  469. X            else {
  470. X                c = 0;
  471. X            }
  472. X        }
  473. X        else {
  474. X            if ((c == '.') || (c == ':') || ((c >= '0') && (c <= '9'))) {
  475. X                if (((delim != '\0') && ((c == '.') || (c == ':'))) &&
  476. X                    ((gll != 2) && (gll != 5))) {
  477. X                    printf("%c", BELL);
  478. X                    c = 0;
  479. X                }
  480. X                else {
  481. X                    gls[gll] = c;
  482. X                    gll++;
  483. X                    gls[gll] = '\0';
  484. X                }
  485. X            }
  486. X            else {
  487. X                if (c != BS) printf("%c", BELL);
  488. X                c = 0; 
  489. X            }
  490. X        }
  491. X        if (c != 0) {
  492. X            if (echo == 1) printf("%c", c);
  493. X            if (echo == 2) printf("*");
  494. X        }
  495. X    }
  496. X    if (gll == 1) {
  497. X        if (escape != 0) {
  498. X            if (((c > 47) && (c < 58)) ||
  499. X                 (c == '-') || (c == '+') ) {
  500. X                    gls[gll] = '\0';
  501. X                    return (UNSIGNED char *) gls;
  502. X            }
  503. X        }
  504. X    }
  505. X
  506. X  } while ((c != ENTER) && (gll < len));
  507. X
  508. X  gls[gll] = '\0';
  509. X
  510. X  return (UNSIGNED char *) gls;
  511. X}
  512. X
  513. X
  514. X
  515. X
  516. X
  517. X
  518. X
  519. X/* #GI - Read an integer. */
  520. X
  521. Xint getint()
  522. X{
  523. X  int c;
  524. X
  525. X
  526. X  if(UMLAUT != 0){
  527. X    c = UMLAUT;
  528. X    UMLAUT = 0;
  529. X    return (int) c;
  530. X  }
  531. X
  532. X  do{
  533. X    c = (int) getch();
  534. X
  535. X#ifndef _UMLAUT
  536. X
  537. X    if(c > 127){
  538. X
  539. X        UMLAUT = 'e';
  540. X
  541. X        switch(c){
  542. X            case 142 : c = 'A'; /* IBM 'Ae' */
  543. X                   break;
  544. X            case 153 : c = 'O'; /* IBM 'Oe' */
  545. X                   break;
  546. X            case 154 : c = 'U'; /* IBM 'Ue' */
  547. X                   break;
  548. X            case 132 : c = 'a'; /* IBM 'ae' */
  549. X                   break;
  550. X            case 148 : c = 'o'; /* IBM 'oe' */
  551. X                   break;
  552. X            case 129 : c = 'u'; /* IBM 'ue' */
  553. X                   break;
  554. X            case 225 : c = 's'; /* IBM 'ss' */
  555. X                   UMLAUT = 's';
  556. X                   break;
  557. X
  558. X            case 196 : c = 'A'; /* AMIGA 'Ae' */
  559. X                   break;
  560. X            case 214 : c = 'O'; /* AMIGA 'Oe' */
  561. X                   break;
  562. X            case 220 : c = 'U'; /* AMIGA 'Ue' */
  563. X                   break;
  564. X            case 228 : c = 'a'; /* AMIGA 'ae' */
  565. X                   break;
  566. X            case 246 : c = 'o'; /* AMIGA 'oe' */
  567. X                   break;
  568. X            case 252 : c = 'u'; /* AMIGA 'ue' */
  569. X                   break;
  570. X            case 223 : c = 's'; /* AMIGA 'ss' */
  571. X                   UMLAUT = 's';
  572. X                   break;
  573. X
  574. X#ifdef I_LIKE_CONFUSIONS
  575. X                case 128 : c = 'A'; /* APPLE 'Ae' */
  576. X                   break;
  577. X            case 133 : c = 'O'; /* APPLE 'Oe' */
  578. X                   break;
  579. X            case 134 : c = 'U'; /* APPLE 'Ue' */
  580. X                   break;
  581. X            case 138 : c = 'a'; /* APPLE 'ae' */
  582. X                   break;
  583. X            case 154 : c = 'o'; /* APPLE 'oe' */
  584. X                   break;
  585. X            case 159 : c = 'u'; /* APPLE 'ue' */
  586. X                   break;
  587. X            case 167 : c = 's'; /* APPLE 'ss' */
  588. X                   UMLAUT = 's';
  589. X                   break;
  590. X#endif /* _CONFUSION */
  591. X            default  : UMLAUT = 0;
  592. X        }        
  593. X        }
  594. X
  595. X  }while((c == 0) || (c > 127));
  596. X
  597. X#else /* _UMLAUT */
  598. X
  599. X  }while(c == 0);
  600. X
  601. X#endif /* _UMLAUT */
  602. X
  603. X
  604. X  return (int) c;
  605. X}
  606. X
  607. X
  608. X
  609. X
  610. X
  611. X/* #YN - Get a char, but only accept GBL06_MSG (Yes, Ja, Qui) and
  612. X   GBL07_MSG (No, Nein, Non). */
  613. X
  614. Xint yesno()
  615. X{
  616. X  int c;
  617. X
  618. X  do {
  619. X    c = getint();
  620. X    if (c >= 97) c -= 32;
  621. X    if ((c != GBL06_MSG) && (c != GBL07_MSG)) c = 0;
  622. X  } while (c == 0);
  623. X
  624. X  printf("%c", c);
  625. X
  626. X  return (int) c;
  627. X}
  628. X
  629. END_OF_FILE
  630.   if test 7130 -ne `wc -c <'mbox/contrib/wendy/getline.c'`; then
  631.     echo shar: \"'mbox/contrib/wendy/getline.c'\" unpacked with wrong size!
  632.   fi
  633.   # end of 'mbox/contrib/wendy/getline.c'
  634. fi
  635. if test -f 'mbox/contrib/wendy/misc.c' -a "${1}" != "-c" ; then 
  636.   echo shar: Will not clobber existing file \"'mbox/contrib/wendy/misc.c'\"
  637. else
  638.   echo shar: Extracting \"'mbox/contrib/wendy/misc.c'\" \(9463 characters\)
  639.   sed "s/^X//" >'mbox/contrib/wendy/misc.c' <<'END_OF_FILE'
  640. X/* ix/MBox/WENDY (misc.c) by Volker Schuermann, 04.12.1993
  641. X
  642. X   This C source code contains the following functions:
  643. X   #BS blockset()              reformat text        
  644. X   #IS insert_file()           insert a file into the text
  645. X   #RS right_stipped()         strip of junk trailing text lines
  646. X   #HP help()                  display help text
  647. X   #IN insert()                insert char/block/line
  648. X   #EN enter()                 process <ENTER> key
  649. X   #VI vi()                    fake "VI" commands
  650. X   #PU pgup()                  one page backwards
  651. X   #PD pgdn()                  one page forwards
  652. X   #CE center()                reformat text
  653. X   #LE lines_end()             process <END> key
  654. X   #WW wordwarp()              handle text running over at eoln
  655. X
  656. X   Contact <volkers@unnet.wupper.de> for help! */
  657. X
  658. X
  659. X
  660. X
  661. X
  662. X
  663. X
  664. X
  665. X
  666. X
  667. X
  668. X
  669. X#include "wendy.h"
  670. X
  671. X
  672. Xunsigned char *right_stripped();
  673. X
  674. X
  675. X
  676. X/* #BS - reformat text line */
  677. X
  678. Xblockset()
  679. X{
  680. X  FILE *fp;
  681. X
  682. X  unsigned char s[STRING];
  683. X  unsigned char a[STRING];
  684. X  unsigned char q[LONGSTRING];
  685. X
  686. X  int i, j = 0, l;
  687. X  int WIDE = MAXX;
  688. X  int whitespace = 1;
  689. X
  690. X  
  691. X  strcpy(s, (unsigned char *) SCREEN[y]); l = strlen((unsigned char *) right_stripped(s));
  692. X
  693. X  if(l < ((WIDE / 10) * 8)) return;
  694. X
  695. X  while(l < WIDE){
  696. X    i = 0; whitespace = 1;
  697. X
  698. X    while((l < WIDE) && (i < WIDE)){
  699. X        if(SCREEN[y][i] != BLANK) whitespace = 0;
  700. X        if(whitespace == 1){
  701. X            i++;
  702. X            continue;
  703. X        }
  704. X        strcpy(s, (unsigned char *) SCREEN[y]);
  705. X        strcpy(a, (unsigned char *) ATTRIB[y]);
  706. X
  707. X        if(isin(".!?,;:", SCREEN[y][i]) != 0){
  708. X            if((WIDE - l - 3) > 0){
  709. X                i++;
  710. X                SCREEN[y][i] = '\0';
  711. X                strcat(SCREEN[y], (unsigned char *) "   ");
  712. X                strcat(SCREEN[y], (unsigned char *) strcopy(s, i, l));
  713. X                ATTRIB[y][i]   = ATTRIB[y][i-1];
  714. X                ATTRIB[y][i+1] = ATTRIB[y][i-1];
  715. X                ATTRIB[y][i+2] = ATTRIB[y][i-1];
  716. X                ATTRIB[y][i+3] = '\0';
  717. X                strcat(ATTRIB[y], (unsigned char *) strcopy(a, i, l));                
  718. X                i += 2;
  719. X            }
  720. X        }
  721. X        if(SCREEN[y][i] == BLANK){
  722. X            i++;
  723. X            SCREEN[y][i] = '\0';
  724. X            strcat(SCREEN[y], (unsigned char *) " ");
  725. X            strcat(SCREEN[y], (unsigned char *) strcopy(s, i, l));
  726. X            ATTRIB[y][i] = ATTRIB[y][i-1];
  727. X            ATTRIB[y][i+1] = '\0';
  728. X            strcat(ATTRIB[y], (unsigned char *) strcopy(a, i, l));                
  729. X        }
  730. X        i++;
  731. X        strcpy(q, (unsigned char *) SCREEN[y]);
  732. X        l = strlen((unsigned char *) right_stripped(q));
  733. X    }
  734. X  }
  735. X}
  736. X
  737. X
  738. X
  739. X/* #IS - Insert a file into the text */
  740. X
  741. Xinsert_file( t )
  742. Xunsigned char t[];
  743. X{
  744. X  unsigned char s[STRING];
  745. X  unsigned char path[STRING];
  746. X  unsigned char tmp[STRING];
  747. X  int i = 0, ynow;
  748. X
  749. X  FILE *fp, *ff;  
  750. X
  751. X  while((t[i] != ' ') && (t[i] != '\0')) i++;
  752. X  strcpy(path, (unsigned char *) strcopy(t, (i+1), strlen(t)));
  753. X
  754. X  fp = fopen( path, "r" );
  755. X  if(fp == 0){
  756. X#ifdef _LOCAL
  757. X    sprintf(t, " Datei <%s> nicht gefunden oder Zugriff verweigert. ", path);
  758. X#else
  759. X    sprintf(t, " File <%s> not found or no access rights. ", path);
  760. X#endif
  761. X    show_status( t );
  762. X        return;
  763. X  }
  764. X
  765. X  sprintf(tmp, "/tmp/wendy.%d", getpid());
  766. X
  767. X  ynow = ypos + y;
  768. X
  769. X  restore_screen( ypos );
  770. X
  771. X  ff = fopen( tmp, "w" );
  772. X  for(i = ynow; i <= lastline; i++){
  773. X    fprintf(ff, "%s\n", TEXT[i]);
  774. X  }
  775. X  fclose(ff);
  776. X
  777. X  lastline = ynow;
  778. X
  779. X  while(fgets(TEXT[lastline], LINELENGTH, fp) != 0) lastline++;
  780. X  fclose(fp);   
  781. X
  782. X  fp = fopen( tmp, "r" );
  783. X  while(fgets(TEXT[lastline], LINELENGTH, fp) != 0) lastline++;
  784. X  fclose(fp);
  785. X
  786. X  unlink( tmp );
  787. X  prep_screen( ypos );
  788. X  show_screen( START );
  789. X}
  790. X
  791. X
  792. X
  793. X/* #RS - Strip of junk from the end of a text line */
  794. X
  795. Xunsigned char *right_stripped( s )
  796. Xunsigned char s[];
  797. X{
  798. X  int i;
  799. X  
  800. X  i = strlen( (unsigned char *) s);
  801. X
  802. X  while(((s[i] < 33) || (s[i] == BLANK)) && (i > -1)) i--;
  803. X  i++;
  804. X  s[i] = '\0';
  805. X
  806. X  return (unsigned char *) s;
  807. X}
  808. X
  809. X
  810. X
  811. X/* #HP - Help! */
  812. X
  813. Xhelp()
  814. X{
  815. X  FILE *fp;
  816. X  unsigned char s[STRING];
  817. X  int c, i;
  818. X
  819. X  restore_screen( ypos );
  820. X
  821. X  ansi( "cl" );
  822. X  c = MAXY;
  823. X  MAXY = 0;
  824. X  show_status( VERSION ); /* !! */
  825. X  MAXY = c;
  826. X
  827. X  i = START;
  828. X
  829. X  fp = fopen( HILFE, "r" );
  830. X  if(fp == NULL){
  831. X#ifdef _LOCAL
  832. X    printf("\n\nDatei <%s> nicht gefunden!\n\n", HILFE);
  833. X#else
  834. X    printf("\n\nFile <%s> not found!\n\n", HILFE);
  835. X#endif
  836. X  }
  837. X  else{
  838. X    while(fgets(s, STRING, fp) != 0){
  839. X        ansi2( "cm", 1, i );
  840. X        printf("%s\n", right_stripped(s));    
  841. X        i++;
  842. X    }
  843. X    fclose(fp);
  844. X  }
  845. X
  846. X  c = getch();
  847. X
  848. X  ansi( "cl" );
  849. X
  850. X  show_status( version );
  851. X  prep_screen( ypos );
  852. X  show_screen( START );
  853. X}
  854. X
  855. X
  856. X
  857. X
  858. X
  859. X/* #IN - Insert a char/line/block */
  860. X
  861. Xinsert( c )
  862. Xunsigned char c;
  863. X{
  864. X  unsigned char s[STRING];
  865. X  unsigned char q[LONGSTRING];
  866. X
  867. X  strcpy(q, (unsigned char *) SCREEN[y]);
  868. X
  869. X  if(strlen((unsigned char *) right_stripped(q)) >= MAXX){
  870. X    printf("%c", 7);
  871. X    if(x >= MAXX) x = MAXX;
  872. X    ansi2( "cm", x, y );
  873. X    return;
  874. X  }
  875. X
  876. X  if(c == ' ') c = BLANK;
  877. X
  878. X  strcpy(s, (unsigned char *) SCREEN[y]);
  879. X  s[x] = '\0'; 
  880. X  s[(x-1)] = c; 
  881. X  strcpy(q, (unsigned char *) SCREEN[y]);
  882. X  strcat(s, (unsigned char *) right_stripped(strcopy(q, (x-1), strlen(q))));
  883. X  strcat(s, " ");
  884. X  s[MAXX] = '\0';    
  885. X  strcpy(SCREEN[y], (unsigned char *) s);
  886. X
  887. X  strcpy(s, (unsigned char *) ATTRIB[y]);
  888. X  s[x] = '\0';
  889. X  s[(x-1)] = RTF_attrib;
  890. X  strcpy(q, (unsigned char *) ATTRIB[y]);
  891. X  strcat(s, (unsigned char *) right_stripped(strcopy(q, (x-1), strlen(q))));
  892. X  strcat(s, "0");
  893. X  s[MAXX] = '\0';    
  894. X  strcpy(ATTRIB[y], (unsigned char *) s);
  895. X
  896. X  if(ansi( "ic") != 0){
  897. X    show_line( SCREEN[y], ATTRIB[y], x );
  898. X  }
  899. X  else{
  900. X    if(c == BLANK)
  901. X        printf(" ");
  902. X    else
  903. X        printf("%c", c);        
  904. X  }
  905. X  x++;
  906. X  ansi2( "cm", x, y );
  907. X}
  908. X
  909. X
  910. X
  911. X/* #EN - Process the <ENTER> key */
  912. X
  913. Xenter()
  914. X{
  915. X  int i, j;
  916. X  int memo;
  917. X  int ymem = y;
  918. X  
  919. X      
  920. X  if(FORMATTER == 'b'){
  921. X    blockset();
  922. X    ansi( "me" );
  923. X    show_line( SCREEN[y], ATTRIB[y], 1 );  
  924. X    activate( RTF_attrib );
  925. X  }
  926. X  if(INS_mode != 0){
  927. X    memo = SCREEN[y][x]; 
  928. X    SCREEN[y][x] = (126);
  929. X    restore_screen( ypos );
  930. X    j = ypos + y - 2;
  931. X        for(i = lastline; i > j; i--){
  932. X        strcpy(TEXT[i+1], (unsigned char *) TEXT[i]);
  933. X        FLAG[i+1] = FLAG[i];
  934. X    } 
  935. X    lastline++;
  936. X
  937. X    i = 0; j++;
  938. X    while((TEXT[j][i] != (126)) && (TEXT[j][i] != '\0')) i++;
  939. X    TEXT[j][i] = memo;
  940. X
  941. X    strcpy(TEXT[(j+1)], (unsigned char *) strcopy(TEXT[j], (i-1), strlen(TEXT[j])));
  942. X    TEXT[j][(i-1)] = '\0'; strcat(TEXT[j], (unsigned char *) "<nl>\n");
  943. X
  944. X    prep_screen( ypos );
  945. X    ansi2( "cm", 1, MAXY );
  946. X    ansi( "ce" );
  947. X    ansi2( "cm", x, y );
  948. X
  949. X    if(ansi( "al" ) != 0){
  950. X        show_screen( (y-1) );    
  951. X    }
  952. X    else{
  953. X        show_line( SCREEN[y], ATTRIB[y], 1);
  954. X        y++;
  955. X        show_line( SCREEN[y], ATTRIB[y], 1);
  956. X        y--;
  957. X    }
  958. X  }
  959. X  if(y < MAXY){
  960. X    lastline++;
  961. X    ansi( "do" );
  962. X    y++; 
  963. X  }
  964. X  else{
  965. X    ctrlj();
  966. X  }
  967. X  x = 1;
  968. X  ansi2( "cm", x, y );
  969. X}
  970. X
  971. X
  972. X
  973. X/* #VI - Fake a few "VI" commands */ 
  974. X
  975. Xint vi( f )
  976. Xunsigned char f[];
  977. X{
  978. X  unsigned char s[STRING];
  979. X  int mode = 0;
  980. X  int newp = 0;
  981. X
  982. X  show_status( ":" );
  983. X  ansi( "mr" );
  984. X  strcpy(s, (unsigned char *) stripped( (unsigned char *) getline( 70, 1, 32, "" )));
  985. X
  986. X
  987. X  newp = atoi(s);
  988. X  if(newp > 0){
  989. X    restore_screen( ypos );    
  990. X
  991. X    if(newp > (lastline - MAXY))
  992. X        ypos = (lastline - MAXY);
  993. X    else
  994. X        ypos = newp;
  995. X
  996. X    y = START;
  997. X
  998. X    prep_screen( ypos );
  999. X    show_screen( START );     
  1000. X  }
  1001. X
  1002. X  ansi( "me" );
  1003. X
  1004. X  if((strcomp(s, "w")    == 0) || (strcomp(s, "w!") == 0)) ctrlw( f );
  1005. X  if(strcomp(s, "wq")    == 0) {
  1006. X    ctrlw( f );
  1007. X    mode = CTRL_X;
  1008. X  }
  1009. X  if(strcomp("set", s)   == 0) ctrls();
  1010. X  if((strcomp(s, "q")    == 0) || (strcomp(s, "q!") == 0)){
  1011. X    ctrlx( f );
  1012. X    mode = CTRL_X;
  1013. X  }
  1014. X  if(strcomp(s, "i")    == 0) ctrlv();
  1015. X  if(strcomp("r ", s)    == 0) insert_file( s );
  1016. X
  1017. X  activate( RTF_attrib );
  1018. X  ansi2( "cm", x, y );
  1019. X
  1020. X  return mode;
  1021. X}
  1022. X
  1023. X
  1024. X
  1025. X/* #PU - Move one page backwards */
  1026. X
  1027. Xpgup()
  1028. X{
  1029. X  int oldypos = ypos;
  1030. X  
  1031. X
  1032. X  if((ypos - (MAXY -1)) > 1) 
  1033. X    ypos -= (MAXY -1);
  1034. X  else
  1035. X    ypos = 1;
  1036. X
  1037. X  if(ypos == oldypos) return;
  1038. X
  1039. X  restore_screen( oldypos );
  1040. X  prep_screen( ypos );
  1041. X  show_screen( START );
  1042. X}
  1043. X
  1044. X
  1045. X
  1046. X/* #PD - Move one page forwards */
  1047. X
  1048. Xpgdn()
  1049. X{
  1050. X  int oldypos = ypos;
  1051. X
  1052. X  if((ypos + (MAXY -1)) < (lastline - (MAXY -1))) 
  1053. X    ypos += (MAXY -1);
  1054. X  else
  1055. X    ypos = lastline - MAXY;
  1056. X  if(ypos < 1) ypos = 1;
  1057. X
  1058. X  if(ypos == oldypos) return;
  1059. X
  1060. X  restore_screen( oldypos );
  1061. X  prep_screen( ypos );
  1062. X  show_screen( START );
  1063. X}
  1064. X
  1065. X
  1066. X
  1067. X
  1068. X/* #CE - Reformat text line */
  1069. X
  1070. Xcenter()
  1071. X{
  1072. X  int i, j = strlen((unsigned char *) stripped(SCREEN[y]));
  1073. X
  1074. X  unsigned char s[LONGSTRING];
  1075. X  unsigned char t[STRING];
  1076. X
  1077. X  i = (MAXX - j) / 2;
  1078. X  strcpy(s, (unsigned char *) "                                                    ");
  1079. X  s[i] = '\0'; strcat(s, (unsigned char *) stripped(SCREEN[y]));
  1080. X  strcat(s, (unsigned char *) "                                                    ");
  1081. X  s[MAXX] = '\0';
  1082. X  strcpy(SCREEN[y], (unsigned char *) s);
  1083. X  strcpy(ATTRIB[y], (unsigned char *) "00000000000000000000000000000000000000000000000000000000000000000000000000000000");
  1084. X  show_line( SCREEN[y], ATTRIB[y], 1 );
  1085. X  strcpy(s, (unsigned char *) SCREEN[y]);
  1086. X  x = strlen( (unsigned char *) right_stripped(s)) + 1;
  1087. X  FLAG[(ypos + y - 1)] |= is_centered;
  1088. X  ansi2( "cm", x, y );
  1089. X}
  1090. X
  1091. X
  1092. X/* #LE - Move cursor to end of line */
  1093. X
  1094. Xlines_end()
  1095. X{
  1096. X  unsigned char s[STRING];
  1097. X
  1098. X  strcpy(s, (unsigned char *) SCREEN[y]);
  1099. X  x = strlen((unsigned char *) right_stripped(s)) + 1;
  1100. X  if(x > MAXX) x = MAXX;
  1101. X  ansi2( "cm", x, y );
  1102. X}
  1103. X
  1104. X
  1105. X
  1106. X/* #WW - Handle overrunning text a the end of a line */    
  1107. X
  1108. Xint wordwrap()
  1109. X{
  1110. X  unsigned char s[STRING];
  1111. X  int i = MAXX -1, j = 0;
  1112. X  int a = y;
  1113. X  int b = y + 1;
  1114. X
  1115. X  while((i > 1) && (j == 0)){
  1116. X     if((SCREEN[a][i] == BLANK) || (SCREEN[a][i] < 33)) j = i;
  1117. X    i--;
  1118. X  }
  1119. X
  1120. X  if(j == 0) return 1;
  1121. X
  1122. X  j++; x = 0;
  1123. X
  1124. X  for(i = j; i <= MAXX; i++){
  1125. X    SCREEN[b][x] = SCREEN[a][i];
  1126. X    SCREEN[a][i] = BLANK;
  1127. X
  1128. X    ATTRIB[b][x] = ATTRIB[a][i];
  1129. X    ATTRIB[a][i] = '0';
  1130. X
  1131. X    x++; 
  1132. X  } 
  1133. X  show_line( SCREEN[a], ATTRIB[a], 1 );
  1134. X  y++;
  1135. X  show_line( SCREEN[b], ATTRIB[b], 1 );  
  1136. X  y = a;
  1137. X
  1138. X  return x;
  1139. X}
  1140. END_OF_FILE
  1141.   if test 9463 -ne `wc -c <'mbox/contrib/wendy/misc.c'`; then
  1142.     echo shar: \"'mbox/contrib/wendy/misc.c'\" unpacked with wrong size!
  1143.   fi
  1144.   # end of 'mbox/contrib/wendy/misc.c'
  1145. fi
  1146. if test -f 'mbox/contrib/wendy/rtf.c' -a "${1}" != "-c" ; then 
  1147.   echo shar: Will not clobber existing file \"'mbox/contrib/wendy/rtf.c'\"
  1148. else
  1149.   echo shar: Extracting \"'mbox/contrib/wendy/rtf.c'\" \(6855 characters\)
  1150.   sed "s/^X//" >'mbox/contrib/wendy/rtf.c' <<'END_OF_FILE'
  1151. X/* ix/MBox/WENDY (rtf.c) by Volker Schuermann, 04.12.1993
  1152. X
  1153. X   This C source code contains the following functions:
  1154. X
  1155. X   #MR make_rtf()         convert screen line to RTF
  1156. X   #RC rtf_convert()      convert RTF line to screen line
  1157. X
  1158. X   Contact <volkers@unnet.wupper.de> for help! */
  1159. X
  1160. X
  1161. X
  1162. X
  1163. X
  1164. X
  1165. X
  1166. X
  1167. X
  1168. X#include "wendy.h"
  1169. X
  1170. X
  1171. X
  1172. X/* #MR - Convert a screen line to RFF */
  1173. X
  1174. Xunsigned char *make_rtf( t, a )
  1175. Xunsigned char t[], a[];
  1176. X{
  1177. X  unsigned char s[LONGSTRING];
  1178. X  unsigned char q[LONGSTRING];
  1179. X  int olda = '0';
  1180. X  int i = 0;
  1181. X  int l = 0;
  1182. X
  1183. X  unsigned char line[1024];
  1184. X
  1185. X
  1186. X
  1187. X  strcpy(q, (unsigned char *) t);  strcpy(s, (unsigned char *) right_stripped(q));
  1188. X
  1189. X  if((strlen(q) > LONGSTRING) || (strlen(s) > LONGSTRING)){
  1190. X    printf("\nMemory fault - Shit!\n");
  1191. X  }  
  1192. X
  1193. X  strcat(s, (unsigned char *) "`");
  1194. X  strcat(a, (unsigned char *) "0");
  1195. X
  1196. X  if(s[0] == '~'){
  1197. X    line[0] = '~';
  1198. X    l++;
  1199. X    i++;
  1200. X  }
  1201. X
  1202. X  if(strcomp("        ", s) == 0){     /* TAB for Makefiles ;-) */
  1203. X    line[l] = TAB;
  1204. X    l++;
  1205. X    i += 8;
  1206. X  }
  1207. X
  1208. X  while((s[i] != '\0') && (l < LINELENGTH)){
  1209. X    if(s[i] == BLANK) s[i] = ' ';
  1210. X    if(a[i] != olda){
  1211. X        line[l] = '\0';
  1212. X        if(olda == '0'){
  1213. X            switch(a[i]){
  1214. X                case 'b' : strcat(line, (unsigned char *) "<Bold>");
  1215. X                       break;    
  1216. X                case 'i' : strcat(line, (unsigned char *) "<Italic>");
  1217. X                       break;
  1218. X                case 'f' : strcat(line, (unsigned char *) "<Flash>");
  1219. X                       break;
  1220. X                case 'u' : strcat(line, (unsigned char *) "<Underline>");
  1221. X                       break;
  1222. X            }
  1223. X        }
  1224. X        else{
  1225. X            switch(olda){
  1226. X                case 'b' : strcat(line, (unsigned char *) "</Bold>");
  1227. X                       break;    
  1228. X                case 'i' : strcat(line, (unsigned char *) "</Italic>");
  1229. X                       break;
  1230. X                                case 'f' : strcat(line, (unsigned char *) "</Flash>");
  1231. X                       break;
  1232. X                case 'u' : strcat(line, (unsigned char *) "</Underline>");
  1233. X                       break;
  1234. X            }
  1235. X        }
  1236. X        olda = a[i];
  1237. X        l = strlen(line);
  1238. X    }
  1239. X    if(s[i] != '`'){
  1240. X        line[l] = s[i];
  1241. X        l++;        
  1242. X    }
  1243. X    i++;
  1244. X  }
  1245. X
  1246. X  line[l] = ' '; line[l+1] = '\0'; /* !!!? */
  1247. X
  1248. X
  1249. X  return (unsigned char *) line;
  1250. X}
  1251. X
  1252. X
  1253. X
  1254. X/* #RC - Convert RTF line to screen line */
  1255. X
  1256. Xrtf_convert( line, scrpos, tpos )
  1257. Xunsigned char line[];
  1258. Xint scrpos;
  1259. Xint tpos;
  1260. X{
  1261. X  unsigned char s[LINELENGTH];
  1262. X
  1263. X  unsigned char screen[1024];
  1264. X  unsigned char attrib[1024];
  1265. X  unsigned char scr2[1024];
  1266. X  unsigned char att2[1024];
  1267. X
  1268. X  int i = 0;
  1269. X  int l = 0;
  1270. X  int j = 0;
  1271. X  int c = 0;
  1272. X
  1273. X  int rtf = 0;
  1274. X  int RTF_local = '0';
  1275. X
  1276. X
  1277. X  screen[0] = '\0';
  1278. X  attrib[0] = '\0';
  1279. X
  1280. X  while(line[i] != '\0'){
  1281. X    rtf = 0;
  1282. X    if(line[i] > 127){
  1283. X        if(strcomp("iso", umlaut) == 0){
  1284. X            switch(line[i]){
  1285. X                case 142 : line[i] = 196; 
  1286. X                       break;
  1287. X                case 153 : line[i] = 214; 
  1288. X                       break;
  1289. X                case 154 : line[i] = 220; 
  1290. X                       break;
  1291. X                case 225 : line[i] = 223; 
  1292. X                       break;
  1293. X                case 132 : line[i] = 228; 
  1294. X                       break;
  1295. X                case 148 : line[i] = 246;
  1296. X                       break;
  1297. X                case 129 : line[i] = 252; 
  1298. X                       break;
  1299. X            }
  1300. X        }
  1301. X        if(strcomp("ibm", umlaut) == 0){
  1302. X            switch(line[i]){
  1303. X                case 196 : line[i] = 142; 
  1304. X                       break;
  1305. X                case 214 : line[i] = 153; 
  1306. X                       break;
  1307. X                case 220 : line[i] = 154; 
  1308. X                       break;
  1309. X                case 223 : line[i] = 225; 
  1310. X                       break;
  1311. X                case 228 : line[i] = 132; 
  1312. X                       break;
  1313. X                case 246 : line[i] = 148;
  1314. X                       break;
  1315. X                case 252 : line[i] = 129; 
  1316. X                       break;
  1317. X            }
  1318. X        }
  1319. X    }
  1320. X    if(line[i] == ' ') line[i] = BLANK;
  1321. X    if(line[i] == '<'){
  1322. X        if(line[(i+1)] == '/'){
  1323. X            rtf++;
  1324. X        }
  1325. X        else{
  1326. X            strcpy(s, (unsigned char *) bigcopy(line, (i+1), strlen(line)));
  1327. X            if((strcomp("Bold",        s) == 0) ||
  1328. X               (strcomp("Italic",      s) == 0) ||
  1329. X               (strcomp("Fixed",       s) == 0) ||
  1330. X               (strcomp("Flash",       s) == 0) || /* Un.Net ;-) */
  1331. X               (strcomp("Smaller",     s) == 0) ||
  1332. X               (strcomp("Bigger",      s) == 0) ||
  1333. X               (strcomp("Underline",   s) == 0) ||
  1334. X               (strcomp("Center",      s) == 0) ||
  1335. X               (strcomp("Flush",       s) == 0) ||
  1336. X               (strcomp("Indent",      s) == 0) ||
  1337. X                (strcomp("Outdent",     s) == 0) ||
  1338. X               (strcomp("Samepage",    s) == 0) ||
  1339. X                   (strcomp("Subscript",   s) == 0) ||
  1340. X               (strcomp("Superscript", s) == 0) ||
  1341. X               (strcomp("Heading",     s) == 0) ||
  1342. X               (strcomp("Footing",     s) == 0) ||
  1343. X               (strcomp("ISO-8859-",   s) == 0) ||
  1344. X               (strcomp("US-ASCII",    s) == 0) ||
  1345. X               (strcomp("Excerpt",     s) == 0) ||
  1346. X               (strcomp("Paragraph",   s) == 0) ||
  1347. X               (strcomp("Signature",   s) == 0) ||
  1348. X                   (strcomp("Comment",     s) == 0) ||
  1349. X               (strcomp("nl",          s) == 0) ||
  1350. X               (strcomp("np",          s) == 0) ||
  1351. X               (strcomp("lt",          s) == 0) ||
  1352. X               (strcomp("No-op",       s) == 0)) rtf++;
  1353. X        }
  1354. X        }
  1355. X
  1356. X    if(rtf == 0){
  1357. X        if(line[i] == TAB){
  1358. X            j = (((int)(l+8)/8) * 8) - l;
  1359. X            strcpy(s, "            "); s[j] = '\0';                        
  1360. X            screen[l] = '\0'; strcat(screen, (unsigned char *) s);
  1361. X            strcpy(s, "000000000000"); s[j] = '\0';
  1362. X            attrib[l] = '\0'; strcat(attrib, (unsigned char *) s);
  1363. X            l += (j -1);
  1364. X        }
  1365. X        else{
  1366. X            if(line[i] > 31){
  1367. X                screen[l] = line[i];
  1368. X                attrib[l] = RTF_local;
  1369. X            }
  1370. X        }
  1371. X        l++;
  1372. X    }        
  1373. X    else{
  1374. X        j = i + 1;
  1375. X        while((line[i] != '>') && (line[i] != '\0')){
  1376. X            i++;
  1377. X        }
  1378. X
  1379. X        strcpy(s, (unsigned char *) bigcopy(line, j, (i-1)));
  1380. X
  1381. X        if(s[0] == '/'){
  1382. X            RTF_local = '0';
  1383. X        }        
  1384. X        else{
  1385. X            if(strcomp("nl", s) != 0){
  1386. X                c = s[0]; if(c < 97) c += 32;
  1387. X                if((c == 'b') || (c == 'i') || (c == 'f') || (c == 'u')){
  1388. X                    RTF_local = c;
  1389. X                }
  1390. X                if(c == 'c'){
  1391. X                    FLAG[(ypos + scrpos -1)] |= is_centered;
  1392. X                }
  1393. X                if(strcomp("lt", s) == 0){
  1394. X                    screen[l] = '<';
  1395. X                    attrib[l] = RTF_local;
  1396. X                    l++;
  1397. X                }
  1398. X            }
  1399. X        }
  1400. X    }
  1401. X    i++;
  1402. X  }
  1403. X  l--;
  1404. X
  1405. X  while(l < MAXX){
  1406. X    screen[l] = ' ';
  1407. X    attrib[l] = '0';
  1408. X    l++;
  1409. X  }
  1410. X  screen[l] = '\0';
  1411. X  attrib[l] = '\0';
  1412. X  sprintf(SCREEN[scrpos], "%-*.*s", MAXX, MAXX, (unsigned char *) screen);
  1413. X  sprintf(ATTRIB[scrpos], "%-*.*s", MAXX, MAXX, (unsigned char *) attrib);
  1414. X
  1415. X  if(l > MAXX){
  1416. X    strcpy(screen, (unsigned char *) strcopy(screen, (MAXX-1), l));
  1417. X    strcpy(attrib, (unsigned char *) strcopy(attrib, (MAXX-1), l));
  1418. X    
  1419. X    screen[0] = '~';
  1420. X    attrib[0] = '0';
  1421. X
  1422. X    for(i = lastline; i > tpos; i--){
  1423. X        strcpy(TEXT[(i+1)], (unsigned char *) TEXT[i]);
  1424. X        FLAG[(i+1)] = FLAG[i];
  1425. X    }
  1426. X    lastline++;    
  1427. X    tpos++;
  1428. X    strcpy(TEXT[tpos], (unsigned char *) make_rtf( screen, attrib ));
  1429. X  }  
  1430. X
  1431. X  if(((FLAG[tpos] & is_centered) == is_centered) && (SCREEN[scrpos][0] != ' ')){
  1432. X    strcpy(screen, (unsigned char *) SCREEN[scrpos]);
  1433. X    strcpy(attrib, (unsigned char *) ATTRIB[scrpos]);
  1434. X    strcpy(s, (unsigned char *) SCREEN[scrpos]); i = strlen((unsigned char *) right_stripped(s));
  1435. X    j = (MAXX - i) / 2;
  1436. X    strcpy(SCREEN[scrpos], (unsigned char *) "                                                                              ");                   
  1437. X    strcpy(ATTRIB[scrpos], (unsigned char *) "000000000000000000000000000000000000000000000000000000000000000000000000000000");
  1438. X    SCREEN[scrpos][j] = '\0';
  1439. X    ATTRIB[scrpos][j] = '\0';
  1440. X        screen[i] = '\0';
  1441. X    strcat(SCREEN[scrpos], (unsigned char *) screen);
  1442. X    attrib[i] = '\0';
  1443. X    strcat(ATTRIB[scrpos], (unsigned char *) attrib);
  1444. X  }
  1445. X
  1446. X}
  1447. END_OF_FILE
  1448.   if test 6855 -ne `wc -c <'mbox/contrib/wendy/rtf.c'`; then
  1449.     echo shar: \"'mbox/contrib/wendy/rtf.c'\" unpacked with wrong size!
  1450.   fi
  1451.   # end of 'mbox/contrib/wendy/rtf.c'
  1452. fi
  1453. if test -f 'mbox/contrib/wendy/wendy.c' -a "${1}" != "-c" ; then 
  1454.   echo shar: Will not clobber existing file \"'mbox/contrib/wendy/wendy.c'\"
  1455. else
  1456.   echo shar: Extracting \"'mbox/contrib/wendy/wendy.c'\" \(9151 characters\)
  1457.   sed "s/^X//" >'mbox/contrib/wendy/wendy.c' <<'END_OF_FILE'
  1458. X/* ix/MBox/WENDY (wendy.c) by Volker Schuermann, 04.12.1993
  1459. X
  1460. X   This C source code contains the following functions:
  1461. X
  1462. X   #LP loop()             main loop
  1463. X   #MA main()             main function
  1464. X
  1465. X   Contact <volkers@unnet.wupper.de> for help! */
  1466. X
  1467. X
  1468. X
  1469. X
  1470. X
  1471. X
  1472. X
  1473. X
  1474. X
  1475. X#include "wendy.h"
  1476. X
  1477. X
  1478. X/* #LP - Read in a char and process it */
  1479. Xloop( f )
  1480. Xunsigned char f[];
  1481. X{
  1482. X  unsigned char s[STRING];
  1483. X  int c, d;
  1484. X  int oldy = -1;
  1485. X  ansi2( "cm", x, y );
  1486. X  do{
  1487. X    c = getch();
  1488. X    if(c == ESC){
  1489. X        c = getch();
  1490. X        if(c == ':'){
  1491. X                c = vi( f );
  1492. X                goto ENDLOOP;
  1493. X        }
  1494. X    if((c == 'C') || (c == 'D')){
  1495. X        d = c;
  1496. X        c = 100 * '[';
  1497. X    }
  1498. X    else{
  1499. X        if(c == 'O') c = '[';
  1500. X
  1501. X        c *= 100;
  1502. X
  1503. X            d = getch();
  1504. X
  1505. X        if(d == '1') d = getch();
  1506. X    }
  1507. X
  1508. X    c += d;
  1509. X    }
  1510. X   
  1511. X    /*
  1512. X    ansi2( "cm", 73, 1 );
  1513. X    ansi( "mr" );
  1514. X    if(c != 126) printf("<%d> ", c);
  1515. X    ansi2( "cm", x, y );
  1516. X    activate( RTF_attrib );
  1517. X    */
  1518. X
  1519. X    if(c ==  wBS) c = BS;
  1520. X    if(c == wDEL) c = DELD;
  1521. X    if(c == wINS) c = INS;
  1522. X    if(c == wEND) c = END;
  1523. X  
  1524. X    switch(c){
  1525. X        case ENTER      :       enter();
  1526. X                                break;
  1527. X        case CTRL_K     :
  1528. X        case UP         :       ctrlk();
  1529. X                                break;
  1530. X#ifdef _SYS7
  1531. X        case CTRL_J     :
  1532. X#endif
  1533. X        case DOWN       :       ctrlj();
  1534. X                                break;
  1535. X        case LEFT       :       if(x > 1){
  1536. X                                        ansi( "kl" );
  1537. X                                        x--;
  1538. X                                }
  1539. X                else{
  1540. X                    ctrlk();
  1541. X                    lines_end();
  1542. X                }
  1543. X                                break;
  1544. X        case RIGHT      :       if(x < MAXX){
  1545. X                                        ansi( "kr" );
  1546. X                                        x++;
  1547. X                                }
  1548. X                else{
  1549. X                    ctrlj();
  1550. X                    x = 1;
  1551. X                    ansi2( "cm", x, y );
  1552. X                }
  1553. X                                break;
  1554. X        case CTRL_B     :
  1555. X    case PGUP_LI    :
  1556. X        case PGUP       :       pgup();
  1557. X                                break;
  1558. X        case CTRL_F     :
  1559. X    case PGDN_LI    :
  1560. X        case PGDN       :       pgdn();
  1561. X                                break;
  1562. X        case CTRL_A     :
  1563. X    case HOME_LI    :
  1564. X        case HOME       :       x = 1;
  1565. X                ansi2( "cm", x, y );
  1566. X                                break;
  1567. X    case CTRL_E    :
  1568. X    case TLX_END    :
  1569. X        case CTRL_Z     :
  1570. X        case END        :       lines_end();
  1571. X                                break;
  1572. X        case BS         :       ctrlh();
  1573. X                                CHANGED++;
  1574. X                                break;
  1575. X    case TLX_DEL    :
  1576. X        case DELD       :       x++;
  1577. X                                CHANGED++;
  1578. X                                ctrlh();
  1579. X                                break;
  1580. X    case TAB    :     x = (int)((x+8)/8*8) + 1;
  1581. X                if(x > MAXX) x = MAXX; 
  1582. X                ansi2( "cm", x, y ); 
  1583. X                break;
  1584. X        case CTRL_O     :       help();
  1585. X                                break;
  1586. X        case CTRL_P     :       if(RULER == 0){
  1587. X                    strcpy(version, (unsigned char *) RULERLINE);
  1588. X                    RULER++;
  1589. X                    xruler = -1;
  1590. X                }
  1591. X                else{
  1592. X                    RULER = 0;
  1593. X                    strcpy(version, (unsigned char *) VERSION);
  1594. X                }
  1595. X                show_status( version );
  1596. X                STATUSM = 0;
  1597. X                ansi2( "cm", x, y );
  1598. X                break;
  1599. X        case CTRL_L     :       ansi( "me" );
  1600. X                ansi2( "cm", 1, y );
  1601. X                                show_line( SCREEN[y], ATTRIB[y], 1 );
  1602. X                activate( RTF_attrib );
  1603. X                ansi2( "cm", x, y );
  1604. X                                break;
  1605. X        case CTRL_R     :       show_status( version );
  1606. X                                show_screen( START );
  1607. X                                break;
  1608. X    case CTRL_X    :    ctrlx( f );
  1609. X                break;
  1610. X    case CTRL_W    :    ctrlw( f );
  1611. X                break;
  1612. X    case CTRL_N    :    ctrln();
  1613. X                break;
  1614. X    case CTRL_U    :    ctrlu();
  1615. X                break;
  1616. X    case CTRL_T    :    ctrlt();
  1617. X                break;
  1618. X    case CTRL_S    :    ctrls();
  1619. X                break;
  1620. X    case CTRL_Y    :    ctrly();
  1621. X                break;
  1622. X    case CTRL_Q    :    block_set();
  1623. X                break;
  1624. X    case TLX_INS    :    
  1625. X    case INS    :
  1626. X    case CTRL_V    :    ctrlv();
  1627. X                break;
  1628. X    case NUM5    :
  1629. X    case CTRL_G    :    ctrlg( f );
  1630. X                break;
  1631. X    default        :       if(c > 9100){
  1632. X#ifdef _LOCAL
  1633. X                    show_status( " WENDY: Unbekannte Taste " );
  1634. X#else
  1635. X                    show_status( " WENDY: Unknown key " );    
  1636. X#endif
  1637. X                    ansi( "mr" );
  1638. X                    printf("<%d>. ", c);
  1639. X                    ansi( "me" );
  1640. X                    ansi2( "cm", x, y );
  1641. X
  1642. X                    c = 0;
  1643. X                }
  1644. X                if(c == '~') c = 0;  
  1645. X
  1646. X                if((c > 31) && (c < 9100)){
  1647. X                    CHANGED++;
  1648. X                    if(INS_mode == 0){
  1649. X                        printf("%c", c);    
  1650. X                        if(c == ' ') c = BLANK;    
  1651. X                        SCREEN[y][(x-1)] = c;
  1652. X                        ATTRIB[y][(x-1)] = RTF_attrib;
  1653. X                        x++;
  1654. X                        if(x > MAXX){
  1655. X                            if(FORMATTER != 'b')
  1656. X                                x = wordwrap();
  1657. X                            if((y < MAXY) && (y < lastline))
  1658. X                                y++;
  1659. X                            else
  1660. X                                ctrlj();
  1661. X                            ansi2( "cm", x, y );
  1662. X                        }
  1663. X                    }
  1664. X                    else{
  1665. X                        insert( c );
  1666. X                    }
  1667. X                    if(FORMATTER == 'c'){
  1668. X                        center();
  1669. X                    }
  1670. X                    if((ypos + y) > lastline)
  1671. X                    lastline = ypos + y;
  1672. X                }
  1673. X    }
  1674. X
  1675. X
  1676. X
  1677. X
  1678. X    ENDLOOP:
  1679. X
  1680. X    if(oldy != y){
  1681. X    if((FLAG[(ypos + y - 1)] & is_richtext) == is_richtext){
  1682. X#ifdef _LOCAL
  1683. X        show_status( "Der folgende Text ist klassifiziert als 'text/richtext'." );
  1684. X#else
  1685. X        show_status( "The following text is classified as 'text/richtext'.");
  1686. X#endif
  1687. X    }
  1688. X    if((FLAG[(ypos + y - 1)] & is_plain) == is_plain){
  1689. X#ifdef _LOCAL
  1690. X        show_status( "Der folgende Text ist klassifiziert als 'text/plain'." );
  1691. X#else
  1692. X        show_status( "The following text is classified as 'text/plain'.");
  1693. X#endif
  1694. X    }
  1695. X    ansi2( "cm", x, y );
  1696. X        /*
  1697. X    if(CHANGED != 0){
  1698. X        fprintf(ROLLBACK, "%05.5d %s\n", oldy, (unsigned char *) make_rtf( SCREEN[oldy], ATTRIB[oldy] ));
  1699. X    }
  1700. X    */
  1701. X    }
  1702. X    oldy = y;
  1703. X
  1704. X    if(RULER){
  1705. X    if(x != xruler){
  1706. X        if(STATUSM != 0) show_status( version );
  1707. X        if(xruler != -1){
  1708. X            ansi( "mr" );
  1709. X            ansi2( "cm", xruler, 1 );
  1710. X            printf("%c", version[(xruler - 1)]);
  1711. X        }
  1712. X        ansi( "me" );
  1713. X        xruler = x;
  1714. X        ansi2( "cm", xruler, 1 );
  1715. X        printf("%c", version[(xruler - 1)]);
  1716. X        ansi2( "cm", x, y );
  1717. X        STATUSM = 0;
  1718. X        activate( RTF_attrib );
  1719. X    }
  1720. X    }
  1721. X
  1722. X  }while(c != CTRL_X);
  1723. X}
  1724. X
  1725. X
  1726. X
  1727. X/* #MA - Wendy main function */
  1728. X
  1729. Xmain(argc, argv)
  1730. Xint argc;
  1731. Xunsigned char *argv[];
  1732. X{
  1733. X  FILE *fp;
  1734. X
  1735. X  unsigned char s[LONGSTRING];
  1736. X  unsigned char *term;
  1737. X  unsigned char *home;
  1738. X  int i, j;
  1739. X  int RTF = 0;
  1740. X
  1741. X#if defined(_ESTDIO) || !defined(_SYS7)
  1742. X  setbuf(stdout, NULL);
  1743. X#endif
  1744. X
  1745. X  RTF_attrib = '0';
  1746. X
  1747. X  MAXX = 79;    /* Default Parameter */
  1748. X  MAXY = 24;
  1749. X
  1750. X  term = (unsigned char *) getenv("TERM");
  1751. X  strcpy(terminal, (unsigned char *) term);
  1752. X  strcpy(umlaut, (unsigned char *) "ibm" );
  1753. X
  1754. X  wBS  = 8;
  1755. X  wDEL = 9152; 
  1756. X  wINS = 9151;
  1757. X  wEND = 9189; 
  1758. X  home = (unsigned char *) getenv( "HOME" );
  1759. X  sprintf(s, "%s/.wendy", home);
  1760. X
  1761. X  fp = fopen( s, "r" );
  1762. X  if(fp != NULL){
  1763. X    fgets(s, 80, fp); MAXY = atoi(s);
  1764. X    fgets(s, 80, fp); MAXX = atoi(s);
  1765. X    fgets(s, 80, fp); sscanf(s, "%s", &terminal);
  1766. X    fgets(s, 80, fp); sscanf(s, "%s", ¨aut);    
  1767. X    fgets(s, 80, fp); wBS = atoi(s);
  1768. X    fgets(s, 80, fp); wDEL = atoi(s);
  1769. X    fgets(s, 80, fp); wINS = atoi(s);
  1770. X    fgets(s, 80, fp); wEND = atoi(s);
  1771. X    fclose(fp);
  1772. X  }
  1773. X  if(MAXY > 24) MAXY = 24;
  1774. X  if(MAXY <  4) MAXY =  4;
  1775. X  
  1776. X  if(MAXX < 10) MAXX = 80;
  1777. X
  1778. X
  1779. X  ansi2( terminal, -1, -1 );
  1780. X  i = ansi2( "cm" );
  1781. X  ansi( "cl" );
  1782. X#ifdef _LOCAL
  1783. X  printf("\n\nMein Name ist "); 
  1784. X#else
  1785. X  printf("\n\nMy name is ");
  1786. X#endif
  1787. X  ansi( "md" ); printf("Wendy");
  1788. X  ansi( "me" ); printf("!\n\n");
  1789. X
  1790. X
  1791. X  if((i == 1) || (i == -1)){
  1792. X#ifdef _LOCAL
  1793. X    printf("Und ich kann Dein Terminal nicht bedienen!\n\n");
  1794. X#else
  1795. X    printf("And I can't handle your terminal!\n\n");
  1796. X#endif
  1797. X    return;
  1798. X  }
  1799. X  if(argc < 2){
  1800. X#ifdef _LOCAL
  1801. X    printf("Und Du hast vergessen einen Dateinamen anzugeben!\n\n");
  1802. X#else
  1803. X    printf("And you've forgotten to mention a filename!\n\n");
  1804. X#endif
  1805. X    return;
  1806. X  }
  1807. X  /*
  1808. X  sprintf(s, "/usr/tmp/WENDY.%d", getpid());
  1809. X  ROLLBACK = fopen( s, "w" );
  1810. X  if(ROLLBACK == NULL){
  1811. X    printf("Rollback ???");
  1812. X  }
  1813. X  fprintf(ROLLBACK, "00000 %s, %s [%s] on %s\n\n", mydate( 0 ), mytime( 0 ), whoami(), ttyna());
  1814. X  */
  1815. X  lastline = 2;
  1816. X  NEU = 0;
  1817. X  RTF_toggle = 0;
  1818. X
  1819. X  i = LINELENGTH -2;
  1820. X
  1821. X  fp = fopen( argv[1], "r" );
  1822. X  if(fp != NULL){
  1823. X    FLAG[lastline] = 0;
  1824. X    while(fgets(TEXT[lastline], i, fp) != 0){
  1825. X        FLAG[lastline+1] = 0;
  1826. X        if(strcomp("Content-Type: text/richtext", TEXT[lastline]) == 0){
  1827. X            FLAG[lastline] |= is_richtext;
  1828. X            lastline--;
  1829. X        }
  1830. X        if(strcomp("Content-Type: text/plain", TEXT[lastline]) == 0){
  1831. X            FLAG[lastline] |= is_plain;
  1832. X            lastline--;
  1833. X        }
  1834. X        lastline++;
  1835. X        if(lastline > MAXLINES){
  1836. X#ifdef _LOCAL
  1837. X            printf("Und die Datei <%s> ist zu gross fuer mich!\n\n", argv[1]);
  1838. X#else
  1839. X            printf("And the file <%s> is much to big for me!\n\n", argv[1]);
  1840. X#endif
  1841. X            fclose(fp);
  1842. X            return;
  1843. X        }
  1844. X    }
  1845. X      fclose(fp);
  1846. X  }
  1847. X  else{
  1848. X    NEU++;
  1849. X    RTF_toggle++;
  1850. X    for(i = 0; i < 25; i++){
  1851. X        strcpy(TEXT[i], (unsigned char *) "\n");
  1852. X        FLAG[i] = 0;
  1853. X    }
  1854. X    lastline += 25;
  1855. X  }
  1856. X  strcpy(TEXT[lastline], (unsigned char *) "\n");
  1857. X  strcpy(version, (unsigned char *) VERSION);
  1858. X  show_status( version );
  1859. X  INS_mode     = 0;
  1860. X  CHANGED      = 0;
  1861. X  REALLY       = 0;
  1862. X  MARK           = 0;
  1863. X  START           = 2;
  1864. X  RULER           = 0;
  1865. X  STATUSM      = 0;
  1866. X  FORMATTER    = 0;
  1867. X  BLOCK.status = 0;
  1868. X
  1869. X  x = 1; y = START; ypos = 1;
  1870. X  
  1871. X  prep_screen( ypos );
  1872. X  show_screen( START );
  1873. X  echo( 0 );
  1874. X  loop( argv[1] );
  1875. X  echo( 1 );
  1876. X  /*
  1877. X  fclose( ROLLBACK );
  1878. X  */
  1879. X  ansi( "me" );
  1880. X  ansi2( "cm", 1, MAXY );
  1881. X  ansi( "ce" );
  1882. X}
  1883. END_OF_FILE
  1884.   if test 9151 -ne `wc -c <'mbox/contrib/wendy/wendy.c'`; then
  1885.     echo shar: \"'mbox/contrib/wendy/wendy.c'\" unpacked with wrong size!
  1886.   fi
  1887.   # end of 'mbox/contrib/wendy/wendy.c'
  1888. fi
  1889. if test -f 'mbox/src/cdrom.c' -a "${1}" != "-c" ; then 
  1890.   echo shar: Will not clobber existing file \"'mbox/src/cdrom.c'\"
  1891. else
  1892.   echo shar: Extracting \"'mbox/src/cdrom.c'\" \(8718 characters\)
  1893.   sed "s/^X//" >'mbox/src/cdrom.c' <<'END_OF_FILE'
  1894. X
  1895. X/* ix/MBox (cdrom.c) by Volker Schuermann, 25.02.1994
  1896. X
  1897. X   This C source code contains the following functions:
  1898. X
  1899. X   #DD cd_download()      Download files from CDROM
  1900. X   #CD cdrom()            Support command 'cdrom'
  1901. X   #CB cdromB()           Treat CDROM as a normal newsgroup
  1902. X
  1903. X   Contact <volkers@unnet.wupper.de> for help! */
  1904. X
  1905. X
  1906. X
  1907. X
  1908. X
  1909. X
  1910. X
  1911. X
  1912. X
  1913. X
  1914. X
  1915. X#ifndef _ESTDIO
  1916. X#include <stdio.h>
  1917. X#else
  1918. X#include <estdio.h>
  1919. X#endif
  1920. X#include <sys/types.h>
  1921. X#include <sys/stat.h>
  1922. X#include <time.h>
  1923. X#include <dirent.h>
  1924. X#include <signal.h>
  1925. X
  1926. X#include <errno.h>
  1927. X
  1928. X#include "mbox.h"
  1929. X
  1930. X
  1931. X#define MAX_CDDRIVES    10
  1932. X
  1933. X
  1934. X
  1935. X
  1936. X/* #DD - Download files from a CDROM device */
  1937. X
  1938. Xcd_download( f )
  1939. XUNSIGNED char f[];
  1940. X{
  1941. X  pd( f, f );
  1942. X  printf("\n");
  1943. X  ansi2( "mr", 0, 0 );
  1944. X  printf(" Taste! ");
  1945. X  ansi2( "me", 0, 0 );
  1946. X  
  1947. X  (void) getch();
  1948. X}
  1949. X
  1950. X
  1951. X/* #CD - The command "cdrom" ... */
  1952. X
  1953. Xvoid cdrom( arg ) 
  1954. XUNSIGNED char arg[];
  1955. X{
  1956. X  UNSIGNED char s[STRING];
  1957. X  UNSIGNED char t[STRING];
  1958. X  UNSIGNED char f[STRING];
  1959. X  UNSIGNED char r[MAX_CDDRIVES][STRING];
  1960. X
  1961. X  FILE *fp;
  1962. X
  1963. X  DIR *dp;
  1964. X  struct dirent *actdir;
  1965. X
  1966. X  int x, a, i;
  1967. X  int intro = 0;
  1968. X  int status = 0;
  1969. X  int y = 0;
  1970. X  int ENDE = 0;
  1971. X  int HAVE_DIR = 0;
  1972. X  int IS_MOUNTED = 0;
  1973. X  
  1974. X  struct stat fst;
  1975. X
  1976. X
  1977. X  headline( CDR01_MSG );
  1978. X  printf("\n");
  1979. X
  1980. X  sprintf(s, "%s/cdrom/cdrom.mnt", HOME );
  1981. X  fp = fopen( s, "r" );
  1982. X  if(fp == NULL){
  1983. X    nerror("cdrom.c", 58, "cdrom", "Can't read", s);
  1984. X    return; 
  1985. X  }
  1986. X  a = 1;
  1987. X  while((fgets(s, STRING, fp) != 0) && (a < MAX_CDDRIVES)){
  1988. X    if(s[0] >= '/'){
  1989. X        strcpy(r[a], (UNSIGNED char *) stripped(s));
  1990. X        a++;
  1991. X    }
  1992. X  }
  1993. X  fclose(fp); 
  1994. X
  1995. X  if(a < 3){
  1996. X    strcpy(t, r[1]);   
  1997. X  }
  1998. X  else{
  1999. X    x = 0;
  2000. X
  2001. X    for(i = 1; i < a; i++){
  2002. X
  2003. X        ansi2( "md", 0, 0 );
  2004. X        sprintf(s, "<%s>", r[i]);    
  2005. X          printf("%-15s", s);
  2006. X        ansi2( "me", 0, 0 );
  2007. X
  2008. X        x++;
  2009. X        if(x == 5){ 
  2010. X            printf("\n");
  2011. X            x = 0;
  2012. X        }
  2013. X    }
  2014. X
  2015. X           if(x != 0) printf("\n");
  2016. X
  2017. X    do{
  2018. X        printf("\n");
  2019. X
  2020. X        ansi2( "mr", 0, 0 );
  2021. X        printf("[CDROM] %s", CDR02_MSG);
  2022. X        ansi2( "me", 0, 0 );
  2023. X        printf(" ");
  2024. X
  2025. X        strcpy(s, (UNSIGNED char *) getline( 70, 1, ' ', "") );
  2026. X
  2027. X        if(s[0] == '\0'){
  2028. X            printf("\n");
  2029. X            return;
  2030. X        }
  2031. X        if(s[0] != '/'){
  2032. X            sprintf(t, "/%s", s);
  2033. X            strcpy(s, (UNSIGNED char *) t);
  2034. X        }
  2035. X
  2036. X        status = chdir( s );
  2037. X
  2038. X        if(status != 0){
  2039. X            printf("\n\n%s <%s> %s\n", CDR03_MSG, s, CDR04_MSG);
  2040. X        }
  2041. X
  2042. X    }while(status != 0);
  2043. X
  2044. X    chdir( HOME );    
  2045. X
  2046. X    strcpy(t, (UNSIGNED char *) stripped(s));
  2047. X  }
  2048. X
  2049. X
  2050. X  headline( CDR01_MSG );
  2051. X  printf("\n"); 
  2052. X
  2053. X  do{
  2054. X    RESHOW:
  2055. X    
  2056. X        x = 0; y = 0; ENDE = 0; HAVE_DIR = 0; IS_MOUNTED = 0;
  2057. X
  2058. X    dp = opendir( t );
  2059. X     if(dp == NULL){
  2060. X        printf("%s\n", CDR05_MSG);    
  2061. X        chdir( HOME );    
  2062. X        return;
  2063. X    }
  2064. X    readdir(dp);
  2065. X    readdir(dp);
  2066. X    while(((actdir = readdir(dp)) != NULL) && (!ENDE)){
  2067. X        sprintf(s, "%s/%s", t, actdir->d_name);
  2068. X        stat(s, &fst);
  2069. X
  2070. X        IS_MOUNTED++;
  2071. X
  2072. X        if(intro == 0){
  2073. X            intro++;
  2074. X            sprintf(f, "%s/cdrom/%ld", HOME, fst.st_atime);
  2075. X            if((arg[0] == '$') && (USER.level >= ADMIN_LEV)){
  2076. X                security_ed( f );
  2077. X                closedir(dp);    
  2078. X                return;
  2079. X            }
  2080. X            fp = fopen( f, "r" );
  2081. X            if(fp != NULL){
  2082. X                ansi2( "us", 0, 0 );
  2083. X                show_raw( f, 0 );
  2084. X                ansi2( "me", 0, 0 );
  2085. X                printf("\n");
  2086. X            }
  2087. X            else{
  2088. X                fp = fopen( f, "w" );
  2089. X                fprintf(fp, "Tell your sysop to do an update here!");
  2090. X            }    
  2091. X            fclose(fp);
  2092. X        }
  2093. X
  2094. X        if(fst.st_mode & S_IFDIR){
  2095. X            ansi2( "md", 0, 0 );
  2096. X            sprintf(s, "<%s>", actdir->d_name);    
  2097. X              printf("%-15s", s);
  2098. X            ansi2( "me", 0, 0 );
  2099. X            HAVE_DIR++;
  2100. X        }
  2101. X        else printf("%-15s", actdir->d_name);
  2102. X        x++;
  2103. X        if(x == 5){ 
  2104. X            printf("\n");
  2105. X            x = 0;
  2106. X            y++;
  2107. X            if(y >= MAX_SCR_LINES){
  2108. X                if(more() == -1) ENDE++;
  2109. X                y = 2;                    
  2110. X            }
  2111. X        }    
  2112. X    }
  2113. X    closedir(dp);
  2114. X
  2115. X    if(IS_MOUNTED == 0){
  2116. X        printf("%s %s\n", CDR03_MSG, CDR04_MSG);
  2117. X        chdir( HOME );    
  2118. X        return;
  2119. X     }
  2120. X    
  2121. X    printf("\n");
  2122. X        if(x != 0) printf("\n");
  2123. X
  2124. X
  2125. X     do{
  2126. X        
  2127. X        ansi2( "mr", 0, 0 );
  2128. X        if(HAVE_DIR == 0)
  2129. X            printf("[CDROM] %s", CDR01aMSG);
  2130. X        else
  2131. X            printf("[CDROM] %s", CDR02_MSG);
  2132. X        ansi2( "me", 0, 0 );
  2133. X        printf(" ");
  2134. X
  2135. X        strcpy(s, (UNSIGNED char *) getline( 70, 1, ' ', "") );
  2136. X        if(s[0] == '?'){
  2137. X            help( "#CDROM" );
  2138. X              headline( CDR01_MSG );
  2139. X              printf("\n"); 
  2140. X            goto RESHOW;
  2141. X        }    
  2142. X
  2143. X        strcpy(s, (UNSIGNED char *) stripped( s ));
  2144. X        if(sgrep( s, " " ) != 0){
  2145. X            ansi2( "md", 0, 0 );
  2146. X            printf(" <- %s\n", CDR02aMSG);
  2147. X            ansi2( "me", 0, 0 );
  2148. X            strcpy(s, "?");    
  2149. X        }
  2150. X
  2151. X        if((sgrep( s, "..") != 0) || (sgrep( s, "/") != 0)){
  2152. X            ansi2( "md", 0, 0 );
  2153. X            printf(" <- %s\n", CDR02bMSG);
  2154. X            ansi2( "me", 0, 0 );
  2155. X            s[0] = '?';    
  2156. X        }
  2157. X
  2158. X    }while(s[0] == '?');
  2159. X
  2160. X        if(s[0] != '\0'){
  2161. X
  2162. X        sprintf(f, "[CDROM:] %s (%s)", s, t);
  2163. X        control( f, 3 );
  2164. X
  2165. X        sprintf(f, "%s/%s", t, s );
  2166. X        a = stat(f, &fst);
  2167. X        if((fst.st_mode & S_IFDIR) && (a == 0)){     /* SUBDIRECTORY */
  2168. X            strcpy(t, (UNSIGNED char *) f); 
  2169. X        }                    
  2170. X        else{                    /* FILE FOR DOWNLOAD */
  2171. X            cd_download( f );                            
  2172. X        }
  2173. X        sprintf(f, " CDROM - [%s] - %s ", t, CDR07_MSG ); 
  2174. X          headline( f );
  2175. X        printf("\n");
  2176. X    }
  2177. X
  2178. X  }while(s[0] != '\0');        
  2179. X
  2180. X  chdir( HOME );
  2181. X
  2182. X  printf("\n"); 
  2183. X}
  2184. X
  2185. X
  2186. X
  2187. Xint buzz;
  2188. X
  2189. Xvoid busy()
  2190. X{
  2191. X  UNSIGNED char s[6];
  2192. X
  2193. X  strcpy(s, "*|/-\\");
  2194. X
  2195. X  if(buzz < 1) buzz = 1;
  2196. X  if(buzz > 4) buzz = 1;
  2197. X
  2198. X  printf("%c%c%c)", BS, BS, s[buzz]);
  2199. X
  2200. X  buzz++;
  2201. X}
  2202. X
  2203. X
  2204. X/* #CB - Treat a CDROM device like a normal newsgroup */
  2205. X
  2206. Xvoid cdromB( group, mode )
  2207. XUNSIGNED char group[];
  2208. Xchar mode;
  2209. X{
  2210. X  UNSIGNED char s[STRING];
  2211. X  UNSIGNED char t[STRING];
  2212. X  UNSIGNED char f[STRING];
  2213. X  UNSIGNED char n[STRING];
  2214. X  UNSIGNED char d[STRING];
  2215. X  UNSIGNED char g[STRING];
  2216. X
  2217. X  FILE *ff;
  2218. X  FILE *fp;
  2219. X  FILE *bbs;
  2220. X
  2221. X  DIR *dp;
  2222. X  struct dirent *actdir;
  2223. X  struct stat fst;
  2224. X
  2225. X  int i, a;
  2226. X  int von, bis;
  2227. X  int OK = 0;
  2228. X  int IS_DIR = 0;
  2229. X
  2230. X  int fpid;
  2231. X
  2232. X
  2233. X  if(mode == 'I'){
  2234. X    
  2235. X#ifndef _NOCDINDEX
  2236. X
  2237. X    strcpy(t, (UNSIGNED char *) shortname( NG ));
  2238. X    sprintf(s, "%s/cdrom/%s", HOME, t);
  2239. X    fp = fopen( s, "r" );
  2240. X    if(fp != NULL){
  2241. X        fclose(fp);
  2242. X        OK = 0; IS_DIR = 0;
  2243. X        strcpy(INHALT, (UNSIGNED char *) s);
  2244. X        printf("\n");
  2245. X        goto QUICKIE;
  2246. X    }
  2247. X
  2248. X#endif    /* _NOCDINDEX */
  2249. X
  2250. X
  2251. X    sprintf(d, "%s/%s/CDDIR.%d", HOME, TMP, getpid());
  2252. X    fp = fopen(d, "w" );
  2253. X    if(fp == NULL){
  2254. X        nerror("cdrom.c", 299, "cdromB", "Can't write to", d);
  2255. X    }
  2256. X
  2257. X    sprintf(g, "%s/%s/CDJNK.%d", HOME, TMP, getpid());
  2258. X    ff = fopen(g, "w" );
  2259. X    if(ff == NULL){
  2260. X        nerror("cdrom.c", 305, "cdromB", "Can't write to", g);
  2261. X    }
  2262. X    fprintf(ff, "INDEX CDROM (JUNK)\n==================\n");
  2263. X
  2264. X      sprintf(t, "%s", group);
  2265. X    dp = opendir( t );
  2266. X     if(dp == NULL){
  2267. X        printf("%s\n", CDR05_MSG);    
  2268. X        chdir( HOME );    
  2269. X        return;
  2270. X    }
  2271. X
  2272. X    printf("\n%s ", CDR09_MSG);
  2273. X    ansi2( "md", 0, 0 );
  2274. X    printf("(*)");
  2275. X    a = 1000;
  2276. X    readdir(dp);
  2277. X    readdir(dp);
  2278. X    while((actdir = readdir(dp)) != NULL){
  2279. X        sprintf(s, "%s/%s", group, actdir->d_name);
  2280. X
  2281. X        busy();
  2282. X
  2283. X        stat(s, &fst);
  2284. X
  2285. X        if(fst.st_mode & S_IFDIR){
  2286. X            sprintf(s, "%s.%s", group, actdir->d_name);
  2287. X            i = 0;
  2288. X            while(s[i] != '\0'){
  2289. X                s[i] = s[i+1];
  2290. X                if(s[i] == '/') s[i] = '.';
  2291. X                i++;
  2292. X            }
  2293. X            fprintf(fp, "%s  30001200  221 y\n", s);
  2294. X            IS_DIR++;    
  2295. X        }
  2296. X        else{
  2297. X            strcpy(n, (UNSIGNED char *) actdir->d_name);
  2298. X            t[0] = '\0';
  2299. X            fprintf(ff, "%-5d %-20.20s  %-43.43s  %ld\n", a, n, t, (int) (fst.st_size / 1024));
  2300. X            a++;    
  2301. X        }
  2302. X    }    
  2303. X    closedir(dp);
  2304. X    fclose(fp);
  2305. X    fclose(ff);
  2306. X
  2307. X    ansi2( "me", 0, 0 );
  2308. X
  2309. X    if(IS_DIR) goto DIR_EXIT;
  2310. X
  2311. X    QUICKY:
  2312. X
  2313. X    printf("%c%s ", CR, CDR10_MSG);
  2314. X    ansi2( "md", 0, 0 );
  2315. X    printf("(*)");
  2316. X
  2317. X    sprintf(f, "%s/%s/CDIDX.%d", HOME, TMP, getpid());
  2318. X    fp = fopen(f, "w" );
  2319. X    if(fp == NULL){
  2320. X        nerror("cdrom.c", 367, "cdromB", "Can't write to", f);
  2321. X    }
  2322. X    fprintf(fp, "CDROM INDEX\n===========\n");
  2323. X
  2324. X    sprintf(s, "%s/files.bbs", group);
  2325. X    bbs = fopen(s, "r" );
  2326. X    if(bbs == NULL){
  2327. X        sprintf(s, "%s/00_index.txt", group);
  2328. X        bbs = fopen(s, "r" );
  2329. X    }
  2330. X    if(bbs != NULL){
  2331. X        a = 1000;
  2332. X        while(fgets(s, STRING, bbs) != NULL){
  2333. X
  2334. X            busy();
  2335. X
  2336. X            if(s[0] > ' '){
  2337. X                i = 0;
  2338. X                while((s[i] != ' ') && (s[i] != TAB) && (s[i] != '\0')){
  2339. X                    if((s[i] >= 'A') && (s[i] <= 'Z')) s[i] += 32;
  2340. X                    i++;
  2341. X                }
  2342. X                strcpy(n, (UNSIGNED char *) s);
  2343. X                n[i] = '\0';
  2344. X
  2345. X                sprintf(t, "%s/%s", group, n);
  2346. X                stat(t, &fst);
  2347. X
  2348. X                strcpy(t, (UNSIGNED char *) stripped(strcopy(s, i, strlen(s))));     
  2349. X    
  2350. X                fprintf(fp, "%-5d %-20.20s  %-43.43s  %ld\n", a, n, t, (int) (fst.st_size / 1024));
  2351. X                a++;
  2352. X            }
  2353. X        }
  2354. X        fclose(bbs);
  2355. X        OK++;
  2356. X    }
  2357. X    fclose(fp);
  2358. X    
  2359. X    ansi2( "me", 0, 0 );
  2360. X
  2361. X
  2362. X    DIR_EXIT:
  2363. X
  2364. X    if(OK != 0){
  2365. X        strcpy(INHALT, (UNSIGNED char *) f);
  2366. X    }
  2367. X    else{
  2368. X        if(IS_DIR != 0)
  2369. X            INHALT[0] = '\0';
  2370. X        else
  2371. X            strcpy(INHALT, (UNSIGNED char *) g);
  2372. X    }
  2373. X
  2374. X    strcpy(t, (UNSIGNED char *) shortname( NG ));
  2375. X    sprintf(s, "%s/cdrom/%s", HOME, t);
  2376. X
  2377. X
  2378. X#ifndef _NOCDINDEX
  2379. X
  2380. X    if(IS_DIR == 0){
  2381. X        fp = fopen( INHALT, "r" );
  2382. X        ff = fopen( s, "w" );
  2383. X        if(ff == NULL){
  2384. X            nerror("cdrom.c", 497, "cdromB", "Can't write to", s);
  2385. X        }
  2386. X        while(fgets(s, STRING, fp) != 0){
  2387. X            fputs(s, ff);
  2388. X        }
  2389. X        fclose(ff);
  2390. X        fclose(fp);
  2391. X    }
  2392. X
  2393. X#endif    /* _NOCDINDEX */
  2394. X
  2395. X    QUICKIE:
  2396. X
  2397. X    clearline();
  2398. X    ansi2( "up", 0, 0 );    
  2399. X  }            /* End of INDEX Building */
  2400. X
  2401. X
  2402. X  if(mode == 'L'){    /* Download CDROM Files */
  2403. X
  2404. X        download( group );
  2405. X  }
  2406. X
  2407. X  chdir( HOME ); 
  2408. X}
  2409. END_OF_FILE
  2410.   if test 8718 -ne `wc -c <'mbox/src/cdrom.c'`; then
  2411.     echo shar: \"'mbox/src/cdrom.c'\" unpacked with wrong size!
  2412.   fi
  2413.   # end of 'mbox/src/cdrom.c'
  2414. fi
  2415. if test -f 'mbox/src/getline.c' -a "${1}" != "-c" ; then 
  2416.   echo shar: Will not clobber existing file \"'mbox/src/getline.c'\"
  2417. else
  2418.   echo shar: Extracting \"'mbox/src/getline.c'\" \(7130 characters\)
  2419.   sed "s/^X//" >'mbox/src/getline.c' <<'END_OF_FILE'
  2420. X/* ix/MBox (getline.c) by Volker Schuermann, 04.12.1993
  2421. X
  2422. X   This C source code contains the following functions:
  2423. X   #GL getline()         read a line, mind various parameters
  2424. X   #GI getint()          read an integer
  2425. X   #YN yesno()           yes or no?
  2426. X   
  2427. X   Contact <volkers@unnet.wupper.de> for help! */
  2428. X
  2429. X
  2430. X
  2431. X
  2432. X
  2433. X
  2434. X
  2435. X
  2436. X#include <stdio.h>
  2437. X
  2438. X#ifdef _MBOX
  2439. X#include "mbox.h"
  2440. X#else
  2441. X#define BS        8
  2442. X#define CR        13
  2443. X#define LF        10
  2444. X#define FF        12
  2445. X#define CTRL_X        24
  2446. X#define CTRL_D        4
  2447. X#define BELL        7
  2448. X#define ESC        27
  2449. X#define DEL        127
  2450. X#define GBL06_MSG    'J'     
  2451. X#define GBL07_MSG    'N'    
  2452. X
  2453. Xint UMLAUT = 0;
  2454. X
  2455. X#ifdef _SYS7
  2456. X#define ENTER        13
  2457. X#else
  2458. X#define ENTER         10
  2459. X#endif
  2460. X
  2461. X#ifndef _MINIX
  2462. X#define UNSIGNED unsigned
  2463. X#else
  2464. X#define UNSIGNED
  2465. X#endif
  2466. X
  2467. X#endif
  2468. X
  2469. X#ifndef STRING
  2470. X#define STRING 85
  2471. X#endif
  2472. X
  2473. X
  2474. X
  2475. X/* GL - Read a line.
  2476. X
  2477. X   [len]      ->  How many characters
  2478. X   [mode]     ->     <0  =  7 Bit
  2479. X                      0  =  Don't echo input (i.e. nothing is shown)
  2480. X                      1  =  Echo input 
  2481. X                      2  =  Show '*' instead of receiver characters
  2482. X                      3  =  Show ':' as third and sixth character (time input)
  2483. X                      4  =  Show '.' as third and sixth character (date input)
  2484. X                      5  =  Only accept alphanumerical input
  2485. X                     10  =  Show [bsc] [len] times before accepting any input
  2486. X                    100  =  Only numeric input, '.' and ':' allowed
  2487. X                   1000  =  Show [deftext] and [bsc] first
  2488. X                  10000  =  If a number is the first input, return immediately
  2489. X   [bsc]      ->  Print this to delete
  2490. X   [deftext]  ->  To be displayed if [mode] >= 1000 */
  2491. X
  2492. Xstatic int endless;
  2493. X
  2494. XUNSIGNED char *getline(len, mode, bsc, deftext)
  2495. Xint len, mode;
  2496. Xint bsc;
  2497. XUNSIGNED char deftext[];
  2498. X{
  2499. X  static UNSIGNED char gls[STRING];
  2500. X  int c;
  2501. X  int gli, gll;
  2502. X  int delim = '\0';
  2503. X  int matrix = 0;
  2504. X  int echo = 1, numerics = 0, defmode = 0, letters = 0;
  2505. X  int escape = 0;
  2506. X  int lenmem = len;
  2507. X  int lastwasblank = 0;
  2508. X  int siebenbit = 0;
  2509. X  
  2510. X  if (mode < 0) {
  2511. X    siebenbit++;
  2512. X    mode *= -1;
  2513. X  }
  2514. X  if (mode > 10000) {
  2515. X    escape++;
  2516. X    mode -= 10000;
  2517. X  }
  2518. X  if (mode > 1000) {
  2519. X    mode -= 1000;
  2520. X    defmode++;
  2521. X  }
  2522. X  if (mode > 100) {
  2523. X    mode -= 100;
  2524. X    numerics++;
  2525. X  }
  2526. X  if (mode > 10) {
  2527. X    mode -= 10;
  2528. X    matrix++;
  2529. X  }
  2530. X  if (mode > 2) {
  2531. X    switch(mode){
  2532. X        case 3    : delim = ':';
  2533. X              break;
  2534. X        case 4  : delim = '.';        
  2535. X              break;
  2536. X         case 5  : letters++;
  2537. X              break;
  2538. X    }
  2539. X    mode = 1;
  2540. X  }
  2541. X  echo = mode;
  2542. X
  2543. X  if (defmode != 0) {
  2544. X    if((deftext[0] < 32) || (deftext[0] > 126)) deftext[0] = '\0';
  2545. X    gll = strlen(deftext);
  2546. X    lenmem = len - gll;
  2547. X    if(deftext[0] != '\0'){
  2548. X        sprintf(gls, "%s", deftext);
  2549. X        printf("%s", deftext);
  2550. X    }
  2551. X    else gls[0] = '\0';
  2552. X  }
  2553. X  else {
  2554. X    gll = 0;
  2555. X    strcpy(gls, (UNSIGNED char *) "OOPS");
  2556. X  }
  2557. X
  2558. X  if (matrix != 0) {
  2559. X    for (gli = 0; gli < lenmem; gli++) {
  2560. X        if (((gli == 2) || (gli == 5)) && (delim != '\0') && (gli != len)) {
  2561. X            printf("%c", delim);
  2562. X        }
  2563. X        else {
  2564. X            printf("%c", bsc);
  2565. X        }
  2566. X    }
  2567. X    for (gli = 0; gli < lenmem; gli++) printf("%c", BS);
  2568. X  }
  2569. X
  2570. X  do {
  2571. X
  2572. X    if (delim != '\0') {
  2573. X        if (((gll == 2) || (gll == 5)) && (gll < len)){
  2574. X            c = delim;
  2575. X        }
  2576. X        else {
  2577. X            c = getint();  
  2578. X        }
  2579. X    }
  2580. X    else {
  2581. X        c = getint();  
  2582. X    }        
  2583. X
  2584. X    if(siebenbit != 0){
  2585. X        if(c > 127) c = 0;
  2586. X    }
  2587. X
  2588. X    /*  LINUX' very strange keymaps ;-(                      */
  2589. X    /*  DEL (= 127) will NOT work any longer! Never mind ... */
  2590. X
  2591. X     if (c == 127) c = BS;
  2592. X
  2593. X
  2594. X
  2595. X    if (c == ESC) {
  2596. X        c = getint();  
  2597. X        c = getint();  
  2598. X        if ((c == 'A') || (c == 'B')) {
  2599. X            if (c == 'A') endless++;
  2600. X            if (c == 'B') endless--;
  2601. X            if (endless < 1) endless = 9;
  2602. X            if (endless > 9) endless = 1;
  2603. X            sprintf(gls, "%d", endless);
  2604. X            return (UNSIGNED char *) gls;
  2605. X        }
  2606. X        if (c == 'D') c = BS;
  2607. X        if (c == 'C') c = ENTER;
  2608. X    }
  2609. X    if ((c == CTRL_X) || (c == CTRL_D) || (c == DEL)) {
  2610. X        return (UNSIGNED char *) "<BREAK>";
  2611. X    }
  2612. X    if (c == FF) {
  2613. X        printf("\\\n");
  2614. X        c = 0;
  2615. X    }
  2616. X    if (c != ENTER) { 
  2617. X        if ((c == BS) && (gll > 0)) {
  2618. X            if (((gll == 3) || (gll == 6)) && (delim != '\0')) {
  2619. X                gll -= 2;
  2620. X                printf("%c%c%c%c", BS, BS, bsc, BS);
  2621. X            } else {
  2622. X                gll--;
  2623. X                printf("%c%c%c", BS, bsc, BS);
  2624. X            }
  2625. X        }
  2626. X        if (numerics == 0) {
  2627. X            if (c >= 32) {
  2628. X                if(letters != 0){
  2629. X                    if((c < 'A') && (c != ' ')) c = 0;
  2630. X                    if(c > 'z') c = 0;
  2631. X                    if((c > 'Z') && (c < 'a')) c = 0;
  2632. X
  2633. X                    if(c == ' '){
  2634. X                        if(lastwasblank != 0) c = 0;
  2635. X                        lastwasblank++;
  2636. X                    }
  2637. X                    else{
  2638. X                        if(c != 0) lastwasblank = 0;
  2639. X                    }                
  2640. X
  2641. X                    if(c == 0)
  2642. X                        printf("%c", BELL);
  2643. X                }
  2644. X                if(c != 0){
  2645. X                    gls[gll] = c;
  2646. X                    gll++;
  2647. X                }
  2648. X            }
  2649. X            else {
  2650. X                c = 0;
  2651. X            }
  2652. X        }
  2653. X        else {
  2654. X            if ((c == '.') || (c == ':') || ((c >= '0') && (c <= '9'))) {
  2655. X                if (((delim != '\0') && ((c == '.') || (c == ':'))) &&
  2656. X                    ((gll != 2) && (gll != 5))) {
  2657. X                    printf("%c", BELL);
  2658. X                    c = 0;
  2659. X                }
  2660. X                else {
  2661. X                    gls[gll] = c;
  2662. X                    gll++;
  2663. X                    gls[gll] = '\0';
  2664. X                }
  2665. X            }
  2666. X            else {
  2667. X                if (c != BS) printf("%c", BELL);
  2668. X                c = 0; 
  2669. X            }
  2670. X        }
  2671. X        if (c != 0) {
  2672. X            if (echo == 1) printf("%c", c);
  2673. X            if (echo == 2) printf("*");
  2674. X        }
  2675. X    }
  2676. X    if (gll == 1) {
  2677. X        if (escape != 0) {
  2678. X            if (((c > 47) && (c < 58)) ||
  2679. X                 (c == '-') || (c == '+') ) {
  2680. X                    gls[gll] = '\0';
  2681. X                    return (UNSIGNED char *) gls;
  2682. X            }
  2683. X        }
  2684. X    }
  2685. X
  2686. X  } while ((c != ENTER) && (gll < len));
  2687. X
  2688. X  gls[gll] = '\0';
  2689. X
  2690. X  return (UNSIGNED char *) gls;
  2691. X}
  2692. X
  2693. X
  2694. X
  2695. X
  2696. X
  2697. X
  2698. X
  2699. X/* #GI - Read an integer. */
  2700. X
  2701. Xint getint()
  2702. X{
  2703. X  int c;
  2704. X
  2705. X
  2706. X  if(UMLAUT != 0){
  2707. X    c = UMLAUT;
  2708. X    UMLAUT = 0;
  2709. X    return (int) c;
  2710. X  }
  2711. X
  2712. X  do{
  2713. X    c = (int) getch();
  2714. X
  2715. X#ifndef _UMLAUT
  2716. X
  2717. X    if(c > 127){
  2718. X
  2719. X        UMLAUT = 'e';
  2720. X
  2721. X        switch(c){
  2722. X            case 142 : c = 'A'; /* IBM 'Ae' */
  2723. X                   break;
  2724. X            case 153 : c = 'O'; /* IBM 'Oe' */
  2725. X                   break;
  2726. X            case 154 : c = 'U'; /* IBM 'Ue' */
  2727. X                   break;
  2728. X            case 132 : c = 'a'; /* IBM 'ae' */
  2729. X                   break;
  2730. X            case 148 : c = 'o'; /* IBM 'oe' */
  2731. X                   break;
  2732. X            case 129 : c = 'u'; /* IBM 'ue' */
  2733. X                   break;
  2734. X            case 225 : c = 's'; /* IBM 'ss' */
  2735. X                   UMLAUT = 's';
  2736. X                   break;
  2737. X
  2738. X            case 196 : c = 'A'; /* AMIGA 'Ae' */
  2739. X                   break;
  2740. X            case 214 : c = 'O'; /* AMIGA 'Oe' */
  2741. X                   break;
  2742. X            case 220 : c = 'U'; /* AMIGA 'Ue' */
  2743. X                   break;
  2744. X            case 228 : c = 'a'; /* AMIGA 'ae' */
  2745. X                   break;
  2746. X            case 246 : c = 'o'; /* AMIGA 'oe' */
  2747. X                   break;
  2748. X            case 252 : c = 'u'; /* AMIGA 'ue' */
  2749. X                   break;
  2750. X            case 223 : c = 's'; /* AMIGA 'ss' */
  2751. X                   UMLAUT = 's';
  2752. X                   break;
  2753. X
  2754. X#ifdef I_LIKE_CONFUSIONS
  2755. X                case 128 : c = 'A'; /* APPLE 'Ae' */
  2756. X                   break;
  2757. X            case 133 : c = 'O'; /* APPLE 'Oe' */
  2758. X                   break;
  2759. X            case 134 : c = 'U'; /* APPLE 'Ue' */
  2760. X                   break;
  2761. X            case 138 : c = 'a'; /* APPLE 'ae' */
  2762. X                   break;
  2763. X            case 154 : c = 'o'; /* APPLE 'oe' */
  2764. X                   break;
  2765. X            case 159 : c = 'u'; /* APPLE 'ue' */
  2766. X                   break;
  2767. X            case 167 : c = 's'; /* APPLE 'ss' */
  2768. X                   UMLAUT = 's';
  2769. X                   break;
  2770. X#endif /* _CONFUSION */
  2771. X            default  : UMLAUT = 0;
  2772. X        }        
  2773. X        }
  2774. X
  2775. X  }while((c == 0) || (c > 127));
  2776. X
  2777. X#else /* _UMLAUT */
  2778. X
  2779. X  }while(c == 0);
  2780. X
  2781. X#endif /* _UMLAUT */
  2782. X
  2783. X
  2784. X  return (int) c;
  2785. X}
  2786. X
  2787. X
  2788. X
  2789. X
  2790. X
  2791. X/* #YN - Get a char, but only accept GBL06_MSG (Yes, Ja, Qui) and
  2792. X   GBL07_MSG (No, Nein, Non). */
  2793. X
  2794. Xint yesno()
  2795. X{
  2796. X  int c;
  2797. X
  2798. X  do {
  2799. X    c = getint();
  2800. X    if (c >= 97) c -= 32;
  2801. X    if ((c != GBL06_MSG) && (c != GBL07_MSG)) c = 0;
  2802. X  } while (c == 0);
  2803. X
  2804. X  printf("%c", c);
  2805. X
  2806. X  return (int) c;
  2807. X}
  2808. X
  2809. END_OF_FILE
  2810.   if test 7130 -ne `wc -c <'mbox/src/getline.c'`; then
  2811.     echo shar: \"'mbox/src/getline.c'\" unpacked with wrong size!
  2812.   fi
  2813.   # end of 'mbox/src/getline.c'
  2814. fi
  2815. if test -f 'mbox/src/languages/english.shh' -a "${1}" != "-c" ; then 
  2816.   echo shar: Will not clobber existing file \"'mbox/src/languages/english.shh'\"
  2817. else
  2818.   echo shar: Extracting \"'mbox/src/languages/english.shh'\" \(8947 characters\)
  2819.   sed "s/^X//" >'mbox/src/languages/english.shh' <<'END_OF_FILE'
  2820. XContent-Type: text/richtext;
  2821. X<Bold>?</Bold>                          reachable commands are shown<nl>
  2822. X<Bold>?</Bold> <Underline>* </Underline>                       all commands are shown<nl>
  2823. X<Underline>command</Underline> <Bold>?</Bold>                  help on "<Underline>command</Underline>"<nl>
  2824. X<nl>
  2825. X<Bold>0</Bold>                          list command-buffers contents<nl>
  2826. X<Bold>1</Bold>-<Bold>9</Bold>                        execute one of nine buffered commands<nl>
  2827. X<nl>
  2828. X<Bold>+</Bold>                          go to the next board/group with NEW articles<nl>
  2829. X<nl>
  2830. X<Bold>-</Bold>                          go to the previous board/group with NEW articles<nl>
  2831. X<nl>
  2832. X<Bold>ACCOUNT</Bold>                    establish an account & a maildrop for a new user<nl>
  2833. X<nl>
  2834. X<Bold>AREA</Bold> <Underline>+</Underline>                     go to the next group of a subgroup<nl>
  2835. X<Bold>AREA</Bold> <Underline>++</Underline>                    go to the next group<nl>
  2836. X<Bold>AREA</Bold> <Underline>-</Underline>                     go to a previous group of a subgroup<nl>
  2837. X<Bold>AREA</Bold> <Underline>--</Underline>                    go to a previous group<nl>
  2838. X<nl>
  2839. X<Bold>ARCHIVES</Bold> <Underline>article</Underline>    <Underline> </Underline>      store "<Underline>article</Underline>" in mailbox (can't be deleted then)<nl>
  2840. X<nl>
  2841. X<Bold>BAUDRATE</Bold>                   check effective baudrate/performance<nl>
  2842. X<nl>
  2843. X<Bold>BOARD</Bold>                      list boards with new articles<nl>
  2844. X<Bold>BOARD</Bold> <Underline>* </Underline>                   list all boards depending on userlevel<nl>
  2845. X<Bold>BOARD</Bold> <Underline>**</Underline>                   list ALL boards<nl>
  2846. X<Bold>BOARD</Bold> <Underline>+</Underline>                    go to the next board<nl>
  2847. X<Bold>BOARD</Bold> <Underline>-</Underline>                    go to the previous board<nl>
  2848. X<Bold>BOARD</Bold> <Underline>!</Underline>                    display the name of the current board<nl>
  2849. X<Bold>BOARD</Bold> <Underline>#</Underline>                    list areas in board<nl>
  2850. X<Bold>BOARD</Bold> <Underline>..</Underline>                   step from one area to the previous one<nl>
  2851. X<Bold>BOARD</Bold> <Underline>boardname</Underline> <Underline> </Underline>          jump to board "<Underline>boardname</Underline>"<nl>
  2852. X<nl>
  2853. X<Bold>CHAT</Bold>                       multiport chatsystem<nl>
  2854. X<nl>
  2855. X<Bold>COMBINE</Bold> <Underline>article article</Underline>    merge personal mails<nl>
  2856. X<nl>
  2857. X<Bold>DATE</Bold>                       display current date<nl>
  2858. X<nl>
  2859. X<Bold>DELETE</Bold> <Underline>article</Underline>             delete article no. "<Underline>article</Underline>"<nl>
  2860. X<Bold>DELETE</Bold> <Underline>article</Underline>-<Underline>article</Underline>     delete from "article" to "<Underline>article</Underline>"<nl>
  2861. X<Bold>DELETE</Bold> <Underline>></Underline>                   delete copies of your own mail in your PM<nl>
  2862. X<nl>
  2863. X<Bold>DIR</Bold>                        index new articles<nl>
  2864. X<Bold>DIR</Bold> <Underline>*</Underline>                      index ALL articles (of a board)<nl>
  2865. X<nl>
  2866. X<Bold>DIRECTION</Bold>                  reading direction OLD <> NEW ?<nl>
  2867. X<nl>
  2868. X<Bold>DOWNLOAD</Bold>                   receive a couple of articles under X-, Y-, Z-<nl>
  2869. X                           or NONE-protocol<nl>
  2870. X<nl>
  2871. X<Bold>EDIT</Bold> <Underline>article</Underline>               re-edit article no. "<Underline>article</Underline>"<nl>
  2872. X<nl>
  2873. X<Bold>EXECUTE</Bold> <Underline>os-command</Underline>         Execute an OS (Operating System/Shell) commands<nl>
  2874. X<nl>
  2875. X<Bold>FINGER</Bold> <Underline>name </Underline>               list infos about user "<Underline>name</Underline>"<nl>
  2876. X<nl>
  2877. X<Bold>FORWARD</Bold>                    list stored mails<nl>
  2878. X<Bold>FORWARD</Bold> <Underline>user</Underline>               forward a stored mail to "<Underline>user</Underline>"<nl>
  2879. X<Bold>FORWARD</Bold> <Underline>article</Underline> <Underline>user</Underline>       forward "<Underline>article</Underline>" to "<Underline>user</Underline>"<nl>
  2880. X<nl>
  2881. X<Bold>GAMES</Bold>                      offer a (list of) game(s)<nl>
  2882. X<nl>
  2883. X<Bold>GOODBYE</Bold>                    leave the BBS<nl>
  2884. X<nl>
  2885. X<Bold>GRAPHICS</Bold>                   de-/activte IBM-ANSI headlines<nl>
  2886. X<nl>
  2887. X<Bold>HELP</Bold>                       this shorthelp<nl>
  2888. X<Bold>HELP</Bold> <Underline>*</Underline>                     display some pages of helpful descriptions<nl>
  2889. X<Bold>HELP</Bold> <Underline>command </Underline>              show information on "<Underline>command</Underline>"<nl>
  2890. X<nl>
  2891. X<Bold>MAIL</Bold> <Underline>user</Underline>                  send mail to "<Underline>user</Underline>"<nl>
  2892. X<Bold>MAIL</Bold> <Underline>host!user</Underline>             send mail to "<Underline>user</Underline>" on system "<Underline>host</Underline>"<nl>
  2893. X<Bold>MAIL</Bold> <Underline>user@host.domain</Underline>      send mail to "<Underline>user</Underline>" on system "<Underline>host.domain</Underline>"<nl>
  2894. X<nl>
  2895. X<Bold>MACRO</Bold>                      display/declare macros<nl>
  2896. X<nl>
  2897. X<Bold>MESSAGE</Bold>                    show/change "hello" message<nl>
  2898. X<nl>
  2899. X<Bold>MONITOR</Bold> <Underline>0</Underline>                  screen saver<nl>
  2900. X<Bold>MONITOR</Bold> <Underline>secs</Underline>               display system information with a pause of<nl>
  2901. X                           "secs" seconds<nl>
  2902. X<nl>
  2903. X<Bold>PLAN</Bold>                       change information text<nl>
  2904. X<nl>
  2905. X<Bold>PORTINFO</Bold>                   list all terminals, users, activities<nl>
  2906. X<nl>
  2907. X<Bold>PROTOCOL</Bold>                   protocol of all call(s/ers)<nl>
  2908. X<Bold>PROTOCOL</Bold> <Underline>*</Underline>                 protocol (complete)<nl>
  2909. X<Bold>PROTOCOL</Bold> <Underline>#</Underline>                 statistics of these calls<nl>
  2910. X<Bold>PROTOCOL</Bold> <Underline>%</Underline>                 callers statistics (hitlist)<nl>
  2911. X<Bold>PROTOCOL</Bold> <Underline>$</Underline>                 systems workload/usage<nl>
  2912. X<nl>
  2913. X<Bold>PM</Bold>                         move to your maildrop<nl>
  2914. X<nl>
  2915. X<Bold>READ</Bold>                       read NEW articles<nl>
  2916. X<Bold>READ</Bold> <Underline>*</Underline>                     real ALL articles (of a board)<nl>
  2917. X<Bold>READ</Bold> <Underline>article</Underline>               show article no. "<Underline>article</Underline>"<nl>
  2918. X<Bold>READ</Bold> <Underline>article</Underline>-<Underline>article</Underline>       display from "article" to "<Underline>article</Underline>"<nl>
  2919. X<nl>
  2920. X<Bold>ROT13</Bold>                      decoding rot13-articles<nl>
  2921. X<nl>
  2922. X<Bold>SEARCH</Bold> <Underline>pattern</Underline>             search for "<Underline>pattern</Underline>" in all articles of a group<nl>
  2923. X<nl>
  2924. X<Bold>SETUP</Bold>                      configure the BBS to your favor<nl>
  2925. X<nl>
  2926. X<Bold>SIGNATURE</Bold>                  show/change your signature<nl>
  2927. X<nl>
  2928. X<Bold>STATE</Bold>                      list your BBS-configuration<nl>
  2929. X<nl>
  2930. X<Bold>STATISTICS</Bold>                 table containing NEWS-statistics<nl>
  2931. X<Bold>STATISTICS</Bold> <Underline>*</Underline>               table containing more NEWS-statistics<nl>
  2932. X<Bold>STATISTICS</Bold> <Underline>$</Underline>               UUCP-rates (only if UUCP supports this)<nl>
  2933. X<Bold>STATISTICS</Bold> <Underline>#</Underline>               download-statistics<nl>
  2934. X<Bold>STATISTICS</Bold> <Underline>%</Underline>               download-statistics (hitlist)<nl>
  2935. X<Bold>STATISTICS</Bold> <Underline>></Underline>               mailing-statistics (xmd)<nl>
  2936. X<nl>
  2937. X<Bold>SUBSCRIBE</Bold>                  (un-)subscribe to newsgroups<nl>
  2938. X<nl>
  2939. X<Bold>THREAD </Bold>                    show the thread of articles and replies<nl>
  2940. X<Bold>THREAD</Bold> <Underline>article</Underline>             follow a thread thru an entire newsgroup<nl>
  2941. X<nl>
  2942. X<Bold>TIME</Bold>                       local time and your online-time in seconds<nl>
  2943. X<nl>
  2944. X<Bold>USERS</Bold>                      show users list<nl>
  2945. X<Bold>USERS</Bold> <Underline>*</Underline>                    show users list (more detailed)<nl>
  2946. X<Bold>USERS</Bold> <Underline>#</Underline>                    users up-/download ratio<nl>
  2947. X<Bold>USERS</Bold> <Underline>%</Underline>                    list users with their newsgroups<nl>
  2948. X<Bold>USERS</Bold> <Underline>$</Underline>                    accounting information (payload ;-)<nl>
  2949. X<Bold>USERS</Bold> <Underline>name</Underline>                 list infos about user "<Underline>name</Underline>"<nl>
  2950. X<nl>
  2951. X<Bold>UUDECODE</Bold> <Underline>article</Underline> <Underline>article</Underline>   Decoding <Underline>article</Underline>(<Underline>s</Underline>) using UUD/UUDECODE<nl>
  2952. X<nl>
  2953. X<Bold>VERSION</Bold>                    print version<nl>
  2954. X<Bold>VERSION</Bold> <Underline>*</Underline>                  display compiling definitions<nl>
  2955. X<Bold>VERSION</Bold> <Underline>#</Underline>                  the "Hall of Fame"<nl>
  2956. X<nl>
  2957. X<Bold>WRITE</Bold>                      create a new article and post it<nl>
  2958. XContent-Type: text/plain;
  2959. END_OF_FILE
  2960.   if test 8947 -ne `wc -c <'mbox/src/languages/english.shh'`; then
  2961.     echo shar: \"'mbox/src/languages/english.shh'\" unpacked with wrong size!
  2962.   fi
  2963.   # end of 'mbox/src/languages/english.shh'
  2964. fi
  2965. if test -f 'mbox/src/lesen.c' -a "${1}" != "-c" ; then 
  2966.   echo shar: Will not clobber existing file \"'mbox/src/lesen.c'\"
  2967. else
  2968.   echo shar: Extracting \"'mbox/src/lesen.c'\" \(9453 characters\)
  2969.   sed "s/^X//" >'mbox/src/lesen.c' <<'END_OF_FILE'
  2970. X/* ix/MBox (lesen.c) by Volker Schuermann, 04.12.1993
  2971. X
  2972. X   This C source code contains the following functions:
  2973. X
  2974. X   #LE lesen()             read mails and articles
  2975. X   #AS ansage()            message editing
  2976. X   #US unterschrift()      signature editing
  2977. X   #PL plan()              sort of UNIX (R) "plan" file
  2978. X   #GS getsite()           find the name of a site in a path
  2979. X   #CD checkdomaintype()   is user trying to send international mails?
  2980. X
  2981. X   Contact <volkers@unnet.wupper.de> for help! */
  2982. X
  2983. X
  2984. X
  2985. X
  2986. X
  2987. X#include <sys/types.h>
  2988. X#include <sys/stat.h>
  2989. X#include <unistd.h>
  2990. X#include <fcntl.h>
  2991. X#include <stdio.h>
  2992. X#include <utmp.h>
  2993. X#include <time.h>
  2994. X
  2995. X
  2996. X#include "mbox.h"
  2997. X
  2998. X
  2999. Xextern UNSIGNED char headinfo[STRING];
  3000. X
  3001. X
  3002. X
  3003. X/* #LE - Read mails or news articles.
  3004. X   [arg] contains the number of a mail or an article. */
  3005. X
  3006. Xvoid lesen(arg)
  3007. XUNSIGNED char arg[];
  3008. X{
  3009. X  FILE *fp;
  3010. X  UNSIGNED char s[LSTRING];
  3011. X  UNSIGNED char entry[STRING];
  3012. X  UNSIGNED char no[10];
  3013. X  UNSIGNED char c;
  3014. X  int i;
  3015. X  int ok;
  3016. X  int MIN, MAX;
  3017. X  int pr;
  3018. X
  3019. X  struct stat fst;
  3020. X
  3021. X
  3022. X  if(strcomp(CDROMNG, NG) == 0){
  3023. X    cdromB( arg, 'L' );
  3024. X    return; 
  3025. X  }
  3026. X
  3027. X  sprintf(no, "%s", arg);
  3028. X
  3029. X  maybe_locked(INHALT, "r");
  3030. X  fp = fopen(INHALT, "r");
  3031. X  if (fp == NULL) {
  3032. X    nerror("misc.c", 558, "lesen", "Can't read", INHALT);
  3033. X  }
  3034. X  while ((fgets(s, LSTRING, fp) != NULL) && (s[2] != '='));
  3035. X  fgets(s, LSTRING, fp);
  3036. X  MIN = atoi(s);
  3037. X  MAX = atoi(s);         /* If it's only one mail/article! */
  3038. X  while (fgets(s, LSTRING, fp) != NULL) {
  3039. X    MAX = atoi(s);
  3040. X  }
  3041. X  fclose(fp);
  3042. X
  3043. X  if (MAX < MIN) {
  3044. X    i = MIN;
  3045. X    MIN = MAX;
  3046. X    MAX = i;
  3047. X  }
  3048. X
  3049. X
  3050. X  NEXT_MSG:
  3051. X
  3052. X  if ((no[0] < '1') || (no[0] > '9')) {
  3053. X    ansi2("md", 0, 0);
  3054. X    printf(" %s\n", MIS41_MSG);
  3055. X    ansi2("me", 0, 0);
  3056. X    return;
  3057. X  }
  3058. X  if (pruefe(no) != 0) goto NEXT_NEXT;
  3059. X
  3060. X  if (strcomp(BRETT, "PM") != 0) {
  3061. X        sprintf(entry, "%s/%s", BRETT, no); 
  3062. X    sprintf(headinfo, " %s %s (%s) ", MIS43_MSG, no, NG);
  3063. X    if(!DISKUSSION) headline( headinfo );    
  3064. X    ok = show(entry, 9999, USER.more);
  3065. X  }
  3066. X  else {
  3067. X    sprintf(entry, "%s/usr/%c/%d/%s", HOME, USER.name[0], USER.id, no);
  3068. X    sprintf(headinfo, " %s (%s) ", MIS45_MSG, no);
  3069. X    if(!DISKUSSION) headline( headinfo );
  3070. X    ok = show(entry, 9999, USER.more);
  3071. X    mail_status( (int) atoi(no), 'L' ); 
  3072. X  }
  3073. X
  3074. X  if(ok == -1) return;
  3075. X  if(ok == -9){
  3076. X    if(USER.leserichtung == 1){
  3077. X        c = MIS52_MSG;
  3078. X    }
  3079. X    else{
  3080. X        c = MIS51_MSG;
  3081. X     }
  3082. X    goto NEXT_DIS;
  3083. X  }
  3084. X
  3085. X  c = LF;
  3086. X
  3087. X  NEXT_NEXT:
  3088. X
  3089. X  printf("\n");
  3090. X  ansi2("mr", 0, 0);
  3091. X  printf("[Mesg. %s] %s, ? >", no, MIS46_MSG);
  3092. X  ansi2("me", 0, 0);
  3093. X  printf(" %c%c", MIS51_MSG, BS);
  3094. X
  3095. X  do {
  3096. X    c = getint();
  3097. X    if (strcomp(BRETT, "PM") == 0) {
  3098. X        if (c == MIS50_MSG) c = '*';
  3099. X    }
  3100. X    if (c >= 97) c -= 32;
  3101. X    if (c == ENTER) c = MIS51_MSG;
  3102. X    if (c == '?') {
  3103. X        clearline();
  3104. X        ansi2("mr", 0, 0);
  3105. X        printf("%c%s >", CR, MIS53_MSG);
  3106. X        ansi2("me", 0 ,0);
  3107. X        printf(" ");
  3108. X    }
  3109. X    if (    (c != MIS47_MSG) && (c != MIS48_MSG) && (c != MIS49_MSG) && 
  3110. X        (c != MIS50_MSG) && (c != MIS50aMSG) && (c != MIS50bMSG) &&
  3111. X        (c != MIS51_MSG) && (c != MIS52_MSG) && (c != '*')) {
  3112. X
  3113. X                c = 0;
  3114. X    }
  3115. X
  3116. X  } while (c == 0);
  3117. X
  3118. X  printf("%c", c);
  3119. X
  3120. X  NEXT_DIS:
  3121. X
  3122. X  if (c == MIS50_MSG) {        /* DELETE / LOESCHEN */
  3123. X    clearline();
  3124. X    ansi2("mr", 0, 0);
  3125. X    printf("%s [%c, %c] >", MIS54_MSG, GBL06_MSG, GBL07_MSG);
  3126. X    ansi2("me", 0, 0);
  3127. X    printf(" ");
  3128. X    if (yesno() == GBL06_MSG) {
  3129. X        loeschen(no);
  3130. X    }
  3131. X    printf("\n");
  3132. X    c = MIS51_MSG;
  3133. X  }
  3134. X  if (c == '*') {        /* DELETE (don't ask) / LOESCHEN (sofort) */
  3135. X    loeschen(no);
  3136. X    printf("\n");
  3137. X    c = MIS51_MSG;
  3138. X  }
  3139. X  if (c == MIS50aMSG) {     /* (undocumented) UUDECODE */
  3140. X    uudecode( no );
  3141. X    c = MIS51_MSG;
  3142. X  }
  3143. X  if (c == MIS50bMSG) {        /* (undocumented) PRINT */
  3144. X    drucken( no );
  3145. X    c = MIS49_MSG;
  3146. X  }
  3147. X  if (c == MIS51_MSG) {        /* NEXT / NAECHSTE */
  3148. X    ok = 0;
  3149. X    do {
  3150. X        i = atoi(no);
  3151. X        i++;
  3152. X        sprintf(no, "%d", i);
  3153. X        pr = pruefe(no);
  3154. X        if (pr == 0) ok = 1;
  3155. X        if (pr == 1) goto NEXT_NEXT;
  3156. X        if (i > MAX) {
  3157. X            if(!DISKUSSION)
  3158. X                printf("\n\n%s\n", MIS55_MSG);
  3159. X            else
  3160. X                printf("\n\n%s\n", MIS55aMSG);
  3161. X            return;
  3162. X        }
  3163. X    } while (ok == 0);
  3164. X    if (ok == 1) goto NEXT_MSG;
  3165. X    goto NEXT_NEXT;
  3166. X  }
  3167. X  if (c == MIS52_MSG) {        /* PREVIOUS / VORHERIGE */
  3168. X    ok = 0;
  3169. X    do {
  3170. X        i = atoi(no);
  3171. X        i--;
  3172. X        sprintf(no, "%d", i);
  3173. X        pr = pruefe(no);
  3174. X        if (pr == 0) ok = 1;
  3175. X        if (pr == 1) goto NEXT_NEXT;
  3176. X        if (i < MIN) {
  3177. X            printf("\n\n%s\n", MIS56_MSG);
  3178. X            return;
  3179. X        }
  3180. X    } while (ok == 0);
  3181. X    if (ok == 1) goto NEXT_MSG;
  3182. X    goto NEXT_NEXT;
  3183. X  }
  3184. X  if (c == MIS49_MSG) goto NEXT_MSG;    /* REPEAT / WIEDERHOLEN */
  3185. X
  3186. X
  3187. X  if (c == MIS48_MSG) {            /* REPLY / BEANTWORTEN */
  3188. X    headline( MIS57_MSG );
  3189. X    sprintf(s, "cp %s %s/%dRep > /dev/null", entry, TMP, getpid());
  3190. X    system(s);
  3191. X
  3192. X    if (strcomp(BRETT, "PM") == 0) {
  3193. X        printf("\n%s", MIS58_MSG);
  3194. X        if(brief("~REPLY~") != -1){
  3195. X            sprintf(s, "%s?", USER.name);
  3196. X            brief(s);
  3197. X            sprintf(s, "%s/usr/%c/%d/INDEX", HOME, USER.name[0], USER.id);
  3198. X            mail_status( (int) atoi(no), 'B');
  3199. X        }
  3200. X    }
  3201. X    else {
  3202. X        printf("\n");
  3203. X        ansi2("mr", 0, 0);
  3204. X        printf("%s, ? >", MIS59_MSG);
  3205. X        ansi2("me", 0, 0);
  3206. X        printf(" ");
  3207. X
  3208. X        do {
  3209. X            c = getint();
  3210. X            if (c >= 97) c -= 32;
  3211. X            if (c == '?') {
  3212. X                clearline();
  3213. X                ansi2("mr", 0, 0);
  3214. X                printf("%c%s >", CR, MIS60_MSG);
  3215. X                ansi2("me", 0, 0);
  3216. X                printf(" ");
  3217. X            }
  3218. X            if ((c != MIS61_MSG) && (c != MIS62_MSG)) c = 0;
  3219. X        } while (c == 0);
  3220. X
  3221. X        printf("%c", c);
  3222. X
  3223. X        printf("\n\n%s", MIS58_MSG);
  3224. X
  3225. X        if (c == MIS62_MSG) {
  3226. X            schreiben("");
  3227. X        }
  3228. X        if (c == MIS61_MSG) {
  3229. X            if((brief("~REPLY~") != -1) && (strcomp(GUEST, USER.name) != 0)){
  3230. X                sprintf(s, "%s?", USER.name);
  3231. X                brief(s);
  3232. X                sprintf(s, "%s/usr/%c/%d/INDEX", HOME, USER.name[0], USER.id);
  3233. X                stat(s, &fst);
  3234. X                    IDX_SIZE = (long) fst.st_size;
  3235. X            }
  3236. X        }
  3237. X    }
  3238. X    goto NEXT_NEXT;
  3239. X  }
  3240. X  printf("\n");
  3241. X  return;
  3242. X}
  3243. X
  3244. X
  3245. X
  3246. X
  3247. X/* #AS - If a user mails you, he is shown a messages which may be
  3248. X   edited here. */
  3249. X
  3250. Xvoid ansage()
  3251. X{
  3252. X  FILE *ff;
  3253. X  UNSIGNED char s[STRING];
  3254. X  UNSIGNED char t[STRING];
  3255. X  UNSIGNED char TEP[STRING];
  3256. X  UNSIGNED char c;
  3257. X
  3258. X
  3259. X  printf("\n\n%s\n\n", MAL38_MSG);
  3260. X
  3261. X  sprintf(TEP, "%s/usr/%c/%d/.hello", HOME, USER.name[0], USER.id);
  3262. X  ff = fopen(TEP, "r");
  3263. X  if (ff != NULL) {
  3264. X    ansi2("md", 0, 0);
  3265. X    while (fgets(s, STRING, ff) != NULL) {
  3266. X        printf("%s", s);
  3267. X    }
  3268. X    fclose(ff);
  3269. X    ansi2("me", 0, 0);
  3270. X    printf("\n\n");
  3271. X  }
  3272. X  ansi2("mr", 0, 0);
  3273. X  printf("%c%s [%c, %c] > ", CR, MAL39_MSG, GBL06_MSG, GBL07_MSG);
  3274. X  ansi2("me", 0, 0);
  3275. X
  3276. X  c = yesno();
  3277. X
  3278. X  if (c == GBL06_MSG) {
  3279. X    security_ed( TEP );
  3280. X  }
  3281. X  printf("\n");
  3282. X}
  3283. X
  3284. X
  3285. X
  3286. X
  3287. X/* #US - Sort of signature. You may edit it here. */
  3288. X
  3289. Xvoid unterschrift()
  3290. X{
  3291. X  FILE *ff;
  3292. X  UNSIGNED char s[STRING];
  3293. X  UNSIGNED char t[STRING];
  3294. X  UNSIGNED char TEP[STRING];
  3295. X  UNSIGNED char c;
  3296. X
  3297. X
  3298. X  printf("\n\n%s\n\n", MAL40_MSG);
  3299. X
  3300. X  sprintf(TEP, "%s/usr/%c/%d/.signature", HOME, USER.name[0], USER.id);
  3301. X  ff = fopen(TEP, "r");
  3302. X  if (ff != NULL) {
  3303. X    ansi2("md", 0, 0);
  3304. X    while (fgets(s, STRING, ff) != NULL) {
  3305. X        printf("%s", s);
  3306. X    }
  3307. X    fclose(ff);
  3308. X    ansi2("me", 0, 0);
  3309. X    printf("\n\n");
  3310. X  }
  3311. X  ansi2("mr", 0, 0);
  3312. X  printf("%c%s [%c, %c] > ", CR, MAL41_MSG, GBL06_MSG, GBL07_MSG);
  3313. X  ansi2("me", 0, 0);
  3314. X
  3315. X  c = yesno();
  3316. X
  3317. X  if (c == GBL06_MSG) {
  3318. X    security_ed( TEP );
  3319. X  }
  3320. X  printf("\n");
  3321. X}
  3322. X
  3323. X
  3324. X
  3325. X
  3326. X/* #PL - Kind of plan. Change your own entry here. */
  3327. X
  3328. Xvoid plan(arg)
  3329. XUNSIGNED char arg[];
  3330. X{
  3331. X  FILE *ff;
  3332. X  UNSIGNED char s[STRING];
  3333. X  UNSIGNED char t[STRING];
  3334. X  UNSIGNED char TEP[STRING];
  3335. X  UNSIGNED char c;
  3336. X
  3337. X  if(arg[0] != '\0'){
  3338. X    finger( arg );
  3339. X    return;
  3340. X  }
  3341. X
  3342. X  printf("\n\n%s\n\n", MAL42_MSG);
  3343. X
  3344. X  sprintf(TEP, "%s/usr/%c/%d/.plan", HOME, USER.name[0], USER.id);
  3345. X  ff = fopen(TEP, "r");
  3346. X  if (ff != NULL) {
  3347. X    ansi2("md", 0, 0);
  3348. X    while (fgets(s, STRING, ff) != NULL) {
  3349. X        printf("%s", s);
  3350. X    }
  3351. X    fclose(ff);
  3352. X    ansi2("me", 0, 0);
  3353. X    printf("\n\n");
  3354. X  }
  3355. X  ansi2("mr", 0, 0);
  3356. X  printf("%c%s [%c, %c] > ", CR, MAL43_MSG, GBL06_MSG, GBL07_MSG);
  3357. X  ansi2("me", 0, 0);
  3358. X
  3359. X  c = yesno();
  3360. X
  3361. X  if (c == GBL06_MSG) {
  3362. X    security_ed( TEP );
  3363. X  }
  3364. X  printf("\n");
  3365. X}
  3366. X
  3367. X
  3368. X
  3369. X
  3370. X
  3371. X/* #GS - Locate the name of a site in a path [arg] and return it. */
  3372. X
  3373. XUNSIGNED char *getsite(arg)
  3374. XUNSIGNED char arg[];
  3375. X{
  3376. X  int i = 0, a = 0, b = 0, c = 0;
  3377. X  UNSIGNED char s[STRING];
  3378. X
  3379. X  while(arg[i] != '\0'){
  3380. X    if(arg[i] == '!') a = i - 1;
  3381. X    if(arg[i] == '@') b = i + 1;
  3382. X    if(arg[i] == '.'){
  3383. X        if((b != 0) && (c == 0)) c = i -1;
  3384. X    }
  3385. X    i++;
  3386. X  }
  3387. X
  3388. X  if((a == 0) && (b == 0)) strcat(s, UUCPSITE);
  3389. X  if(a != 0) strcpy(s, (UNSIGNED char *) strcopy(arg, 0, a));
  3390. X  if(b != 0) strcpy(s, (UNSIGNED char *) strcopy(arg, b, c));
  3391. X
  3392. X  return (UNSIGNED char *) s;
  3393. X}
  3394. X
  3395. X
  3396. X
  3397. X
  3398. X
  3399. X/* #CD - Check whether a user is allowed to mail to the specified
  3400. X   receiver [arg], or not.
  3401. X
  3402. X   This function returns 0 is everything is ok, and -1 if the user
  3403. X   level isn't high enough. */
  3404. X
  3405. Xint checkdomaintype(arg)
  3406. XUNSIGNED char arg[];
  3407. X{
  3408. X  int i = 0, l, a, e = 0, f = 0, g = 0, international = 0;
  3409. X  UNSIGNED char s[STRING];
  3410. X
  3411. X  if(USER.level >= WRITE_INTERNAT) return (int) 0;
  3412. X
  3413. X  while(arg[i] != '\0'){
  3414. X    if(arg[i] == '!') e++;
  3415. X    if(arg[i] == '@') g++;
  3416. X    i++;
  3417. X  }
  3418. X  s[0] = '\0';
  3419. X
  3420. X  if((e == 0) && (g == 0)) return (int) 0;
  3421. X
  3422. X  if(e > 1) international++;
  3423. X
  3424. X  if(e == 0){
  3425. X
  3426. X    l = strlen( (UNSIGNED char *) arg);
  3427. X
  3428. X    a = strlen( (UNSIGNED char *) NAT_DOMAIN1 );
  3429. X    strcpy(s, (UNSIGNED char *) strcopy(arg, (l-a), l));
  3430. X    if(strcomp(s, NAT_DOMAIN1) == 0) f++;
  3431. X
  3432. X    a = strlen( (UNSIGNED char *) NAT_DOMAIN2 );
  3433. X    strcpy(s, (UNSIGNED char *) strcopy(arg, (l-a), l));
  3434. X    if(strcomp(s, NAT_DOMAIN2) == 0) f++;
  3435. X
  3436. X    a = strlen( (UNSIGNED char *) NAT_DOMAIN3 );
  3437. X    strcpy(s, (UNSIGNED char *) strcopy(arg, (l-a), l));
  3438. X    if(strcomp(s, NAT_DOMAIN3) == 0) f++;      
  3439. X
  3440. X    if(f == 0) international++;
  3441. X  }  
  3442. X
  3443. X  if(international != 0){
  3444. X    ansi2("md", 0, 0);
  3445. X    printf("\n\n%s (%d) %s\n", MAL01_MSG, WRITE_INTERNAT, MAL02_MSG);
  3446. X    ansi2("me", 0 ,0);
  3447. X    return (int) -1;    
  3448. X  }
  3449. X
  3450. X  return (int) 0;
  3451. X}
  3452. X
  3453. X
  3454. X
  3455. X
  3456. END_OF_FILE
  3457.   if test 9453 -ne `wc -c <'mbox/src/lesen.c'`; then
  3458.     echo shar: \"'mbox/src/lesen.c'\" unpacked with wrong size!
  3459.   fi
  3460.   # end of 'mbox/src/lesen.c'
  3461. fi
  3462. if test -f 'mbox/src/suchen.c' -a "${1}" != "-c" ; then 
  3463.   echo shar: Will not clobber existing file \"'mbox/src/suchen.c'\"
  3464. else
  3465.   echo shar: Extracting \"'mbox/src/suchen.c'\" \(6852 characters\)
  3466.   sed "s/^X//" >'mbox/src/suchen.c' <<'END_OF_FILE'
  3467. X/* ix/MBox (suchen.c) by Volker Schuermann, 04.12.1993
  3468. X
  3469. X   This C source code contains the following functions:
  3470. X
  3471. X   #SU suchen()           search & find patterns in newsgroups
  3472. X   #ED edit()             edit articles
  3473. X   #KB kombinieren()      combine a couple of mails
  3474. X   #SE security_ed()      close a serious security gap with external editors
  3475. X
  3476. X   Contact <volkers@unnet.wupper.de> for help! */
  3477. X
  3478. X
  3479. X
  3480. X
  3481. X
  3482. X
  3483. X
  3484. X
  3485. X#include <stdio.h>
  3486. X#include <signal.h>
  3487. X#include <sys/types.h>
  3488. X#include <sys/stat.h>
  3489. X
  3490. X#include "mbox.h"
  3491. X
  3492. X
  3493. X
  3494. X
  3495. X
  3496. X/* #SU - Find the pattern [muster] in the current newsgroup. */
  3497. X
  3498. Xvoid suchen( muster )
  3499. XUNSIGNED char muster[];
  3500. X{
  3501. X  FILE *fp;
  3502. X  FILE *ff;
  3503. X
  3504. X  UNSIGNED char s[STRING];
  3505. X  UNSIGNED char t[STRING];
  3506. X  UNSIGNED char tmp[STRING];
  3507. X  UNSIGNED char hl[STRING];
  3508. X  UNSIGNED char ex[LONGSTRING];
  3509. X  UNSIGNED char fx[LONGSTRING];
  3510. X
  3511. X  int fpid;
  3512. X  int found = 0;
  3513. X  int ok = 0;
  3514. X  int i, j;
  3515. X  
  3516. X
  3517. X  if(muster[0] == '\0'){
  3518. X    ansi2( "md", 0, 0 );
  3519. X    printf("\n\n%s ", SUC01_MSG);
  3520. X    ansi2( "me", 0, 0 );
  3521. X    strcpy(muster, (UNSIGNED char *) getline(60, 1, 32, ""));
  3522. X    if(muster[0] == '\0'){
  3523. X        printf(" <- %s\n", SUC02_MSG);
  3524. X        return;
  3525. X    }
  3526. X  }
  3527. X
  3528. X  i = 0;
  3529. X  while(muster[i] != '\0'){
  3530. X    if(muster[i] == '"') muster[i] = ' ';
  3531. X    i++;
  3532. X  }
  3533. X
  3534. X  sprintf(hl, " %s \"%s\" %s [%s] ", SUC03_MSG, (UNSIGNED char *) stripped(muster), SUC04_MSG, NG);
  3535. X  headline( hl );
  3536. X
  3537. X  printf("%s .", SUC05_MSG);
  3538. X
  3539. X  sprintf(tmp, "%s/such.%d", GLOBAL_TMP, getpid());
  3540. X
  3541. X  if(strcomp("PM", BRETT) == 0){
  3542. X    sprintf(t, "%s/usr/%c/%d", HOME, USER.name[0], USER.id);
  3543. X    chdir( t );
  3544. X  }
  3545. X  else{
  3546. X    chdir( BRETT );
  3547. X  }
  3548. X
  3549. X  switch( (fpid = fork()) ){
  3550. X        case -1 :
  3551. X                break;
  3552. X        case  0 :    while(1){
  3553. X                    printf(".");
  3554. X                    sleep(3);
  3555. X                }    
  3556. X                break;
  3557. X  }
  3558. X
  3559. X  sprintf(s, "%s \"%s\" * > %s 2> %s", GREP, (UNSIGNED char *) stripped(muster), tmp, CPRN);
  3560. X  system( s );
  3561. X
  3562. X  kill( fpid, SIGKILL );
  3563. X  (void) wait( &fpid );
  3564. X
  3565. X  printf("%c", CR);
  3566. X
  3567. X  sprintf(t, "%s/sres.%d", GLOBAL_TMP, getpid());  
  3568. X  ff = fopen( t, "w" );
  3569. X  if(ff == NULL){
  3570. X  }
  3571. X
  3572. X  fp = fopen( tmp, "r" );
  3573. X  if(fp == NULL){
  3574. X    
  3575. X  }
  3576. X  while((fgets(ex, LONGSTRING, fp) != NULL) && (ok == 0)){
  3577. X    if(atoi(ex) != 0){    
  3578. X        i = 0;            
  3579. X        while((ex[i] != '\0') && (ex[i] != ':')) i++;
  3580. X        j = i + 1;
  3581. X        strcpy(fx, (UNSIGNED char *) bigcopy(ex, 0, (i - 1)));
  3582. X        fprintf(ff, "%-8s", fx);
  3583. X        i++;
  3584. X        
  3585. X        while((ex[i] != '\0') && (ex[i] != ':')) i++;
  3586. X        strcpy(fx, (UNSIGNED char *) bigcopy(ex, j, (i - 1)));
  3587. X        fprintf(ff, "%6s    ", fx);        
  3588. X        j = i + 1;
  3589. X
  3590. X        strcpy(fx, (UNSIGNED char *) bigcopy(ex, j, (strlen(ex))));
  3591. X    
  3592. X        fx[61] = '\0';
  3593. X    
  3594. X        fprintf(ff, "%s\n", stripped(fx));
  3595. X
  3596. X        found++;
  3597. X    }
  3598. X  }
  3599. X  fclose(fp);
  3600. X  fclose(ff);
  3601. X
  3602. X  chdir( HOME );
  3603. X
  3604. X  if(found == 0){
  3605. X    printf("%s \"%s\" %s\n", SUC06_MSG, (UNSIGNED char *) stripped(muster), SUC07_MSG);
  3606. X  }
  3607. X  else{
  3608. X    headblock( hl, SUC06aMSG );
  3609. X    show(t, 9999, USER.more + 100);
  3610. X  }
  3611. X
  3612. X  unlink( tmp );
  3613. X  unlink( t );
  3614. X}
  3615. X
  3616. X
  3617. X/* #ED - Reedit a file [arg] (number, not path!). */
  3618. X
  3619. Xvoid edit( arg )
  3620. XUNSIGNED char arg[];
  3621. X{
  3622. X  FILE *fp;
  3623. X  FILE *ff;
  3624. X
  3625. X  UNSIGNED char s[STRING];
  3626. X  UNSIGNED char t[STRING];
  3627. X  UNSIGNED char d[STRING];
  3628. X  UNSIGNED char p1[STRING];
  3629. X  UNSIGNED char p2[STRING];
  3630. X
  3631. X  int ok = 0;
  3632. X  int yet = 0;
  3633. X
  3634. X  if (arg[0] == '\0') {
  3635. X    ansi2( "md", 0, 0 );
  3636. X    printf(" <- %s\n", SUC07aMSG);
  3637. X    ansi2( "me", 0, 0 ); 
  3638. X    return;
  3639. X  }
  3640. X
  3641. X  if (strcomp(BRETT, "PM") != 0) {
  3642. X        sprintf(t, "%s/%s", BRETT, arg); 
  3643. X  }
  3644. X  else {
  3645. X    sprintf(t, "%s/usr/%c/%d/%s", HOME, USER.name[0], USER.id, arg);
  3646. X  }
  3647. X  
  3648. X  if((USER.level < ADMIN_LEV) && (USER.level >= EXE_LEV)){
  3649. X     fp = fopen( t, "r" );
  3650. X    if(fp == NULL){
  3651. X        ansi2( "md", 0, 0 );
  3652. X        printf(" <- %s\n", SUC10_MSG);
  3653. X        ansi2( "me", 0, 0 ); 
  3654. X        return;
  3655. X    }
  3656. X    while((fgets(s, STRING, fp) != 0) && (ok == 0)){
  3657. X        if(strcomp("From: ", s) == 0){
  3658. X            strcpy(d, (UNSIGNED char *) strcopy(s, 6, STRING));
  3659. X            if(strcomp(USER.name, d) == 0) ok++;
  3660. X        }
  3661. X    }
  3662. X    fclose(fp);
  3663. X    if(ok == 0){
  3664. X        ansi2( "md", 0, 0 );
  3665. X        printf(" <- %s\n", SUC09_MSG);
  3666. X        ansi2( "me", 0, 0 ); 
  3667. X        return;
  3668. X    }
  3669. X  }
  3670. X
  3671. X  if(USER.level >= EXE_LEV){
  3672. X
  3673. X    noctrlx();
  3674. X    security_ed( t );
  3675. X    ctrlx();
  3676. X  }
  3677. X  else{
  3678. X    sprintf(p1, "%s/%dED1", TMP, getpid());
  3679. X    sprintf(p2, "%s/%dED2", TMP, getpid());
  3680. X
  3681. X    fp = fopen( t, "r" );
  3682. X    if(fp == NULL){
  3683. X        ansi2( "md", 0, 0 );
  3684. X        printf(" <- %s\n", SUC08_MSG);
  3685. X        ansi2( "me", 0, 0 ); 
  3686. X        return;
  3687. X    }
  3688. X     ff = fopen( p1, "w" );
  3689. X    while(fgets(s, STRING, fp) != NULL){
  3690. X        fputs(s, ff);
  3691. X        if(strcomp("From: ", s) == 0){
  3692. X            strcpy(d, (UNSIGNED char *) strcopy(s, 6, STRING));
  3693. X            if(strcomp(USER.name, d) == 0) ok++;
  3694. X        }
  3695. X        if((strlen(s) < 3) && (yet == 0)){
  3696. X            fclose(ff);
  3697. X            ff = fopen( p2, "w" );
  3698. X            yet++;
  3699. X        }
  3700. X    }
  3701. X    fclose(fp);
  3702. X    fclose(ff);
  3703. X
  3704. X    if(ok == 0){
  3705. X        ansi2( "md", 0, 0 );
  3706. X        printf(" <- %s\n", SUC09_MSG);
  3707. X        ansi2( "me", 0, 0 ); 
  3708. X        unlink( p1 );
  3709. X        unlink( p2 );
  3710. X        return;
  3711. X    }
  3712. X
  3713. X    noctrlx();
  3714. X    security_ed( p2 );
  3715. X    ctrlx();
  3716. X
  3717. X    sprintf(s, "cat %s > %s", p1, t);
  3718. X    system( s );
  3719. X    sprintf(s, "cat %s >> %s", p2, t);
  3720. X    system( s );
  3721. X
  3722. X    unlink( p1 );
  3723. X    unlink( p2 );
  3724. X  }
  3725. X}
  3726. X
  3727. X
  3728. X
  3729. X
  3730. X
  3731. X/* #KB - Combine a couple of mails [arg]. */
  3732. X
  3733. Xvoid kombinieren( arg )
  3734. XUNSIGNED char arg[];
  3735. X{
  3736. X  FILE *fp;
  3737. X  FILE *ff;
  3738. X
  3739. X  UNSIGNED char s[STRING];
  3740. X  UNSIGNED char t[STRING];
  3741. X
  3742. X  int i = 0, a = 0, n;
  3743. X  int runde = 0;
  3744. X
  3745. X  strcat(arg, " ");
  3746. X
  3747. X  while(arg[i] != '\0'){
  3748. X    if(arg[i] == ' '){
  3749. X        runde++;
  3750. X        strcpy(t, (UNSIGNED char *) strcopy(arg, a, (i-1)));
  3751. X        a = i + 1;
  3752. X        if(atoi(t) != 0){
  3753. X            if(runde == 1){
  3754. X                sprintf(s, "%s/usr/%c/%d/%d", HOME, USER.name[0], USER.id, atoi(t));
  3755. X                fp = fopen( s, "r" );
  3756. X                if(fp == NULL){
  3757. X                    printf(" <- %s\n", SUC11_MSG);
  3758. X                    return;
  3759. X                }
  3760. X                fclose(fp);
  3761. X                fp = fopen( s, "a" );
  3762. X            }
  3763. X            else{
  3764. X                fprintf(fp, "\n+ + +  S T O P  + + +\n");
  3765. X            
  3766. X                sprintf(s, "%s/usr/%c/%d/%d", HOME, USER.name[0], USER.id, atoi(t));
  3767. X                ff = fopen( s, "r" );
  3768. X                if(ff != NULL){
  3769. X                    while(fgets(s, STRING, ff) != NULL){
  3770. X                        fputs(s, fp);        
  3771. X                    }
  3772. X                    fclose(ff);
  3773. X
  3774. X                    loeschen( t );
  3775. X                }
  3776. X            }
  3777. X        }
  3778. X    }
  3779. X    i++;
  3780. X  }
  3781. X  fclose(fp);
  3782. X}
  3783. X
  3784. X
  3785. X
  3786. X/* #SE - Edit the file [path] with any editor */
  3787. X
  3788. Xsecurity_ed( path )
  3789. XUNSIGNED char path[];
  3790. X{
  3791. X  UNSIGNED char s[STRING];
  3792. X  UNSIGNED char t[STRING];
  3793. X
  3794. X  UNSIGNED char *home;
  3795. X
  3796. X  struct stat fst;
  3797. X  mode_t mode;
  3798. X  uid_t uid;
  3799. X  short int gid;
  3800. X
  3801. X  int is_new = 0;
  3802. X
  3803. X  stat(path, &fst);
  3804. X  mode = fst.st_mode;
  3805. X  uid  = fst.st_uid;
  3806. X  gid  = fst.st_gid;
  3807. X
  3808. X  sprintf(t, "%s/%d.ED", GLOBAL_TMP, getpid());
  3809. X  if(mbrename( path, t ) != 0){
  3810. X
  3811. X    /*    
  3812. X    printf("\nCan't rename %s -> %s\n", path, t);
  3813. X    It might be a NEW file, so it doesn't matter!
  3814. X    */    
  3815. X
  3816. X    is_new ++;
  3817. X  }
  3818. X
  3819. X  chmod( t, 0777 );
  3820. X
  3821. X  home = (UNSIGNED char *) getenv( "HOME" );
  3822. X
  3823. X  chdir( home );
  3824. X
  3825. X  noctrlx();
  3826. X  sprintf(s, "exec %s/%s %s %s %d %d", HOME, RSH, EDDY, t, OLDUID, OLDGID);
  3827. X  system(s);
  3828. X  ctrlx();
  3829. X
  3830. X  chdir( HOME );
  3831. X
  3832. X  if(mbrename( t, path ) != 0){
  3833. X    printf("\nCan't rename %s -> %s\n", t, path);
  3834. X  }
  3835. X
  3836. X  if(is_new) return;
  3837. X
  3838. X  chmod( path, mode );
  3839. X
  3840. X#ifdef _SYS7  
  3841. X  chown( path, uid, gid );
  3842. X#else
  3843. X  chown( path, uid, gid );
  3844. X
  3845. X  /* SVR3, SVR4 maybe this way ???
  3846. X
  3847. X  chown( path, uid );
  3848. X  chgrp( path, gid );
  3849. X
  3850. X  */
  3851. X#endif
  3852. X}
  3853. X
  3854. END_OF_FILE
  3855.   if test 6852 -ne `wc -c <'mbox/src/suchen.c'`; then
  3856.     echo shar: \"'mbox/src/suchen.c'\" unpacked with wrong size!
  3857.   fi
  3858.   # end of 'mbox/src/suchen.c'
  3859. fi
  3860. echo shar: End of archive 9 \(of 12\).
  3861. cp /dev/null ark9isdone
  3862. MISSING=""
  3863. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  3864.     if test ! -f ark${I}isdone ; then
  3865.     MISSING="${MISSING} ${I}"
  3866.     fi
  3867. done
  3868. if test "${MISSING}" = "" ; then
  3869.     echo You have unpacked all 12 archives.
  3870.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  3871. else
  3872.     echo You still must unpack the following archives:
  3873.     echo "        " ${MISSING}
  3874. fi
  3875. exit 0
  3876. exit 0 # Just in case...
  3877.