home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume29 / mbox / part01 < prev    next >
Encoding:
Text File  |  1992-04-05  |  53.1 KB  |  2,096 lines

  1. Newsgroups: comp.sources.misc
  2. From: Volker.Schuermann@unnet.w.open.de@unnet (Volker Schuermann)
  3. Subject:  v29i063:  mbox - A Bulletin Board System for UNIX and MINIX, Part01/10
  4. Message-ID: <csm-v29i063=mbox.132853@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: d5233b0510fb2be5118773e45312e8e8
  6. Date: Sun, 5 Apr 1992 18:29:27 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Volker.Schuermann@unnet.w.open.de@unnet (Volker Schuermann)
  10. Posting-number: Volume 29, Issue 63
  11. Archive-name: mbox/part01
  12. Environment: MINIX, ISC, ESIX, SVR3
  13.  
  14. This is a BBS-System written & tested on MINIX 386 (!) and UNIX SVR3 (ISC,
  15. ESIX, AT&T). It only works, if you've already installed UUCP, NEWS and MAIL !
  16.  
  17. The BBS could deal with different 'human' languages. This package includes
  18. the files for an 'english' and a 'german' version. If you prefer another
  19. language, just change the language-files.
  20.  
  21. Describtion of the features ??? Well, it's a combination of a NEWSREADER,
  22. a MAILER and a DATABASE. For users, it looks and feels like a PC/DOS-BBS,
  23. but it offers Internet-contact and NEWS-transfer ...
  24.  
  25. That's what it's about ...
  26.  
  27. #! /bin/sh
  28. # This is a shell archive.  Remove anything before this line, then feed it
  29. # into a shell via "sh file" or similar.  To overwrite existing files,
  30. # type "sh file -c".
  31. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  32. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  33. # Contents:  README etc src src/mb-daemon.c
  34. # Wrapped by kent@sparky on Sun Apr  5 11:57:39 1992
  35. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  36. echo If this archive is complete, you will see the following message:
  37. echo '          "shar: End of archive 1 (of 10)."'
  38. if test -f 'README' -a "${1}" != "-c" ; then 
  39.   echo shar: Will not clobber existing file \"'README'\"
  40. else
  41.   echo shar: Extracting \"'README'\" \(27945 characters\)
  42.   sed "s/^X//" >'README' <<'END_OF_FILE'
  43. X
  44. X
  45. X
  46. X
  47. X
  48. X
  49. X
  50. X
  51. X
  52. X            
  53. X
  54. X                 ix/MBox  R E A D M E
  55. X           Bulletin Board System for UNIX(-Derivations)
  56. X            
  57. X               Volker Schuermann
  58. X              Wuppertal, FRG, 27.12.1991
  59. X
  60. X
  61. X
  62. X
  63. X
  64. X
  65. X
  66. X
  67. X
  68. X
  69. X               TABLE OF CONTENTS
  70. X
  71. X
  72. X    PREFACE ....................................................... IV
  73. X
  74. X    1.  FIRST STEPS ...............................................  V
  75. X
  76. X    2.  SHELL SCRIPTS
  77. X
  78. X    2.1.  Appending new Users to the 'Aliases'-File ...........  1
  79. X    2.2.  Sending Articles to the NEWS-System .................  2
  80. X    2.3.  Sending Mail ........................................  3
  81. X    2.4.  Handling PD (Public Domain) Stuff ...................  4
  82. X
  83. X    3.  CONFIGUREABLE FILES 
  84. X    
  85. X    3.1.  The List of Editors .................................  5
  86. X    3.2.  The offered Games ...................................  6
  87. X    3.3.  The Commands ........................................  7
  88. X    3.4.  The Helpfile (long) .................................  8
  89. X    3.5.  The Helpfile (short) ................................  9
  90. X
  91. X    4.  ACCOUNTING
  92. X
  93. X    4.1.  The Users DATABASE .................................. 10
  94. X    
  95. X    5.  DEFINITIONS IN SOURCE CODE
  96. X
  97. X    5.1.  The Headerfile ...................................... 11
  98. X    5.2.  The Makefile ........................................ 12
  99. X
  100. X    6.  SUPPORTING TOOLS
  101. X
  102. X    6.1.  The NEWS SCANNER (MB-DAEMON) ........................ 13
  103. X    6.2   The MAILING AGENT (XMD) ............................. 14
  104. X
  105. X
  106. X                APPENDIX    
  107. X    
  108. X    A.  DICTIONARY for german Error Codes ......................... 15
  109. X    B.  DIRECTORIES with Permissions and Owners ................... 16
  110. X    C.  QUICK REFERENCE put in order by Files ..................... 17
  111. X
  112. X
  113. XDecember 27, 1991        - III -                          ix/MBox
  114. X
  115. X                PREFACE
  116. X
  117. X    This BBS-Package is the first international release of the ix/MBox. The
  118. Xgerman version has been tested and modified for month. Several problems have
  119. Xoccured while using other OSs (than MINIX), but they have been fixed with
  120. Xthe help of some guys out there on the net and on my BBS. Their names and
  121. Xtheir 'heroic deeds' are documented (try using 'version #') to show who was
  122. Xinvolved in the BBS develoment.
  123. X
  124. X    Also special thanks to Fred v. Kempen and Will Rose. They made UUCP and
  125. XNEWS available on MINIX. And don't forget Burce D. Evans. Without his 386er
  126. Xpatches, programs like this BBS would never have been possible.
  127. X
  128. X    Though this package is not a Beta-Release, some difficulties will appear
  129. Xwhile your're installing and setting up the BBS. To render the exchange of
  130. XBug-Reports, FAQs, hints and fixes two services are offered:
  131. X
  132. XE-Mail:       Volker.Schuermann@unnet.w.open.de
  133. X          Volker.Schuermann@unnet.ruhr.sub.org
  134. X
  135. XMailing-List: To ADD/DELETE/SUBSCRIBE a User or Alias; send mail to 
  136. X              mbox@ivcmd.Boerde.DE (unido!fub!ivcmd!mbox) or
  137. X              mbox@Boerde.DE
  138. X
  139. X          To BROADCAST a message; send mail to 
  140. X              mbox-list@ivcmd.Boerde.DE (unido!fub!ivcmd!mbox-list) or
  141. X              mbox-list@Boerde.DE
  142. X
  143. X    Feel free to make use of both offers everytime you aren't able to get rid
  144. Xof problem, or if you're having questions, or if you found/fixed a bug, or if
  145. Xyou created a better language-file, or whatever ...  
  146. X
  147. XRegards, Volker
  148. X
  149. X
  150. X
  151. XDecember 27, 1991        - IV -                          ix/MBox
  152. X
  153. X
  154. X
  155. X
  156. X
  157. X
  158. X
  159. X
  160. X
  161. X
  162. X1.  FIRST STEPS
  163. X
  164. X    You managed to unpack the BBS-package without any help - congratulations!
  165. XIt's time now to correct your first failure :-) This file (README) has to be
  166. Xin the [/mbox] directory. This directory will be the HOME of your BBS. If you
  167. Xdon't like '/mbox' to be the base for all following work, you have to create
  168. Xa directory to you favor and unpack the BBS-package again in this new HOME.
  169. X
  170. X    After unpacking the BBS, the HOME should look like the sample in the
  171. Xdirectory [/mbox] (see APPENDIX B.). In the following, you are confronted
  172. Xwith some files that are configurable to make the BBS running on your special
  173. Xenvironment.
  174. X
  175. X
  176. X
  177. XDecember 27, 1991          - V -                          ix/MBox
  178. X
  179. X
  180. X
  181. X
  182. X
  183. X
  184. X
  185. X
  186. X
  187. X2.  SHELL SCRIPTS
  188. X
  189. X2.1.  Appending new Users to the 'Aliases'-File (SMAIL only!)
  190. X
  191. X    This script is called by ix/MBox to append a line for every new BBS-user
  192. Xto the 'aliases'-file of SMAIL.
  193. X
  194. X    The name of the new user is send as parameter ($1). If a mail arrives for
  195. Xthis user, SMAIL uses this entry to deliver the mail.
  196. X
  197. XFile /mbox/etc/alias.sh
  198. X=======================
  199. Xecho $1 "        " \"\|/usr/bin/xmd $1 -\" >> /usr/lib/smail/aliases
  200. X
  201. X# $1 includes the name of the new BBS-User (Format: "Prename.Name")
  202. X
  203. X    You mustn't change the "/usr/bin/xmd $1 -" part of this line. All other
  204. Xitem could be changed.
  205. X
  206. XNOTE: If you're using UMAIL, you can forget about using this file - it would
  207. Xbe best to comment out everything!
  208. X
  209. X
  210. X
  211. XDecember 27, 1991        - 1 -                          ix/MBox
  212. X
  213. X
  214. X
  215. X
  216. X
  217. X
  218. X
  219. X
  220. X
  221. X2.2.  Sending Articles to the NEWS-System 
  222. X
  223. X    To communicate with any kind of NEWS-System, this file makes the necessary
  224. Xcalls. As described below, INEWS gets the name of (i.e. path to) a file,
  225. Xwhere ix/MBox stores the user-written new article. 
  226. X
  227. XFile /mbox/etc/inews.sh
  228. X=======================
  229. X/usr/lib/news/inews -h < $2
  230. X
  231. X# $1 is the newsgroup which should receive the article
  232. X# $2 includes the file, where the ix/MBox saves the article
  233. X
  234. X
  235. X
  236. XDecember 27, 1991        - 2 -                          ix/MBox
  237. X
  238. X
  239. X
  240. X
  241. X
  242. X
  243. X
  244. X
  245. X
  246. X2.3.  Sending Mail
  247. X
  248. X    Since there are some very powerful/intelligent mailing systems available 
  249. Xunder UNIX/MINIX, ix/MBox doesn't offer it's own mailer (for external mails).
  250. X
  251. X    Your are able to use your most favorite mailer without making any changes
  252. Xto your configuration. (RMAIL should be a link to UMAIL, SMAIL etc.)
  253. X
  254. XFile /mbox/etc/rmail.sh
  255. X=======================
  256. Xrmail -d -i $1 $2
  257. X
  258. X# $1 name/path to the user-written mail
  259. X# $2 receiver of the mail (full address)
  260. X
  261. X
  262. X
  263. XDecember 27, 1991        - 3 -                          ix/MBox
  264. X
  265. X
  266. X
  267. X
  268. X
  269. X
  270. X2.4.  Handling PD (Public Domain) Stuff
  271. X
  272. X    The BBS doesn't know anything about where you hide your PD (Public Domain
  273. XSoftware). So if a user wants to send such a program to the BBS, the file has
  274. Xto be stored in the NEWS-PD-area (the place where articles are collected, 
  275. Xthat contain PD-files). After such an upload, you have two new files in that
  276. Xarea (let's call it [/usr/spool/news/local/pd/minix]):
  277. X
  278. X1. An article, containing the identifier BINFILE and the path to:
  279. X2. A PD.nnnnnnn file, which contains the PD-file itself
  280. X
  281. XIn our example below, there are the following files:
  282. X
  283. X1. 2157 (the article)
  284. X2. PD.693419573 (the PD-file)
  285. X
  286. X    If we would start [sh /mbox/etc/pd.script] now , the file (2.) would be
  287. Xcopied to our PD-area ([/public/pd]), and the article (1.) would be changed
  288. Xto get the new path to (2.).
  289. X   
  290. X    That sounds much more compilcate as it is. The comment '#' tells you where
  291. Xthe PD belongs to and who sent it to you.
  292. X
  293. XFile /mbox/etc/pd.script
  294. X========================
  295. Xmv /usr/spool/news/local/pd/minix/PD.693419573 /public/pd/tel.tar.Z
  296. Xmined /usr/spool/news/local/pd/minix/2157
  297. X#local.pd.minix   Andreas Zell
  298. X
  299. X
  300. X
  301. XDecember 27, 1991        - 4 -                          ix/MBox
  302. X
  303. X
  304. X
  305. X
  306. X
  307. X
  308. X
  309. X3.  CONFIGUREABLE FILES 
  310. X    
  311. X3.1.  The List of Editors
  312. X
  313. X    There is a LineEditor delivered with this BBS-Package, but on your system
  314. Xthere are lots of editors, I suppose. Therefore you may offer some of them
  315. Xto your users.
  316. X
  317. XFile /mbox/etc/mbox.editors
  318. X===========================
  319. XLed    /usr/bin/bled
  320. XMined    /usr/bin/mined
  321. XVi    /usr/bin/vi
  322. XME    /usr/bin/me
  323. X
  324. XNOTE: Between the comments-box (/* comments */) and the table itself, there 
  325. Xhas to be ONE empty line.
  326. X
  327. X
  328. XDecember 27, 1991        - 5 -                          ix/MBox
  329. X
  330. X
  331. X
  332. X
  333. X
  334. X
  335. X
  336. X
  337. X3.2.  The offered Games
  338. X
  339. X    Users are kids, anyway ... so allow them playing games (Don't deny ... 
  340. XI know, you're still playing rogue/empire, too!).
  341. X
  342. XFile /mbox/etc/mbox.games
  343. X=========================
  344. XAnimals    /usr/bin/animals
  345. XDiepbom /usr/games/diepbom
  346. XEmpire    /usr/games/empire
  347. XKiller    /usr/games/killer
  348. XSokoban    /usr/games/sokoban
  349. XRogue    /usr/bin/rogue
  350. XRobots  /usr/games/robots
  351. X
  352. XNOTE: Between the comments-box (/* comments */) and the table itself, there
  353. Xhas to be ONE empty line.
  354. X
  355. X
  356. XDecember 27, 1991        - 6 -                          ix/MBox
  357. X
  358. X
  359. X
  360. X
  361. X
  362. X
  363. X
  364. X3.3.  The Commands
  365. X
  366. X    This one is the MOST IMPORTANT file of all. It contains the whole command
  367. Xstructure of the BBS.
  368. X
  369. XThe rows containing the following informations:
  370. X
  371. XID (Commands No.)    This is the only connection between this table and
  372. X            the BBS (see [loop.c]). 
  373. X
  374. XIntern/Extern (Level)   That means the minimum level to be allowed to use
  375. X            the command.
  376. X
  377. X            The difference between intern and extern is used
  378. X            to decide whether a user can write external mails
  379. X            too, or internal mails only.              
  380. X
  381. XPrototyp(e)        If you set '1' in this row, the command is shown
  382. X            in the "command survey". Otherwise the command
  383. X            is known, but not displayed.
  384. X
  385. XBefehl (Command)    The command itself.
  386. X
  387. X    As you see in the table, some IDs are mentioned more than once. That's 
  388. Xallowed! If there is a couple of commands doing the same action, you may 
  389. Xcollect them:
  390. X
  391. X180    0    0    1    Goodbye
  392. X180    0    0    0    Quit
  393. X180    0    0    0    Bye
  394. X180    0    0    0    End
  395. X
  396. X   The prototype for the LOGOUT-Command is called 'Goodbye' - only this one
  397. Xwill be displayed, if a user types '?' (and only this one is described in the
  398. XHELP-file). But 'Quit', 'Bye' and 'End' may also be used to leave the BBS.
  399. X
  400. XFile /mbox/etc/help.befehle
  401. X===========================
  402. XID    Intern  Extern  Prototyp  Befehl
  403. X==============================================
  404. X110    0    0    1    +        # next board
  405. X120    0    0    1    -        # previous board
  406. X260    0    0    1    Account        # Registration
  407. X125    9    9    0    Admin        # Administration
  408. X150    0    0    1    Board        # Board
  409. X170    0    0    1    Chat        # Chat (See 'mbox.h')
  410. X200    0    0    1    Dir        # Contents
  411. X370    0    0    1    Date        # Date
  412. X220    1    1    1    Delete        # Delete
  413. X150    0    0    0    Cd        
  414. X400     0       0       1       Direction    # Direction (OLD <> NEW)
  415. X340    1    1    1    Forward        # Forward a MSG
  416. X390     0    0    1    Games        # Games
  417. X180    0    0    1    Goodbye        # Logout
  418. X180    0    0    0    Quit
  419. X180    0    0    0    Bye
  420. X180    0    0    0    End
  421. X190    0    0    1    Help        # Help
  422. X160    0    2    1    Mail        # Write a Mail
  423. X330     0       0       1       Macro        # Macro Definition
  424. X140    0    0    1    Message        # 'Hello' MSG
  425. X240    6    6    1    Minix        # OS-Shell
  426. X240    6    6    0    Execute        
  427. X270    0    0    1    Portinfo    # A Kind of 'who'
  428. X130    0    0    1    Protocol    # Logfile
  429. X250    0    0    1    PM        # PM 
  430. X210    0    0    1    Read        # Read
  431. X280    0    0    1    Setup        # Configurations
  432. X280    0    0    0    Password    
  433. X280    0    0    0    Ansi    
  434. X280    0    0    0    Bell    
  435. X280    0    0    0    Address        
  436. X310    1    0    1    Signature    # Signature    
  437. X290    0    0    1    State        # Configurations List
  438. X410     0       0       1       Statistics    # Statistics
  439. X380    0    0    1    Time        # Time
  440. X300    0    0    1    Users        # List of Users
  441. X320    0    0    1    Version            # Version
  442. X230    0    5    1    Write        # Write a Mail/Article
  443. X270    0    0    0    Who        
  444. X195    0    1    0    ~PD        # Up-/Download LEVEL-Dummy
  445. X215    0    0    0    Level        # Level
  446. X275    9    9    0    Relogin        # Login again ...
  447. X350     0       0       0       Sleep        # Macro Special
  448. X360     0       0       0       Keypressed    # Macro Special
  449. X230     0       5       0       Upload        
  450. X210    0    0    0    Download
  451. X998    2    2    0    ~MAIL_DUMMY    # LEVEL-Dummy
  452. X
  453. X    The LEVEL-Dummys are useful to set the required LEVEL for UP-/DOWNLOADING
  454. X(~PD) or mailing to external hosts (~MAIL_DUMMY).
  455. X
  456. X    The comments '#' are NOT allowed in the [/mbox/etc/help.befehle] file,
  457. Xthough they are used in this documentation.
  458. X
  459. XNOTE: Between the comments-box (/* comments */) and the table itself, there 
  460. Xhas to be ONE empty line.
  461. X
  462. X
  463. X
  464. XDecember 27, 1991        - 7 -                          ix/MBox
  465. X
  466. X
  467. X
  468. X
  469. X
  470. X
  471. X
  472. X
  473. X
  474. X3.4.  The Helpfile (long)
  475. X
  476. X    It's just a textfile, that contains informations on every prototyped
  477. Xcommand of [/mbox/etc/help.befehle]. 
  478. X
  479. XFile /mbox/etc/help.hilfe
  480. X=========================
  481. X#BOARD
  482. XCommand: "Board"
  483. X
  484. XThere is a board for every single subject/theme with it's own index. So you
  485. Xhadn't to search long for special information on any item. To move from one
  486. Xboard to another, you use the command 'board' with some options:
  487. X.
  488. X.
  489. X.
  490. X
  491. X
  492. XNOTE: The '#COMMAND' has to be set before any further text. This line is
  493. Xused to select which commands info follows.
  494. X
  495. X
  496. X
  497. XDecember 27, 1991        - 8 -                          ix/MBox
  498. X
  499. X
  500. X
  501. X
  502. X
  503. X
  504. X
  505. X
  506. X
  507. X3.5.  The Helpfile (short)
  508. X
  509. X    A textfile, which is displayed complete to any user who types 'help'.
  510. X
  511. XFile /mbox/etc/help.shorthelp
  512. X=============================
  513. X?                          reachable commands are shown 
  514. X? *                        all commands are shown
  515. Xcommand ?                  help on 'command'
  516. X
  517. XACCOUNT               establish an account & a maildrop for a new user
  518. X
  519. XBOARD                      list boards with new articles
  520. X
  521. X
  522. XNOTE: If you've changed [/mbox/etc/help.befehle], you have to change this
  523. Xfile, too!
  524. X
  525. X
  526. X
  527. XDecember 27, 1991        - 9 -                          ix/MBox
  528. X
  529. X
  530. X
  531. X
  532. X
  533. X
  534. X
  535. X
  536. X
  537. X4.  ACCOUNTING
  538. X
  539. X4.1.  The Users DATABASE 
  540. X
  541. X    NEVER try to edit this file. It's created automagically by the BBS and
  542. Xmaintained with the command 'admin'.
  543. X
  544. X    And how to install this database? That's simple. Just erase the files
  545. X[/mbox/etc/users.data] and [/mbox/etc/users.seq]. After doing that, you
  546. Xmay start the BBS, which will install a new database for you.
  547. X
  548. X    The first two entries in this database are generated from data in
  549. X[/mbox/src/mbox.h] ... if you (as "root") are not allowed to use the
  550. X'admin' command, you have to change the 'extern' and 'intern' entry of
  551. X"admin" in [/mbox/etc/help.befehle] to level 0.
  552. X
  553. XNOTE: Don't forget to set the 'admin' level back to 9 again, after you've
  554. Xset your own level to 10 (try 'admin' to see how)!
  555. X
  556. X
  557. XDecember 27, 1991        - 10 -                          ix/MBox
  558. X
  559. X
  560. X
  561. X
  562. X
  563. X
  564. X
  565. X
  566. X
  567. X5.  DEFINITIONS IN SOURCE CODE
  568. X
  569. X5.1.  The Headerfile
  570. X
  571. X    The following file HAS TO BE CHANGED before trying to compile the BBS. It
  572. Xcontains all stuff, that depends on you special environment.
  573. X
  574. X
  575. XFile /mbox/src/mbox.h
  576. X=====================
  577. X
  578. X-    Even your BBS needs a name:
  579. X
  580. X#define ORGANIZATION "THE UNDERGROUND NETWORK"
  581. X#define SYSTEM       "The Time Traveling Agency"
  582. X
  583. X
  584. X-    UUCP/Internet Identifications:
  585. X
  586. X#define UUCPSITE     "unnet"
  587. X#define UUCPID       "unnet.w.open.de"     
  588. X#define UUCPBANG     "~!unido!horga!xenox!unnet!"
  589. X
  590. X
  591. X-    If your UUCP supports any kind of protocol/logfile:
  592. X
  593. X#define UUCPCOSTS    "/usr/spool/uucp/.costs"
  594. X
  595. X
  596. X-    Where does the BBS live (i.e. HOME):
  597. X
  598. X#define HOME         "/mbox"
  599. X
  600. X
  601. X-    Some directories:
  602. X
  603. X#define BIN          "/usr/bin"
  604. X#define TMP         "/tmp"
  605. X#define SPOOL        "/usr/spool"
  606. X#define NEWS         "/usr/spool/news"
  607. X#define MAILDROP     "/usr/spool/mail"
  608. X
  609. X
  610. X-    If you don't use SMAIL:
  611. X
  612. X#define ERRMBOX      "/usr/spool/mail/postmaster"
  613. X
  614. X
  615. X-    NEWS 'active' file:
  616. X
  617. X#define NGROUPS      "/usr/lib/news/active"
  618. X
  619. X
  620. X-    Define the device/file where to display log-informations:
  621. X    (if defined as 'REDIRECT', the device/file is used, that
  622. X    you've specified in the file CDIRECTFL !)
  623. X
  624. X#define CONSOLE         "REDIRECT"
  625. X#define CDIRECTFL    "/etc/mbox.out"
  626. X#define CPRN         '/tmp/errlog'
  627. X
  628. X
  629. X-    Who's the BOSS (don't use "root"):
  630. X
  631. X#define POSTMASTER   "volkers"
  632. X
  633. X
  634. X-    On which terminal POSTMASTER can use MBOX only:
  635. X
  636. X#define PMS_TTY      "/dev/tty4"
  637. X
  638. X
  639. X-    The fastest BPS-Rate of your Modem-Ports:
  640. X
  641. X#define MAX_BPS      2400
  642. X
  643. X
  644. X-    What's the Name of your Visitors:
  645. X
  646. X#define GUEST        "GAST"
  647. X
  648. X
  649. X-    This file is displayed after the BBS started:
  650. X
  651. X#define INTRO        "./etc/intro"
  652. X
  653. X
  654. X-    If this file exists, it's shown as BBS-'Jingle':
  655. X
  656. X#define LOGO         "./etc/logo"
  657. X
  658. X
  659. X-    The number of 'all time calls' to your BBS:
  660. X
  661. X#define SEQ          "./etc/mbox.seq"
  662. X
  663. X
  664. X-    The callers logfile:
  665. X
  666. X#define CALLS        "./etc/mbox.calls"
  667. X
  668. X
  669. X-    Your List of Editors:
  670. X
  671. X#define EDITORS      "./etc/mbox.editors"
  672. X
  673. X
  674. X-    The Games:
  675. X
  676. X#define GAMES        "'./etc/mbox.games"
  677. X
  678. X
  679. X-    If you like to offer a CHAT/WRITE/TALK:
  680. X
  681. X#define CHAT         "/usr/bin/chat"
  682. X
  683. X
  684. X-    A special BBS-OS-Shell:
  685. X
  686. X#define RSH          "./mbrsh"
  687. X
  688. X
  689. X-    Have a look at '/etc/passwd' to find the correct values:
  690. X
  691. X#define ROOT_UID      0
  692. X#define ROOT_GID      0
  693. X#define GUEST_GID     1  !!! Users and Guests have to have DIFFERENT GIDs !!!
  694. X#define UUCPUID      40
  695. X#define UUCPGID      40
  696. X#define NEWSUID      30
  697. X#define NEWSGID      6
  698. X
  699. X    It's very, very, very important to change '/etc/passwd' if 'guest'
  700. X    and 'users' had the same GID until now. The BBS uses the GID to
  701. X    fix if a User is 'guest' or a real 'user' ...    
  702. X
  703. X
  704. X
  705. X-    For MINIX only (the number of the first Modem-Port):
  706. X
  707. X#define FIRST_EX_TTY 64
  708. X
  709. X
  710. X-    Where does your local mail hides the signatures:
  711. X
  712. X#define SIGNATURE    ".wmailsign"
  713. X
  714. X
  715. X-    Where is your TSET:    
  716. X
  717. X#define TSET         "./etc/tset"
  718. X
  719. X
  720. X-    What's the prefix of your PD-boards ([local.pd.minix] etc.):
  721. X
  722. X#define PDNG         "local.pd"
  723. X
  724. X
  725. X-    Where do you want protocol the downloads:
  726. X
  727. X#define PDLOG         "./etc/pd.log"
  728. X
  729. X
  730. X-    Where do you like to have the upload script:
  731. X
  732. X#define PDSCRIPT     "./etc/pd.script"
  733. X
  734. X
  735. X-    Which groups should new users be allowed to read:
  736. X
  737. X#define NEWS_MINIMUM "junk dnet local sub xenox"
  738. X
  739. X
  740. X-    How many entries are allowed per broard/group:
  741. X
  742. X#define MAX_PER_NG   700
  743. X
  744. X    If use use a VERY high value, EXPIRE will never be started by
  745. X    MB-DAEMON ! (CNEWS don't like any handstarted EXPIREs)
  746. X
  747. X
  748. X-    How many days should be expired, if MAX_PRE_NG is reached:
  749. X
  750. X#define EXPIRED_DAYS 32
  751. X
  752. X
  753. X-    Which domains may be reached by 'normal' users if they send 
  754. X    external mails:
  755. X
  756. X#define NAT_DOMAIN1  ".de"
  757. X#define NAT_DOMAIN2  ".sub.org"
  758. X#define NAT_DOMAIN3  ".de" 
  759. X
  760. X
  761. X-    Where are the Up-/Download Protocols:
  762. X
  763. X#define SZ           "/usr/bin/sz"
  764. X#define SX           "/usr/bin/sx"
  765. X#define SB          "/usr/bin/sb"
  766. X
  767. X#define RZ           "/usr/bin/rz"
  768. X#define RX         "/usr/bin/rx"
  769. X#define RB         "/usr/bin/rb"
  770. X
  771. X
  772. X-    What's the actual telephone rate (in Pfennig :-):
  773. X
  774. X#define TARIF        23
  775. X
  776. X
  777. X-    How many seconds can you talk (three zones, each day/night):
  778. X
  779. X#define NZNT         360
  780. X#define NZBT         720
  781. X#define RZNT          60
  782. X#define RZBT         120
  783. X#define WZNT         21
  784. X#define WZBT         42
  785. X
  786. X
  787. X-    How many entries will be hold in callers protocol:
  788. X
  789. X#define PRO_ENTRIES  600
  790. X
  791. X
  792. X   Yep, I know, there are some items missing. Don't play around with one of
  793. Xthem! To get the definitions in [mbox.h] right is the most important and most
  794. Xcompilcate work on your way to get the BBS up and running. So spend a little
  795. Xtime on this job - it will be a big advantage to have no errors or misunder-
  796. Xstandings in this file.
  797. X
  798. X
  799. X
  800. XDecember 27, 1991        - 11 -                          ix/MBox
  801. X
  802. X
  803. X
  804. X
  805. X
  806. X
  807. X
  808. X
  809. X
  810. X5.2.  The Makefile
  811. X
  812. X    Type 'make' (keep finger crossed and pray) and see what you'll get ... 
  813. XNo, that's not the right way to get this packaged compiled!
  814. X
  815. X    The Makefile is fitted out with some special definitions for different
  816. XUNIX-Versions and favors. Use the CFLAGS to modify the Makefile for your
  817. Xenvironment.
  818. X
  819. XFile /mbox/src/Makefile
  820. X=======================
  821. X#CFLAGS: 
  822. X# -D_SYS7         UNIX System 7 (UNIX, COHERENT, ...)
  823. X# -D_MBOX         EVER!!! 
  824. X# -D_MINIX        For MINIX only
  825. X# -D_ISC          For Interactive UNIX
  826. X# -D_SCO          For SCO UNIX
  827. X# -D_ESTDIO       For Earl Chew's [estdio.h] (or GCC)
  828. X# -D_CORELEFT     Check your memory
  829. X# -D_DATESTAMP    Protocol time&date, too
  830. X# -D_NOINDEX      Don't store INDEX-Files for every group/board
  831. X# -D_BAUDRATE     If your modem is an HST with 'fixed baudrate'
  832. X
  833. X    If you are using SYSV, comment out everything that belongs to Sys7 and
  834. Xvice versa, if you're using Sys7. 
  835. X
  836. XThat's what you can 'make':
  837. X
  838. Xmake all       <-   Build all executables
  839. Xmake world     <-   Create the directories and set the permissions
  840. Xmake inst      <-   Build and install ALL !!
  841. Xmake clean     <-   Delete the executables (links etc.)
  842. Xmake mbox      <-   Build the BBS-executable 'mbox'
  843. Xmake mb-daemon <-   Build the NEWS-SCANNER 'mb-daemon'
  844. Xmake xmd       <-   Build the MAILING-AGENT 'xmd'
  845. Xmake mbrsh     <-   Build the SHELL 'mbrsh'
  846. Xmake bled      <-   Build the LINE-EDITOR 'bled'
  847. X
  848. X    If everything's ok, you only have to type 'make inst' to build and install
  849. Xthe whole BBS and it's "world". 
  850. X
  851. X    The MINIX-Version of ix/MBox needs much more memory as given by compiler.
  852. XWith the command 'chmem +200000', the necessary amount is set up. Yes, that's
  853. Xwasting memory in some cases. To minimize the amount, use the FLAG _CORELEFT 
  854. Xin format '-D_CORELEFT=20000'. Now you can test around with 'chmem +/-' until
  855. Xyou reach a value, which allows to run the BBS without producing "cores".
  856. X
  857. X
  858. X
  859. XDecember 27, 1991        - 12 -                          ix/MBox
  860. X
  861. X
  862. X
  863. X
  864. X
  865. X
  866. X
  867. X
  868. X6.  SUPPORTING TOOLS
  869. X
  870. X6.1.  The NEWS SCANNER (MB-DAEMON)
  871. X
  872. X    For every board/newsgroup in your BBS, you need an INDEX-File. As the
  873. Xcontents of such an INDEX-File depends on which articles are collected in
  874. Xthe corresponding newsgroup, a program is needed, that scans those articles
  875. Xand derives the informations for the INDEX.
  876. X
  877. X    That's exactly what 'mb-daemon' does. It would be best, to append a
  878. Xline to [/usr/lib/crontab] for calling 'mb-daemon' after each 'rnews' run.
  879. X
  880. XSYNOPSIS: 
  881. X
  882. Xmb-daemon          rebuild all INDEX-Files (Fastmode)
  883. Xmb-daemon all -x     rebuild all INDEX-Files (totally rebuilding)
  884. Xmb-daemon newsgroup     rebuild INDEX-File(s) for 'newsgroup'
  885. Xmb-daemon newsgroup -x   rebuild INDEX-File(s) for 'newsgroup' (total)
  886. X    
  887. XEXAMPLES:
  888. X        
  889. Xmb-daemon local.pd.minix 
  890. Xmb-daemon local.pd       (means: all newgroups at 'local.pd')
  891. X
  892. X
  893. X
  894. XDecember 27, 1991        - 13 -                          ix/MBox
  895. X
  896. X
  897. X
  898. X
  899. X
  900. X
  901. X
  902. X
  903. X
  904. X6.2   The MAILING AGENT (XMD)
  905. X
  906. X    The Usernames on this BBS are Realnames. If your name is "Jack Daniels",
  907. Xyour UUCP/Internet-ID is "Jack.Daniels@host.domain". Since normal mailing
  908. Xagents can't handle such IDs, the BBS needs it's own agent.
  909. X
  910. X    This one is called 'xmd'. It works in two different modes. The first one
  911. Xscans the ERRMBOX [/usr/spool/mail/postmaster] and delivers all mails with
  912. Xreceiver "Prename.Name" ("Jack.Daniels") to the BBS-maildrops. Spend a line
  913. Xin [/usr/lib/crontab] for the execution of 'xmd' every hour.
  914. X
  915. X    The second mode is used if SMAIL is the systems mailer. Have a look at 
  916. Xthe description of 'alias.sh' (see 2.1.).
  917. X
  918. XSYNOPSIS:
  919. X
  920. Xxmd            Scanns ERRMBOX and delivers mail to BBS-Users
  921. Xxmd Prename.Name -      Delivers mail from STDIN (-) to Prename.Name on BBS
  922. X
  923. X
  924. XEXAMPLE:
  925. X
  926. Xxmd Jack.Daniels -
  927. X
  928. X
  929. X
  930. XDecember 27, 1991        - 14 -                          ix/MBox
  931. X
  932. X
  933. X
  934. X
  935. X
  936. X
  937. X
  938. X                APPENDIX    
  939. X
  940. X    
  941. XA.  DICTIONARY for german Error Codes
  942. X
  943. X    The ix/MBox (BBS) was created in Germany. That's why all lowlevel comments
  944. Xand error-codes are written in german. 
  945. X
  946. X    If any of those error-codes appears on your screen, you're really in
  947. Xtrouble, because they MUSTN'T !!! (But they will :-)
  948. X
  949. XGerman Error-Code                      Meaning
  950. X-----------------------------------------------------------------------------
  951. XDatei-Lesefehler                       BBS can't read the specified file 
  952. XDatei-Schreibfehler               BBS can't write the specified file
  953. XPositionierungsfehler               Error in [users.data] (FATAL!)
  954. XDatei-Erstellungsfehler               BBS can't create specified file    
  955. XDatei-Ergaenzungsfehler               BBS can't append to specified file
  956. XDatei gesperrt                   File locked
  957. XPRO_ENTRIES zu klein dimensioniert     Definition PRO_ENTRIES (mbox.h) to low
  958. XDatei-Schreib/-Lesefehler           BBS can't write/read file          
  959. XZuviele Artikel                   Too much articles in board/group
  960. XSpeicherplatz kleiner nnnn           Free Bytes lower than nnnn
  961. XMAX_BEF ueberschritten !!           Too much commands in [help.befehle]    
  962. XMAX_MAK ueberschritten !!           Too much macros defined
  963. X
  964. X    If one of the "Datei-XXXX" errors occures, 'touch' the specified file and
  965. Xcheck the permissions/owners (see APPENDIX B.) - in most cases, that will 
  966. Xhelp.
  967. X
  968. X
  969. X
  970. XDecember 27, 1991        - 15 -                          ix/MBox
  971. X
  972. X
  973. X
  974. X
  975. X
  976. X
  977. X
  978. X
  979. X
  980. XB.  DIRECTORIES with Permissions and Owners
  981. X
  982. XDirectory /mbox
  983. X===============
  984. Xdrwxrwx---  6 root     root          896 Dec 27 11:07 .
  985. Xdrwxr-xr-x 14 bin      bin           576 Dec 27 11:00 ..
  986. X-rw-rw-rw   1 root     root         1000 Dec 27 11:30 README
  987. Xdrwxrwx---  2 root     root          576 Dec 27 10:42 etc
  988. Xdrwxrwx---  2 root     root         1728 Dec 27 02:05 lib
  989. X-rwxr-xr-x  1 root     root         3912 Dec 21 22:48 mbrsh
  990. X-rw-r--r--  1 root     root         1562 Aug 10 13:40 rz.cdiff
  991. Xdrwxrwx---  2 root     root         1536 Dec 27 11:05 src
  992. Xdrwxrwx--- 19 root     root         1920 Dec 26 14:11 usr
  993. X
  994. X
  995. XDirectory /mbox/etc
  996. X===================
  997. Xdrwxrwx---  2 root     root          321 Dec 27 11:07 .
  998. Xdrwxrwx---  6 root     root          896 Dec 27 11:07 ..
  999. X-rw-rw-rw-  1 root     root         3002 Dec 27 02:05 active
  1000. X-rw-rw-r--  1 root     root          829 Dec  8 16:41 alias.sh
  1001. X-rw-r-----  1 root     root         2693 Dec 25 12:48 help.befehle
  1002. X-rw-r--r--  1 root     root        16492 Dec 26 14:45 help.hilfe
  1003. X-rw-r--r--  1 root     root         3801 Dec 24 09:57 help.shorthelp
  1004. X-rw-r--r--  1 root     root          701 Dec  8 13:55 inews.sh
  1005. X-rw-rw----  1 root     root          245 Dec 25 13:17 intro
  1006. X-rw-r--r--  1 root     root          243 Dec  7 21:05 logo
  1007. X-rw-rw-rw-  1 root     root        16426 Dec 27 02:05 mbd.log
  1008. X-rw-rw----  1 root     root        24080 Dec 27 10:40 mbox.calls
  1009. X-rw-rw----  1 root     root          627 Dec  7 21:05 mbox.editors
  1010. X-rw-r--r--  1 root     root          734 Dec  7 21:05 mbox.games
  1011. X-rw-rw----  1 root     root            5 Dec 27 10:40 mbox.seq
  1012. X-rw-rw----  1 root     root           79 Dec 27 10:42 mbox.who
  1013. X-rw-rw----  1 root     root        44474 Dec 27 00:55 pd.log
  1014. X-rw-rw----  1 root     root          143 Dec 22 16:33 pd.script
  1015. X-rw-rw-rw-  1 root     root        14634 Dec 16 21:30 reflector.log
  1016. X-rw-r--r--  1 root     root          727 Dec  8 13:53 rmail.sh
  1017. X-rwxrwx---  1 root     root           21 Dec  7 21:06 tset
  1018. X-rw-r--r--  1 root     root        73416 Dec 27 10:42 users.data
  1019. X-rw-r--r--  1 root     root            4 Dec 26 14:11 users.seq
  1020. X
  1021. X
  1022. X
  1023. XDirectory /mbox/lib
  1024. X===================
  1025. Xdrwxrwx---  2 root     root         1728 Dec 27 02:05 .
  1026. Xdrwxrwx---  6 root     root          896 Dec 27 11:07 ..
  1027. X-rw-rw-rw-  1 root     root         4080 Dec 27 02:01 com0ws.x.motif
  1028. X-rw-rw-rw-  1 root     root        28880 Dec 27 02:00 comp.os.minix
  1029. X-rw-rw-rw-  1 root     root          240 Dec 27 02:01 control
  1030. X-rw-rw-rw-  1 root     root         4240 Dec 27 02:01 junk
  1031. X-rw-rw-rw-  1 root     root          320 Dec 27 02:01 local.lists
  1032. X-rw-rw-rw-  1 root     root        26240 Dec 27 02:02 sub.config
  1033. X-rw-rw-rw-  1 root     root        13760 Dec 27 02:02 sub.general
  1034. X-rw-rw-rw-  1 root     root         3040 Dec 27 02:03 sub.os.minix
  1035. X
  1036. X
  1037. XDirectory /mbox/usr
  1038. X===================
  1039. Xdrwxrwx--- 19 root     root         1920 Dec 26 14:11 .
  1040. Xdrwxrwx---  6 root     root          896 Dec 27 11:07 ..
  1041. Xdrwxrwx---  2 root     root          240 Aug 28 19:27 1
  1042. Xdrwxrwx---  2 root     root          128 Aug  2 19:42 2
  1043. Xdrwxrwx---  2 root     root          192 Dec 11 22:30 3
  1044. Xdrwxrwx---  2 root     root          112 Aug  2 19:42 4
  1045. Xdrwxrwx---  2 root     root          112 Aug  2 19:42 5
  1046. Xdrwxrwx---  2 root     root          112 Aug  2 19:40 6
  1047. Xdrwxrwx---  2 root     root          112 Aug  2 19:42 7
  1048. X
  1049. X
  1050. XDirectory /mbox/usr/1
  1051. X=====================
  1052. Xdrwxrwx---  2 root     root         5680 Dec 27 11:01 .
  1053. Xdrwxrwx--- 19 root     root         1920 Dec 26 14:11 ..
  1054. X-rw-rw----  1 root     root          199 Dec 27 10:09 .active
  1055. X-rw-rw----  1 root     root          104 Jun 16  1991 .hello
  1056. X-rw-rw----  1 root     root           12 Dec 26 21:14 .lastsubject
  1057. X-rw-rw----  1 root     root          971 Dec 22 16:48 .makro
  1058. X-rw-rw----  1 root     root          313 Sep 11 19:31 .signature
  1059. X-rw-rw----  1 root     root          606 Sep 13 07:36 1116
  1060. X-rw-rw----  1 root     root          945 Sep 13 10:48 1117
  1061. X-rw-rw----  1 root     root         1168 Sep 13 12:49 1118
  1062. X-rw-rw----  1 root     root         2775 Dec 27 11:01 INDEX
  1063. X-rw-rw----  1 root     root            5 Dec 27 11:01 seq
  1064. X
  1065. X
  1066. XDirectory /usr/bin
  1067. X==================
  1068. X-rwsr-sr-x  1 root     root        40684 Dec 26 10:50 /usr/bin/mb-daemon
  1069. X-rwsr-sr-x  1 root     root       136604 Dec 26 11:23 /usr/bin/mbox
  1070. X-rwxr-xr-x  1 root     root        29408 Dec 15 13:06 /usr/bin/xmd
  1071. X-rwxr-xr-x  1 root     root        33228 Dec 26 18:02 /usr/bin/bled
  1072. X
  1073. X
  1074. X
  1075. XDecember 27, 1991        - 16 -                          ix/MBox
  1076. X
  1077. X
  1078. X
  1079. X
  1080. X
  1081. X
  1082. X
  1083. X
  1084. X
  1085. XC.  QUICK REFERENCE put in order by Files
  1086. X
  1087. X2.1.  /mbox/etc/alias.sh
  1088. X2.2.  /mbox/etc/inews.sh
  1089. X2.3.  /mbox/etc/rmail.sh
  1090. X2.4.  /mbox/etc/pd.script
  1091. X
  1092. X3.1.  /mbox/etc/mbox.editors
  1093. X3.2.  /mbox/etc/mbox.games
  1094. X3.3.  /mbox/etc/help.befehle
  1095. X3.4.  /mbox/etc/help.hilfe
  1096. X3.5.  /mbox/etc/help.shorthelp
  1097. X
  1098. X4.1.  /mbox/etc/users.data & /mbox/etc/users.seq
  1099. X    
  1100. X5.1.  /mbox/src/mbox.h
  1101. X5.2.  /mbox/src/Makefile
  1102. X
  1103. X
  1104. X
  1105. XDecember 27, 1991        - 17 -                          ix/MBox
  1106. END_OF_FILE
  1107.   if test 27945 -ne `wc -c <'README'`; then
  1108.     echo shar: \"'README'\" unpacked with wrong size!
  1109.   fi
  1110.   # end of 'README'
  1111. fi
  1112. if test ! -d 'etc' ; then
  1113.     echo shar: Creating directory \"'etc'\"
  1114.     mkdir 'etc'
  1115. fi
  1116. if test ! -d 'src' ; then
  1117.     echo shar: Creating directory \"'src'\"
  1118.     mkdir 'src'
  1119. fi
  1120. if test -f 'src/mb-daemon.c' -a "${1}" != "-c" ; then 
  1121.   echo shar: Will not clobber existing file \"'src/mb-daemon.c'\"
  1122. else
  1123.   echo shar: Extracting \"'src/mb-daemon.c'\" \(21389 characters\)
  1124.   sed "s/^X//" >'src/mb-daemon.c' <<'END_OF_FILE'
  1125. X/***************************************************************************/
  1126. X/*        PROGRAMM  ix/Mbox                           */
  1127. X/*             DATEI  mb-daemon.c                       */
  1128. X/*        FUNKTIONEN  reflector(), scan(), mix(), main()           */
  1129. X/*             AUTOR  vs (Volker Schuermann/MINIX-Version)           */
  1130. X/*  LETZTE AENDERUNG  31.01.1992                       */
  1131. X/***************************************************************************/
  1132. X
  1133. X#ifndef _ESTDIO
  1134. X#include <stdio.h>
  1135. X#else
  1136. X#include <estdio.h>
  1137. X#endif
  1138. X#include <sys/types.h>
  1139. X#include <sys/stat.h>
  1140. X#include <time.h>
  1141. X
  1142. X#include "mbox.h"
  1143. X
  1144. X
  1145. X#define ADDRMODE
  1146. X
  1147. X
  1148. Xint FASTMODE;
  1149. X
  1150. X
  1151. Xint mb_gruppen;
  1152. Xint mb_new;
  1153. Xlong mb_bytes;
  1154. Xlong mb_new_bytes;
  1155. Xlong mb_artikel;
  1156. X
  1157. X#ifdef ADDRMODE
  1158. XFILE *ad;
  1159. X#endif
  1160. X
  1161. X/***************************************************************************/
  1162. X/*      FUNKTION  reflector()                           */
  1163. X/*  BESCHREIBUNG  Sendet eine persoenliche Mail an den Autor eines Arti-   */
  1164. X/*          kels in einer bestimmten NG.                               */
  1165. X/*                                                               */
  1166. X/*          VORSICHT: Wilde Reflectoren werden vom Netz getrennt !!! */
  1167. X/*     PARAMETER  arg  =  DUMMY (?)                                        */
  1168. X/*          msg  =  Artikel                                          */
  1169. X/*     RUECKGABE  -1   =  Artikel nicht gefunden                           */
  1170. X/*                0    =  Ok                            */
  1171. X/***************************************************************************/
  1172. X
  1173. Xint FLAG;
  1174. X
  1175. Xint reflector(arg, msg)
  1176. Xchar arg[];
  1177. Xchar msg[];
  1178. X{
  1179. X  FILE *fp;
  1180. X  FILE *ff;
  1181. X
  1182. X  char s[255];
  1183. X  char tmp[STRING];
  1184. X
  1185. X  char receiver[STRING];
  1186. X
  1187. X  char path[255];
  1188. X  char reply_to[255];
  1189. X  char from[255];
  1190. X  char sender[255];
  1191. X  char subject[255];
  1192. X  char summary[255];
  1193. X  char keywords[255];
  1194. X  char newsgroups[255];
  1195. X  char followup_to[255];
  1196. X  char distribution[255];
  1197. X  char date[255];
  1198. X  char lines[255];
  1199. X  char message_id[255];
  1200. X  char organization[255];
  1201. X  char posted[255];
  1202. X  char article_id[255];
  1203. X  char nntp_post[255];
  1204. X  char references[255];
  1205. X
  1206. X  int id_err = 0;
  1207. X  int i;
  1208. X  int inlines, ok;
  1209. X
  1210. X  int reply = 0;
  1211. X  int noreply = 0;
  1212. X  int dirlist = 0;
  1213. X  int logfile = 0;
  1214. X  int info = 0;
  1215. X  int minimal = 0;
  1216. X  long timer;
  1217. X
  1218. X
  1219. X  fp = fopen(msg, "r");
  1220. X  if (fp == NULL) return -1;
  1221. X
  1222. X  sprintf(tmp, "%s/%d", TMP, getpid());
  1223. X  ff = fopen(tmp, "w");
  1224. X  
  1225. X  i = 1;
  1226. X  inlines = -1;
  1227. X
  1228. X  while (fgets(s, 255, fp) != NULL) {
  1229. X    ok = 0;
  1230. X    if (strcomp("Path:", s) == 0) {
  1231. X        sprintf(path, "%02d>> %s <<\n", i, (char *) stripped(s));
  1232. X        ok++;
  1233. X    }
  1234. X    if (strcomp("Reply-To:", s) == 0) {
  1235. X        sprintf(reply_to, "%02d>> %s <<\n", i, (char *) stripped(s));
  1236. X        reply--;
  1237. X        ok++;
  1238. X    }
  1239. X    if (strcomp("From:", s) == 0) {
  1240. X        sprintf(from, "%02d>> %s <<\n", i, (char *) stripped(s));
  1241. X        ok++;
  1242. X    }
  1243. X    if (strcomp("Sender:", s) == 0) {
  1244. X        sprintf(sender, "%02d>> %s <<\n", i, (char *) stripped(s));
  1245. X        ok++;
  1246. X    }
  1247. X    if (strcomp("Subject:", s) == 0) {
  1248. X        sprintf(subject, "%02d>> %s <<\n", i, (char *) stripped(s));
  1249. X        ok++;
  1250. X    }
  1251. X    if (strcomp("Summary:", s) == 0) {
  1252. X        sprintf(summary, "%02d>> %s <<\n", i, (char *) stripped(s));
  1253. X        ok++;
  1254. X    }
  1255. X    if (strcomp("Keywords:", s) == 0) {
  1256. X        sprintf(keywords, "%02d>> %s <<\n", i, (char *) stripped(s));
  1257. X        ok++;
  1258. X    }
  1259. X    if (strcomp("Newsgroups:", s) == 0) {
  1260. X        sprintf(newsgroups, "%02d>> %s <<\n", i, (char *) stripped(s));
  1261. X        ok++;
  1262. X    }
  1263. X    if (strcomp("Followup-To:", s) == 0) {
  1264. X        sprintf(followup_to, "%02d>> %s <<\n", i, (char *) stripped(s));
  1265. X        ok++;
  1266. X    }
  1267. X    if (strcomp("Distribution:", s) == 0) {
  1268. X        sprintf(distribution, "%02d>> %s <<\n", i, (char *) stripped(s));
  1269. X        ok++;
  1270. X    }
  1271. X    if (strcomp("Date:", s) == 0) {
  1272. X        sprintf(date, "%02d>> %s <<\n", i, (char *) stripped(s));
  1273. X        ok++;
  1274. X    }
  1275. X    if (strcomp("Lines:", s) == 0) {
  1276. X        sprintf(lines, "%02d>> %s <<\n", i, (char *) stripped(s));
  1277. X        ok++;
  1278. X    }
  1279. X    if (strcomp("Message-I", s) == 0) {
  1280. X        sprintf(message_id, "%02d>> %s <<\n", i, (char *) stripped(s));
  1281. X        /*
  1282. X        if (s[9] == 'D') id_err++;
  1283. X        */
  1284. X        ok++;
  1285. X    }
  1286. X    if (strcomp("Organization:", s) == 0) {
  1287. X        sprintf(organization, "%02d>> %s <<\n", i, (char *) stripped(s));
  1288. X        ok++;
  1289. X    }
  1290. X    if (strcomp("Posted:", s) == 0) {
  1291. X        sprintf(posted, "%02d>> %s <<\n", i, (char *) stripped(s));
  1292. X        ok++;
  1293. X    }
  1294. X    if (strcomp("Article-I.D.:", s) == 0) {
  1295. X        sprintf(article_id, "%02d>> %s <<\n", i, (char *) stripped(s));
  1296. X        ok++;
  1297. X    }
  1298. X    if (strcomp("Nntp-Posting-Host:", s) == 0) {
  1299. X        sprintf(nntp_post, "%02d>> %s <<\n", i, (char *) stripped(s));
  1300. X        ok++;
  1301. X    }
  1302. X    if (strcomp("References:", s) == 0) {
  1303. X        sprintf(references, "%02d>> %s <<\n", i, (char *) stripped(s));
  1304. X        ok++;
  1305. X    }
  1306. X
  1307. X
  1308. X
  1309. X    if (strcomp("NO REPLY", s)        == 0 ||
  1310. X        strcomp("NOT REPLY", s)       == 0 ||
  1311. X        strcomp("KEIN REPLY", s)      == 0 ||
  1312. X        strcomp("NO REPLIES", s)      == 0 ||
  1313. X        strcomp("KEINE REPLIES", s)   == 0 ||
  1314. X        strcomp("NO REPLYS", s)       == 0 ||
  1315. X        strcomp("KEINE REPLYS", s)    == 0 ||
  1316. X        strcomp("KEINE ANTWORTEN", s) == 0 ||
  1317. X        strcomp("NICHT ANTWORTEN", s) == 0 ||
  1318. X        strcomp("NO REFLECT", s)      == 0 ||
  1319. X        strcomp("NOT REFLECT", s)     == 0 ||
  1320. X        strcomp("NO ANSWER", s)       == 0 ||
  1321. X        strcomp("NOT ANSWER", s)      == 0 ||
  1322. X        strcomp("IGNORE", s)          == 0)
  1323. X        noreply++;
  1324. X
  1325. X    if (strcomp("PLEASE REPLY", s)    == 0 ||
  1326. X        strcomp("BITTE REPLY", s)     == 0 ||
  1327. X        strcomp("PLEASE REFLECT", s)  == 0 ||
  1328. X        strcomp("BITTE REFLECT", s)   == 0 ||
  1329. X        strcomp("BITTE ANTWORT", s)   == 0 ||
  1330. X        strcomp("REPLY", s)           == 0 ||
  1331. X        strcomp("REFLECT", s)         == 0 ||
  1332. X        strcomp("ANTWORT", s)         == 0)
  1333. X        reply++;
  1334. X
  1335. X    if (strcomp("DIRLIST", s) == 0) dirlist++;
  1336. X
  1337. X    if (strcomp("LOGFILE", s) == 0) logfile++;
  1338. X
  1339. X    if (strcomp("INFO", s) == 0 ||
  1340. X        strcomp("HELP", s) == 0)
  1341. X        info++;
  1342. X
  1343. X    if (strcomp("SHORT", s) == 0) minimal++;
  1344. X
  1345. X    if (ok == 0) {
  1346. X        /* Sprintf(s, "%02d Body >> %s <<\n\n", i, (char *) stripped(s)); */
  1347. X        inlines++;
  1348. X    }
  1349. X    i++;
  1350. X  }
  1351. X  fclose(fp);
  1352. X
  1353. X  strcpy(s, (char *) strcopy(organization, 19, 80));
  1354. X  if ((FLAG == 1) && (strcomp(ORGANIZATION, s) != 0)) return -1;
  1355. X
  1356. X  if (reply_to[0] != '\0') {
  1357. X    strcpy(receiver, (char *) strcopy(reply_to, 15, 80));
  1358. X  } else {
  1359. X    strcpy(receiver, (char *) strcopy(from, 11, 80));
  1360. X  }
  1361. X
  1362. X  i = 0;
  1363. X  while ((receiver[i] != '\0') && (receiver[i] != '(')) i++;
  1364. X  receiver[(i - 1)] = '\0';
  1365. X
  1366. X
  1367. X
  1368. X  time(&timer);
  1369. X
  1370. X  fprintf(ff, "From: reflector@%s (Reflecting Device)\n", UUCPID2); 
  1371. X  fprintf(ff, "Organization: %s\n", ORGANIZATION);
  1372. X  if(message_id[0] != '\0'){
  1373. X    fprintf(fp, "References: %s", message_id);
  1374. X  }
  1375. X  fprintf(ff, "To: %s\n", receiver);
  1376. X  fprintf(ff, "Subject: *Reflexion*\n");
  1377. X  fprintf(ff, "X-Mailer: %s %s %s\n", VERSION, PATCHLEVEL, AUTOR);    
  1378. X  fprintf(ff, "Message-Id: <%x.reflector@%s>\n", timer, UUCPID2);
  1379. X  fputs("\n", ff);
  1380. X
  1381. X
  1382. X
  1383. X  fp = fopen(REFLECT_LOG, "a");
  1384. X  if (fp == NULL) {
  1385. X    while (1) printf("%c", 7);
  1386. X  }
  1387. X  fprintf(fp, "%s - %s", (char *) mydate(1), from);
  1388. X  fprintf(fp, "         - %s", message_id);
  1389. X  fprintf(fp, "         - %s", subject);
  1390. X  if (dirlist != 0) {
  1391. X    fprintf(fp, "         - DIRLIST-Request\n");
  1392. X  }
  1393. X  if (logfile != 0) {
  1394. X    fprintf(fp, "         - LOGFILE-Request\n");
  1395. X  }
  1396. X  if (info != 0) {
  1397. X    fprintf(fp, "         - INFO-Request\n");
  1398. X  }
  1399. X  fprintf(fp, "         - Reflected to %s\n\n", receiver);
  1400. X  fclose(fp);
  1401. X
  1402. X
  1403. X  fprintf(ff, "%s\n\n", MVERSION);
  1404. X
  1405. X
  1406. X  if ((dirlist == 0) && (logfile == 0) && (info == 0) && (minimal == 0)) {
  1407. X    fprintf(ff, "That's what we received in NG \"%s\" ...\n\n", arg);
  1408. X
  1409. X    fputs(path, ff);
  1410. X    fputs(from, ff);
  1411. X    fputs(reply_to, ff);
  1412. X    fputs(sender, ff);
  1413. X    fputs(newsgroups, ff);
  1414. X    fputs(subject, ff);
  1415. X    fputs(article_id, ff);
  1416. X    fputs(posted, ff);
  1417. X    fputs(nntp_post, ff);
  1418. X    fputs(summary, ff);
  1419. X    fputs(keywords, ff);
  1420. X    fputs(followup_to, ff);
  1421. X    fputs(distribution, ff);
  1422. X    fputs(references, ff);
  1423. X    fputs(message_id, ff);
  1424. X    fputs(organization, ff);
  1425. X    fputs(date, ff);
  1426. X    fputs(lines, ff);
  1427. X
  1428. X
  1429. X    fputs("\n\nDiagnostics ...\n\n", ff);
  1430. X
  1431. X    if (id_err != 0) {
  1432. X        fprintf(ff, "- \"Message-ID\" may cause trouble ... use \"Message-Id\".\n\n");
  1433. X    }
  1434. X    if (reply_to[0] == '\0') {
  1435. X        fprintf(ff, "- No \"Reply-To\"-Path ... don't know how to deliever responses.\n\n");
  1436. X    }
  1437. X    i = atoi((char *) strcopy(lines, 12, 80));
  1438. X    inlines--;
  1439. X    if (inlines != i) {
  1440. X        fprintf(ff, "- Your Header reports %d lines ... we counted %d.\n\n", i, inlines);
  1441. X    }
  1442. X    if ((reply != 0) || (noreply != 0)) {
  1443. X        fprintf(ff, "- Found %d Reply-Requests and %d No-Replies.\n\n", reply, noreply);
  1444. X    }
  1445. X  }
  1446. X  if (dirlist != 0) {
  1447. X    fp = fopen(DIRLIST, "r");
  1448. X    if (fp != NULL) {
  1449. X        fputs("DIRLIST:\n\n", ff);
  1450. X        while (fgets(s, 250, fp) != NULL) fputs(s, ff);
  1451. X        fclose(fp);
  1452. X    } else {
  1453. X        fputs("Sorry, no DIRLIST-Entry found ...\n\n", ff);
  1454. X    }
  1455. X    printf("\n\n");
  1456. X  }
  1457. X  if (logfile != 0) {
  1458. X    fp = fopen(REFLECT_LOG, "r");
  1459. X    if (fp != NULL) {
  1460. X        fputs("LOGFILE:\n\n", ff);
  1461. X        while (fgets(s, 250, fp) != NULL) fputs(s, ff);
  1462. X        fclose(fp);
  1463. X    } else {
  1464. X        fputs("Sorry, no LOGFILE-Entry found ...\n\n", ff);
  1465. X    }
  1466. X    printf("\n\n");
  1467. X  }
  1468. X  if (info != 0) {
  1469. X    fputs("INFO (weitere Schluesselwoerter):\n\n", ff);
  1470. X    fputs("LOGFILE - Wenn der Reflektor nicht reflektiert, kann man sich\n", ff);
  1471. X    fputs("          das LOGFILE senden lassen, um zu ueberpruefen ob der\n", ff);
  1472. X    fputs("                 Artikel jemals erfasst worden ist.\n\n", ff);
  1473. X
  1474. X    fputs("DIRLIST - Eine Liste des lokalen MINIX-Archivs. Da der Reflektor\n", ff);
  1475. X    fputs("          (noch) kein PD-Server ist, kann man diese Liste nur zu\n", ff);
  1476. X    fputs("          Testzwecken anfordern.\n\n", ff);
  1477. X
  1478. X    fputs("SHORT   - Quittiert nur den Empfang des Artikels.\n\n", ff);
  1479. X  }
  1480. X  if (minimal != 0) {
  1481. X    fprintf(ff, "Received your article %s", message_id);
  1482. X  }
  1483. X  fclose(ff);
  1484. X
  1485. X  sprintf(s, "/bin/sh ./etc/rmail.sh %s %s", tmp, receiver);
  1486. X  system(s);
  1487. X
  1488. X  unlink(tmp);
  1489. X
  1490. X  return 0;
  1491. X}
  1492. X
  1493. X
  1494. X
  1495. X/***************************************************************************/
  1496. X/*      FUNKTION  pdsize()                           */
  1497. X/*  BESCHREIBUNG  Groesse eine PD-Datei ermitteln                */
  1498. X/*     PARAMETER  arg - Name des NG-Eintrags                               */
  1499. X/*     RUECKGABE  Groesse in kBytes                                        */
  1500. X/***************************************************************************/
  1501. X
  1502. Xint pdsize( arg )
  1503. Xchar arg[];
  1504. X{
  1505. X  FILE *fp;
  1506. X  char s[STRING];
  1507. X  int ok = 0;
  1508. X  struct stat fstat;
  1509. X
  1510. X  fp = fopen( arg, "r" );
  1511. X  if(fp == NULL){
  1512. X    return (int) 0;
  1513. X  }
  1514. X  while((ok == 0) && (fgets(s, 80, fp) != NULL)){
  1515. X    if(strcomp("BINFILE", s) == 0) ok++;
  1516. X  }
  1517. X  if(ok == 0){
  1518. X    fclose(fp);
  1519. X    stat(arg, &fstat);
  1520. X    return (int) (fstat.st_size / 1024);
  1521. X  }
  1522. X
  1523. X  fgets(s, 80, fp);
  1524. X  fclose(fp);
  1525. X  stat((char *) stripped(s), &fstat);
  1526. X  return (int) (fstat.st_size / 1024);
  1527. X}
  1528. X
  1529. X
  1530. X
  1531. X
  1532. X
  1533. X
  1534. X
  1535. X
  1536. X/***************************************************************************/
  1537. X/*      FUNKTION  scan()                           */
  1538. X/*  BESCHREIBUNG  Filtert einen NEWS-Artikel, und erstellt einen Eintrag   */
  1539. X/*          fuer das entsprechenden INDEX-Files der ix/Mbox.       */
  1540. X/*     PARAMETER  arg  =  NG                                               */
  1541. X/*     RUECKGABE  Datum des aktuellsten Artikels                           */
  1542. X/***************************************************************************/
  1543. X
  1544. Xchar *scan(arg)
  1545. Xchar arg[];
  1546. X{
  1547. X  FILE *ff;
  1548. X  FILE *fp;
  1549. X  FILE *fl;
  1550. X  FILE *ft;
  1551. X
  1552. X  char s[STRING];
  1553. X  char t[STRING];
  1554. X  char f[STRING];
  1555. X  char v[STRING];
  1556. X  char num[STRING];
  1557. X  char from[STRING];
  1558. X  char subj[STRING];
  1559. X  char date[STRING];
  1560. X  char line[STRING];
  1561. X  char orga[STRING];
  1562. X  char Ndir[STRING];
  1563. X  char Ldir[STRING];
  1564. X  char Tdir[STRING];
  1565. X  char ex[1024];
  1566. X  char et[355];
  1567. X
  1568. X  static char sdate[STRING];
  1569. X
  1570. X  char today[STRING];
  1571. X  char thatday[STRING];
  1572. X  char arti[STRING];
  1573. X
  1574. X  int i, j;
  1575. X  int ok = 0;
  1576. X  int a, b;
  1577. X  int BINFILE = 0;
  1578. X  int PDGROUP = 0;
  1579. X  int fsi = 0;
  1580. X  int seq = 0;
  1581. X  int OLDENTRY = 0;
  1582. X  int OLDn = 0;
  1583. X  int OLDo = 0;
  1584. X  struct stat fstat;
  1585. X  struct tm *tp;
  1586. X
  1587. X  i = 0;
  1588. X  while (arg[i] != '\0') {
  1589. X    t[i] = arg[i];
  1590. X    if (t[i] == '.') t[i] = '/';
  1591. X    i++;
  1592. X  }
  1593. X  t[i] = '\0';
  1594. X
  1595. X  sprintf(Ndir, "%s/%s", NEWS, t);
  1596. X
  1597. X  if(length(arg) > 14){
  1598. X    s[0] = '\0'; strcat(s, (char *) shortname(arg));
  1599. X    sprintf(Ldir, "%s/%s", LIB, s);
  1600. X  } 
  1601. X  else{
  1602. X    sprintf(Ldir, "%s/%s", LIB, arg);
  1603. X  }
  1604. X  sprintf(Tdir, "%s/TD.%d", TMP, getpid());
  1605. X
  1606. X  if (FLAG == 0) printf("\n%s...\n", Ndir);
  1607. X
  1608. X  sprintf(f, "%s/%dA", TMP, getpid());
  1609. X
  1610. X  sprintf(s, "ls %s | sort -nr > %s", Ndir, f);
  1611. X
  1612. X  system(s);
  1613. X
  1614. X
  1615. X  fl = fopen(f, "r");
  1616. X  if (fl == NULL) {
  1617. X    if (FLAG == 0) printf("cancelled!");
  1618. X    return "";
  1619. X  }
  1620. X  sprintf(sdate, "%s", ":-)");
  1621. X
  1622. X  sprintf(today, "%s", (char *) mydate(1));
  1623. X
  1624. X
  1625. X  ft = fopen(Ldir, "r");
  1626. X  if(ft == NULL){
  1627. X    ft = fopen(Ldir, "w");
  1628. X    fputs("\n\n0\n", ft);
  1629. X    fclose(ft);
  1630. X    ft = fopen(Ldir, "r");
  1631. X    OLDo = -2;
  1632. X  }
  1633. X  fgets(s, 81, ft);
  1634. X  fgets(s, 81, ft);
  1635. X  fgets(s, 81, ft);
  1636. X  OLDENTRY = atoi(s); 
  1637. X
  1638. X  lockf(Ldir);
  1639. X
  1640. X  ff = fopen(Tdir, "w");
  1641. X
  1642. X  seq = 0;
  1643. X
  1644. X  mb_gruppen++;
  1645. X
  1646. X
  1647. X  if(strcomp(PDNG, arg) == 0){
  1648. X    PDGROUP++;    
  1649. X    fprintf(ff, "%s\n", GBL08_MSG); 
  1650. X  }
  1651. X  else{
  1652. X    fprintf(ff, "%s\n", GBL05_MSG);
  1653. X  }
  1654. X  fputs("===============================================================================\n", ff);
  1655. X  
  1656. X  while (fgets(num, 80, fl) != NULL) {
  1657. X
  1658. X    if((atoi(num) < OLDENTRY) && (FASTMODE == 1)) goto YET_SCANNED;
  1659. X
  1660. X    OLDn++;
  1661. X
  1662. X    seq++;
  1663. X    BINFILE = 0;
  1664. X    fsi++;
  1665. X
  1666. X    strcpy(s, (char *) stripped(num));
  1667. X    sprintf(t, "%s/%s", Ndir, s);
  1668. X        sprintf(arti, "%s", t);
  1669. X  
  1670. X
  1671. X    if (FLAG == 0) printf("%s: ", t);
  1672. X
  1673. X    fp = fopen(t, "r");
  1674. X    if (fp != NULL) {
  1675. X
  1676. X        stat(t, &fstat);
  1677. X        tp = localtime(&fstat.st_mtime);
  1678. X
  1679. X        if(fstat.st_mode & S_IFDIR) goto OFF_HERE;
  1680. X
  1681. X        mb_bytes += (long) fstat.st_size;
  1682. X        sprintf(thatday, "%02.2d.%02.2d.%02.2d", tp->tm_mday, tp->tm_mon + TZS, tp->tm_year);
  1683. X        if(strcomp(thatday, today) == 0) mb_new_bytes += (long) fstat.st_size;
  1684. X
  1685. X        if (sdate[0] == ':') {
  1686. X            sprintf(sdate, "%4.4d%02.2d%02.2d",
  1687. X                1900 + tp->tm_year, tp->tm_mon + TZS, tp->tm_mday);
  1688. X            sprintf(s, "%02.2d:%02.2d",
  1689. X                tp->tm_hour, tp->tm_min);
  1690. X            LASTTIME = timeconv(s);
  1691. X            if (FLAG == 0) printf(" (%s) ", sdate);
  1692. X            if(strcomp(thatday, today) == 0) mb_new++;
  1693. X        }
  1694. X        if (strcomp(arg, REFLECT_NG) == 0) {
  1695. X            if (strcomp(thatday, today) == 0) {
  1696. X                reflector(arg, t);
  1697. X            }
  1698. X        }
  1699. X        from[0] = '\0';
  1700. X        subj[0] = '\0';
  1701. X        date[0] = '\0';
  1702. X        line[0] = '\0';
  1703. X        orga[0] = '\0';
  1704. X
  1705. X        for (i = 0; i < 20; i++) {
  1706. X            fgets(ex, 350, fp);
  1707. X#ifdef ADDRMODE
  1708. X            if (strcomp("de.", arg) == 0) {
  1709. X                if (strcomp("Path:", ex) == 0) {
  1710. X                    fprintf(ad, "%s\n", (char *) stripped(ex));
  1711. X                }
  1712. X            }
  1713. X#endif
  1714. X            ex[80] = '\0'; strcpy(s, ex);
  1715. X            if (strcomp("From:", s) == 0) {
  1716. X                strcpy(from, s);
  1717. X            }
  1718. X            if (strcomp("Reply-To:", s) == 0) {
  1719. X                strcpy(from, s);
  1720. X            }
  1721. X            if (strcomp("Subject:", s)      == 0) strcpy(subj, s);
  1722. X            if (strcomp("Date:", s)         == 0) strcpy(date, s);
  1723. X            if (strcomp("Lines:", s)        == 0) strcpy(line, s);
  1724. X            if (strcomp("BINFILE", s)       == 0) BINFILE++;
  1725. X            if (strcomp("Organization:", s) == 0) strcpy(orga, s);
  1726. X        }
  1727. X
  1728. X#ifdef ADDRMODE        
  1729. X        if (strcomp("de.", arg) == 0) {
  1730. X            fprintf(ad, "%s\n", (char *) stripped(from));
  1731. X            fprintf(ad, "%s\n", (char *) stripped(orga));
  1732. X        }
  1733. X#endif
  1734. X
  1735. X        if (FLAG == 0) printf("%s", subj);
  1736. X
  1737. X        if ((from[0] == 'F') || (from[0] == 'R')) {
  1738. X
  1739. X            strcpy(s, (char *) stripped(num));
  1740. X            strcat(s, "       ");
  1741. X            s[6] = '\0';
  1742. X            if (BINFILE != 0) s[5] = '*';
  1743. X
  1744. X            subj[79] = '\0';
  1745. X            strcpy(ex, (char *) strcopy(subj, 8, 79));
  1746. X            strcpy(et, (char *) stripped(ex));
  1747. X            strcpy(ex, et);
  1748. X            strcat(ex, "                           ");
  1749. X            ex[25] = '\0';
  1750. X            strcat(s, ex);
  1751. X            strcat(s, "   ");
  1752. X
  1753. X
  1754. X            i = 8;
  1755. X            if (from[0] == 'R') i = 10;
  1756. X
  1757. X            from[79] = '\0';
  1758. X            strcpy(ex, (char *) strcopy(from, i, 80));
  1759. X            strcpy(et, (char *) stripped(ex));
  1760. X            strcpy(ex, et);
  1761. X
  1762. X            a = 0;
  1763. X            b = 0;
  1764. X            i = 0;
  1765. X            while (ex[i] != '\0') {
  1766. X                if (ex[i] == '(') a = i + 1;
  1767. X                if (ex[i] == ')') b = i - 1;
  1768. X                i++;
  1769. X            }
  1770. X            if (a < b) {
  1771. X                strcpy(et, (char *) strcopy(ex, a, b));
  1772. X                strcpy(ex, et);
  1773. X            }
  1774. X            strcat(ex, "                           ");
  1775. X            ex[19] = '\0';
  1776. X            strcat(s, ex);
  1777. X            strcat(s, "   ");
  1778. X
  1779. X
  1780. X            i = 0;
  1781. X            j = 0;
  1782. X            while (date[i] != '\0') {
  1783. X                if (j == 0) {
  1784. X                    if ((date[i] >= '1') && (date[i] <= '9'))
  1785. X                        j = i;
  1786. X                }
  1787. X                i++;
  1788. X            }
  1789. X
  1790. X            sprintf(ex, "%02.2d.%02.2d.%02.2d  %02.2d:%02.2d",
  1791. X             tp->tm_mday, tp->tm_mon + TZS, tp->tm_year,
  1792. X                tp->tm_hour, tp->tm_min);
  1793. X            strcat(ex, "                         ");
  1794. X            ex[15] = '\0';
  1795. X            strcat(s, ex);
  1796. X            strcat(s, "  ");
  1797. X
  1798. X            strcpy(ex, (char *) strcopy(line, 7, 20));
  1799. X            strcpy(t, (char *) stripped(ex));
  1800. X            i = atoi(t);
  1801. X            sprintf(ex, "%-6.d", i);
  1802. X        
  1803. X            if(PDGROUP != 0){
  1804. X                sprintf(ex, "%-6.d", pdsize(arti));
  1805. X            }
  1806. X
  1807. X            strcat(s, ex);
  1808. X            fputs(s, ff);
  1809. X            fputs("\n", ff);
  1810. X
  1811. X            mb_artikel++;
  1812. X
  1813. X            ok = 1;
  1814. X        } else {
  1815. X            if (FLAG == 0) printf("invalid header!\n");
  1816. X        }
  1817. X
  1818. X        OFF_HERE:
  1819. X
  1820. X        if (fp != 0) fclose(fp);
  1821. X    } else {
  1822. X        if (FLAG == 0) printf("can't open!");
  1823. X    }
  1824. X  }
  1825. X
  1826. X  YET_SCANNED:
  1827. X
  1828. X  while(fgets(num, 80, fl) != NULL){
  1829. X    fgets(s, 81, ft); 
  1830. X    fputs(s, ff);
  1831. X    strcpy(s, (char *) stripped(num));
  1832. X    sprintf(t, "%s/%s", Ndir, s);
  1833. X    stat(t, &fstat);
  1834. X    mb_bytes += (long) fstat.st_size;
  1835. X    mb_artikel++;
  1836. X    OLDo++;
  1837. X  }
  1838. X  fgets(s, 81, ft);
  1839. X  if(FASTMODE == 1) fputs(s, ff);
  1840. X
  1841. X  if (ff != 0) fclose(ff);
  1842. X  if (fl != 0) fclose(fl);
  1843. X  if (ft != 0) fclose(ft);
  1844. X  
  1845. X  fp = fopen( Ldir, "w" );
  1846. X  fl = fopen( Tdir, "r" );
  1847. X  while(fgets(s, 81, fl) != NULL){
  1848. X    fputs(s, fp);
  1849. X  }
  1850. X  fclose(fp);
  1851. X  fclose(fl);
  1852. X
  1853. X  unlink(f);
  1854. X  unlink(Tdir);
  1855. X  
  1856. X  if (sdate[0] == ':') {
  1857. X    sprintf(sdate, "%s", "19700101");
  1858. X    LASTTIME = 0;
  1859. X  }
  1860. X
  1861. X#ifdef _SYS7
  1862. X  if ((seq > MAX_PER_NG) && (FLAG == 0) && (strcomp("local", arg) != 0)) {
  1863. X    sprintf(s, "%s -n %s -e %d", EXPIRE, arg, EXPIRED_DAYS);
  1864. X    printf("%s\n", s);
  1865. X    system(s);
  1866. X    sprintf(s, "%s %s EXP", MB_DAEMON, arg);
  1867. X    system(s);
  1868. X  }
  1869. X#endif
  1870. X  
  1871. X  unlockf(Ldir);
  1872. X
  1873. X  if((FASTMODE == 1) && (FLAG == 0)){
  1874. X    if(OLDn != 0) OLDn -= 1;
  1875. X    OLDo += 2;
  1876. X    printf("\n==> %s %d. %s %d.\n\n", MBD01_MSG, OLDn, MBD02_MSG, OLDo);
  1877. X  }
  1878. X  
  1879. X  return (char *) sdate;
  1880. X}
  1881. X
  1882. X
  1883. X
  1884. X/***************************************************************************/
  1885. X/*      FUNKTION  mix()                               */
  1886. X/*  BESCHREIBUNG  Aktualisiert einzelnen Eintraege im AGROUPS-File.       */
  1887. X/*     PARAMETER  s  =  NG                                                 */
  1888. X/*          t  =  Neuer AGROUPS-Eintrag                              */
  1889. X/*     RUECKGABE  keine                                                    */
  1890. X/***************************************************************************/
  1891. X
  1892. Xvoid mix( s, t )
  1893. Xchar s[], t[];
  1894. X{
  1895. X  FILE *ff, *fp;
  1896. X  char tmp[STRING];
  1897. X  char f[STRING];
  1898. X
  1899. X  sprintf(tmp, "%s/ff%d", TMP, getpid());
  1900. X
  1901. X
  1902. X  maybe_locked( AGROUPS, "r" );
  1903. X  fp = fopen( AGROUPS, "r" );
  1904. X  if(fp == NULL){
  1905. X    printf("%s ?", AGROUPS);
  1906. X    exit(-1);
  1907. X  }
  1908. X
  1909. X  ff = fopen( tmp, "w" );
  1910. X  if(ff == NULL){
  1911. X    printf("%s ?", tmp);
  1912. X    exit(-1);
  1913. X  }
  1914. X
  1915. X  while(fgets(f, 80, fp) != NULL){
  1916. X    if(strcomp(s, f) == 0){
  1917. X        fputs(t, ff);
  1918. X    }
  1919. X    else{
  1920. X        fputs(f, ff);
  1921. X    }
  1922. X  }
  1923. X  fclose(fp);
  1924. X  fclose(ff);
  1925. X
  1926. X  sprintf(f, "mv %s %s", tmp, AGROUPS);
  1927. X  system( f );
  1928. X}
  1929. X
  1930. X
  1931. X
  1932. X
  1933. X
  1934. X/***************************************************************************/
  1935. X/*      FUNKTION  main() (mb_daemon)                       */
  1936. X/*  BESCHREIBUNG  Scannt einen bzw. alle NEWS-Artikel, um die INDEX-Files  */
  1937. X/*          der ix/Mbox zu aktualisieren.                            */
  1938. X/*     PARAMETER  argc  =  Anzahl der Parameter                            */
  1939. X/*          argv  =  NG  = nur diese NG scannen                */
  1940. X/*               ''  = alle NGs scannen                    */
  1941. X/*     RUECKGABE  keine                                                    */
  1942. X/***************************************************************************/
  1943. X
  1944. Xmain(argc, argv)
  1945. Xint argc;
  1946. Xchar *argv[];
  1947. X{
  1948. X  FILE *fp;
  1949. X  FILE *fa;
  1950. X  char s[STRING];
  1951. X  char t[STRING];
  1952. X  char d[STRING];
  1953. X
  1954. X
  1955. X  int a, b, i;
  1956. X
  1957. X  chdir(HOME);
  1958. X
  1959. X  setuid(0);
  1960. X  setgid(0);
  1961. X  umask(0000);
  1962. X
  1963. X  FLAG = 0;
  1964. X  FASTMODE = 1;
  1965. X
  1966. X  if(argc > 1){
  1967. X    FLAG++;
  1968. X  }
  1969. X  if(argc > 2){            /* MB-Daemon ruft MB-Daemon !!! */
  1970. X    FLAG++; 
  1971. X    FASTMODE = 0; 
  1972. X  }
  1973. X
  1974. X  if(strcomp("all", argv[1]) == 0) FLAG = 0;
  1975. X
  1976. X#if 0
  1977. X  if(argv[2][0] == '-'){    /* Index KOMPLETT neu bilden !!! */
  1978. X    FASTMODE = 0;
  1979. X  }
  1980. X#endif
  1981. X
  1982. X  if(FLAG == 0){
  1983. X    if (fa = fopen(AGROUPS, "w"))
  1984. X    fclose(fa);
  1985. X  }
  1986. X
  1987. X#ifdef ADDRMODE
  1988. X    ad = fopen( "/tmp/local/address/addresses", "a" );
  1989. X#endif
  1990. X
  1991. X  mb_gruppen = 0;
  1992. X  mb_new = 0;
  1993. X  mb_bytes = 0L;
  1994. X  mb_new_bytes = 0L;
  1995. X  mb_artikel = 0L;
  1996. X
  1997. X
  1998. X  if (fp = fopen(NGROUPS, "r"))
  1999. X  while (fscanf(fp, "%s %d %d %s", s, &a, &b, t) > 0) {
  2000. X    if(FLAG > 0){
  2001. X        if(strcomp(argv[1], s) == 0){
  2002. X            d[0] = '\0';
  2003. X#ifdef _SYS7
  2004. X            strcat(d, (char *) scan(s));
  2005. X#else
  2006. X            strcat(d, (char *) scan(&s));
  2007. X#endif
  2008. X            sprintf(t, "%s  %s  %ld\n", s, d, LASTTIME);
  2009. X            if(FLAG < 2) mix( s, t );
  2010. X        }
  2011. X    }
  2012. X    else{
  2013. X        d[0] = '\0';
  2014. X#ifdef _SYS7    
  2015. X        strcat(d, (char *) scan(s));
  2016. X#else    
  2017. X        strcat(d, (char *) scan(&s));
  2018. X#endif
  2019. X        fa = fopen(AGROUPS, "a");
  2020. X        fprintf(fa, "%s  %s  %ld\n", s, d, LASTTIME);
  2021. X        fclose(fa);
  2022. X    }
  2023. X  }
  2024. X  if(fp != 0) fclose(fp);
  2025. X
  2026. X  if(FLAG > 0){
  2027. X  }
  2028. X  else{
  2029. X     mb_bytes = (long)(mb_bytes / 1024);
  2030. X     mb_new_bytes = (long)(mb_new_bytes /1024);
  2031. X   
  2032. X     sprintf(d, "%s/%d.mbd", TMP, getpid());
  2033. X     fp = fopen( d, "w" );
  2034. X     fprintf(fp, "%s  %s    %6.d   %6.ld",
  2035. X                  mydate(1), mytime(1), mb_new, mb_new_bytes);
  2036. X     fprintf(fp, "%16.16s", " ");
  2037. X     fprintf(fp, "%6.d   %6.ld   %6.ld\n", mb_gruppen, mb_artikel, mb_bytes);
  2038. X
  2039. X     b = PRO_ENTRIES / 2; a = 0;
  2040. X
  2041. X     fa = fopen( MB_DLOG, "r" );
  2042. X     if(fa != 0){
  2043. X    while((fgets(s, STRING, fa) != 0) && (a < b)){
  2044. X        fputs(s, fp);
  2045. X        a++;
  2046. X    }
  2047. X    fclose(fa);
  2048. X     }
  2049. X     if(fp != 0) fclose(fp);
  2050. X
  2051. X     sprintf(s, "mv %s %s > /dev/null", d, MB_DLOG);
  2052. X     system(s);
  2053. X  } 
  2054. X
  2055. X  if((FASTMODE == 1) && (FLAG == 0)){
  2056. X    printf("%s %d %s %ld %s.\n", MBD03_MSG, mb_new, MBD04_MSG, 
  2057. X        mb_new_bytes, MBD05_MSG);
  2058. X    printf("%s %d %s %ld %s %ld %s.\n\n", 
  2059. X        MBD06_MSG, mb_gruppen, MBD07_MSG, mb_artikel, MBD08_MSG, 
  2060. X        mb_bytes, MBD09_MSG);
  2061. X  }
  2062. X
  2063. X
  2064. X#ifdef ADDRMODE
  2065. X  if(ad != 0) fclose(ad);
  2066. X#endif
  2067. X
  2068. X  return;
  2069. X}
  2070. X
  2071. X
  2072. END_OF_FILE
  2073.   if test 21389 -ne `wc -c <'src/mb-daemon.c'`; then
  2074.     echo shar: \"'src/mb-daemon.c'\" unpacked with wrong size!
  2075.   fi
  2076.   # end of 'src/mb-daemon.c'
  2077. fi
  2078. echo shar: End of archive 1 \(of 10\).
  2079. cp /dev/null ark1isdone
  2080. MISSING=""
  2081. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  2082.     if test ! -f ark${I}isdone ; then
  2083.     MISSING="${MISSING} ${I}"
  2084.     fi
  2085. done
  2086. if test "${MISSING}" = "" ; then
  2087.     echo You have unpacked all 10 archives.
  2088.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2089. else
  2090.     echo You still must unpack the following archives:
  2091.     echo "        " ${MISSING}
  2092. fi
  2093. exit 0
  2094. exit 0 # Just in case...
  2095.