[comp.sources.amiga] v90i192: mailchk 05 - mail client+server for DNet, Part01/03

Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator) (07/03/90)

Submitted-by: <lobster@quiche.cs.mcgill.ca>
Posting-number: Volume 90, Issue 192
Archive-name: comm/dnet/mailchk-05/part01

[ uuencoded executable enclosed  ...tad ]

  Included below is the latest version of mailchk, a mail
server for dnet.  Mailchk now has a mailbox icon on the
workbench, which you must doubleclick to see the contents
of the mailbox.

Enjoy!

-Stephane

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 3)."
# Contents:  amiga amiga/bin amiga/client amiga/client/Dmakefile
#   amiga/client/mailchk_chip.c amiga/client/mailmenu.h amiga/devs
#   amiga/doc amiga/doc/mailchk.doc amiga/l amiga/server
#   amiga/server/servers.h amiga/version.h unix unix/README.SMAILCHK
#   unix/bin unix/doc unix/doc/smailchk.doc unix/lib unix/lib/Makefile
#   unix/lib/dnetlib.c unix/lib/dnetlib.h unix/server
#   unix/server/Makefile unix/server/servers.h unix/server/smailchk.c
# Wrapped by tadguy@xanth on Tue Jul  3 08:56:44 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d 'amiga' ; then
    echo shar: Creating directory \"'amiga'\"
    mkdir 'amiga'
fi
if test ! -d 'amiga/bin' ; then
    echo shar: Creating directory \"'amiga/bin'\"
    mkdir 'amiga/bin'
fi
if test ! -d 'amiga/client' ; then
    echo shar: Creating directory \"'amiga/client'\"
    mkdir 'amiga/client'
fi
if test -f 'amiga/client/Dmakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amiga/client/Dmakefile'\"
else
echo shar: Extracting \"'amiga/client/Dmakefile'\" \(829 characters\)
sed "s/^X//" >'amiga/client/Dmakefile' <<'END_OF_FILE'
X
X#	DNET CLIENTS
X#
X#  DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved.
X#
X#   Aztec C Compilation and Makefile
X
XLFLAGS	= +Q
XSYMS	= include:symbols.m
XSYMD	= ram:symbols.m
XCFLAGS	= +L +I$(SYMS)
XBIN	= /bin/
XOBDIR	= tmp:dnet/
XSRCS	= *.c
XOBJS	= $(OBDIR)*.o
X
Xall: $(SYMS) /lib/dnetlib.lib /bin/mailchk
X
XOBJS = mailchk.o mailchk_chip.o
X
X/bin/mailchk : $(OBJS)
X	ln $(LFLAGS) mailchk.o -l/lib/dnetlib -la -lsup32 -lc32 +cd \
X	   mailchk_chip.o -o %(left)
X
X
X
Xmailchk.o: mailchk.c
X	cc $(CFLAGS) %(right) -o t:dnet_temp.o
X	copy T:dnet_temp.o %(left)
X	-delete t:dnet_temp.o
X
Xmailchk_chip.o: mailchk_chip.c
X	cc $(CFLAGS) %(right) -o t:dnet_temp.o
X	copy T:dnet_temp.o %(left)
X	-delete t:dnet_temp.o
X
X/lib/dnetlib.lib: /lib/dnetlib.c
X	cd /lib
X	dmake
X	cd /client
X
Xclean:
X	-delete $(OBDIR)#?.o
X
X$(SYMD) : $(SYMS)
X	Copy %(right) %(left)
X
END_OF_FILE
if test 829 -ne `wc -c <'amiga/client/Dmakefile'`; then
    echo shar: \"'amiga/client/Dmakefile'\" unpacked with wrong size!
