🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
4 messages
4 total messages Started by Richard Coleman Wed, 26 Sep 1990 15:54
named pipes and .plan
#917
Author: Richard Coleman
Date: Wed, 26 Sep 1990 15:54
10 lines
747 bytes
-- 
Could someone send me or post a simple example
of sending program output to .plan when someone uses
the finger command.  It would be greatly appreciated.


           Richard Coleman
           G.E. Simulation & Control Systems
           coleman@sunny.dab.ge.com
Re: named pipes and .plan
#918
Author: Paul John Falstad
Date: Thu, 27 Sep 1990 22:13
31 lines
1492 bytes
In article <5932@ge-dab.GE.COM> coleman@sunny.DAB.GE.COM (Richard Coleman) writes:
>Could someone send me or post a simple example
>of sending program output to .plan when someone uses
>the finger command.  It would be greatly appreciated.

Somebody just posted an 100+ line program that does much the same thing as
this (unless I'm missing something really obvious):

nowhere% cd
nowhere% /usr/etc/mknod .plan p
nowhere% sh
$ while true; do (
> echo This is my .plan.
> /usr/games/fortune         # put whatever you want inside the ( )'s
> ) >.plan; sleep 1; done &
12345
$ exit
nowhere% cat .plan
This is my .plan.
Stupid, n.:
	Losing $25 on the game and $25 on the instant replay.

Also try this inside the plan:

echo Stop fingering me, `w|grep finger|awk '{print $1}'`

Now what am I missing??? Why does this have to be so complicated????

Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
I'd like to answer this question, if I may, in two ways.  Firstly in
my normal voice, and then in a kind of silly high-pitched whine.
Re: named pipes and .plan
#919
Author: Kaleb Keithley
Date: Thu, 27 Sep 1990 23:12
58 lines
1942 bytes
In article coleman@sunny.DAB.GE.COM (Richard Coleman) writes:
>-- 
>Could someone send me or post a simple example
>of sending program output to .plan when someone uses
>the finger command.  It would be greatly appreciated.
>
Here's the one I wrote as a result of this thread.  It does work,
feel free to finger me (kaleb@nutmeg.jpl.nasa.gov) if you doubt my
word.

It may not be the epitome of efficiency, so I'll gladly take tips
on making it better.

#include <time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <fcntl.h>

main ()

{

    int     planfile;
    int     number = 0;
    time_t  tim;
    char    *planmessage = "You are the %d%s person to finger me\nat the tone, the time will be %s\n"; 
    char    target[256];
    char    *consmessage = "you have been fingered\n";
    char    *index2;

    for (;;) {

        planfile = open (".plan", O_WRONLY );

        time (&tim);
        switch (number % 10) {
            case 1: index2 = "st"; break;
            case 2: index2 = "nd"; break;
            case 3: index2 = "rd"; break;
            default: index2 = "th"; break;
        }
        sprintf (target,planmessage, number++, index2, asctime (localtime (&tim)));
        write (planfile, target, strlen (target));

        write (1, consmessage, strlen (consmessage));
        close (planfile);

        sleep (1);

    }
}
	

-- 
Kaleb Keithley                      Jet Propulsion Labs
kaleb@thyme.jpl.nasa.gov

Stirring up trouble again.
Re: named pipes and .plan
#923
Author: Dan Bernstein
Date: Fri, 28 Sep 1990 03:44
10 lines
865 bytes
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. :-)

---Dan
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads