HDTenEightyP/NetNews huggingface dataset:
From: jim@spitws117.sbil.co.uk (James Gillespie)
Newsgroups: comp.lang.perl
Subject: Prompting for input
Date: 8 Sep 92 14:16:20 GMT
Reply-To: jim@spitws117.sbil.co.uk
Organization: Salomon Brothers International Limited

Yes, it's me again.  Hopefully this problem won't be quite such an own
goal :-)  It is this: I decided to write a little script to execute a
given command on a lot of arguments.  It worked fine.  Then I thought
I'd add a couple of options so that it would say what it was about to
do, and wait for a keyboard input before proceeding.  Then I thought,
"how about a command to skip this occurrence?".  I came up with this
(slightly stripped down):

$command = shift(@ARGV);

 COMMAND:
foreach $file (@ARGV)
{
    print "'$command $file'";
    $ans = getc;
    exit if $ans eq "q";
    next COMMAND if $ans eq "n";
    
    system $command, $file;
}

This works fine as long as you want to either execute everything or
quit part way through, but if you type "n\n" to skip an instance, it
skips that instance alright but executes the next one without a
pause.  It appears to me that there must be something left on STDIN
as a result of entering the string "n\n", but I can't find anything
in the Camel book about such an occurrence, or how to "suck"
everything off STDIN without sending an EOF.  Setting $| doesn't
appear to have any effect.

Does anybody have any idea what's going on and how to fix it?

Perl version 3.0.1.9, patch level 41

Thanks,

Jim Gillespie ----------------------------------------------------
jim@sbil.co.uk              Salomon Brothers International Limited
+44 71 721 2672             ---------------------------------------------------
           "Three strikes and you're history, kiddo!" - Calvin's mom
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Piping to and from a unix command
Originator: tchrist@pixel.convex.com
Date: Sun, 6 Sep 1992 13:58:11 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
Keywords: unix pipe perl
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of jimrutt@walney.com (Jim Rutt):
:
:
:There's an intriguing aside in the O'Reilly & Assoc PERL book page 163 
:in the description of the Open function speaking of using the open 
:function to open a pipe to a unix command:
:
:	"you may not have an open pipe command that pipes both in 
:         and out, though it's easy to build using the _pipe_
:         and _fork_ commands."
:
:Unfortunately as a not very expereinced UNIXer and "C"er, fork and pipe
:just aren't very intuitive for me yet.  

Check out open2.pl in the Perl library.

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    And don't tell me there isn't one bit of difference between null and space,
    because that's exactly how much difference there is.  :-)
            --Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>
From: merlyn@ora.com (Randal L. Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: Tips and Techniques...
Date: 11 Sep 92 00:22:17 GMT
Article-I.D.: romulus.MERLYN.92Sep10172212
Organization: Stonehenge Consulting Services; Portland, Oregon, USA

In article <1992Sep10.005427.18924@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:

	       articles    size    compressed
       lwall       1311    6552    2576
       tchrist     1126    4536    1728
       merlyn       534    1666     576

Ooops... coming up a distant third?  How embarassing. :-)

Anyway, you probably aren't counting all those proselytizing articles
I write in comp.unix.{shell,questions}... that'd surely bring up the
count quite a bit. :-)

I guess it's time to post every script I've written (giggle).

Or maybe the text (so far) of the new book.  (NOT!)

seek(DATA,-26,2);print <DATA> __END__ Just another Perl hacker,
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
Newsgroups: comp.lang.perl
Subject: The Perl Book
From: marcello@deis20.cineca.it (Marcello Dalpasso)
Date: 15 Sep 92 17:55:09 +0100
Distribution: world
Organization: Dept. of Electronics, Computer Science & Systems, Univ. of Bologna, Italy

Hi netters,

who can supply me with a complete reference of "The Perl Book", possibly
including the ISBN code ?

Thanks in advance.

-- 
	Marcello Dalpasso (e-mail: marcello@deis16.cineca.it)
	D.E.I.S. - Department of Electronics, Computer Science and Systems
	Viale Risorgimento 2, I-40136 Bologna, Italy			
	Phone: +39-51-644-3015 (fax: +39-51-644-3073)
