home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-04-05 | 53.1 KB | 2,096 lines |
- Newsgroups: comp.sources.misc
- From: Volker.Schuermann@unnet.w.open.de@unnet (Volker Schuermann)
- Subject: v29i063: mbox - A Bulletin Board System for UNIX and MINIX, Part01/10
- Message-ID: <csm-v29i063=mbox.132853@sparky.IMD.Sterling.COM>
- X-Md4-Signature: d5233b0510fb2be5118773e45312e8e8
- Date: Sun, 5 Apr 1992 18:29:27 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: Volker.Schuermann@unnet.w.open.de@unnet (Volker Schuermann)
- Posting-number: Volume 29, Issue 63
- Archive-name: mbox/part01
- Environment: MINIX, ISC, ESIX, SVR3
-
- This is a BBS-System written & tested on MINIX 386 (!) and UNIX SVR3 (ISC,
- ESIX, AT&T). It only works, if you've already installed UUCP, NEWS and MAIL !
-
- The BBS could deal with different 'human' languages. This package includes
- the files for an 'english' and a 'german' version. If you prefer another
- language, just change the language-files.
-
- Describtion of the features ??? Well, it's a combination of a NEWSREADER,
- a MAILER and a DATABASE. For users, it looks and feels like a PC/DOS-BBS,
- but it offers Internet-contact and NEWS-transfer ...
-
- That's what it's about ...
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: README etc src src/mb-daemon.c
- # Wrapped by kent@sparky on Sun Apr 5 11:57:39 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 10)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(27945 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X ix/MBox R E A D M E
- X Bulletin Board System for UNIX(-Derivations)
- X
- X Volker Schuermann
- X Wuppertal, FRG, 27.12.1991
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X TABLE OF CONTENTS
- X
- X
- X PREFACE ....................................................... IV
- X
- X 1. FIRST STEPS ............................................... V
- X
- X 2. SHELL SCRIPTS
- X
- X 2.1. Appending new Users to the 'Aliases'-File ........... 1
- X 2.2. Sending Articles to the NEWS-System ................. 2
- X 2.3. Sending Mail ........................................ 3
- X 2.4. Handling PD (Public Domain) Stuff ................... 4
- X
- X 3. CONFIGUREABLE FILES
- X
- X 3.1. The List of Editors ................................. 5
- X 3.2. The offered Games ................................... 6
- X 3.3. The Commands ........................................ 7
- X 3.4. The Helpfile (long) ................................. 8
- X 3.5. The Helpfile (short) ................................ 9
- X
- X 4. ACCOUNTING
- X
- X 4.1. The Users DATABASE .................................. 10
- X
- X 5. DEFINITIONS IN SOURCE CODE
- X
- X 5.1. The Headerfile ...................................... 11
- X 5.2. The Makefile ........................................ 12
- X
- X 6. SUPPORTING TOOLS
- X
- X 6.1. The NEWS SCANNER (MB-DAEMON) ........................ 13
- X 6.2 The MAILING AGENT (XMD) ............................. 14
- X
- X
- X APPENDIX
- X
- X A. DICTIONARY for german Error Codes ......................... 15
- X B. DIRECTORIES with Permissions and Owners ................... 16
- X C. QUICK REFERENCE put in order by Files ..................... 17
- X
- X
- XDecember 27, 1991 - III - ix/MBox
- X
- X PREFACE
- X
- X This BBS-Package is the first international release of the ix/MBox. The
- Xgerman version has been tested and modified for month. Several problems have
- Xoccured while using other OSs (than MINIX), but they have been fixed with
- Xthe help of some guys out there on the net and on my BBS. Their names and
- Xtheir 'heroic deeds' are documented (try using 'version #') to show who was
- Xinvolved in the BBS develoment.
- X
- X Also special thanks to Fred v. Kempen and Will Rose. They made UUCP and
- XNEWS available on MINIX. And don't forget Burce D. Evans. Without his 386er
- Xpatches, programs like this BBS would never have been possible.
- X
- X Though this package is not a Beta-Release, some difficulties will appear
- Xwhile your're installing and setting up the BBS. To render the exchange of
- XBug-Reports, FAQs, hints and fixes two services are offered:
- X
- XE-Mail: Volker.Schuermann@unnet.w.open.de
- X Volker.Schuermann@unnet.ruhr.sub.org
- X
- XMailing-List: To ADD/DELETE/SUBSCRIBE a User or Alias; send mail to
- X mbox@ivcmd.Boerde.DE (unido!fub!ivcmd!mbox) or
- X mbox@Boerde.DE
- X
- X To BROADCAST a message; send mail to
- X mbox-list@ivcmd.Boerde.DE (unido!fub!ivcmd!mbox-list) or
- X mbox-list@Boerde.DE
- X
- X Feel free to make use of both offers everytime you aren't able to get rid
- Xof problem, or if you're having questions, or if you found/fixed a bug, or if
- Xyou created a better language-file, or whatever ...
- X
- XRegards, Volker
- X
- X
- X
- XDecember 27, 1991 - IV - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X1. FIRST STEPS
- X
- X You managed to unpack the BBS-package without any help - congratulations!
- XIt's time now to correct your first failure :-) This file (README) has to be
- Xin the [/mbox] directory. This directory will be the HOME of your BBS. If you
- Xdon't like '/mbox' to be the base for all following work, you have to create
- Xa directory to you favor and unpack the BBS-package again in this new HOME.
- X
- X After unpacking the BBS, the HOME should look like the sample in the
- Xdirectory [/mbox] (see APPENDIX B.). In the following, you are confronted
- Xwith some files that are configurable to make the BBS running on your special
- Xenvironment.
- X
- X
- X
- XDecember 27, 1991 - V - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X2. SHELL SCRIPTS
- X
- X2.1. Appending new Users to the 'Aliases'-File (SMAIL only!)
- X
- X This script is called by ix/MBox to append a line for every new BBS-user
- Xto the 'aliases'-file of SMAIL.
- X
- X The name of the new user is send as parameter ($1). If a mail arrives for
- Xthis user, SMAIL uses this entry to deliver the mail.
- X
- XFile /mbox/etc/alias.sh
- X=======================
- Xecho $1 " " \"\|/usr/bin/xmd $1 -\" >> /usr/lib/smail/aliases
- X
- X# $1 includes the name of the new BBS-User (Format: "Prename.Name")
- X
- X You mustn't change the "/usr/bin/xmd $1 -" part of this line. All other
- Xitem could be changed.
- X
- XNOTE: If you're using UMAIL, you can forget about using this file - it would
- Xbe best to comment out everything!
- X
- X
- X
- XDecember 27, 1991 - 1 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X2.2. Sending Articles to the NEWS-System
- X
- X To communicate with any kind of NEWS-System, this file makes the necessary
- Xcalls. As described below, INEWS gets the name of (i.e. path to) a file,
- Xwhere ix/MBox stores the user-written new article.
- X
- XFile /mbox/etc/inews.sh
- X=======================
- X/usr/lib/news/inews -h < $2
- X
- X# $1 is the newsgroup which should receive the article
- X# $2 includes the file, where the ix/MBox saves the article
- X
- X
- X
- XDecember 27, 1991 - 2 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X2.3. Sending Mail
- X
- X Since there are some very powerful/intelligent mailing systems available
- Xunder UNIX/MINIX, ix/MBox doesn't offer it's own mailer (for external mails).
- X
- X Your are able to use your most favorite mailer without making any changes
- Xto your configuration. (RMAIL should be a link to UMAIL, SMAIL etc.)
- X
- XFile /mbox/etc/rmail.sh
- X=======================
- Xrmail -d -i $1 $2
- X
- X# $1 name/path to the user-written mail
- X# $2 receiver of the mail (full address)
- X
- X
- X
- XDecember 27, 1991 - 3 - ix/MBox
- X
- X
- X
- X
- X
- X
- X2.4. Handling PD (Public Domain) Stuff
- X
- X The BBS doesn't know anything about where you hide your PD (Public Domain
- XSoftware). So if a user wants to send such a program to the BBS, the file has
- Xto be stored in the NEWS-PD-area (the place where articles are collected,
- Xthat contain PD-files). After such an upload, you have two new files in that
- Xarea (let's call it [/usr/spool/news/local/pd/minix]):
- X
- X1. An article, containing the identifier BINFILE and the path to:
- X2. A PD.nnnnnnn file, which contains the PD-file itself
- X
- XIn our example below, there are the following files:
- X
- X1. 2157 (the article)
- X2. PD.693419573 (the PD-file)
- X
- X If we would start [sh /mbox/etc/pd.script] now , the file (2.) would be
- Xcopied to our PD-area ([/public/pd]), and the article (1.) would be changed
- Xto get the new path to (2.).
- X
- X That sounds much more compilcate as it is. The comment '#' tells you where
- Xthe PD belongs to and who sent it to you.
- X
- XFile /mbox/etc/pd.script
- X========================
- Xmv /usr/spool/news/local/pd/minix/PD.693419573 /public/pd/tel.tar.Z
- Xmined /usr/spool/news/local/pd/minix/2157
- X#local.pd.minix Andreas Zell
- X
- X
- X
- XDecember 27, 1991 - 4 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X3. CONFIGUREABLE FILES
- X
- X3.1. The List of Editors
- X
- X There is a LineEditor delivered with this BBS-Package, but on your system
- Xthere are lots of editors, I suppose. Therefore you may offer some of them
- Xto your users.
- X
- XFile /mbox/etc/mbox.editors
- X===========================
- XLed /usr/bin/bled
- XMined /usr/bin/mined
- XVi /usr/bin/vi
- XME /usr/bin/me
- X
- XNOTE: Between the comments-box (/* comments */) and the table itself, there
- Xhas to be ONE empty line.
- X
- X
- XDecember 27, 1991 - 5 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X3.2. The offered Games
- X
- X Users are kids, anyway ... so allow them playing games (Don't deny ...
- XI know, you're still playing rogue/empire, too!).
- X
- XFile /mbox/etc/mbox.games
- X=========================
- XAnimals /usr/bin/animals
- XDiepbom /usr/games/diepbom
- XEmpire /usr/games/empire
- XKiller /usr/games/killer
- XSokoban /usr/games/sokoban
- XRogue /usr/bin/rogue
- XRobots /usr/games/robots
- X
- XNOTE: Between the comments-box (/* comments */) and the table itself, there
- Xhas to be ONE empty line.
- X
- X
- XDecember 27, 1991 - 6 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X3.3. The Commands
- X
- X This one is the MOST IMPORTANT file of all. It contains the whole command
- Xstructure of the BBS.
- X
- XThe rows containing the following informations:
- X
- XID (Commands No.) This is the only connection between this table and
- X the BBS (see [loop.c]).
- X
- XIntern/Extern (Level) That means the minimum level to be allowed to use
- X the command.
- X
- X The difference between intern and extern is used
- X to decide whether a user can write external mails
- X too, or internal mails only.
- X
- XPrototyp(e) If you set '1' in this row, the command is shown
- X in the "command survey". Otherwise the command
- X is known, but not displayed.
- X
- XBefehl (Command) The command itself.
- X
- X As you see in the table, some IDs are mentioned more than once. That's
- Xallowed! If there is a couple of commands doing the same action, you may
- Xcollect them:
- X
- X180 0 0 1 Goodbye
- X180 0 0 0 Quit
- X180 0 0 0 Bye
- X180 0 0 0 End
- X
- X The prototype for the LOGOUT-Command is called 'Goodbye' - only this one
- Xwill be displayed, if a user types '?' (and only this one is described in the
- XHELP-file). But 'Quit', 'Bye' and 'End' may also be used to leave the BBS.
- X
- XFile /mbox/etc/help.befehle
- X===========================
- XID Intern Extern Prototyp Befehl
- X==============================================
- X110 0 0 1 + # next board
- X120 0 0 1 - # previous board
- X260 0 0 1 Account # Registration
- X125 9 9 0 Admin # Administration
- X150 0 0 1 Board # Board
- X170 0 0 1 Chat # Chat (See 'mbox.h')
- X200 0 0 1 Dir # Contents
- X370 0 0 1 Date # Date
- X220 1 1 1 Delete # Delete
- X150 0 0 0 Cd
- X400 0 0 1 Direction # Direction (OLD <> NEW)
- X340 1 1 1 Forward # Forward a MSG
- X390 0 0 1 Games # Games
- X180 0 0 1 Goodbye # Logout
- X180 0 0 0 Quit
- X180 0 0 0 Bye
- X180 0 0 0 End
- X190 0 0 1 Help # Help
- X160 0 2 1 Mail # Write a Mail
- X330 0 0 1 Macro # Macro Definition
- X140 0 0 1 Message # 'Hello' MSG
- X240 6 6 1 Minix # OS-Shell
- X240 6 6 0 Execute
- X270 0 0 1 Portinfo # A Kind of 'who'
- X130 0 0 1 Protocol # Logfile
- X250 0 0 1 PM # PM
- X210 0 0 1 Read # Read
- X280 0 0 1 Setup # Configurations
- X280 0 0 0 Password
- X280 0 0 0 Ansi
- X280 0 0 0 Bell
- X280 0 0 0 Address
- X310 1 0 1 Signature # Signature
- X290 0 0 1 State # Configurations List
- X410 0 0 1 Statistics # Statistics
- X380 0 0 1 Time # Time
- X300 0 0 1 Users # List of Users
- X320 0 0 1 Version # Version
- X230 0 5 1 Write # Write a Mail/Article
- X270 0 0 0 Who
- X195 0 1 0 ~PD # Up-/Download LEVEL-Dummy
- X215 0 0 0 Level # Level
- X275 9 9 0 Relogin # Login again ...
- X350 0 0 0 Sleep # Macro Special
- X360 0 0 0 Keypressed # Macro Special
- X230 0 5 0 Upload
- X210 0 0 0 Download
- X998 2 2 0 ~MAIL_DUMMY # LEVEL-Dummy
- X
- X The LEVEL-Dummys are useful to set the required LEVEL for UP-/DOWNLOADING
- X(~PD) or mailing to external hosts (~MAIL_DUMMY).
- X
- X The comments '#' are NOT allowed in the [/mbox/etc/help.befehle] file,
- Xthough they are used in this documentation.
- X
- XNOTE: Between the comments-box (/* comments */) and the table itself, there
- Xhas to be ONE empty line.
- X
- X
- X
- XDecember 27, 1991 - 7 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X3.4. The Helpfile (long)
- X
- X It's just a textfile, that contains informations on every prototyped
- Xcommand of [/mbox/etc/help.befehle].
- X
- XFile /mbox/etc/help.hilfe
- X=========================
- X#BOARD
- XCommand: "Board"
- X
- XThere is a board for every single subject/theme with it's own index. So you
- Xhadn't to search long for special information on any item. To move from one
- Xboard to another, you use the command 'board' with some options:
- X.
- X.
- X.
- X
- X
- XNOTE: The '#COMMAND' has to be set before any further text. This line is
- Xused to select which commands info follows.
- X
- X
- X
- XDecember 27, 1991 - 8 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X3.5. The Helpfile (short)
- X
- X A textfile, which is displayed complete to any user who types 'help'.
- X
- XFile /mbox/etc/help.shorthelp
- X=============================
- X? reachable commands are shown
- X? * all commands are shown
- Xcommand ? help on 'command'
- X
- XACCOUNT establish an account & a maildrop for a new user
- X
- XBOARD list boards with new articles
- X
- X
- XNOTE: If you've changed [/mbox/etc/help.befehle], you have to change this
- Xfile, too!
- X
- X
- X
- XDecember 27, 1991 - 9 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X4. ACCOUNTING
- X
- X4.1. The Users DATABASE
- X
- X NEVER try to edit this file. It's created automagically by the BBS and
- Xmaintained with the command 'admin'.
- X
- X And how to install this database? That's simple. Just erase the files
- X[/mbox/etc/users.data] and [/mbox/etc/users.seq]. After doing that, you
- Xmay start the BBS, which will install a new database for you.
- X
- X The first two entries in this database are generated from data in
- X[/mbox/src/mbox.h] ... if you (as "root") are not allowed to use the
- X'admin' command, you have to change the 'extern' and 'intern' entry of
- X"admin" in [/mbox/etc/help.befehle] to level 0.
- X
- XNOTE: Don't forget to set the 'admin' level back to 9 again, after you've
- Xset your own level to 10 (try 'admin' to see how)!
- X
- X
- XDecember 27, 1991 - 10 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X5. DEFINITIONS IN SOURCE CODE
- X
- X5.1. The Headerfile
- X
- X The following file HAS TO BE CHANGED before trying to compile the BBS. It
- Xcontains all stuff, that depends on you special environment.
- X
- X
- XFile /mbox/src/mbox.h
- X=====================
- X
- X- Even your BBS needs a name:
- X
- X#define ORGANIZATION "THE UNDERGROUND NETWORK"
- X#define SYSTEM "The Time Traveling Agency"
- X
- X
- X- UUCP/Internet Identifications:
- X
- X#define UUCPSITE "unnet"
- X#define UUCPID "unnet.w.open.de"
- X#define UUCPBANG "~!unido!horga!xenox!unnet!"
- X
- X
- X- If your UUCP supports any kind of protocol/logfile:
- X
- X#define UUCPCOSTS "/usr/spool/uucp/.costs"
- X
- X
- X- Where does the BBS live (i.e. HOME):
- X
- X#define HOME "/mbox"
- X
- X
- X- Some directories:
- X
- X#define BIN "/usr/bin"
- X#define TMP "/tmp"
- X#define SPOOL "/usr/spool"
- X#define NEWS "/usr/spool/news"
- X#define MAILDROP "/usr/spool/mail"
- X
- X
- X- If you don't use SMAIL:
- X
- X#define ERRMBOX "/usr/spool/mail/postmaster"
- X
- X
- X- NEWS 'active' file:
- X
- X#define NGROUPS "/usr/lib/news/active"
- X
- X
- X- Define the device/file where to display log-informations:
- X (if defined as 'REDIRECT', the device/file is used, that
- X you've specified in the file CDIRECTFL !)
- X
- X#define CONSOLE "REDIRECT"
- X#define CDIRECTFL "/etc/mbox.out"
- X#define CPRN '/tmp/errlog'
- X
- X
- X- Who's the BOSS (don't use "root"):
- X
- X#define POSTMASTER "volkers"
- X
- X
- X- On which terminal POSTMASTER can use MBOX only:
- X
- X#define PMS_TTY "/dev/tty4"
- X
- X
- X- The fastest BPS-Rate of your Modem-Ports:
- X
- X#define MAX_BPS 2400
- X
- X
- X- What's the Name of your Visitors:
- X
- X#define GUEST "GAST"
- X
- X
- X- This file is displayed after the BBS started:
- X
- X#define INTRO "./etc/intro"
- X
- X
- X- If this file exists, it's shown as BBS-'Jingle':
- X
- X#define LOGO "./etc/logo"
- X
- X
- X- The number of 'all time calls' to your BBS:
- X
- X#define SEQ "./etc/mbox.seq"
- X
- X
- X- The callers logfile:
- X
- X#define CALLS "./etc/mbox.calls"
- X
- X
- X- Your List of Editors:
- X
- X#define EDITORS "./etc/mbox.editors"
- X
- X
- X- The Games:
- X
- X#define GAMES "'./etc/mbox.games"
- X
- X
- X- If you like to offer a CHAT/WRITE/TALK:
- X
- X#define CHAT "/usr/bin/chat"
- X
- X
- X- A special BBS-OS-Shell:
- X
- X#define RSH "./mbrsh"
- X
- X
- X- Have a look at '/etc/passwd' to find the correct values:
- X
- X#define ROOT_UID 0
- X#define ROOT_GID 0
- X#define GUEST_GID 1 !!! Users and Guests have to have DIFFERENT GIDs !!!
- X#define UUCPUID 40
- X#define UUCPGID 40
- X#define NEWSUID 30
- X#define NEWSGID 6
- X
- X It's very, very, very important to change '/etc/passwd' if 'guest'
- X and 'users' had the same GID until now. The BBS uses the GID to
- X fix if a User is 'guest' or a real 'user' ...
- X
- X
- X
- X- For MINIX only (the number of the first Modem-Port):
- X
- X#define FIRST_EX_TTY 64
- X
- X
- X- Where does your local mail hides the signatures:
- X
- X#define SIGNATURE ".wmailsign"
- X
- X
- X- Where is your TSET:
- X
- X#define TSET "./etc/tset"
- X
- X
- X- What's the prefix of your PD-boards ([local.pd.minix] etc.):
- X
- X#define PDNG "local.pd"
- X
- X
- X- Where do you want protocol the downloads:
- X
- X#define PDLOG "./etc/pd.log"
- X
- X
- X- Where do you like to have the upload script:
- X
- X#define PDSCRIPT "./etc/pd.script"
- X
- X
- X- Which groups should new users be allowed to read:
- X
- X#define NEWS_MINIMUM "junk dnet local sub xenox"
- X
- X
- X- How many entries are allowed per broard/group:
- X
- X#define MAX_PER_NG 700
- X
- X If use use a VERY high value, EXPIRE will never be started by
- X MB-DAEMON ! (CNEWS don't like any handstarted EXPIREs)
- X
- X
- X- How many days should be expired, if MAX_PRE_NG is reached:
- X
- X#define EXPIRED_DAYS 32
- X
- X
- X- Which domains may be reached by 'normal' users if they send
- X external mails:
- X
- X#define NAT_DOMAIN1 ".de"
- X#define NAT_DOMAIN2 ".sub.org"
- X#define NAT_DOMAIN3 ".de"
- X
- X
- X- Where are the Up-/Download Protocols:
- X
- X#define SZ "/usr/bin/sz"
- X#define SX "/usr/bin/sx"
- X#define SB "/usr/bin/sb"
- X
- X#define RZ "/usr/bin/rz"
- X#define RX "/usr/bin/rx"
- X#define RB "/usr/bin/rb"
- X
- X
- X- What's the actual telephone rate (in Pfennig :-):
- X
- X#define TARIF 23
- X
- X
- X- How many seconds can you talk (three zones, each day/night):
- X
- X#define NZNT 360
- X#define NZBT 720
- X#define RZNT 60
- X#define RZBT 120
- X#define WZNT 21
- X#define WZBT 42
- X
- X
- X- How many entries will be hold in callers protocol:
- X
- X#define PRO_ENTRIES 600
- X
- X
- X Yep, I know, there are some items missing. Don't play around with one of
- Xthem! To get the definitions in [mbox.h] right is the most important and most
- Xcompilcate work on your way to get the BBS up and running. So spend a little
- Xtime on this job - it will be a big advantage to have no errors or misunder-
- Xstandings in this file.
- X
- X
- X
- XDecember 27, 1991 - 11 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X5.2. The Makefile
- X
- X Type 'make' (keep finger crossed and pray) and see what you'll get ...
- XNo, that's not the right way to get this packaged compiled!
- X
- X The Makefile is fitted out with some special definitions for different
- XUNIX-Versions and favors. Use the CFLAGS to modify the Makefile for your
- Xenvironment.
- X
- XFile /mbox/src/Makefile
- X=======================
- X#CFLAGS:
- X# -D_SYS7 UNIX System 7 (UNIX, COHERENT, ...)
- X# -D_MBOX EVER!!!
- X# -D_MINIX For MINIX only
- X# -D_ISC For Interactive UNIX
- X# -D_SCO For SCO UNIX
- X# -D_ESTDIO For Earl Chew's [estdio.h] (or GCC)
- X# -D_CORELEFT Check your memory
- X# -D_DATESTAMP Protocol time&date, too
- X# -D_NOINDEX Don't store INDEX-Files for every group/board
- X# -D_BAUDRATE If your modem is an HST with 'fixed baudrate'
- X
- X If you are using SYSV, comment out everything that belongs to Sys7 and
- Xvice versa, if you're using Sys7.
- X
- XThat's what you can 'make':
- X
- Xmake all <- Build all executables
- Xmake world <- Create the directories and set the permissions
- Xmake inst <- Build and install ALL !!
- Xmake clean <- Delete the executables (links etc.)
- Xmake mbox <- Build the BBS-executable 'mbox'
- Xmake mb-daemon <- Build the NEWS-SCANNER 'mb-daemon'
- Xmake xmd <- Build the MAILING-AGENT 'xmd'
- Xmake mbrsh <- Build the SHELL 'mbrsh'
- Xmake bled <- Build the LINE-EDITOR 'bled'
- X
- X If everything's ok, you only have to type 'make inst' to build and install
- Xthe whole BBS and it's "world".
- X
- X The MINIX-Version of ix/MBox needs much more memory as given by compiler.
- XWith the command 'chmem +200000', the necessary amount is set up. Yes, that's
- Xwasting memory in some cases. To minimize the amount, use the FLAG _CORELEFT
- Xin format '-D_CORELEFT=20000'. Now you can test around with 'chmem +/-' until
- Xyou reach a value, which allows to run the BBS without producing "cores".
- X
- X
- X
- XDecember 27, 1991 - 12 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X6. SUPPORTING TOOLS
- X
- X6.1. The NEWS SCANNER (MB-DAEMON)
- X
- X For every board/newsgroup in your BBS, you need an INDEX-File. As the
- Xcontents of such an INDEX-File depends on which articles are collected in
- Xthe corresponding newsgroup, a program is needed, that scans those articles
- Xand derives the informations for the INDEX.
- X
- X That's exactly what 'mb-daemon' does. It would be best, to append a
- Xline to [/usr/lib/crontab] for calling 'mb-daemon' after each 'rnews' run.
- X
- XSYNOPSIS:
- X
- Xmb-daemon rebuild all INDEX-Files (Fastmode)
- Xmb-daemon all -x rebuild all INDEX-Files (totally rebuilding)
- Xmb-daemon newsgroup rebuild INDEX-File(s) for 'newsgroup'
- Xmb-daemon newsgroup -x rebuild INDEX-File(s) for 'newsgroup' (total)
- X
- XEXAMPLES:
- X
- Xmb-daemon local.pd.minix
- Xmb-daemon local.pd (means: all newgroups at 'local.pd')
- X
- X
- X
- XDecember 27, 1991 - 13 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X6.2 The MAILING AGENT (XMD)
- X
- X The Usernames on this BBS are Realnames. If your name is "Jack Daniels",
- Xyour UUCP/Internet-ID is "Jack.Daniels@host.domain". Since normal mailing
- Xagents can't handle such IDs, the BBS needs it's own agent.
- X
- X This one is called 'xmd'. It works in two different modes. The first one
- Xscans the ERRMBOX [/usr/spool/mail/postmaster] and delivers all mails with
- Xreceiver "Prename.Name" ("Jack.Daniels") to the BBS-maildrops. Spend a line
- Xin [/usr/lib/crontab] for the execution of 'xmd' every hour.
- X
- X The second mode is used if SMAIL is the systems mailer. Have a look at
- Xthe description of 'alias.sh' (see 2.1.).
- X
- XSYNOPSIS:
- X
- Xxmd Scanns ERRMBOX and delivers mail to BBS-Users
- Xxmd Prename.Name - Delivers mail from STDIN (-) to Prename.Name on BBS
- X
- X
- XEXAMPLE:
- X
- Xxmd Jack.Daniels -
- X
- X
- X
- XDecember 27, 1991 - 14 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X APPENDIX
- X
- X
- XA. DICTIONARY for german Error Codes
- X
- X The ix/MBox (BBS) was created in Germany. That's why all lowlevel comments
- Xand error-codes are written in german.
- X
- X If any of those error-codes appears on your screen, you're really in
- Xtrouble, because they MUSTN'T !!! (But they will :-)
- X
- XGerman Error-Code Meaning
- X-----------------------------------------------------------------------------
- XDatei-Lesefehler BBS can't read the specified file
- XDatei-Schreibfehler BBS can't write the specified file
- XPositionierungsfehler Error in [users.data] (FATAL!)
- XDatei-Erstellungsfehler BBS can't create specified file
- XDatei-Ergaenzungsfehler BBS can't append to specified file
- XDatei gesperrt File locked
- XPRO_ENTRIES zu klein dimensioniert Definition PRO_ENTRIES (mbox.h) to low
- XDatei-Schreib/-Lesefehler BBS can't write/read file
- XZuviele Artikel Too much articles in board/group
- XSpeicherplatz kleiner nnnn Free Bytes lower than nnnn
- XMAX_BEF ueberschritten !! Too much commands in [help.befehle]
- XMAX_MAK ueberschritten !! Too much macros defined
- X
- X If one of the "Datei-XXXX" errors occures, 'touch' the specified file and
- Xcheck the permissions/owners (see APPENDIX B.) - in most cases, that will
- Xhelp.
- X
- X
- X
- XDecember 27, 1991 - 15 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- XB. DIRECTORIES with Permissions and Owners
- X
- XDirectory /mbox
- X===============
- Xdrwxrwx--- 6 root root 896 Dec 27 11:07 .
- Xdrwxr-xr-x 14 bin bin 576 Dec 27 11:00 ..
- X-rw-rw-rw 1 root root 1000 Dec 27 11:30 README
- Xdrwxrwx--- 2 root root 576 Dec 27 10:42 etc
- Xdrwxrwx--- 2 root root 1728 Dec 27 02:05 lib
- X-rwxr-xr-x 1 root root 3912 Dec 21 22:48 mbrsh
- X-rw-r--r-- 1 root root 1562 Aug 10 13:40 rz.cdiff
- Xdrwxrwx--- 2 root root 1536 Dec 27 11:05 src
- Xdrwxrwx--- 19 root root 1920 Dec 26 14:11 usr
- X
- X
- XDirectory /mbox/etc
- X===================
- Xdrwxrwx--- 2 root root 321 Dec 27 11:07 .
- Xdrwxrwx--- 6 root root 896 Dec 27 11:07 ..
- X-rw-rw-rw- 1 root root 3002 Dec 27 02:05 active
- X-rw-rw-r-- 1 root root 829 Dec 8 16:41 alias.sh
- X-rw-r----- 1 root root 2693 Dec 25 12:48 help.befehle
- X-rw-r--r-- 1 root root 16492 Dec 26 14:45 help.hilfe
- X-rw-r--r-- 1 root root 3801 Dec 24 09:57 help.shorthelp
- X-rw-r--r-- 1 root root 701 Dec 8 13:55 inews.sh
- X-rw-rw---- 1 root root 245 Dec 25 13:17 intro
- X-rw-r--r-- 1 root root 243 Dec 7 21:05 logo
- X-rw-rw-rw- 1 root root 16426 Dec 27 02:05 mbd.log
- X-rw-rw---- 1 root root 24080 Dec 27 10:40 mbox.calls
- X-rw-rw---- 1 root root 627 Dec 7 21:05 mbox.editors
- X-rw-r--r-- 1 root root 734 Dec 7 21:05 mbox.games
- X-rw-rw---- 1 root root 5 Dec 27 10:40 mbox.seq
- X-rw-rw---- 1 root root 79 Dec 27 10:42 mbox.who
- X-rw-rw---- 1 root root 44474 Dec 27 00:55 pd.log
- X-rw-rw---- 1 root root 143 Dec 22 16:33 pd.script
- X-rw-rw-rw- 1 root root 14634 Dec 16 21:30 reflector.log
- X-rw-r--r-- 1 root root 727 Dec 8 13:53 rmail.sh
- X-rwxrwx--- 1 root root 21 Dec 7 21:06 tset
- X-rw-r--r-- 1 root root 73416 Dec 27 10:42 users.data
- X-rw-r--r-- 1 root root 4 Dec 26 14:11 users.seq
- X
- X
- X
- XDirectory /mbox/lib
- X===================
- Xdrwxrwx--- 2 root root 1728 Dec 27 02:05 .
- Xdrwxrwx--- 6 root root 896 Dec 27 11:07 ..
- X-rw-rw-rw- 1 root root 4080 Dec 27 02:01 com0ws.x.motif
- X-rw-rw-rw- 1 root root 28880 Dec 27 02:00 comp.os.minix
- X-rw-rw-rw- 1 root root 240 Dec 27 02:01 control
- X-rw-rw-rw- 1 root root 4240 Dec 27 02:01 junk
- X-rw-rw-rw- 1 root root 320 Dec 27 02:01 local.lists
- X-rw-rw-rw- 1 root root 26240 Dec 27 02:02 sub.config
- X-rw-rw-rw- 1 root root 13760 Dec 27 02:02 sub.general
- X-rw-rw-rw- 1 root root 3040 Dec 27 02:03 sub.os.minix
- X
- X
- XDirectory /mbox/usr
- X===================
- Xdrwxrwx--- 19 root root 1920 Dec 26 14:11 .
- Xdrwxrwx--- 6 root root 896 Dec 27 11:07 ..
- Xdrwxrwx--- 2 root root 240 Aug 28 19:27 1
- Xdrwxrwx--- 2 root root 128 Aug 2 19:42 2
- Xdrwxrwx--- 2 root root 192 Dec 11 22:30 3
- Xdrwxrwx--- 2 root root 112 Aug 2 19:42 4
- Xdrwxrwx--- 2 root root 112 Aug 2 19:42 5
- Xdrwxrwx--- 2 root root 112 Aug 2 19:40 6
- Xdrwxrwx--- 2 root root 112 Aug 2 19:42 7
- X
- X
- XDirectory /mbox/usr/1
- X=====================
- Xdrwxrwx--- 2 root root 5680 Dec 27 11:01 .
- Xdrwxrwx--- 19 root root 1920 Dec 26 14:11 ..
- X-rw-rw---- 1 root root 199 Dec 27 10:09 .active
- X-rw-rw---- 1 root root 104 Jun 16 1991 .hello
- X-rw-rw---- 1 root root 12 Dec 26 21:14 .lastsubject
- X-rw-rw---- 1 root root 971 Dec 22 16:48 .makro
- X-rw-rw---- 1 root root 313 Sep 11 19:31 .signature
- X-rw-rw---- 1 root root 606 Sep 13 07:36 1116
- X-rw-rw---- 1 root root 945 Sep 13 10:48 1117
- X-rw-rw---- 1 root root 1168 Sep 13 12:49 1118
- X-rw-rw---- 1 root root 2775 Dec 27 11:01 INDEX
- X-rw-rw---- 1 root root 5 Dec 27 11:01 seq
- X
- X
- XDirectory /usr/bin
- X==================
- X-rwsr-sr-x 1 root root 40684 Dec 26 10:50 /usr/bin/mb-daemon
- X-rwsr-sr-x 1 root root 136604 Dec 26 11:23 /usr/bin/mbox
- X-rwxr-xr-x 1 root root 29408 Dec 15 13:06 /usr/bin/xmd
- X-rwxr-xr-x 1 root root 33228 Dec 26 18:02 /usr/bin/bled
- X
- X
- X
- XDecember 27, 1991 - 16 - ix/MBox
- X
- X
- X
- X
- X
- X
- X
- X
- X
- XC. QUICK REFERENCE put in order by Files
- X
- X2.1. /mbox/etc/alias.sh
- X2.2. /mbox/etc/inews.sh
- X2.3. /mbox/etc/rmail.sh
- X2.4. /mbox/etc/pd.script
- X
- X3.1. /mbox/etc/mbox.editors
- X3.2. /mbox/etc/mbox.games
- X3.3. /mbox/etc/help.befehle
- X3.4. /mbox/etc/help.hilfe
- X3.5. /mbox/etc/help.shorthelp
- X
- X4.1. /mbox/etc/users.data & /mbox/etc/users.seq
- X
- X5.1. /mbox/src/mbox.h
- X5.2. /mbox/src/Makefile
- X
- X
- X
- XDecember 27, 1991 - 17 - ix/MBox
- END_OF_FILE
- if test 27945 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test ! -d 'etc' ; then
- echo shar: Creating directory \"'etc'\"
- mkdir 'etc'
- fi
- if test ! -d 'src' ; then
- echo shar: Creating directory \"'src'\"
- mkdir 'src'
- fi
- if test -f 'src/mb-daemon.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'src/mb-daemon.c'\"
- else
- echo shar: Extracting \"'src/mb-daemon.c'\" \(21389 characters\)
- sed "s/^X//" >'src/mb-daemon.c' <<'END_OF_FILE'
- X/***************************************************************************/
- X/* PROGRAMM ix/Mbox */
- X/* DATEI mb-daemon.c */
- X/* FUNKTIONEN reflector(), scan(), mix(), main() */
- X/* AUTOR vs (Volker Schuermann/MINIX-Version) */
- X/* LETZTE AENDERUNG 31.01.1992 */
- X/***************************************************************************/
- X
- X#ifndef _ESTDIO
- X#include <stdio.h>
- X#else
- X#include <estdio.h>
- X#endif
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X#include <time.h>
- X
- X#include "mbox.h"
- X
- X
- X#define ADDRMODE
- X
- X
- Xint FASTMODE;
- X
- X
- Xint mb_gruppen;
- Xint mb_new;
- Xlong mb_bytes;
- Xlong mb_new_bytes;
- Xlong mb_artikel;
- X
- X#ifdef ADDRMODE
- XFILE *ad;
- X#endif
- X
- X/***************************************************************************/
- X/* FUNKTION reflector() */
- X/* BESCHREIBUNG Sendet eine persoenliche Mail an den Autor eines Arti- */
- X/* kels in einer bestimmten NG. */
- X/* */
- X/* VORSICHT: Wilde Reflectoren werden vom Netz getrennt !!! */
- X/* PARAMETER arg = DUMMY (?) */
- X/* msg = Artikel */
- X/* RUECKGABE -1 = Artikel nicht gefunden */
- X/* 0 = Ok */
- X/***************************************************************************/
- X
- Xint FLAG;
- X
- Xint reflector(arg, msg)
- Xchar arg[];
- Xchar msg[];
- X{
- X FILE *fp;
- X FILE *ff;
- X
- X char s[255];
- X char tmp[STRING];
- X
- X char receiver[STRING];
- X
- X char path[255];
- X char reply_to[255];
- X char from[255];
- X char sender[255];
- X char subject[255];
- X char summary[255];
- X char keywords[255];
- X char newsgroups[255];
- X char followup_to[255];
- X char distribution[255];
- X char date[255];
- X char lines[255];
- X char message_id[255];
- X char organization[255];
- X char posted[255];
- X char article_id[255];
- X char nntp_post[255];
- X char references[255];
- X
- X int id_err = 0;
- X int i;
- X int inlines, ok;
- X
- X int reply = 0;
- X int noreply = 0;
- X int dirlist = 0;
- X int logfile = 0;
- X int info = 0;
- X int minimal = 0;
- X long timer;
- X
- X
- X fp = fopen(msg, "r");
- X if (fp == NULL) return -1;
- X
- X sprintf(tmp, "%s/%d", TMP, getpid());
- X ff = fopen(tmp, "w");
- X
- X i = 1;
- X inlines = -1;
- X
- X while (fgets(s, 255, fp) != NULL) {
- X ok = 0;
- X if (strcomp("Path:", s) == 0) {
- X sprintf(path, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Reply-To:", s) == 0) {
- X sprintf(reply_to, "%02d>> %s <<\n", i, (char *) stripped(s));
- X reply--;
- X ok++;
- X }
- X if (strcomp("From:", s) == 0) {
- X sprintf(from, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Sender:", s) == 0) {
- X sprintf(sender, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Subject:", s) == 0) {
- X sprintf(subject, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Summary:", s) == 0) {
- X sprintf(summary, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Keywords:", s) == 0) {
- X sprintf(keywords, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Newsgroups:", s) == 0) {
- X sprintf(newsgroups, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Followup-To:", s) == 0) {
- X sprintf(followup_to, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Distribution:", s) == 0) {
- X sprintf(distribution, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Date:", s) == 0) {
- X sprintf(date, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Lines:", s) == 0) {
- X sprintf(lines, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Message-I", s) == 0) {
- X sprintf(message_id, "%02d>> %s <<\n", i, (char *) stripped(s));
- X /*
- X if (s[9] == 'D') id_err++;
- X */
- X ok++;
- X }
- X if (strcomp("Organization:", s) == 0) {
- X sprintf(organization, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Posted:", s) == 0) {
- X sprintf(posted, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Article-I.D.:", s) == 0) {
- X sprintf(article_id, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("Nntp-Posting-Host:", s) == 0) {
- X sprintf(nntp_post, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X if (strcomp("References:", s) == 0) {
- X sprintf(references, "%02d>> %s <<\n", i, (char *) stripped(s));
- X ok++;
- X }
- X
- X
- X
- X if (strcomp("NO REPLY", s) == 0 ||
- X strcomp("NOT REPLY", s) == 0 ||
- X strcomp("KEIN REPLY", s) == 0 ||
- X strcomp("NO REPLIES", s) == 0 ||
- X strcomp("KEINE REPLIES", s) == 0 ||
- X strcomp("NO REPLYS", s) == 0 ||
- X strcomp("KEINE REPLYS", s) == 0 ||
- X strcomp("KEINE ANTWORTEN", s) == 0 ||
- X strcomp("NICHT ANTWORTEN", s) == 0 ||
- X strcomp("NO REFLECT", s) == 0 ||
- X strcomp("NOT REFLECT", s) == 0 ||
- X strcomp("NO ANSWER", s) == 0 ||
- X strcomp("NOT ANSWER", s) == 0 ||
- X strcomp("IGNORE", s) == 0)
- X noreply++;
- X
- X if (strcomp("PLEASE REPLY", s) == 0 ||
- X strcomp("BITTE REPLY", s) == 0 ||
- X strcomp("PLEASE REFLECT", s) == 0 ||
- X strcomp("BITTE REFLECT", s) == 0 ||
- X strcomp("BITTE ANTWORT", s) == 0 ||
- X strcomp("REPLY", s) == 0 ||
- X strcomp("REFLECT", s) == 0 ||
- X strcomp("ANTWORT", s) == 0)
- X reply++;
- X
- X if (strcomp("DIRLIST", s) == 0) dirlist++;
- X
- X if (strcomp("LOGFILE", s) == 0) logfile++;
- X
- X if (strcomp("INFO", s) == 0 ||
- X strcomp("HELP", s) == 0)
- X info++;
- X
- X if (strcomp("SHORT", s) == 0) minimal++;
- X
- X if (ok == 0) {
- X /* Sprintf(s, "%02d Body >> %s <<\n\n", i, (char *) stripped(s)); */
- X inlines++;
- X }
- X i++;
- X }
- X fclose(fp);
- X
- X strcpy(s, (char *) strcopy(organization, 19, 80));
- X if ((FLAG == 1) && (strcomp(ORGANIZATION, s) != 0)) return -1;
- X
- X if (reply_to[0] != '\0') {
- X strcpy(receiver, (char *) strcopy(reply_to, 15, 80));
- X } else {
- X strcpy(receiver, (char *) strcopy(from, 11, 80));
- X }
- X
- X i = 0;
- X while ((receiver[i] != '\0') && (receiver[i] != '(')) i++;
- X receiver[(i - 1)] = '\0';
- X
- X
- X
- X time(&timer);
- X
- X fprintf(ff, "From: reflector@%s (Reflecting Device)\n", UUCPID2);
- X fprintf(ff, "Organization: %s\n", ORGANIZATION);
- X if(message_id[0] != '\0'){
- X fprintf(fp, "References: %s", message_id);
- X }
- X fprintf(ff, "To: %s\n", receiver);
- X fprintf(ff, "Subject: *Reflexion*\n");
- X fprintf(ff, "X-Mailer: %s %s %s\n", VERSION, PATCHLEVEL, AUTOR);
- X fprintf(ff, "Message-Id: <%x.reflector@%s>\n", timer, UUCPID2);
- X fputs("\n", ff);
- X
- X
- X
- X fp = fopen(REFLECT_LOG, "a");
- X if (fp == NULL) {
- X while (1) printf("%c", 7);
- X }
- X fprintf(fp, "%s - %s", (char *) mydate(1), from);
- X fprintf(fp, " - %s", message_id);
- X fprintf(fp, " - %s", subject);
- X if (dirlist != 0) {
- X fprintf(fp, " - DIRLIST-Request\n");
- X }
- X if (logfile != 0) {
- X fprintf(fp, " - LOGFILE-Request\n");
- X }
- X if (info != 0) {
- X fprintf(fp, " - INFO-Request\n");
- X }
- X fprintf(fp, " - Reflected to %s\n\n", receiver);
- X fclose(fp);
- X
- X
- X fprintf(ff, "%s\n\n", MVERSION);
- X
- X
- X if ((dirlist == 0) && (logfile == 0) && (info == 0) && (minimal == 0)) {
- X fprintf(ff, "That's what we received in NG \"%s\" ...\n\n", arg);
- X
- X fputs(path, ff);
- X fputs(from, ff);
- X fputs(reply_to, ff);
- X fputs(sender, ff);
- X fputs(newsgroups, ff);
- X fputs(subject, ff);
- X fputs(article_id, ff);
- X fputs(posted, ff);
- X fputs(nntp_post, ff);
- X fputs(summary, ff);
- X fputs(keywords, ff);
- X fputs(followup_to, ff);
- X fputs(distribution, ff);
- X fputs(references, ff);
- X fputs(message_id, ff);
- X fputs(organization, ff);
- X fputs(date, ff);
- X fputs(lines, ff);
- X
- X
- X fputs("\n\nDiagnostics ...\n\n", ff);
- X
- X if (id_err != 0) {
- X fprintf(ff, "- \"Message-ID\" may cause trouble ... use \"Message-Id\".\n\n");
- X }
- X if (reply_to[0] == '\0') {
- X fprintf(ff, "- No \"Reply-To\"-Path ... don't know how to deliever responses.\n\n");
- X }
- X i = atoi((char *) strcopy(lines, 12, 80));
- X inlines--;
- X if (inlines != i) {
- X fprintf(ff, "- Your Header reports %d lines ... we counted %d.\n\n", i, inlines);
- X }
- X if ((reply != 0) || (noreply != 0)) {
- X fprintf(ff, "- Found %d Reply-Requests and %d No-Replies.\n\n", reply, noreply);
- X }
- X }
- X if (dirlist != 0) {
- X fp = fopen(DIRLIST, "r");
- X if (fp != NULL) {
- X fputs("DIRLIST:\n\n", ff);
- X while (fgets(s, 250, fp) != NULL) fputs(s, ff);
- X fclose(fp);
- X } else {
- X fputs("Sorry, no DIRLIST-Entry found ...\n\n", ff);
- X }
- X printf("\n\n");
- X }
- X if (logfile != 0) {
- X fp = fopen(REFLECT_LOG, "r");
- X if (fp != NULL) {
- X fputs("LOGFILE:\n\n", ff);
- X while (fgets(s, 250, fp) != NULL) fputs(s, ff);
- X fclose(fp);
- X } else {
- X fputs("Sorry, no LOGFILE-Entry found ...\n\n", ff);
- X }
- X printf("\n\n");
- X }
- X if (info != 0) {
- X fputs("INFO (weitere Schluesselwoerter):\n\n", ff);
- X fputs("LOGFILE - Wenn der Reflektor nicht reflektiert, kann man sich\n", ff);
- X fputs(" das LOGFILE senden lassen, um zu ueberpruefen ob der\n", ff);
- X fputs(" Artikel jemals erfasst worden ist.\n\n", ff);
- X
- X fputs("DIRLIST - Eine Liste des lokalen MINIX-Archivs. Da der Reflektor\n", ff);
- X fputs(" (noch) kein PD-Server ist, kann man diese Liste nur zu\n", ff);
- X fputs(" Testzwecken anfordern.\n\n", ff);
- X
- X fputs("SHORT - Quittiert nur den Empfang des Artikels.\n\n", ff);
- X }
- X if (minimal != 0) {
- X fprintf(ff, "Received your article %s", message_id);
- X }
- X fclose(ff);
- X
- X sprintf(s, "/bin/sh ./etc/rmail.sh %s %s", tmp, receiver);
- X system(s);
- X
- X unlink(tmp);
- X
- X return 0;
- X}
- X
- X
- X
- X/***************************************************************************/
- X/* FUNKTION pdsize() */
- X/* BESCHREIBUNG Groesse eine PD-Datei ermitteln */
- X/* PARAMETER arg - Name des NG-Eintrags */
- X/* RUECKGABE Groesse in kBytes */
- X/***************************************************************************/
- X
- Xint pdsize( arg )
- Xchar arg[];
- X{
- X FILE *fp;
- X char s[STRING];
- X int ok = 0;
- X struct stat fstat;
- X
- X fp = fopen( arg, "r" );
- X if(fp == NULL){
- X return (int) 0;
- X }
- X while((ok == 0) && (fgets(s, 80, fp) != NULL)){
- X if(strcomp("BINFILE", s) == 0) ok++;
- X }
- X if(ok == 0){
- X fclose(fp);
- X stat(arg, &fstat);
- X return (int) (fstat.st_size / 1024);
- X }
- X
- X fgets(s, 80, fp);
- X fclose(fp);
- X
- X stat((char *) stripped(s), &fstat);
- X return (int) (fstat.st_size / 1024);
- X}
- X
- X
- X
- X
- X
- X
- X
- X
- X/***************************************************************************/
- X/* FUNKTION scan() */
- X/* BESCHREIBUNG Filtert einen NEWS-Artikel, und erstellt einen Eintrag */
- X/* fuer das entsprechenden INDEX-Files der ix/Mbox. */
- X/* PARAMETER arg = NG */
- X/* RUECKGABE Datum des aktuellsten Artikels */
- X/***************************************************************************/
- X
- Xchar *scan(arg)
- Xchar arg[];
- X{
- X FILE *ff;
- X FILE *fp;
- X FILE *fl;
- X FILE *ft;
- X
- X char s[STRING];
- X char t[STRING];
- X char f[STRING];
- X char v[STRING];
- X char num[STRING];
- X char from[STRING];
- X char subj[STRING];
- X char date[STRING];
- X char line[STRING];
- X char orga[STRING];
- X char Ndir[STRING];
- X char Ldir[STRING];
- X char Tdir[STRING];
- X char ex[1024];
- X char et[355];
- X
- X static char sdate[STRING];
- X
- X char today[STRING];
- X char thatday[STRING];
- X char arti[STRING];
- X
- X int i, j;
- X int ok = 0;
- X int a, b;
- X int BINFILE = 0;
- X int PDGROUP = 0;
- X int fsi = 0;
- X int seq = 0;
- X int OLDENTRY = 0;
- X int OLDn = 0;
- X int OLDo = 0;
- X struct stat fstat;
- X struct tm *tp;
- X
- X i = 0;
- X while (arg[i] != '\0') {
- X t[i] = arg[i];
- X if (t[i] == '.') t[i] = '/';
- X i++;
- X }
- X t[i] = '\0';
- X
- X sprintf(Ndir, "%s/%s", NEWS, t);
- X
- X if(length(arg) > 14){
- X s[0] = '\0'; strcat(s, (char *) shortname(arg));
- X sprintf(Ldir, "%s/%s", LIB, s);
- X }
- X else{
- X sprintf(Ldir, "%s/%s", LIB, arg);
- X }
- X sprintf(Tdir, "%s/TD.%d", TMP, getpid());
- X
- X if (FLAG == 0) printf("\n%s...\n", Ndir);
- X
- X sprintf(f, "%s/%dA", TMP, getpid());
- X
- X sprintf(s, "ls %s | sort -nr > %s", Ndir, f);
- X
- X system(s);
- X
- X
- X fl = fopen(f, "r");
- X if (fl == NULL) {
- X if (FLAG == 0) printf("cancelled!");
- X return "";
- X }
- X sprintf(sdate, "%s", ":-)");
- X
- X sprintf(today, "%s", (char *) mydate(1));
- X
- X
- X ft = fopen(Ldir, "r");
- X if(ft == NULL){
- X ft = fopen(Ldir, "w");
- X fputs("\n\n0\n", ft);
- X fclose(ft);
- X ft = fopen(Ldir, "r");
- X OLDo = -2;
- X }
- X fgets(s, 81, ft);
- X fgets(s, 81, ft);
- X fgets(s, 81, ft);
- X OLDENTRY = atoi(s);
- X
- X lockf(Ldir);
- X
- X ff = fopen(Tdir, "w");
- X
- X seq = 0;
- X
- X mb_gruppen++;
- X
- X
- X if(strcomp(PDNG, arg) == 0){
- X PDGROUP++;
- X fprintf(ff, "%s\n", GBL08_MSG);
- X }
- X else{
- X fprintf(ff, "%s\n", GBL05_MSG);
- X }
- X fputs("===============================================================================\n", ff);
- X
- X while (fgets(num, 80, fl) != NULL) {
- X
- X if((atoi(num) < OLDENTRY) && (FASTMODE == 1)) goto YET_SCANNED;
- X
- X OLDn++;
- X
- X seq++;
- X BINFILE = 0;
- X fsi++;
- X
- X strcpy(s, (char *) stripped(num));
- X sprintf(t, "%s/%s", Ndir, s);
- X sprintf(arti, "%s", t);
- X
- X
- X if (FLAG == 0) printf("%s: ", t);
- X
- X fp = fopen(t, "r");
- X if (fp != NULL) {
- X
- X stat(t, &fstat);
- X tp = localtime(&fstat.st_mtime);
- X
- X if(fstat.st_mode & S_IFDIR) goto OFF_HERE;
- X
- X mb_bytes += (long) fstat.st_size;
- X sprintf(thatday, "%02.2d.%02.2d.%02.2d", tp->tm_mday, tp->tm_mon + TZS, tp->tm_year);
- X if(strcomp(thatday, today) == 0) mb_new_bytes += (long) fstat.st_size;
- X
- X if (sdate[0] == ':') {
- X sprintf(sdate, "%4.4d%02.2d%02.2d",
- X 1900 + tp->tm_year, tp->tm_mon + TZS, tp->tm_mday);
- X sprintf(s, "%02.2d:%02.2d",
- X tp->tm_hour, tp->tm_min);
- X LASTTIME = timeconv(s);
- X if (FLAG == 0) printf(" (%s) ", sdate);
- X if(strcomp(thatday, today) == 0) mb_new++;
- X }
- X if (strcomp(arg, REFLECT_NG) == 0) {
- X if (strcomp(thatday, today) == 0) {
- X reflector(arg, t);
- X }
- X }
- X from[0] = '\0';
- X subj[0] = '\0';
- X date[0] = '\0';
- X line[0] = '\0';
- X orga[0] = '\0';
- X
- X for (i = 0; i < 20; i++) {
- X fgets(ex, 350, fp);
- X#ifdef ADDRMODE
- X if (strcomp("de.", arg) == 0) {
- X if (strcomp("Path:", ex) == 0) {
- X fprintf(ad, "%s\n", (char *) stripped(ex));
- X }
- X }
- X#endif
- X ex[80] = '\0'; strcpy(s, ex);
- X if (strcomp("From:", s) == 0) {
- X strcpy(from, s);
- X }
- X if (strcomp("Reply-To:", s) == 0) {
- X strcpy(from, s);
- X }
- X if (strcomp("Subject:", s) == 0) strcpy(subj, s);
- X if (strcomp("Date:", s) == 0) strcpy(date, s);
- X if (strcomp("Lines:", s) == 0) strcpy(line, s);
- X if (strcomp("BINFILE", s) == 0) BINFILE++;
- X if (strcomp("Organization:", s) == 0) strcpy(orga, s);
- X }
- X
- X#ifdef ADDRMODE
- X if (strcomp("de.", arg) == 0) {
- X fprintf(ad, "%s\n", (char *) stripped(from));
- X fprintf(ad, "%s\n", (char *) stripped(orga));
- X }
- X#endif
- X
- X if (FLAG == 0) printf("%s", subj);
- X
- X if ((from[0] == 'F') || (from[0] == 'R')) {
- X
- X strcpy(s, (char *) stripped(num));
- X strcat(s, " ");
- X s[6] = '\0';
- X if (BINFILE != 0) s[5] = '*';
- X
- X subj[79] = '\0';
- X strcpy(ex, (char *) strcopy(subj, 8, 79));
- X strcpy(et, (char *) stripped(ex));
- X strcpy(ex, et);
- X strcat(ex, " ");
- X ex[25] = '\0';
- X strcat(s, ex);
- X strcat(s, " ");
- X
- X
- X i = 8;
- X if (from[0] == 'R') i = 10;
- X
- X from[79] = '\0';
- X strcpy(ex, (char *) strcopy(from, i, 80));
- X strcpy(et, (char *) stripped(ex));
- X strcpy(ex, et);
- X
- X a = 0;
- X b = 0;
- X i = 0;
- X while (ex[i] != '\0') {
- X if (ex[i] == '(') a = i + 1;
- X if (ex[i] == ')') b = i - 1;
- X i++;
- X }
- X if (a < b) {
- X strcpy(et, (char *) strcopy(ex, a, b));
- X strcpy(ex, et);
- X }
- X strcat(ex, " ");
- X ex[19] = '\0';
- X strcat(s, ex);
- X strcat(s, " ");
- X
- X
- X i = 0;
- X j = 0;
- X while (date[i] != '\0') {
- X if (j == 0) {
- X if ((date[i] >= '1') && (date[i] <= '9'))
- X j = i;
- X }
- X i++;
- X }
- X
- X sprintf(ex, "%02.2d.%02.2d.%02.2d %02.2d:%02.2d",
- X tp->tm_mday, tp->tm_mon + TZS, tp->tm_year,
- X tp->tm_hour, tp->tm_min);
- X strcat(ex, " ");
- X ex[15] = '\0';
- X strcat(s, ex);
- X strcat(s, " ");
- X
- X strcpy(ex, (char *) strcopy(line, 7, 20));
- X strcpy(t, (char *) stripped(ex));
- X i = atoi(t);
- X sprintf(ex, "%-6.d", i);
- X
- X if(PDGROUP != 0){
- X sprintf(ex, "%-6.d", pdsize(arti));
- X }
- X
- X strcat(s, ex);
- X fputs(s, ff);
- X fputs("\n", ff);
- X
- X mb_artikel++;
- X
- X ok = 1;
- X } else {
- X if (FLAG == 0) printf("invalid header!\n");
- X }
- X
- X OFF_HERE:
- X
- X if (fp != 0) fclose(fp);
- X } else {
- X if (FLAG == 0) printf("can't open!");
- X }
- X }
- X
- X YET_SCANNED:
- X
- X while(fgets(num, 80, fl) != NULL){
- X fgets(s, 81, ft);
- X fputs(s, ff);
- X strcpy(s, (char *) stripped(num));
- X sprintf(t, "%s/%s", Ndir, s);
- X stat(t, &fstat);
- X mb_bytes += (long) fstat.st_size;
- X mb_artikel++;
- X OLDo++;
- X }
- X fgets(s, 81, ft);
- X if(FASTMODE == 1) fputs(s, ff);
- X
- X if (ff != 0) fclose(ff);
- X if (fl != 0) fclose(fl);
- X if (ft != 0) fclose(ft);
- X
- X fp = fopen( Ldir, "w" );
- X fl = fopen( Tdir, "r" );
- X while(fgets(s, 81, fl) != NULL){
- X fputs(s, fp);
- X }
- X fclose(fp);
- X fclose(fl);
- X
- X unlink(f);
- X unlink(Tdir);
- X
- X if (sdate[0] == ':') {
- X sprintf(sdate, "%s", "19700101");
- X LASTTIME = 0;
- X }
- X
- X#ifdef _SYS7
- X if ((seq > MAX_PER_NG) && (FLAG == 0) && (strcomp("local", arg) != 0)) {
- X sprintf(s, "%s -n %s -e %d", EXPIRE, arg, EXPIRED_DAYS);
- X printf("%s\n", s);
- X system(s);
- X sprintf(s, "%s %s EXP", MB_DAEMON, arg);
- X system(s);
- X }
- X#endif
- X
- X unlockf(Ldir);
- X
- X if((FASTMODE == 1) && (FLAG == 0)){
- X if(OLDn != 0) OLDn -= 1;
- X OLDo += 2;
- X printf("\n==> %s %d. %s %d.\n\n", MBD01_MSG, OLDn, MBD02_MSG, OLDo);
- X }
- X
- X return (char *) sdate;
- X}
- X
- X
- X
- X/***************************************************************************/
- X/* FUNKTION mix() */
- X/* BESCHREIBUNG Aktualisiert einzelnen Eintraege im AGROUPS-File. */
- X/* PARAMETER s = NG */
- X/* t = Neuer AGROUPS-Eintrag */
- X/* RUECKGABE keine */
- X/***************************************************************************/
- X
- Xvoid mix( s, t )
- Xchar s[], t[];
- X{
- X FILE *ff, *fp;
- X char tmp[STRING];
- X char f[STRING];
- X
- X sprintf(tmp, "%s/ff%d", TMP, getpid());
- X
- X
- X maybe_locked( AGROUPS, "r" );
- X fp = fopen( AGROUPS, "r" );
- X if(fp == NULL){
- X printf("%s ?", AGROUPS);
- X exit(-1);
- X }
- X
- X ff = fopen( tmp, "w" );
- X if(ff == NULL){
- X printf("%s ?", tmp);
- X exit(-1);
- X }
- X
- X while(fgets(f, 80, fp) != NULL){
- X if(strcomp(s, f) == 0){
- X fputs(t, ff);
- X }
- X else{
- X fputs(f, ff);
- X }
- X }
- X fclose(fp);
- X fclose(ff);
- X
- X sprintf(f, "mv %s %s", tmp, AGROUPS);
- X system( f );
- X}
- X
- X
- X
- X
- X
- X/***************************************************************************/
- X/* FUNKTION main() (mb_daemon) */
- X/* BESCHREIBUNG Scannt einen bzw. alle NEWS-Artikel, um die INDEX-Files */
- X/* der ix/Mbox zu aktualisieren. */
- X/* PARAMETER argc = Anzahl der Parameter */
- X/* argv = NG = nur diese NG scannen */
- X/* '' = alle NGs scannen */
- X/* RUECKGABE keine */
- X/***************************************************************************/
- X
- Xmain(argc, argv)
- Xint argc;
- Xchar *argv[];
- X{
- X FILE *fp;
- X FILE *fa;
- X char s[STRING];
- X char t[STRING];
- X char d[STRING];
- X
- X
- X int a, b, i;
- X
- X chdir(HOME);
- X
- X setuid(0);
- X setgid(0);
- X umask(0000);
- X
- X FLAG = 0;
- X FASTMODE = 1;
- X
- X if(argc > 1){
- X FLAG++;
- X }
- X if(argc > 2){ /* MB-Daemon ruft MB-Daemon !!! */
- X FLAG++;
- X FASTMODE = 0;
- X }
- X
- X if(strcomp("all", argv[1]) == 0) FLAG = 0;
- X
- X#if 0
- X if(argv[2][0] == '-'){ /* Index KOMPLETT neu bilden !!! */
- X FASTMODE = 0;
- X }
- X#endif
- X
- X if(FLAG == 0){
- X if (fa = fopen(AGROUPS, "w"))
- X fclose(fa);
- X }
- X
- X#ifdef ADDRMODE
- X ad = fopen( "/tmp/local/address/addresses", "a" );
- X#endif
- X
- X mb_gruppen = 0;
- X mb_new = 0;
- X mb_bytes = 0L;
- X mb_new_bytes = 0L;
- X mb_artikel = 0L;
- X
- X
- X if (fp = fopen(NGROUPS, "r"))
- X while (fscanf(fp, "%s %d %d %s", s, &a, &b, t) > 0) {
- X if(FLAG > 0){
- X if(strcomp(argv[1], s) == 0){
- X d[0] = '\0';
- X#ifdef _SYS7
- X strcat(d, (char *) scan(s));
- X#else
- X strcat(d, (char *) scan(&s));
- X#endif
- X sprintf(t, "%s %s %ld\n", s, d, LASTTIME);
- X if(FLAG < 2) mix( s, t );
- X }
- X }
- X else{
- X d[0] = '\0';
- X#ifdef _SYS7
- X strcat(d, (char *) scan(s));
- X#else
- X strcat(d, (char *) scan(&s));
- X#endif
- X fa = fopen(AGROUPS, "a");
- X fprintf(fa, "%s %s %ld\n", s, d, LASTTIME);
- X fclose(fa);
- X }
- X }
- X if(fp != 0) fclose(fp);
- X
- X if(FLAG > 0){
- X }
- X else{
- X mb_bytes = (long)(mb_bytes / 1024);
- X mb_new_bytes = (long)(mb_new_bytes /1024);
- X
- X sprintf(d, "%s/%d.mbd", TMP, getpid());
- X fp = fopen( d, "w" );
- X fprintf(fp, "%s %s %6.d %6.ld",
- X mydate(1), mytime(1), mb_new, mb_new_bytes);
- X fprintf(fp, "%16.16s", " ");
- X fprintf(fp, "%6.d %6.ld %6.ld\n", mb_gruppen, mb_artikel, mb_bytes);
- X
- X b = PRO_ENTRIES / 2; a = 0;
- X
- X fa = fopen( MB_DLOG, "r" );
- X if(fa != 0){
- X while((fgets(s, STRING, fa) != 0) && (a < b)){
- X fputs(s, fp);
- X a++;
- X }
- X fclose(fa);
- X }
- X if(fp != 0) fclose(fp);
- X
- X sprintf(s, "mv %s %s > /dev/null", d, MB_DLOG);
- X system(s);
- X }
- X
- X if((FASTMODE == 1) && (FLAG == 0)){
- X printf("%s %d %s %ld %s.\n", MBD03_MSG, mb_new, MBD04_MSG,
- X mb_new_bytes, MBD05_MSG);
- X printf("%s %d %s %ld %s %ld %s.\n\n",
- X MBD06_MSG, mb_gruppen, MBD07_MSG, mb_artikel, MBD08_MSG,
- X mb_bytes, MBD09_MSG);
- X }
- X
- X
- X#ifdef ADDRMODE
- X if(ad != 0) fclose(ad);
- X#endif
- X
- X return;
- X}
- X
- X
- END_OF_FILE
- if test 21389 -ne `wc -c <'src/mb-daemon.c'`; then
- echo shar: \"'src/mb-daemon.c'\" unpacked with wrong size!
- fi
- # end of 'src/mb-daemon.c'
- fi
- echo shar: End of archive 1 \(of 10\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 10 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-