Path: utzoo!utgpu!water!watmath!uunet!lll-winken!killer!osu-cis!att!icus!lenny From: lenny@icus.UUCP (Lenny Tropiano) Newsgroups: unix-pc.sources Subject: Re: Repost of phdaemon - version #3 Message-ID: <431@icus.UUCP> Date: 17 Jul 88 22:50:22 GMT References: <112@pbhacker.UUCP> Reply-To: lenny@icus.UUCP (Lenny Tropiano) Followup-To: unix-pc.general Distribution: unix-pc Organization: ICUS Software Systems, Islip, New York Lines: 312 [I know this is not a source, it's really a discussion on one, but we don't have a group called unix-pc.sources.d -- I directed all other discussions to unix-pc.general - LBT] In article <112@pbhacker.UUCP> tlh@pbhacker.UUCP (Lee Hounshell) writes: |>I've had a few requests for a repost of the fixed version of phdaemon.. |>for those of you not familiar with it, phdaemon will monitor both |>incoming and outgoing calls on your Unix PC. |> Some phdaemon history... The phdaemon everyone is familiar with was probably the version I wrote. I've been running it here for over 10 months without any problems. There was some work done by Lee Hounshell (tlh@pbhacker) to avoid those "popup smgr windows" that stopped all cron processes in this version of phdaemon, of which he used the version of phdaemon I wrote. Paul Condie (pjc@pcbox) wrote the *original* phdaemon back in October 1987, and posted his version to the net. It had some deficiencies and problems, so I decided to do a total rewrite and get a new-and-improved version. I posted mine back in November, 1987. It had two problems which I addressed later with patches. One was the handling of LCK..ph* files and possibly getting in a race-condition and causing the popup window to show. The second was the popup windows in the error-handling routine, this was later changed to a [!!] icon which did not halt cron processes. |> |>/************************************************************************\ |> ** ** |> ** Program name: phdaemon.c (Phone Daemon) ** |> ** Programmers: original version - Paul J. Condie (UUCP=pcbox!pjc) ** |> ** modified version - Lenny Tropiano (UUCP=icus!lenny) ** |> ** fixes/enhancements - Lee Hounshell (UUCP=pbhacker!tlh) ** |> ** kernel access rtns - Michael Ditto (ford@crash.CTS.COM) ** Note this was a total rewrite... I did give credit to Paul and Mike in my comment section which was somehow changed (for what reason) by Lee Hounshell. I would appreciate if the header information was left in tack, and you just added your revision history and your comments where appropriate. [I thought this was somehow understood when people add to someone else's programs] In the future anyone who modifies one of my programs, please mail me the context diffs so that I can apply them to my source and keep it up to date. This avoids many people having different copies and each supporting their own version. It would be much better to have one person (usually the original author) handle all revision changes and patches. When someone on the net says their "phdaemon isn't working" (for example) each of us wouldn't have to look to figure out who's is at fault. |> ** Date: December 13, 1987 ** |> ** ** |> ************************************************************************ |> ** ** |> ** Program use: Program is run as a daemon process from the boot ** |> ** procedure /etc/rc. It can be placed in /etc/daemons/ ** |> ** and will be started up apon system boot. This program ** |> ** monitors the data line (defined as /dev/ph1) for ** |> ** any kind of activity (or lack thereof) and displays ** |> ** the information in the Phone Managers window. Freeing ** |> ** up any other windows from being allocated for that use ** |> ** ** |> ** This program checks for DATA or VOICE, UUCP logins, ** |> ** User logins, UUCP outgoing, Internal use of outgoing ** |> ** modem. This process will terminate if the /etc/ph ** |> ** process is terminated. ** |> ** ** |> ** Enhancements: Bugs in properly detecting incoming calls have been ** |> ** fixed. The program now reports stray lock files in ** |> ** the status window. Errors are reported by placing ** |> ** "ERROR" in the status window. User logins and errors ** |> ** are now logged in the "/usr/adm/phdaemon.log" file. ** |> ** ** |>\************************************************************************/ |> ... [ rest of the source omitted ] ... Note: I haven't tested Lee's version, although I assume it works as he wouldn't have posted it if it didn't. The only thing that I see might be a problem is the printing of "ERROR" in the ph-window. That will be erased if the phone is picked up (ie. VOICE 1: ACTIVE) or it rings (ie. VOICE 1: 'Makefile' <<'END_OF_FILE' X# X# Makefile to compile phdaemon.c (Phone Daemon) X# By Lenny Tropiano X# (c)1987 ICUS Computer Group UUCP: ...icus!lenny X# XCFLAGS=-v -O XLDFLAGS=-s XLIBS=/lib/crt0s.o /lib/shlib.ifile XDEST=/etc/daemons/ X# Xphdaemon.o: X $(CC) $(CFLAGS) -c phdaemon.c X# Xphdaemon: phdaemon.o X @echo "Loading ..." X $(LD) $(LDFLAGS) -o phdaemon phdaemon.o $(LIBS) X# X# You need to be super-user to do this. X# X/etc/daemons: X mkdir /etc/daemons X chmod 755 /etc/daemons X# Xinstall: phdaemon /etc/daemons X cp phdaemon /etc/daemons/ X chown root /etc/daemons/phdaemon X chgrp bin /etc/daemons/phdaemon X chmod 4750 /etc/daemons/phdaemon X @echo "Phone Daemon started." X /etc/daemons/phdaemon END_OF_FILE if test 664 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(4692 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' XThe phone daemon program was written to keep all those people who jump Xto login when they hear the relay click on the UNIX pc. The program Xwas first written by Paul Condie (pcbox!pjc) for this exact reason! X XI give thanks to Paul and Michael Ditto (ford@crash.CTS.COM) for his Xexpertise in the internals of the AT&T UNIX pc kernel. X XAfter unpacking the shar file, "su" and become root. Then type: X X # make install X XThis will create the phdaemon executable and copy it into /etc/daemons/. XThis directory is looked at by /etc/rc apon boot-up to start all system Xdaemons. If the directory doesn't exist, it will be created. Make sure Xthe following code is in /etc/rc somewhere: X X Xif [ -d /etc/daemons ] Xthen X DAEMONS=`ls /etc/daemons/*` X if [ $? != 0 ] ; then DAEMONS=""; fi X for i in $DAEMONS X do X if [ -x $i ] X then nohup $i > /dev/null 2>&1 & X fi X done Xfi X XThings to know about the Phone Daemon. This program is configured Xfor a multi-line system, where ph0 is the VOICE only line, and ph1 is Xthe DATA/VOICE line. The program will need a few revisions to allow Xto work with a ONE line system. If someone cares to do this, please Xmail me the context diffs. X XThe program will display: X X DATA 2:IDLE - obviously when the line is idle. X DATA 2:PENDING - A process is going out, not sure what it is. X DATA 2:user - When a user locks the modem for outgoing calls X DATA 2:ph1 - When a user locks (not sure what user) going out X (Generally happens when the user uses the async_main X program to dial out) -- The lock file doesn't reflect X the pid of the locking process. -- POSSIBLE BUG? X X The following "machine" is in BOLD video. X X DATA 2:machine - When a uucico process locks modem going out. X DATA 2:icus!lenny X"Usenet the final frontier" ...{cmcl2!phri, hoptoad}!dasys1!/ END_OF_FILE if test 4692 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi echo shar: End of shell archive. exit 0 -- Paper-net: Lenny Tropiano | @-net: lenny@icus.UUCP ICUS Software Systems | !-net: ...att \ PO Box 1 | boulder \ Islip Terrace, NY 11752 | talcott !icus!lenny Vocal-net: (516) 582-5525 [work] | pacbell / (516) 968-8576 [home] | sbcs / Telex-net: 154232428 ICUS | Another-net: attmail!icus!lenny