Newsgroups: comp.lang.perl,sci.classics,alt.lang.intercal
From: jgd@csd4.csd.uwm.edu (John G Dobnick)
Subject: Re: SCRIPT: Roman numeral conversion
Originator: jgd@csd4.csd.uwm.edu
Reply-To: jgd@csd4.csd.uwm.edu
Organization: University of Wisconsin - Milwaukee
Date: Mon, 7 Sep 1992 06:47:52 GMT

From article by rf@cl.cam.ac.uk (Robin Fairbairns):
> sherman@unx.sas.com (Chris Sherman) writes:
> |> adam@owlnet.rice.edu (Adam Justin Thornton) writes:
> |> 
> |> >Of course, INTERCAL deals with Roman numbers in native mode.
> |> 
> |> Why?
> 
> Whyever not?  [just to pursue the silly follow-up style]

The _real_ reason, of course, is...   Because it's _INTERCAL_ !!   :-}


-- 
John G Dobnick                          ATTnet: (414) 229-5727
Computing Services Division             INTERNET: jgd@uwm.edu
University of Wisconsin - Milwaukee     UUCP: uunet!uwm!jgd

"Knowing how things work is the basis for appreciation,
and is thus a source of civilized delight."  -- William Safire
Newsgroups: comp.lang.perl
From: vannes@srzts304.alcatel.ch (Tom van Nes)
Subject: Re: P-COPS
Organization: Alcatel STR AG Switzerland
Distribution: na
Date: Mon, 14 Sep 1992 08:17:36 GMT

In article <60270@mimsy.umd.edu> folta@cs.umd.edu (Wayne Folta) writes:
>There is a package, COPS, of C/shell out there that checks through a UNIX system
>looking for security holes. It has been ported to perl, evidently, and called
>P-COPS. I found what claimed to be a beta copy somewhere, but is there a final
>copy somewhere?
>
Yes. Get it via ftp from:
Host cert.sei.cmu.edu

    Location: /pub/tools/cops/1.04
	   FILE -rw-r--r--     991232  Mar 10 14:09  cops_104.tar