fi
# end of 'amiga/client/Dmakefile'
fi
if test -f 'amiga/client/mailchk_chip.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amiga/client/mailchk_chip.c'\"
else
echo shar: Extracting \"'amiga/client/mailchk_chip.c'\" \(18977 characters\)
sed "s/^X//" >'amiga/client/mailchk_chip.c' <<'END_OF_FILE'
X/* Busy pointer image */
XUSHORT BusyPointer[48] =
X	{
X	0x0000, 0x0000,
X
X	0x6700, 0xC700,
X	0xCFA0, 0xCFA0,
X	0xBFF0, 0x3FF0,
X	0x70F8, 0x7FF8,
X	0x7DFC, 0x7FFC,
X	0xFBFC, 0xFFFC,
X	0x70FC, 0x7FFC,
X	0x7FFE, 0x7FFE,
X	0x7F0E, 0x7FFE,
X	0x3FDF, 0x3FFF,
X	0x7FBE, 0x7FFE,
X	0x3F0E, 0x3FFE,
X	0x1FFC, 0x1FFC,
X	0x07F8, 0x07F8,
X	0x01E0, 0x01E0,
X	0x0780, 0x0780,
X	0x0FE0, 0x0FE0,
X	0x0740, 0x0740,
X	0x0000, 0x0000,
X	0x0070, 0x0070,
X	0x0078, 0x0078,
X	0x0030, 0x0030,
X
X	0x0000, 0x0000,
X	};
X
X
X
X
XUSHORT MbBitMap[3][48*36] = {
X   {
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x03c0, 0x0000,    /* ......................####...................... */
X   0x0000, 0x3fc0, 0x0000,    /* ..................########...................... */
X   0x0000, 0xffc0, 0x0000,    /* ................##########...................... */
X   0x0000, 0x01c0, 0x0000,    /* .......................###...................... */
X   0x00ff, 0xfdc0, 0x0000,    /* ........##############.###...................... */
X   0x03c0, 0x07c0, 0x0000,    /* ......####...........#####...................... */
X   0x0700, 0x005f, 0x8000,    /* .....###.................#.######............... */
X   0x0700, 0x0040, 0x7f00,    /* .....###.................#.......#######........ */
X   0x0700, 0x0040, 0x80c0,    /* .....###.................#......#.......##...... */
X   0x0700, 0x0043, 0x0020,    /* .....###.................#....##..........#..... */
X   0x0700, 0x0044, 0x0020,    /* .....###.................#...#............#..... */
X   0x0700, 0x0047, 0xc020,    /* .....###.................#...#####........#..... */
X   0x0700, 0x00e7, 0xfe20,    /* .....###................###..##########...#..... */
X   0x0700, 0x0047, 0xe7a0,    /* .....###.................#...######..####.#..... */
X   0x0700, 0x0007, 0xc3e0,    /* .....###.....................#####....#####..... */
X   0x0700, 0x0007, 0xc3e0,    /* .....###.....................#####....#####..... */
X   0x0700, 0x0007, 0xff20,    /* .....###.....................###########..#..... */
X   0x0700, 0x0007, 0xfe20,    /* .....###.....................##########...#..... */
X   0x03e0, 0x0007, 0xfc20,    /* ......#####..................#########....#..... */
X   0x003f, 0x8007, 0xf020,    /* ..........#######............#######......#..... */
X   0x000e, 0xfc07, 0xe7e0,    /* ............###.######.......######..######..... */
X   0x000e, 0x07e7, 0x9e00,    /* ............###......######..####..####......... */
X   0x000e, 0x01ff, 0xf000,    /* ............###........#############............ */
X   0x000e, 0x01c0, 0x0000,    /* ............###........###...................... */
X   0x000e, 0x01c0, 0x0000,    /* ............###........###...................... */
X   0x000e, 0x01c0, 0x0000,    /* ............###........###...................... */
X   0x000e, 0x01c0, 0x0000,    /* ............###........###...................... */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X
X   0xffff, 0xffff, 0xffff,    /* ################################################ */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc03f, 0xf800, 0x0001,    /* ##........###########..........................# */
X   0xc0ff, 0xffa0, 0x0001,    /* ##......#################.#....................# */
X   0xc0ff, 0xffbf, 0x8001,    /* ##......#################.#######..............# */
X   0xc0ff, 0xffbf, 0x7f01,    /* ##......#################.######.#######.......# */
X   0xc0ff, 0xffbc, 0xffc1,    /* ##......#################.####..##########.....# */
X   0xc0ff, 0xffbb, 0xffc1,    /* ##......#################.###.############.....# */
X   0xc0ff, 0xffb8, 0x3fc1,    /* ##......#################.###.....########.....# */
X   0xc0ff, 0xff1b, 0xc1c1,    /* ##......################...##.####.....###.....# */
X   0xc0ff, 0xffbb, 0xe041,    /* ##......#################.###.#####......#.....# */
X   0xc0ff, 0xfffb, 0xc381,    /* ##......#####################.####....###......# */
X   0xc0ff, 0xfff9, 0xc301,    /* ##......#####################..###....##.......# */
X   0xc0ff, 0xfffa, 0xfec1,    /* ##......#####################.#.#######.##.....# */
X   0xc0ff, 0xfffb, 0xfdc1,    /* ##......#####################.########.###.....# */
X   0xc01f, 0xfff9, 0xf3c1,    /* ##.........##################..#####..####.....# */
X   0xc000, 0x7ffb, 0xefc1,    /* ##...............############.#####.######.....# */
X   0xc000, 0x03fb, 0x9801,    /* ##....................#######.###..##..........# */
X   0xc000, 0x001b, 0x6001,    /* ##.........................##.##.##............# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xc000, 0x0000, 0x0001,    /* ##.............................................# */
X   0xffff, 0xffff, 0xffff,    /* ################################################ */
X   },
X
X   {
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0380, 0x0000,    /* ......................###....................... */
X   0x0000, 0x3f80, 0x0000,    /* ..................#######....................... */
X   0x0000, 0xff80, 0x0000,    /* ................#########....................... */
X   0x0000, 0x0180, 0x0000,    /* .......................##....................... */
X   0x00ff, 0xf980, 0x0000,    /* ........#############..##....................... */
X   0x0380, 0x0f80, 0x0000,    /* ......###...........#####....................... */
X   0x0600, 0x00bf, 0x0000,    /* .....##.................#.######................ */
X   0x0600, 0x0080, 0xfe00,    /* .....##.................#.......#######......... */
X   0x0600, 0x0081, 0x0180,    /* .....##.................#......#.......##....... */
X   0x0600, 0x0086, 0x0040,    /* .....##.................#....##..........#...... */
X   0x0600, 0x0088, 0x0040,    /* .....##.................#...#............#...... */
X   0x0600, 0x0088, 0x0240,    /* .....##.................#...#.........#..#...... */
X   0x0600, 0x01c8, 0x0e40,    /* .....##................###..#.......###..#...... */
X   0x0600, 0x0088, 0xfc40,    /* .....##.................#...#...######...#...... */
X   0x0600, 0x0008, 0xf840,    /* .....##.....................#...#####....#...... */
X   0x0600, 0x0008, 0x0040,    /* .....##.....................#............#...... */
X   0x0600, 0x0008, 0x0040,    /* .....##.....................#............#...... */
X   0x0600, 0x0008, 0x0040,    /* .....##.....................#............#...... */
X   0x03c0, 0x0008, 0x0040,    /* ......####..................#............#...... */
X   0x003f, 0x0008, 0x0040,    /* ..........######............#............#...... */
X   0x000c, 0xf808, 0x0fc0,    /* ............##..#####.......#.......######...... */
X   0x000c, 0x07c8, 0x3c00,    /* ............##.......#####..#.....####.......... */
X   0x000c, 0x01ff, 0xe000,    /* ............##.........############............. */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X
X   0xffff, 0xffff, 0xffff,    /* ################################################ */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x807f, 0xf000, 0x0001,    /* #........###########...........................# */
X   0x81ff, 0xff40, 0x0001,    /* #......#################.#.....................# */
X   0x81ff, 0xff7f, 0x0001,    /* #......#################.#######...............# */
X   0x81ff, 0xff7e, 0xfe01,    /* #......#################.######.#######........# */
X   0x81ff, 0xff79, 0xff81,    /* #......#################.####..##########......# */
X   0x81ff, 0xff77, 0xff81,    /* #......#################.###.############......# */
X   0x81ff, 0xff77, 0xff81,    /* #......#################.###.############......# */
X   0x81ff, 0xfe37, 0xff81,    /* #......################...##.############......# */
X   0x81ff, 0xff77, 0xff81,    /* #......#################.###.############......# */
X   0x81ff, 0xfff7, 0xff81,    /* #......#####################.############......# */
X   0x81ff, 0xfff7, 0xff81,    /* #......#####################.############......# */
X   0x81ff, 0xfff7, 0xff81,    /* #......#####################.############......# */
X   0x81ff, 0xfff7, 0xff81,    /* #......#####################.############......# */
X   0x803f, 0xfff7, 0xff81,    /* #.........##################.############......# */
X   0x8000, 0xfff7, 0xff81,    /* #...............############.############......# */
X   0x8000, 0x07f7, 0xf001,    /* #....................#######.#######...........# */
X   0x8000, 0x0037, 0xc001,    /* #.........................##.#####.............# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0xffff, 0xffff, 0xffff,    /* ################################################ */
X   },
X
X   {
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x00ff, 0xf800, 0x0000,    /* ........#############........................... */
X   0x0380, 0x0f80, 0x0000,    /* ......###...........#####....................... */
X   0x0600, 0x007f, 0x0000,    /* .....##..................#######................ */
X   0x0600, 0x0000, 0xfe00,    /* .....##.........................#######......... */
X   0x0600, 0x0001, 0x0180,    /* .....##........................#.......##....... */
X   0x0600, 0x0006, 0x0040,    /* .....##......................##..........#...... */
X   0x0600, 0x0008, 0x0040,    /* .....##.....................#............#...... */
X   0x0600, 0x0088, 0x0240,    /* .....##.................#...#.........#..#...... */
X   0x0607, 0xffc8, 0x0e40,    /* .....##......#############..#.......###..#...... */
X   0x0607, 0x8088, 0xfc40,    /* .....##......####.......#...#...######...#...... */
X   0x0603, 0x0008, 0xf840,    /* .....##.......##............#...#####....#...... */
X   0x0603, 0x0008, 0x0040,    /* .....##.......##............#............#...... */
X   0x0601, 0x0008, 0x0040,    /* .....##........#............#............#...... */
X   0x0600, 0x0008, 0x0040,    /* .....##.....................#............#...... */
X   0x03c0, 0x0008, 0x0040,    /* ......####..................#............#...... */
X   0x003f, 0x0008, 0x0040,    /* ..........######............#............#...... */
X   0x000c, 0xf808, 0x0fc0,    /* ............##..#####.......#.......######...... */
X   0x000c, 0x07c8, 0x3c00,    /* ............##.......#####..#.....####.......... */
X   0x000c, 0x01ff, 0xe000,    /* ............##.........############............. */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x000c, 0x0180, 0x0000,    /* ............##.........##....................... */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X   0x0000, 0x0000, 0x0000,    /* ................................................ */
X
X   0xffff, 0xffff, 0xffff,    /* ################################################ */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x807f, 0xf000, 0x0001,    /* #........###########...........................# */
X   0x81ff, 0xff80, 0x0001,    /* #......##################......................# */
X   0x81ff, 0xffff, 0x0001,    /* #......#########################...............# */
X   0x81ff, 0xfffe, 0xfe01,    /* #......########################.#######........# */
X   0x81ff, 0xfff9, 0xff81,    /* #......######################..##########......# */
X   0x81ff, 0xfff7, 0xff81,    /* #......#####################.############......# */
X   0x81ff, 0xff77, 0xff81,    /* #......#################.###.############......# */
X   0x81f8, 0x0037, 0xff81,    /* #......######.............##.############......# */
X   0x81f8, 0x7f77, 0xff81,    /* #......######....#######.###.############......# */
X   0x81fc, 0xfff7, 0xff81,    /* #......#######..############.############......# */
X   0x81fc, 0xfff7, 0xff81,    /* #......#######..############.############......# */
X   0x81fe, 0xfff7, 0xff81,    /* #......########.############.############......# */
X   0x81ff, 0xfff7, 0xff81,    /* #......#####################.############......# */
X   0x803f, 0xfff7, 0xff81,    /* #.........##################.############......# */
X   0x8000, 0xfff7, 0xff81,    /* #...............############.############......# */
X   0x8000, 0x07f7, 0xf001,    /* #....................#######.#######...........# */
X   0x8000, 0x0037, 0xc001,    /* #.........................##.#####.............# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0x8000, 0x0000, 0x0001,    /* #..............................................# */
X   0xffff, 0xffff, 0xffff,    /* ################################################ */
X   }
X};
X
Xstruct Image MbImage = { 0,0, 48,36, 2, &MbBitMap[2][0], 0x3,0x0, NULL };
X
END_OF_FILE
if test 18977 -ne `wc -c <'amiga/client/mailchk_chip.c'`; then
    echo shar: \"'amiga/client/mailchk_chip.c'\" unpacked with wrong size!
