Article View: comp.unix.programmer
Article #932Re: how to put a program into .plan file
From: Paul John Falstad
Date: Fri, 28 Sep 1990 17:45
Date: Fri, 28 Sep 1990 17:45
53 lines
3033 bytes
3033 bytes
In article <10511@panix.UUCP> jsb@panix.UUCP (J. S. B'ach) writes: >In article <2782@idunno.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes: >)The "cool" way to do this is to set up your .plan as a named pipe with >)/etc/mknod. >)Then you simply write a C program that checks the status of the file, >)to see whether someone (the fingerer) has opened it. Then simply >)write your message to the named pipe. You can do many fancy things with this. >And does this C program run all the time checking? No. Or does it sleep >until fingered? Yes. It blocks until the file is opened. Even in the latter case some system resources are >permanently tied up. Now (as Emanuel Kant might say) if everyone were >to do this, the entire process table would fill up! True. I wouldn't do this, but it is a neat hack. This would take up a lot of swap space and process table space. Perhaps you could run it just when you're logged on, and replace the named pipe with a conventional .plan in your .logout. Then again, someone at our site used to have a planserver that would create a new .plan file every 5 seconds, inserting a new funny quote each time. This solution with the named pipes is DEFINITELY preferable to that one, I'm sure you'll agree. On this same subject: In some article somewhere, Dan Bernstein writes: >In article <2884@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul John Falstad) writes: >> Somebody just posted an 100+ line program that does much the same thing as >> this (unless I'm missing something really obvious): > [ shell script deleted ] >> Now what am I missing??? Why does this have to be so complicated???? >Error checking, a couple of extra features, and no wasted execs. If you >don't want to check errors, write code for Berkeley. :-) Oh, well, of course. I was just demonstrating the principle. If I had a planserver, I'd probably make it a C program. I was just showing that a planserver does not have to be some complicated program with select(2) and all that. Some error checking and the extra features could have been added to my shell script as well. The wasted execs are a problem, as they would be with any shell script. Write code for Berkeley.... Hmmm.... -- Here is the address to complain to: pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD CIS: 70016,1355 That address again, sync@thumper.princeton.edu PLink:OHS738 GEnie:OHS738 CIS: 4128 143 1234 937
Technical Details
Message-ID:
<2914@idunno.Princeton.EDU>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!know!samsung!umich!mailrus!cornell!rochester!rutgers!njin!princeton!burn!pfalstadReferences:
<1990Sep26.155456.1656@agate.berkeley.edu> <10511@panix.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!know!samsung!umich!mailrus!cornell!rochester!rutgers!njin!princeton!burn!pfalstad From: pfalstad@burn.Princeton.EDU (Paul John Falstad) Newsgroups: comp.unix.programmer Subject: Re: how to put a program into .plan file Message-ID: <2914@idunno.Princeton.EDU> Date: 28 Sep 90 17:45:38 GMT References: <1990Sep26.155456.1656@agate.berkeley.edu> <10511@panix.UUCP> Sender: news@idunno.Princeton.EDU Organization: Princeton University, Princeton, New Jersey Lines: 53