-- 
+----------V----------+  Tom van Nes         | RFC822:  thomas.vannes@alcatel.ch
| A  L  C  A  T  E  L |  Alcatel STR 1.698   | DECnet:  PSI%4795123920::T_VANNES
+---------------------+  Friesenbergstr. 75  | FAX:	+41 1 465-2411
         S T R           CH-8055 Zuerich     | X.400:   c=CH a=arCom p=Alcatel
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Regexp question/suggestion
Originator: tchrist@pixel.convex.com
Date: Sun, 13 Sep 1992 22:32:21 GMT
Distribution: comp
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of krab@iesd.auc.dk (Kresten Krab Thorup):
:How do I find the number of matches for regexp `R' in a string `S' ?
:My current solution is this:
:
:	$string = 'S';
:	$mathces = ($string =~ s/R/\&/g);
:
:Now, what is the reason for the fact, that regexp-substitusion has the
:value of the number of the matches, while ordinary regexp-match
:hasn't?  To me, it would seem resonable, to have an extra flag, say
:`n' for regular expression matches, so that one could say:
:
:	$matches = ($string =~ /R/n);

We've got one of those:

	$matches++ while $string =~ /R/g;

or if you have ( ) subexpressions that you care about:

    $matches = @substrs = $string =~ /(R)/g;


--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

Pascal, n.: A programming language named after a man who would turn over in
his grave if he knew about it.
Newsgroups: comp.lang.perl
From: muts@fysap.fys.ruu.nl (Peter Mutsaers)
Subject: REXX compared to perl
Organization: Rijks Universiteit Utrecht
Distribution: comp
Date: Mon, 14 Sep 1992 07:29:36 GMT

When reaeding 'SAS compared to perl' an article of M. Haley (spelled
correctly?) came to my mind; his articles are reprinted in a dutch
computer magazine. He stated that for all administration tasks one
should use REXX as it is the only one which is supported on all
platforms. 

Now this person is quite biassed towards old fashioned (but proven)
technology which is used in financial and administrative environments
and I don't trust such statements a lot, but still I became curious
about it. Is REXX something similar to perl, and if so how do they
compare?
--
_________________________________________________________________________
Peter Mutsaers.         |================================================ 
muts@fys.ruu.nl         |        Quod licet bovi, non licet Jovi
Newsgroups: comp.lang.perl
From: pmoore@cix.compulink.co.uk (Paul Moore)
Subject: Use of 'b' templates
Reply-To: pmoore@cix.compulink.co.uk
Date: Wed, 9 Sep 1992 23:21:00 +0000

The subject says it, really. Can somebody tell me how 'b' and 'B' templates
work, in pack() and unpack()? Preferably with a few examples to make things
clear.
 
I have just struggled to an understanding of vec(), but 'b' is beyond me...
 
[NB: if it matters for examples, my machine stores bytes such that
 
   for $i (0..15)
   {
      print vec('31',$i,1) ? '1' : '0';
   }
 
gives 1100110010001100]
 
Thanks in advance for any help...
 
Gustav.

---------------------------------------------------------------------------
Paul Moore (pmoore@cix.compulink.co.uk)   |
---------------------------------------------------------------------------
Rimmer directive #271 states just as clearly "No chance, you metal bastard"
---------------------------------------------------------------------------
From: ian@unipalm.co.uk (Ian Phillipps)
Subject: Length of $' seems broken.
Organization: Unipalm Ltd., 216 Cambridge Science Park, Cambridge CB4 4WA, UK
Date: Tue, 15 Sep 1992 23:47:25 GMT

$_='hello, Larry'; /a/; print length $';

Gives the answer 446468 on a Sunos 4.1.1 with Perl 4.019.
An overestimate? :-)

I first encountered problems when an ms-dos Perl 4.019 entered Nirvana
as a result of a sequence like
	$e =~ /blah/;
	$e = $& . $';

(yeah, I could probably do it with an s/.../ command, except I need
multiline matching, and writing (.|\n)* is against my religion)

I still haven't put my finger on exactly what causes the crash, but
since the last one blew away my MSDOS.SYS file, and all of them need the
BRS, I'm a little reticent at fiddling..

Ian
-- 
Ian Phillipps, Unipalm Ltd, 216 Science Park,		Phone +44 223 420002
Milton Road, Cambridge, CB4 4WA, England.		Phax  +44 223 426868
	print unpack( u,q,9:G5S="!A;F]T:&5R('!E<FP@:&%C:V5R"@``,.'');
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: reopening STDOUT as another stream
Date: 6 Sep 92 04:04:44 GMT
Organization: NetLabs, Inc.

In article <lahv06INN169@jethro.Corp.Sun.COM> tmhoff@oogoody.Corp.Sun.COM writes:
: >If you aren't running an ancient version, ordinary open should work
: >fine for that:    open(STDOUT, "| lpr")
: 
: Not quite what I was looking for. I have DEBUG and LOG output streams.
: Sometimes I want DEBUG and LOG to goto STDOUT, sometimes I want them to
: goto different streams. In C use freopen. 

Sounds more like you want a dupish thingy then.  You can use >&FILEHANLE
to do that.  Suppose you set up environment variables to say where
to put DEBUG and LOG.

	open(DEBUG, $ENV{DEBUG} ? ">$ENV{DEBUG}" : ">&STDOUT");
	open(LOG,   $ENV{LOG}   ? ">$ENV{LOG}"   : ">&STDOUT");

or, written sideways,

	open(DEBUG, ">" . ($ENV{DEBUG} || "&STDOUT"));
	open(LOG,   ">" . ($ENV{LOG}   || "&STDOUT"));

Larry
Newsgroups: comp.lang.perl
From: meissner@osf.org (Michael Meissner)
Subject: Re: Removing duplicates from an array
Organization: Open Software Foundation
Date: Sat, 12 Sep 1992 02:43:54 GMT

In article <lb27g1INNaef@jethro.Corp.Sun.COM>
tmhoff@oogoody.Corp.Sun.COM (Todd Hoff) writes:

| Is there a cool way of removing duplicates from an array? I can think
| of several methods, it could be an option on sort, but what is the
| perl way?

I would think an associtive array:

	%foo = ();
	@array = grep ($foo{$_}++ == 0, @array);
	%foo = ();
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

You are in a twisty little passage of standards, all conflicting.
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Perl language formatting conventions?
Originator: tchrist@pixel.convex.com
Date: Mon, 14 Sep 1992 23:05:56 GMT
Distribution: comp
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of jc@minya.UUCP (John Chambers):
:Sounds like a win to me. Actually, I think it'd be more readable, more
:mnemonic, and might even fit, if you used ':' instead of '=>'. Perhaps
:that's another bit of trivia that could be worth a violent argument or
:three.  Would this conflict with other uses of ':'?

Well, I at least am on record for voting for packname:variable 
as a more intuitive (and parsable) alias for packname'variable.

--tom

-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

    pos += screamnext[pos]  /* does this goof up anywhere? */
        --Larry Wall in util.c from the perl source code
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Tips and Techniques...
Date: 11 Sep 92 17:03:04 GMT
Organization: NetLabs, Inc.

In article <MERLYN.92Sep10172212@romulus.reed.edu> merlyn@ora.com (Randal L. Schwartz) writes:
: Or maybe the text (so far) of the new book.  (NOT!)

Postfix Operators Considered Harmful

Larry
From: kevin@spillman.uucp (Kevin Hoffman)
Subject: help w/userinit() changing environ
Date: Mon, 14 Sep 1992 20:15:19 GMT
Organization: Spillman Data Systems

Hello,

Larry Wall is there a way that userinit() can add/modify/delete the
environment, without causing it to get clobbered in perl's main()?

My userinit() calls putenv() which enlarges the environment (eg. the global
variable environ gets realloc'd which moves it.)  Perl then notices that it
has changed, and clobbers it (see code below.)

The main for perl (with my comments added) is declared as follows:

char rcsid[] = "$RCSfile: perl.c,v $$Revision: 4.0.1.7 $$Date: 92/06/08 14:50:39 $\nPatch level: ###\n";

main(argc,argv,env)
register int argc;
register char **argv;
register char **env;
{
    ...
    userinit(); /* putenv() ( eg. environ= realloc( environ, ... ) ) */
    ...
    if (env != environ)         /* Of course they are now different */
        environ[0] = Nullch;    /* !clobber the environment! (WHY?) */
		/* env= environ;		/* THIS IS WHAT I WANT IT TO DO */
    for (; *env; env++) {       /* build %ENV array from INVALID env */
        if (!(s = index(*env,'=')))
        continue;
        *s++ = '\0';
        str = str_make(s--,0);
        str_magic(str, envstab, 'E', *env, s - *env);
        (void)hstore(stab_hash(envstab), *env, s - *env, str, 0);
        *s = '=';
    }
    ...
}

int
userinit()
{
  char buf[80], *myfil;
  char **oldenv= environ;
  char *getenv(), *strdup();
    strcpy( buf, "MYVAR=/tmp/myfile" );
    if( putenv( strdup(buf) ) || NULL == (myfil= getenv("MYVAR")) )
        fprintf( stderr, "Insufficient memory to putenv %s", buf );
    else if( oldenv != environ )
        fprintf( stderr, "putenv() enlarged the environment and moved it" );
}

Thanks
Kevin Hoffman   kevin@spillman.com   -OR-  ...!uunet!spillman!kevin
From: tmhoff@oogoody.Corp.Sun.COM (Todd Hoff)
Newsgroups: comp.lang.perl
Subject: Re: reopening STDOUT as another stream
Date: 5 Sep 1992 18:27:18 GMT
Organization: Sun Microsystems, Inc.
Distribution: world
Reply-To: tmhoff@oogoody.Corp.Sun.COM
NNTP-Posting-Host: oogoody.corp.sun.com

>If you aren't running an ancient version, ordinary open should work
>fine for that:    open(STDOUT, "| lpr")

Not quite what I was looking for. I have DEBUG and LOG output streams.
Sometimes I want DEBUG and LOG to goto STDOUT, sometimes I want them to
goto different streams. In C use freopen. 


Newsgroups: comp.lang.perl
From: robt@is.morgan.com (Rob Torop)
Subject: Re: What's the difference between `command` and system('command')?
Organization: Morgan Stanley - IS
Date: Fri, 11 Sep 1992 20:18:27 GMT

In article <peter.716216984@merlin>, peter@merlin.acadiau.ca (Peter Steele) writes:
|> >:What the difference between saying `some Unix command` and
|> >:system('some Unix command')?  Are they synonymous?  Are there situations
|> >:where one is better than the other?
|> 
|> >	`cmd`;
|> >	$line = `cmd`;
|> >	@lines = `cmd`;
|> 
|> >returns the output, as it does in the shell.  The first form,
|> >however, throws it away.  system() works much (although not
|> >quite exactly) as it does in C.
|> 
|> Where does error output go (i.e., stderr)? I have an application
|> where I want to capture error output, not stdout.

How about

	@lines = `cmd 2>&1`;

This runs cmd with stderr redirected to stdout.  It works with ksh - I don't know about csh.q

-- Rob Torop

+---------------------------------------------------------------------+
| The views expressed here are neither mine nor those of my employer. |
+---------------------------------------------------------------------+
From: eabcu@cbnewsg.cb.att.com (brian.c.urch)
Newsgroups: comp.lang.perl
Subject: Re: bug in timelocal.pl?
Date: 11 Sep 92 14:13:11 GMT
Distribution: usa
Organization: AT&T Creative Software

In article <920905184508.155@NIKE.CHEME.CMU.EDU> TM1D@NIKE.CHEME.CMU.EDU writes:
>I'm having a problem with &timelocal() in timelocal.pl...  It seems to loop
>forever when called with &timelocal(0,0,0,5,8,1992).
>

I had the same problem a while back.  If you call timelocal with 1's
instead of 0's you shouldn't have any problems:

                    &timelocal(1, 1, 1, 5, 8, 1992);


--
Brian C. Urch
AT&T Creative Software
bcu@addams.att.com
Newsgroups: comp.lang.perl
From: ckd@eff.org (Christopher Davis)
Subject: Re: How to convice awk/sed users to use Perl ?
Organization: Electronic Frontier Foundation Tech Central
Distribution: na
Date: Thu, 10 Sep 1992 04:07:42 GMT

Wayne Folta made quite a few good points.  One more to his list:

Compatibility, or the "what do you mean it's SysV tr and wants brackets?"
Just ask the HP-UX folks who found C news breaking because HP broke awk...
--
Christopher Davis   | ]CALL -151       
<ckd@eff.org>       | *300: 20 DD FB 60
System Administrator| *3D0G            
EFF +1 617 864 0665 | ]CALL 768
From: TM1D@NIKE.CHEME.CMU.EDU
Newsgroups: comp.lang.perl
Subject: bug in timelocal.pl?
Date: 5 Sep 92 22:45:08 GMT
Article-I.D.: NIKE.920905184508.155
Organization: Carnegie Mellon, Pittsburgh, PA

I'm having a problem with &timelocal() in timelocal.pl...  It seems to loop
forever when called with &timelocal(0,0,0,5,8,1992).

A while back I seem to recall a fix being posted here for this problem,
but now I can't find it anywhere.  Does anyone know where I can find this
fix?

Thanks...
--
Tod McQuillin
tm1d@nike.cheme.cmu.edu
From: edwardsk@cuug.ab.ca (Kenneth Edwards 268-6500)
Newsgroups: comp.lang.perl
Subject: Re: Columnization
Date: 12 Sep 92 18:57:30 GMT
Organization: Calgary UNIX Users' Group

In article <1360@minya.UUCP> jc@minya.UUCP (John Chambers) writes:
>> pr -m -t -w# file1 file2 ...
>> where # is the width (default 72).  May be System V only.
>
>Several people have suggested something like this, but I don't see any
>way  that  you can use pr to columnize the output of ls like the above

Do not use the -m option as this would force you to have a file per line.
Use

ls | pr -4 -t

as this produces the desired output on SCO and BULL.

thor:kedwards:/u/kedwards [205] $ ls | pr -4 -t
#.article#	  arch		    bin		      private
News		  art		    lib		      pub
Newsgroups: comp.lang.perl
From: dichter@chdasic.sps.mot.com (Carl Dichter)
Subject: Re: Prompting for input
Organization: SPS
Date: Wed, 9 Sep 1992 17:59:31 GMT

In article <memo.616870@cix.compulink.co.uk>, pmoore@cix.compulink.co.uk (Paul Moore) writes:
|> 
|> In his posting, James Gillespie says:
|>   > pause.  It appears to me that there must be something left
|>   > on STDIN as a result of entering the string "n\n", but I
|>   > can't find anything in the Camel book about such an
|>   > occurrence, or how to "suck" 
|>  
|> Er - what about the "\n"? getc only gets a single character.
|>  
|> Gustav.
|>  
|> ------------------------------------------------------------------------
|> Paul Moore (pmoore@cix.compulink.co.uk)   |
|> ------------------------------------------------------------------------
|> Programming is the process of debugging an empty source file
|> ------------------------------------------------------------------------ 
|> 

That's why Tom says to use <STDIN>.
That way it "eats" the newline too.

----------------------
Carl R. Dichter 			"iwannanugui"
Motorola ASIC Division
email: dichter@chdasic.sps.mot.com
Newsgroups: comp.lang.perl
From: Kevin Burton <noran!iowa!kburton@uunet.uu.net>
Subject: Case dependent substitution
Reply-To: noran!iowa!kburton@uunet.uu.net
Organization: The Internet
Date: Wed, 9 Sep 1992 19:14:33 GMT


I would like to substitute an arbitrary pattern for another, but it all of
the alphabetic characters in the source pattern are upper case I would like
to case the replacement pattern to also force upper case substitution.

For example:

	substitute "abc" in "ABCxyzabc" with "xyz" produces "XYZxyzxyz"
	substitute "abc" in "abcxyzABC" with "xyz" produces "xyzxyzXYZ"

I have started to work on a solution that first searches the string for pattern
matches, checks the mathched patten, then finally makes the appropriate
substitution. This "brute force" method doesn't seem very elegant or efficient
and I was wondering if any of the more experienced perl users could give me
a tip ? 

Thanks.

kburton@noran.com
From: matthew@sunpix.East.Sun.COM (Matthew Stier - Sun NC Development Center)
Newsgroups: comp.lang.perl
Subject: Handling serial ports in perl.
Date: 11 Sep 1992 13:00:00 GMT
Organization: Sun Microsystems, Research Triangle Park, NC
Distribution: world
NNTP-Posting-Host: superdave.east.sun.com
Summary: Anyone have a package to talk to devices?


I'm trying to make a ipc server to talk to a device hanging off a serial 
port on a Sparcstation 1+.

I've been able to emulate 'tip' using the following script, but would to
know if anyone has written a package to talk to devices, or would have an 
idea on how to wrap this into a ipc server. 

{What I'm interested in, is to telnet to a host/port, issue commands which
 the server will feed to the device, and that the reply will be returned
 to requestor.}


#!/usr/bin/perl

$tty =  "/dev/ttya";

$SIG{'INT'} = 'dokill';
sub dokill {
    kill 9,$child if $child;
}

if($child = fork) {
    # Parent
    open(TTY, ">  $tty");
    system("stty raw >  $tty"); # place the tty in the raw mode
    while (<STDIN>) {
        tr/a-z/A-Z/;
        last if /^QUIT/;
        print TTY;
    }
    sleep 1;
    do dokill();
}
else {
    # Child
    open(TTY, "< $tty");
    while(<TTY>) {
        print;
    }
}


-- 
Matthew Lee Stier                          |
Sun Microsystems ---  RTP, NC  27709-3447  |     "Wisconsin   Escapee"
Email: matthew.stier@East.Sun.COM          |
Phone: (919) 469-8300 fax: (919) 460-8355  |