fi
# end of 'amiga/client/mailchk_chip.c'
fi
if test -f 'amiga/client/mailmenu.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amiga/client/mailmenu.h'\"
else
echo shar: Extracting \"'amiga/client/mailmenu.h'\" \(1780 characters\)
sed "s/^X//" >'amiga/client/mailmenu.h' <<'END_OF_FILE'
X/*  mailmenu.h
X *
X *  Menu definitions for mailchk.c
X */
X
X
XITEXT IText1[] = {
X    { 0, 1, JAM2, CHECKWIDTH, 0, NULL, (ubyte *)"Talk"  },
X    { 0, 1, JAM2, CHECKWIDTH, 0, NULL, (ubyte *)"Window"},
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"Remove"         }
X};
X
XITEXT IText2[] = {
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"View"           },
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"Print"          },
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"Delete"         },
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"Save"           },
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"Speak"          },
X    { 0, 1, JAM2, 0, 0, NULL, (ubyte *)"Reply"          },
X};
X
X
XITEM Item1[] = {
X    { &Item1[1], 0, 0, 100, 10, ITEMTEXT|MENUTOGGLE|CHECKIT|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText1[0], NULL },
X    { &Item1[2], 0,10, 100, 10, ITEMTEXT|MENUTOGGLE|CHECKIT|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText1[1], NULL },
X    { NULL     , 0,20, 100, 10, ITEMTEXT|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText1[2], NULL }
X};
X
XITEM Item2[] = {
X    { &Item2[1], 0, 0, 100, 10, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText2[0], NULL, 'V' },
X    { &Item2[2], 0,10, 100, 10, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText2[1], NULL, 'P' },
X    { &Item2[3], 0,20, 100, 10, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText2[2], NULL, 'D' },
X    { &Item2[4], 0,30, 100, 10, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText2[3], NULL, 'S' },
X    { &Item2[5], 0,40, 100, 10, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText2[4], NULL, 'T' },
X    { NULL     , 0,50, 100, 10, ITEMTEXT|COMMSEQ|ITEMENABLED|HIGHCOMP, 0, (APTR)&IText2[5], NULL, 'R'},
X};
X
XMENU Menu[] = {
X    { &Menu[1], 0, 0, 100, 10+20, MENUENABLED, "Project", &Item1[0] },
X    { NULL    , 110, 0, 100, 10+50, MENUENABLED, "Mail", &Item2[0] }
X};
X
END_OF_FILE
if test 1780 -ne `wc -c <'amiga/client/mailmenu.h'`; then
    echo shar: \"'amiga/client/mailmenu.h'\" unpacked with wrong size!
fi
# end of 'amiga/client/mailmenu.h'
fi
if test ! -d 'amiga/devs' ; then
    echo shar: Creating directory \"'amiga/devs'\"
    mkdir 'amiga/devs'
fi
if test ! -d 'amiga/doc' ; then
    echo shar: Creating directory \"'amiga/doc'\"
    mkdir 'amiga/doc'
fi
if test -f 'amiga/doc/mailchk.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amiga/doc/mailchk.doc'\"
else
echo shar: Extracting \"'amiga/doc/mailchk.doc'\" \(5543 characters\)
sed "s/^X//" >'amiga/doc/mailchk.doc' <<'END_OF_FILE'
XAMIGA/MAILCHK
X
X    MAILCHK [-Nnet] [-tupdatetime] [-h] [-s#] [-w#] [-q]
X
X    The -N option specifies the network (default = 0).  This is the same
X    network as was specified when you ran DNET (if was not specified, is 0)
X
X    The -t option specifies the time between checks [DEFAULT = 40s].
X    The -h option displays a help message.
X    The -s option selects speech:
X           -s0 = Do not speak.
X           -s1 = Say things like "You have mail"... [DEFAULT]
X    The -w option selects nowindow/window:
X           -w0 = Do not open a window when mail is received.
X           -w1 = Open a window to display mailbox.  [DEFAULT]
X    The -q option removes the client.  It has no effect if MailChk was
X                  not already running. 
X
X
X    With MAILCHK, you may view letters using you favorite text viewer. 
XThis viewer must be able to read from the DPIPE: device.  I know that TY
Xand MUCHMORE work as expected.  LessV1.3 DOES NOT WORK with the DPIPE:
X(or the PIPE:) device.  The default viewer is SYS:UTILITIES/More.  To
Xchange it, use SETENV PAGER "path/your viewer".  The DPIPE: device must be
Xmounted for this option to work.
X
X    When you first run the program, an icon representing a mailbox
Xwill appear on your workbench screen.  The position of the icon on
Xthe screen can be set with Matt Dillon's config utility.  I think
Xthat the various mailbox images are intuitive enough so I won't
Xdescribe them.  To view the contents of the mailbox, double click on
Xthe icon.
X
XNOTE:  You need ARP.LIBRARY V39.1 to run this program.
X------------------------------------------------------ 
X
XDescription of the switches:
X============================
X
X    The server process on the Unix end must check periodically for new
Xmail.  The -t switch sets the frequency of those checks.  If speech is
Xselected (-s1), the program will use the SPEAK: device to say "You have
Xmail" or "New mail has arrived".  If the -w0 switch is selected, then
Xno window will be opened when mail arrives. In the case of -s0 -w0 being
Xselected, what would have appeared in a window is redirected to the
Xstandard output.
X    The -q switch removes Mailchk.  All the above settings can be
Xmodified at any time by calling the program with the desired switches.
XEg.
X        run mailchk -s0 -t15       ; do not speak, frequency 15 seconds
X        mailchk -s1 -w0            ; speak, but do not open a window
X        mailchk -q                 ; done with the mail client...
X
XDescription of the menus:
X=========================
X
X    There are two menus, Project and Mail, which are available from
Xboth the icon window and the display window (when opened).
X
XProject:
X          
X   Talk   :  Toggle that have the same function as the -s switch
X
X   Window :  Toggle that have the same function as the -w switch
X
X   Remove :  Same effect as typing "mailchk -q" in a CLI.  The client is
X             removed (killed).
X
XMail:
X
X   View   :  View a message previously selected with the mouse.  The
X             text viewer used is More.  If you prefer another viewer,
X             then setenv PAGER to the name of the viewer.
X             Eg. setenv PAGER 'MuchMore'
X             Note:  LessV1.3 does not work with the DPIPE: device, which
X                    just reminded me that the DPIPE: device must be
X                    mounted for this option to work.
X
X   Print  :  Output the selected letter to the PRT: device.
X  
X   Delete :  Remove the selected message from your Unix mailbox.
X             Look in the DNET.LOG file for any errors...
X
X   Save   :  Save the selected message.  This option uses the ARP
X             file requester.
X
X   Speak  :  Send the selected message to the SPEAK:, which must be
X             mounted.  Only the actual message is sent (No use in
X             hearing a bunch of numbers or some unpronouncable
X             addresses, don't you think?).
X             If the environnement variable SPEAKER is set, its value 
X             is taken as the name of the device.
X             Eg. setenv SPEAKER 'SPEAK:opt/f'
X
X   Reply  :  Replies to the selected message using your favorite editor.
X             The program will use 'ed' unless you specified another
X             editor in the environnement variable EDITOR.  
X             You may cancel the operation by quitting the editor without
X             saving.  If for any reasons the reply could not be sent,
X             your letter will be saved in the T: directory under the
X             name "dead.letter".
X
X
XBUGS
X
X    The DPIPE: device seems to choke on big transfers. 
Xavoid reading files that contain a uuencoded program...
XIf the PIPE: device was working with ARP, it would also have simplified
Xthings a bit.
X
X    Also the Reply function does not work reliably.  When you see
X"Transmission error" on the window title bar, it is an indication
Xsomething went wrong.  Just to be sure, I always save the letter I'm
Xcurrently editing in a different file.
X
XDISCLAIMER
X
X    I offer no guarantee that this program will work as advertised.
XThis program is subject to the same distributions conditions specified 
Xin the Dnet documentation.    
X
XNOTE FROM THE PROGRAMMER
X
X    I will continue to improve MailChk.  For this reason, any
Xsuggestions or improvements should be sent to me to ensure that only one
X'official' version exists and that it is the best one.
X
X    Things to look for in future versions:
X       ...A send option. 
X       ...A better narrator.device!?!...
X
X
XStephane Laroche
XApril 25, 1990
X
XBITNET:  B85O@MUSICB.MCGILL.BITNET
X
XBefore (september 1990):  lobster@calvin.cs.mcgill.ca
X    
END_OF_FILE
if test 5543 -ne `wc -c <'amiga/doc/mailchk.doc'`; then
    echo shar: \"'amiga/doc/mailchk.doc'\" unpacked with wrong size!
fi
# end of 'amiga/doc/mailchk.doc'
fi
if test ! -d 'amiga/l' ; then
    echo shar: Creating directory \"'amiga/l'\"
    mkdir 'amiga/l'
fi
if test ! -d 'amiga/server' ; then
    echo shar: Creating directory \"'amiga/server'\"
    mkdir 'amiga/server'
fi
if test -f 'amiga/server/servers.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amiga/server/servers.h'\"
else
echo shar: Extracting \"'amiga/server/servers.h'\" \(643 characters\)
sed "s/^X//" >'amiga/server/servers.h' <<'END_OF_FILE'
X
X/*
X *  SERVERS.H
X *
X *  DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved.
X *
X */
X
X#include "/version.h"
X
X#define PORT_FILECOPY	8192
X#define PORT_ALPHATERM	8193
X#define PORT_ECHO	8194
X#define PORT_IALPHATERM 8195
X#define PORT_AMIGASHELL 8196
X#define PORT_LOADAV	8197
X#define PORT_PRINTER	8198
X#define PORT_PASSWD	8199
X#define PORT_BBS	8200
X#define PORT_GFILECOPY	8201
X#define PORT_MAILCHK    8204
X
X#define DNET_WRITE  "DNET_WRITE"
X#define DNET_READ   "DNET_READ"
X#define DNET_LEVEL  "DNET_LEVEL"
X#define DNET_GROUP  "DNET_GROUP"
X
X#define FS_GROUP    "GR="   /*  MUST INCLUDE '=' cause I use strncmp()  */
X#define FS_ACCESS   "AC="
X
END_OF_FILE
if test 643 -ne `wc -c <'amiga/server/servers.h'`; then
    echo shar: \"'amiga/server/servers.h'\" unpacked with wrong size!
fi
# end of 'amiga/server/servers.h'
fi
if test -f 'amiga/version.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'amiga/version.h'\"
else
echo shar: Extracting \"'amiga/version.h'\" \(527 characters\)
sed "s/^X//" >'amiga/version.h' <<'END_OF_FILE'
X
X#define VERSION 	    "2.01"
X
X#define DNET_VERSION	    ".10"
X#define STATDNET_VERSION    ".04"
X#define PUTFILES_VERSION    ".03"
X#define LOADAV_VERSION	    ".05"
X#define FTERM_VERSION	    ".04"
X#define QUITDNET_VERSION    ".01"
X#define GETFILES_VERSION    ".02"
X#define CLITERM_VERSION     ".01"
X#define MAILCHK_VERSION     ".05"
X
X#define SPRINT_VERSION	    ".01"
X#define SGCOPY_VERSION	    ".01"
X#define SCOPY_VERSION	    ".03"
X#define STERM_VERSION	    ".03"
X#define SCLI_VERSION	    ".02"
X#define SPASSWD_VERSION     ".01"
X
END_OF_FILE
if test 527 -ne `wc -c <'amiga/version.h'`; then
    echo shar: \"'amiga/version.h'\" unpacked with wrong size!
fi
# end of 'amiga/version.h'
fi
if test ! -d 'unix' ; then
    echo shar: Creating directory \"'unix'\"
    mkdir 'unix'
fi
if test -f 'unix/README.SMAILCHK' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/README.SMAILCHK'\"
else
echo shar: Extracting \"'unix/README.SMAILCHK'\" \(143 characters\)
sed "s/^X//" >'unix/README.SMAILCHK' <<'END_OF_FILE'
X
XThe version of dnetlib.c is 2.10.  If you are using a different version,
Xit might be wise to place the correct version of dnetlib.c in lib/ .
END_OF_FILE
if test 143 -ne `wc -c <'unix/README.SMAILCHK'`; then
    echo shar: \"'unix/README.SMAILCHK'\" unpacked with wrong size!
fi
# end of 'unix/README.SMAILCHK'
fi
if test ! -d 'unix/bin' ; then
    echo shar: Creating directory \"'unix/bin'\"
    mkdir 'unix/bin'
fi
if test ! -d 'unix/doc' ; then
    echo shar: Creating directory \"'unix/doc'\"
    mkdir 'unix/doc'
fi
if test -f 'unix/doc/smailchk.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/doc/smailchk.doc'\"
else
echo shar: Extracting \"'unix/doc/smailchk.doc'\" \(784 characters\)
sed "s/^X//" >'unix/doc/smailchk.doc' <<'END_OF_FILE'
X
X
XUNIX/SMAILCHK
X
X
X
X	(Port number 8204: MAILCHK client)
X
X        This server handles only one connection.  You must add an entry in
Xyour 'dnet.servers' file for this server.
X
X      Eg:  8204  /u/home/loginname  /u/home/loginname/dnetbin/smailchk
X
X
X	This server expects to find your mailbox in the /usr/spool/mail
Xdirectory.  If, on your system, your mailbox is located in a different
Xplace, then store the path in the environment variable MAIL.
X
X      Eg.  setenv MAIL /var/spool/mail
X
X	There must a unix "mail" program in your path if you want to use
Xthe Reply option from the Amiga.
X
X	To compile the program, type 'make' in the dnet/unix/server
Xdirectory. 
X
X
X
XStephane Laroche
XMarch 19, 1990
X
XINTERNET:  B85O@MUSICB.MCGILL.CA
X
XBefore (september 1990):  lobster@calvin.cs.mcgill.ca
X 
END_OF_FILE
if test 784 -ne `wc -c <'unix/doc/smailchk.doc'`; then
    echo shar: \"'unix/doc/smailchk.doc'\" unpacked with wrong size!
fi
# end of 'unix/doc/smailchk.doc'
fi
if test ! -d 'unix/lib' ; then
    echo shar: Creating directory \"'unix/lib'\"
    mkdir 'unix/lib'
fi
if test -f 'unix/lib/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/lib/Makefile'\"
else
echo shar: Extracting \"'unix/lib/Makefile'\" \(42 characters\)
sed "s/^X//" >'unix/lib/Makefile' <<'END_OF_FILE'
X
X
Xdnetlib.o : dnetlib.c
X	cc -c dnetlib.c
X
END_OF_FILE
if test 42 -ne `wc -c <'unix/lib/Makefile'`; then
    echo shar: \"'unix/lib/Makefile'\" unpacked with wrong size!
fi
# end of 'unix/lib/Makefile'
fi
if test -f 'unix/lib/dnetlib.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/lib/dnetlib.c'\"
else
echo shar: Extracting \"'unix/lib/dnetlib.c'\" \(6103 characters\)
sed "s/^X//" >'unix/lib/dnetlib.c' <<'END_OF_FILE'
X
X/*
X *  DNETLIB.C
X *
X *	DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved
X *
X *  Library Interface for DNET.
X */
X
X#include <sys/types.h>
X#include <sys/socket.h>
X#include <fcntl.h>
X#include <signal.h>
X#include <stdio.h>
X#include <errno.h>
X#ifdef O_CREAT
X#include <sys/file.h>
X#endif
X#include "../lib/dnetlib.h"
X
Xextern char *getenv();
X
Xtypedef unsigned short uword;
Xtypedef unsigned long ulong;
Xtypedef unsigned char ubyte;
Xtypedef struct sockaddr SOCKADDR;
X
Xtypedef struct {
X	int s;
X	uword port;
X} CHANN;
X
X#define NAMELEN sizeof(".PORT.XXXXX")
X#define NAMEPAT "%s.PORT.%ld"
X
Xchar *getdirpart();
X
XCHANN *
XDListen(port)
Xuword port;
X{
X    CHANN *chan;
X    int s;
X    SOCKADDR *sa = (SOCKADDR *)malloc(sizeof(SOCKADDR)+256);
X    char *dirstr = getenv("DNETDIR") ? getenv("DNETDIR") : "";
X
X    sprintf(sa->sa_data, NAMEPAT, dirstr, port);
X    sa->sa_family = AF_UNIX;
X    unlink(sa->sa_data);
X
X    s = socket(PF_UNIX, SOCK_STREAM, 0);
X    fcntl(s, F_SETOWN, getpid());
X    if (bind(s, sa, sizeof(*sa)-sizeof(sa->sa_data)+strlen(sa->sa_data)) < 0) {
X	close(s);
X	free(sa);
X	return(NULL);
X    }
X    if (listen(s, 5) < 0) {
X	close(s);
X	unlink(sa->sa_data);
X	free(sa);
X	return(NULL);
X    }
X    chan = (CHANN *)malloc(sizeof(CHANN));
X    chan->s = s;
X    chan->port = port;
X    free(sa);
X    return(chan);
X}
X
X
XDUnListen(chan)
XCHANN *chan;
X{
X    char *dirstr = getenv("DNETDIR") ? getenv("DNETDIR") : "";
X    char buf[32];
X
X    close(chan->s);
X    sprintf(buf, NAMEPAT, dirstr, chan->port);
X    unlink(buf);
X    free(chan);
X}
X
XDAccept(chan)
XCHANN *chan;
X{
X    SOCKADDR sa;
X    int addrlen = sizeof(sa);
X    int fd;
X
X    fd = accept(chan->s, &sa, &addrlen);
X    return(fd);
X}
X
XDOpen(host, port, txpri, rxpri)
Xchar *host;
Xuword port;
Xchar txpri, rxpri;
X{
X    int s;
X    char rc;
X    short xb[3];
X    SOCKADDR *sa = (SOCKADDR *)malloc(sizeof(SOCKADDR)+256);
X    char *dirstr = getenv("DNETDIR") ? getenv("DNETDIR") : "";
X
X    if (rxpri < -127)
X	rxpri = -127;
X    if (rxpri > 126)
X	rxpri = 126;
X    if (txpri < -127)
X	txpri = -127;
X    if (txpri > 126)
X	txpri = 126;
X
X    if (host == NULL)
X	host = (getenv("DNETHOST")) ? getenv("DNETHOST"):"3";
X
X    sa->sa_family = AF_UNIX;
X    sprintf(sa->sa_data, "%s%s%s", dirstr, "DNET.", host);
X
X    s = socket(PF_UNIX, SOCK_STREAM, 0);
X    fcntl(s, F_SETOWN, getpid());
X    if (connect(s, sa, sizeof(sa->sa_family) + strlen(sa->sa_data)) < 0) {
X	close(s);
X	free(sa);
X	return(-1);
X    }
X    free(sa);
X    xb[0] = port;
X    ((char *)&xb[1])[0] = txpri;
X    ((char *)&xb[1])[1] = rxpri;
X    write(s, xb, 4);
X    if (read(s, &rc, 1) == 1 && rc == 0)
X	return(s);
X    close(s);
X    return(-1);
X}
X
XDEof(fd)
X{
X    char dummy;
X
X    shutdown(fd, 1);
X    write(fd, &dummy, 0);
X}
X
Xgwrite(fd, buf, bytes)
Xchar *buf;
X{
X    int n;
X    int orig = bytes;
X    extern int errno;
X    while (bytes) {
X	n = write(fd, buf, bytes);
X	if (n > 0) {
X	    bytes -= n;
X	    buf += n;
X	    continue;
X	}
X	if (n < 0) {
X	    if (errno == EINTR)
X		continue;
X	    if (errno == EWOULDBLOCK) {
X		int wm = 1 << fd;
X		int em = 1 << fd;
X		if (select(fd+1, NULL, &wm, &em, NULL) < 0)
X		    continue;
X		if (wm)
X		    continue;
X	    }
X	    return(orig - bytes);
X	}
X    }
X    return(orig);
X}
X
Xgread(fd, buf, bytes)
Xchar *buf;
X{
X    int n;
X    int orig = bytes;
X    extern int errno;
X    while (bytes) {
X	n = read(fd, buf, bytes);
X	if (n > 0) {
X	    bytes -= n;
X	    buf += n;
X	    break;
X	}
X	if (n < 0) {
X	    if (errno == EINTR)
X		continue;
X	    if (errno == EWOULDBLOCK) {
X		int rm = 1 << fd;
X		int em = 1 << fd;
X		if (select(fd+1, &rm, NULL, &em, NULL) < 0)
X		    continue;
X		if (rm)
X		    continue;
X	    }
X	    return(orig - bytes);
X	}
X	if (n == 0)
X	    break;
X    }
X    return(orig - bytes);
X}
X
Xggread(fd, buf, bytes)
Xchar *buf;
X{
X    int n;
X    int ttl = 0;
X    while (bytes) {
X	n = gread(fd, buf, bytes);
X	if (n > 0) {
X	    bytes -= n;
X	    buf += n;
X	    ttl += n;
X	    continue;
X	}
X	return(-1);
X    }
X    return(ttl);
X}
X
X/*
X *	Convert to and from 68000 longword format.  Of course, it really
X *	doesn't matter what format you use, just as long as it is defined.
X */
X
Xntohl68(n)
Xulong n;
X{
X    return(
X	(((ubyte *)&n)[0] << 24)|
X	(((ubyte *)&n)[1] << 16)|
X	(((ubyte *)&n)[2] << 8)|
X	(((ubyte *)&n)[3])
X    );
X}
X
Xhtonl68(n)
Xulong n;
X{
X    ulong v;
X    ((ubyte *)&v)[0] = n >> 24;
X    ((ubyte *)&v)[1] = n >> 16;
X    ((ubyte *)&v)[2] = n >> 8;
X    ((ubyte *)&v)[3] = n;
X    return(v);
X}
X
X
XDoOption(ac, av, ops, args)
Xshort ac;
Xchar *av[];
Xchar *ops;
Xlong args;
X{
X    register short i;
X    short j;
X
X    for (i = j = 1; i < ac; ++i) {
X	register char *ptr = av[i];
X	if (*ptr != '-') {
X	    av[j++] = av[i];
X	    continue;
X	}
X	while (*++ptr) {
X	    register char *op;
X	    long **ap = (long **)&args;
X	    short isshort;
X
X	    for (op = ops; *op && *op != *ptr;) {
X		if (*op == *ptr)
X		    break;
X		if (*++op == '%') {
X		    while (*op && *op != 's' && *op != 'd')
X			++op;
X		    if (*op)
X			++op;
X		}
X		if (*op == ',')     /*  optional ,  */
X		    ++op;
X		++ap;
X	    }
X	    if (*op == 0)
X		return(-1);
X	    if (op[1] != '%') {
X		*(short *)*ap = 1;
X		++ap;
X		continue;
X	    }
X	    op += 2;
X	    isshort = 1;
X	    while (*op && *op != 's' && *op != 'd') {
X		switch(*op) {
X		case 'h':
X		    isshort = 1;
X		    break;
X		case 'l':
X		    isshort = 0;
X		    break;
X		default:
X		    return(-1);
X		}
X		++op;
X	    }
X	    switch(*op) {
X	    case 's':
X		if (ptr[1]) {
X		    *(char **)*ap = ptr + 1;
X		    ptr = "\0";
X		} else {
X		    *(char **)*ap = av[++i];
X		}
X		break;
X	    case 'd':
X		if (isshort)
X		    *(short *)*ap = atoi(++ptr);
X		else
X		    *(long *)*ap = atoi(++ptr);
X		while (*ptr >= '0' && *ptr <= '9')
X		    ++ptr;
X		break;
X	    default:
X		return(-1);
X	    }
X	}
X    }
X    return(j);
X}
X
Xelog(how, ctl, arg)
Xchar *ctl;
Xlong arg;
X{
X    char *dir = getenv("DNETDIR");
X    FILE *fi;
X    char buf[256];
X    long dtime;
X
X    time(&dtime);
X
X    if (!dir)
X	dir = "";
X    sprintf(buf, "%s%s", dir, "DNET.LOG");
X    if (fi = fopen(buf, "a")) {
X	strcpy(buf, ctime(&dtime));
X	buf[strlen(buf)-1] = 0;
X	fprintf(fi, "%s ", buf);
X	fprintf(fi, ctl, arg);
X	putc('\n', fi);
X	fclose(fi);
X    }
X    if (how == EFATAL)
X	exit(1);
X}
X
END_OF_FILE
if test 6103 -ne `wc -c <'unix/lib/dnetlib.c'`; then
    echo shar: \"'unix/lib/dnetlib.c'\" unpacked with wrong size!
fi
# end of 'unix/lib/dnetlib.c'
fi
if test -f 'unix/lib/dnetlib.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/lib/dnetlib.h'\"
else
echo shar: Extracting \"'unix/lib/dnetlib.h'\" \(52 characters\)
sed "s/^X//" >'unix/lib/dnetlib.h' <<'END_OF_FILE'
X
X#define EFATAL 0
X#define EWARN 1
X#define EDEBUG 2
X
END_OF_FILE
if test 52 -ne `wc -c <'unix/lib/dnetlib.h'`; then
    echo shar: \"'unix/lib/dnetlib.h'\" unpacked with wrong size!
fi
# end of 'unix/lib/dnetlib.h'
fi
if test ! -d 'unix/server' ; then
    echo shar: Creating directory \"'unix/server'\"
    mkdir 'unix/server'
fi
if test -f 'unix/server/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/server/Makefile'\"
else
echo shar: Extracting \"'unix/server/Makefile'\" \(765 characters\)
sed "s/^X//" >'unix/server/Makefile' <<'END_OF_FILE'
X
X#	DNET SERVERS
X#
X#
X#	DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved
X
XNETLIB = ../lib/dnetlib.o
XBIN = ../bin
X
X
X#all:	$(NETLIB) $(BIN)/scopy $(BIN)/sshell \
X#	$(BIN)/sloadav $(BIN)/sgcopy $(BIN)/snfs \
X
Xall:	$(NETLIB) $(BIN)/smailchk 
X
X$(NETLIB) : ../lib/dnetlib.c
X	cc -c ../lib/dnetlib.c
X	mv dnetlib.o ../lib
X
X#$(BIN)/snfs:		snfs.o
X#	cc snfs.o $(NETLIB) -o $(BIN)/snfs
X
X#$(BIN)/scopy:		scopy.o
X#	cc scopy.o $(NETLIB) -o $(BIN)/scopy
X
X#$(BIN)/sgcopy:		sgcopy.o
X#	cc sgcopy.o $(NETLIB) -o $(BIN)/sgcopy
X
X#$(BIN)/sshell:    	sshell.o
X#	cc sshell.o $(NETLIB) -o $(BIN)/sshell
X
X#$(BIN)/sloadav:    	sloadav.o
X#	cc sloadav.o $(NETLIB) -o $(BIN)/sloadav
X
X$(BIN)/smailchk:   	smailchk.o
X	cc smailchk.o $(NETLIB) -o $(BIN)/smailchk
X
Xclean:
X	rm -f *.o make.out
X
END_OF_FILE
if test 765 -ne `wc -c <'unix/server/Makefile'`; then
    echo shar: \"'unix/server/Makefile'\" unpacked with wrong size!
fi
# end of 'unix/server/Makefile'
fi
if test -f 'unix/server/servers.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/server/servers.h'\"
else
echo shar: Extracting \"'unix/server/servers.h'\" \(450 characters\)
sed "s/^X//" >'unix/server/servers.h' <<'END_OF_FILE'
X
X/*
X *  SERVERS.H
X *
X *	DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved
X */
X
X#define PORT_FILECOPY	8192
X#define PORT_ALPHATERM	8193
X#define PORT_ECHO	8194
X#define PORT_IALPHATERM 8195
X#define PORT_AMIGATERM	8195
X#define PORT_AMIGASHELL 8196
X#define PORT_LOADAV	8197
X#define PORT_PRINTER	8198
X#define PORT_PASSWD	8199
X#define PORT_BBS	8200
X#define PORT_GFILECOPY	8201
X#define PORT_NFS	8202
X#define PORT_ND		8203
X#define PORT_MAILCHK	8204
X
END_OF_FILE
if test 450 -ne `wc -c <'unix/server/servers.h'`; then
    echo shar: \"'unix/server/servers.h'\" unpacked with wrong size!
fi
# end of 'unix/server/servers.h'
fi
if test -f 'unix/server/smailchk.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'unix/server/smailchk.c'\"
else
echo shar: Extracting \"'unix/server/smailchk.c'\" \(10797 characters\)
sed "s/^X//" >'unix/server/smailchk.c' <<'END_OF_FILE'
X
X/*
X *	SMAILCHK.C
X *
X *	DNET (c)Copyright 1988, Matthew Dillon, All Rights Reserved
X *
X *	Check the mailbox and reports if new mail
X *	has arrived.  Connects to the Mailchk client on the Amiga.
X *	Accepts only one connection.
X *
X *	Written by S. Laroche.
X */
X
X#include <stdio.h>
X#include <sys/time.h>
X#include <sys/file.h>
X#include <errno.h>
X#include <signal.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <strings.h>
X#include <sys/param.h>	  /* for definition of MAXPATHLEN */
X
X#include "servers.h"
X
X#define BUFLENGTH		512L  /* Should be the same as the */
X#define MAILDIR   "/usr/spool/mail/"  /*  def. in mailchk.c on the Amiga */
X
Xextern int errno;
Xextern char *getenv();
X
Xvoid do_mailchk();
Xchar delmailmsg();
Xchar copyfiles();
Xchar sendmail();
X
Xlong numsecs;
Xchar firstrun;
Xint fd;
X
Xmain(ac,av)
Xchar *av[];
X{
X    long chann = DListen(PORT_MAILCHK);
X    char result;
X
X    if (av[1])
X	chdir(av[1]);
X    signal(SIGALRM, do_mailchk);
X    for (;;) {
X	fd = DAccept(chann);
X	if (fd < 0) {
X	    if (errno == EINTR)
X		continue;
X	    break;
X	}
X	getmailpath();
X	while (ggread(fd,&result,1) == 1) {
X          alarm(0); 
X	  Whatdoyouwant(fd,result);
X          if (result > 1) do_mailchk(); 
X          else alarm(numsecs);
X	}
X	close(fd);
X	_exit(1);
X    }
X    perror("SMAILCHK");
X}
X
Xchar buf[BUFLENGTH], mname[MAXPATHLEN];
X
Xgetmailpath()
X
X{
X    char *buffer;
X
X    if ((buffer = getenv("MAIL")) == NULL) {
X       strcpy(mname,MAILDIR);
X    }
X    else {
X       strcpy(mname,buffer);
X       strcat(mname,"/");
X    }
X    strncat(mname, getenv("USER"), MAXPATHLEN - strlen(mname));
X}
X
XWhatdoyouwant(fd,result)
X
Xint fd;
Xchar result;
X
X/*  This function interprets requests from the Amiga client.
X    0 -> Do nothing
X    1 -> Send the headers of each letter.
X    2 -> Send a particular message.
X    3 -> Delete a particular message.
X    4 -> Initial handshake.
X    5 -> Send mail using "mail".
X*/
X
X{
X    char *buffer;
X    unsigned char dummy;
X    int temp;
X    FILE *fi;
X
X    switch(result) {
X	case 1 :
X	  if (fi = fopen(mname, "r")) {
X	      do {
X		temp = produceheader(fi,buf);
X		if (temp < 0) dummy = strlen(buf);
X		else if (temp == 0) break;
X		     else dummy = temp;
X		gwrite(fd,&dummy,1);
X		gwrite(fd,buf,dummy);
X	      } while (temp > 0);
X	  }
X	  else {
X	    perror("SMAILCHK, error opening mailbox");
X	    exit(0);
X	  }
X	  fclose(fi);
X	  dummy = 0;
X	  gwrite(fd,&dummy,1);
X	  break;
X	case 2 :
X	  buffer = (char *) malloc(BUFLENGTH);
X	  if (buffer == NULL) {
X	      fprintf(stderr,"SMAILCHK:  error allocating memory\n");
X	  }
X	  else {
X	      sendmailmsg(fd,mname,buffer);
X	      free(buffer);
X	  }
X	  break;
X	case 3 :
X	  { char ok;
X
X	  ok = delmailmsg(fd,mname);
X	  gwrite(fd,&ok,1);
X	  }
X	  break;
X	case 4 :
X	  if ((ggread(fd,&numsecs,4)  == 4) &&
X	      (ggread(fd,&firstrun,1) == 1)) {
X               fprintf(stderr,"SMAILCHK, frequency = %ld seconds\n",numsecs);
X               break;
X          }
X	  else { close(fd); _exit(1); }
X        case 5 :
X          { char ok = 0, *address;
X
X	    buffer = (char *) malloc(BUFLENGTH);
X	    address = (char *) malloc(BUFLENGTH);
X	    if ((buffer == NULL) || (address == NULL)) {
X	        fprintf(stderr,"SMAILCHK:  error allocating memory\n");
X	    }
X            else {
X                if (ok = sendmail(fd,address,buffer)) {
X                    sprintf(buf,"mail %s < %s",address,buffer);
X                    ok = system(buf) >> 8;
X                    unlink(buffer);
X                    if (ok == 0) ok = 1;
X                    else ok = 0; 
X                }
X                free(buffer);
X                free(address);
X	    }
X            gwrite(fd,&ok,1);
X            break;
X          }
X    }
X}
X
Xvoid do_mailchk()
X
X{
X    char dummy, *s_mtime;
X    struct stat tempbuf;
X    static char nomail = 1;
X    static long lasttime = 0;
X
X    alarm(numsecs);
X    strcpy(buf,"=");
X    if (stat(mname,&tempbuf) == -1 || tempbuf.st_size == 0) {
X	if (errno == ENOENT || tempbuf.st_size == 0) { 
X            if (nomail) {
X		strcpy(buf,"No mail.");
X		nomail = 0;
X            }
X	}
X	else perror("SMAILCHK, Unable to examine file");
X    }
X    else {
X        if (tempbuf.st_mtime > lasttime) {
X	    if (tempbuf.st_mtime >= tempbuf.st_atime) {
X	         s_mtime = ctime(&tempbuf.st_mtime);
X	         strcpy(buf,"New mail arrived on ");
X	         strcat(buf,s_mtime);
X	         nomail = 1;
X	    }
X	    else if (firstrun > 0) strcpy(buf,"You have mail\n");
X            lasttime = tempbuf.st_mtime;
X        }
X    }
X    dummy = strlen(buf);
X    if (dummy > 2) {
X	gwrite(fd, &dummy, 1);
X	gwrite(fd, buf, dummy);
X    }
X    firstrun = 1;
X}
X
Xint produceheader(fi,buf)
X
X/* Produce a header of the form 'N sender, date, subject L/C S'
X * where N = number of the message
X *       L = number of lines in message
X *       C = number of characters in message
X *       S = number of characters in message without header
X * 
X * The function returns the # of chars in the header.  When the last
X * header is encountered, the fn returns -(# of chars).
X */
X
XFILE *fi;
Xchar *buf;
X
X{
X    static int mcnt = -1;
X    static char from = 1, subject = 1, Date = 1;
X    static unsigned long llines = 0, lch = 0, sch2, sch1;
X    unsigned long lines, ch;
X    char line[256], fl, *cp;
X    static char date[60], olddate[60], path[80], oldpath[80];
X    static char sub[80], oldsub[80];
X
X    lines = llines;
X    ch = lch;
X    while (cp = fgets(line, 256, fi)) {
X      lines++;
X      ch += strlen(line);
X      llines++;
X      lch += strlen(line);
X      cp[strlen(line)-1] = '\0';
X      if (!strncmp(line, "From ", 5)) {
X	  mcnt++;
X	  from = 0;
X	  subject = 0;
X	  Date = 0;
X	  if (mcnt > 0) {
X	      strcpy(olddate,date);
X	      strcpy(oldpath,path);
X	      strcpy(oldsub,sub);
X	      strcpy(sub,"(no subject)");
X	      strcpy(date,"(no date)"); 
X	      sch2 = sch1;
X	      llines = 1L;
X	      lch = strlen(line) + 1;
X	  }
X      } else
X	  if (!from && ( !strncmp(line, "From: ", 6) ||
X	       !strncmp(line+1, "From: ", 6) )) {
X	      from = 1;
X	      sch1 = ch;
X	      cp = index(line,'<');
X	      if (cp) *cp++;
X	      else cp = index(line,' ')+1;
X	      strcpy(path, cp);
X	      cp = index(path,'>');
X	      if (!cp) cp = index(path,' ');
X	      if (cp) cp[0] = '\0';
X	      if (mcnt > 0) {
X		  fl = 1;
X		  break;
X	      }
X	  } else
X	      if (!subject && !strncmp(line, "Subject: ", 9)) {
X		  subject = 1;
X		  sch1 = ch;
X		  strncpy(sub,index(line,' ')+1,80);
X	      }
X	      else
X		if (!Date && !strncmp(line,"Date: ",6)) {
X		    Date = 1;
X		    sch1 = ch;
X		    cp = index(line,':') + 1;
X		    while (*cp == ' ' || *cp == '\t') *cp++;
X		    strncpy(date,cp,60);
X		}
X      fl = 0;
X    }
X    if (fl) {
X        sprintf(buf," %d %s",mcnt,oldpath);
X        cp = buf + strlen(buf);
X	sprintf(cp,"  %s, %s %ld/%ld %ld \0",olddate,oldsub,lines-llines,ch-lch,sch2);
X    }
X    else {
X        sprintf(buf," %d %s",mcnt+1,path);
X        cp = buf + strlen(buf);
X        sprintf(cp,"  %s, %s %ld/%ld %ld \0",date,sub,lines,ch,sch1);
X    }
X    if (strlen(buf) > 255) buf[254] = '\0';
X    if (fl) return(strlen(buf));
X    else {
X	mcnt = -1;
X        llines = lch = 0L;
X	return(-strlen(buf));
X    }
X}
X
Xsendmailmsg(fd,mname,buffer)
X
Xchar *buffer, *mname;
Xint fd;
X
X{
X  long len= BUFLENGTH;
X  unsigned long nochars, stchar;
X  char dummy;
X  FILE *fi;
X
X  if (ggread(fd,&stchar,4) == 4) {
X      if (ggread(fd,&nochars,4) == 4) {
X	  if (fi = fopen(mname,"r")) {
X	      if (fseek(fi,stchar,0) < 0) {
X		  fclose(fi);
X		  exit;
X	      }
X	      else {
X		  dummy = 0;
X		  while (nochars > len) {
X			 fread(buffer,1,len,fi);
X			 nochars -= len;
X			 gwrite(fd,&len,4);
X			 gwrite(fd,buffer,len);
X			 ggread(fd,&dummy,1);
X			 if (dummy) break;
X			}
X		  if (dummy == 0) {
X		      if (fread(buffer,1,nochars,fi) != nochars) {
X			  perror("SMAILCHK, unable to read mail file");
X			  exit;
X		      }
X		      gwrite(fd,&nochars,4);
X		      gwrite(fd,buffer,nochars);
X		      ggread(fd,&dummy,1);
X		      nochars = 0L;
X		      gwrite(fd,&nochars,4);
X		  }
X	      }
X	      fclose(fi);
X	   }
X       }
X   }
X}
X
Xchar sendmail(fd,address,fname)
X
Xint fd;
Xchar *address, *fname;
X
X{
X  FILE *fi;
X  char ok = 0, *tname;
X
X  if (!(tname = getenv("DNETDIR"))) return(ok);
X  sprintf(fname,"%smailchk%ld",tname,getpid());
X  {  short len;
X     if (ggread(fd,&len,2) != 2) return(ok);
X     if (ggread(fd,address,len) != len) return(ok);
X  }
X  {  long len;
X     if (ggread(fd,&len,4) != 4) return(ok);
X     if ((fi = fopen(fname, "w")) == NULL) return(ok);
X     while (len > BUFLENGTH) {
X         int count = BUFLENGTH;
X         if (ggread(fd,buf,count) != count) goto fin;
X         if (fwrite(buf,1,count,fi) != count) {
X             perror("SMAILCHK, error while writing");
X             goto fin;
X         }
X         len -= count;
X     }
X     if (len > 0) {
X         if (ggread(fd,buf,len) != len) goto fin;
X         if (fwrite(buf,1,len,fi) != len) {
X             perror("SMAILCHK, error while writing");
X             goto fin; 
X         }
X     }
X     ok = 1;
Xfin: fclose(fi);
X     if (!ok) unlink(fname);
X     return(ok);
X  }
X}
X
Xchar delmailmsg(fd,mname)
X
Xchar *mname;
Xint fd;
X
X{
X  long nochars, stchar;
X  FILE *f1, *f2;
X  char ok = 0, *tname;
X
X
X  if (!(tname = getenv("DNETDIR"))) return(ok);
X  strcpy(buf,tname);
X  strcat(buf,"MAIL0001");
X  if (ggread(fd,&stchar,4) == 4)
X      if (ggread(fd,&nochars,4) == 4)
X	  if ((f1 = fopen(mname,"r")) && (f2 = fopen(buf,"w+"))) {
X	      if (copyfiles(f1,f2,stchar))
X		  if (fseek(f1,nochars,1) == 0)
X		      if (ok = copyfiles(f1,f2,-1)) {
X			  fclose(f1);
X			  if (unlink(mname) < 0) {
X			      perror("SMAILCHK, Error while removing");
X			      fclose(f2);
X			      unlink(buf);
X			      return(0);
X			  }
X			  rewind(f2);
X			  if (f1 = fopen(mname,"w")) {
X			      fchmod(f1,0600);
X			      ok = copyfiles(f2,f1,-1);
X			      fclose(f1);
X			      fclose(f2);
X			      unlink(buf);
X			  }
X			  else {
X			      perror("SMAILCHK, Error writing in spool dir");
X			      fclose(f2);
X			      return(0);
X			  }
X			  if (f1 = fopen(mname,"r")) { /* Touch the file */
X			      char f = 0;
X			      fread(f,1,1,f1);
X			      fseek(f1,0,2);
X			      if (ftell(f1) < 2) f = 1;
X			      fclose(f1);
X			      if (f) unlink(mname);
X			  }
X			  return(ok);
X		      }
X	      perror("SMAILCHK, Error while writing");
X	      fclose(f1);
X	      fclose(f2);
X	      return(0);
X	  }
X  perror("SMAILCHK, Delete operation");
X  return(0);
X}
X
Xchar copyfiles(f1,f2,n)
X
XFILE *f1, *f2;
Xlong n;
X
X{
X  char buffer[1024], ok = 1;
X  int tmp;
X
X  while (n > 1024 || n < 0) {
X    if (n > 0) n -= 1024;
X    if ((tmp = fread(buffer,1,1024,f1)) == 1024)
X	if (fwrite(buffer,1,1024,f2) == 1024)
X	    continue;
X    ok = 0;
X    break;
X  }
X  while (ok && n > 0) {
X      if (fread(buffer,1,n,f1) == n)
X	  if (fwrite(buffer,1,n,f2) == n)
X	      break;
X      ok = 0;
X  }
X  if (n >= 0) return(ok);
X  if (fwrite(buffer,1,tmp,f2) == tmp) ok = 1;
X  return(ok);
X}
END_OF_FILE
if test 10797 -ne `wc -c <'unix/server/smailchk.c'`; then
    echo shar: \"'unix/server/smailchk.c'\" unpacked with wrong size!
fi
# end of 'unix/server/smailchk.c'
fi
echo shar: End of archive 1 \(of 3\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
Mail comments to the moderator at <amiga-request@cs.odu.edu>.
Post requests for sources, and general discussion to comp.sys.amiga.