Mail Delivery Problem

SMTP MAILER postmaster at ecf.ncsl.nist.gov
Sat Aug 11 21:45:47 AEST 1990


 ----Reason for mail failure follows----
Sending mail to host ecf.ncsl.nist.gov :
  Fatal reply code to command 'RCPT TO:<ise.ncsl.nist.gov at ecf.ncsl.nist.gov>':
  550 User "ise.ncsl.nist.gov" Unknown.


 ----Transcript of message follows----
Date: 11 Aug 90 06:51:00 EST
From: info-unix at BRL.MIL
Subject: INFO-UNIX Digest  V10#113
To: "ise.ncsl.nist.gov" <ise.ncsl.nist.gov at ecf.ncsl.nist.gov>

Return-Path: <unixinfo-request at ecf.ncsl.nist.gov>
Received: from SEM.BRL.MIL by ecf.ncsl.nist.gov with SMTP ; 
          Sat, 11 Aug 90 06:50:33 EST
Received: from SEM.BRL.MIL by SEM.BRL.MIL id ab03279; 11 Aug 90 5:58 EDT
Received: from sem.brl.mil by SEM.BRL.MIL id aa03263; 11 Aug 90 5:46 EDT
Date:       Sat, 11 Aug 90 05:45:48 EST
From:       The Moderator (Mike Muuss) <Info-Unix-Request at BRL.MIL>
To:         INFO-UNIX at BRL.MIL
Reply-To:   INFO-UNIX at BRL.MIL
Subject:    INFO-UNIX Digest  V10#113
Message-ID:  <9008110546.aa03263 at SEM.BRL.MIL>

INFO-UNIX Digest          Sat, 11 Aug 1990              V10#113

Today's Topics:
                       book request, want advice
                     Re: book request, want advice
                     Re: reliable reads from pipes
                              Re: Foo Bar
                        Re: KSH recommendations?
                       Re: how to use diff files?
                         Re: ftp in background?
                   Using Lex (and Yacc) on a string.
                 Re: Using Lex (and Yacc) on a string.
           Need program to attach a pseudo tty to tcp/ip port
         Re: Get process name w/o using argv[0] in C function?
 Re:In defense of Larry WAS What's wrong with this Bourne shell script?
Re: ksh question: what's the difference between [ ... ] and [[ ... ]] ?
                          Re: Working with sed
              Needed: "user friendly" batch job scheduler
    article "Get Ready for GNU Software" in Computer World magazine
                        Re: Suid script security
               SUMMARY: finding disk usage of partitions
            HP-UX 7.0 problems with ps(1) and awk(1) in pipe
                            rexecd for ESIX?
               Re: help sought - securing a terminal/line
                        Re: C-shell programming
                  Re: How to tell if a process exists
                         make's usage of VPATH
                  Re: Printer Accounting File Parsing
               Re: backing up an entire unix/xenix system
                         AWK Language Question
              permissions and parameters on terminal line
                                 Emacs
         Demented question -- anyone retargeted yacc for nawk?
                       Timeout on shell command.
-----------------------------------------------------------------

From: Asmodeus <dodgeT at batman.moravian.edu>
Subject: book request, want advice
Keywords: unix books, non-trivial
Date: 1 Aug 90 06:26:50 GMT
To:       info-unix at sem.brl.mil


	I would like the net's advice on (a) good book(s) concerning 
the non-trivial aspects of unix.  I am already familiar w/many of the
commands...that is not a problem...what i want is a book that 
details and explains many of the unix features that separate it from
the smaller operating systems.  Ex.->  devices, virtual memory, perl,
other various shells...basically a good book that doesn't spend too much
time explaining every line-editor and vi to me...tell me something 
interesting...

thanx


-- 
 
 Timothy Dodge  Bernhardt 207 ,Box 134, Moravian College, Bethlehem PA 18018
 ------------  CSNET/INTERNET....dodgeT at moravian.edu        ___________________
 |The keeper of|  UUCP......!rutgers!liberty!batman!dodgeT_|I would if i could
 |strange hours|          In Bill Gates I Trust          |  i can't so i won't
				

-----------------------------

From: Doug Gwyn <gwyn at smoke.brl.mil>
Subject: Re: book request, want advice
Keywords: unix books, non-trivial
Date: 10 Aug 90 21:52:37 GMT
To:       info-unix at sem.brl.mil

In article <1900 at batman.moravian.EDU> dodgeT at batman.moravian.EDU (Asmodeus) writes:
-	I would like the net's advice on (a) good book(s) concerning 
-the non-trivial aspects of unix.  I am already familiar w/many of the
-commands...that is not a problem...what i want is a book that 
-details and explains many of the unix features that separate it from
-the smaller operating systems.  Ex.->  devices, virtual memory, perl,
-other various shells...basically a good book that doesn't spend too much
-time explaining every line-editor and vi to me...tell me something 
-interesting...

Libes & Ressler, "Life With UNIX", would probably tell you much of
what you want to know, but only at a survey level.  For details you
have to dig into lots of places.

-----------------------------

From: Andrew Hume <andrew at alice.uucp>
Subject: Re: reliable reads from pipes
Date: 7 Aug 90 05:35:02 GMT
To:       info-unix at sem.brl.mil



	lest anyone start relying on reads returning whatever is in the pipe,
9th edition and later unices preserved the size of the writes which can
now also exceed the size of the pipe buffer (i think).

-----------------------------

From: "Karen C. Pichnarczyk" <karyn at nssdca.gsfc.nasa.gov>
Subject: Re: Foo Bar
Date: 8 Aug 90 18:31:37 GMT
Sender: news at dftsrv.gsfc.nasa.gov
To:       info-unix at sem.brl.mil

Foo Bar is derived from the abbreviation FUBAR:

F: American English colloquialism for 'messed', or 'destroyed'
   ('nice' people don't use this language)
U: Up
B: Beyond
A: All
R: Recognition 

Karyn

***disclaimer: insert standard disclaimer here

-----------------------------

From: Fredrik Stax{ng <fredriks at kuling.uucp>
Subject: Re: KSH recommendations?
Date: 9 Aug 90 18:58:48 GMT
To:       info-unix at sem.brl.mil

In article <1990Aug08.113542.13266 at iti.uucp> todd at iti.UUCP (maroC ddoT) writes:
>In article <LARRY.90Aug7135159 at focsys.uucp> larry at focsys.uucp (Larry Williamson) writes:
>>I'd like to purchase a copy of the korn shell for ISC's Unix 2.2.
>If you can't find a cheap korn shell, you may want to consider looking into
>GNU's BASH (Bourne Again SHell).  It has a lot of nice features that make the
>korn shell worth while (including emacs & vi style command history editing).
>Best of all.... it's free.

And it works on 2.2. I got it up about a week ago.

>Since ISC just added job control (to 2.2) you may want to keep in mind that
>any korn shell compiled for an earlier ISC probally will not support  any
>job control.

I have not tried to get job control to work yet. There is a bug in 2.2
that bit me. POSIX-compliant mode survives exec, so I had to put
in a call to _setostype(0) before the exec. Also wait() in nojobs.c
needed to be changed to waitpid(). Compile with -Xp.

-- 
Fredrik Stax{ng                | Unix is the last operating system. Any
CS Student at Uppsala University  | new will be strictly in the Unix tradition.
fredriks at kuling.docs.uu.se     |
(+46 18) 46 32 07              |

-----------------------------

From: Dennis Glatting <dennisg at kgw2.bwi.wec.com>
Subject: Re: how to use diff files?
Date: 9 Aug 90 19:53:36 GMT
Followup-To: comp.unix.questions
To:       info-unix at sem.brl.mil

In article <2044.26b890a2 at miavx1.acs.muohio.edu> dastrout at miavx1.acs.muohio.edu (root at next1) writes:
>This may be a silly question, but how do diff files work?  specifically,
>I want to upgrade g++ from 1.37.0 to 1.37.1.  I ftp'ed the diff file, but
>can't seem to get it to work.  I tried ( cat fname.diff ; echo w) | ed
>but that doesn't go.  I would appreciate the responses, and will send a
>summary to be included in the next Freq. Asked Q's.
>

there is a program called "patch".  you can get it from uunet or osu.


>From adnan at sgtech.UUCP Fri Dec  1 05:38:51 1989
Path: kgw2!spca6!uccba!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!hal!ncoast!sgtech!adnan
From: adnan at sgtech.UUCP (Adnan Yaqub)
Newsgroups: comp.sources.wanted
Subject: osu-cis Archive [was Re: pathalias]
Summary: Try the osu-cis archive for all your software needs.
Message-ID: <ADNAN.89Dec1103851 at sgtech.UUCP>
Date: 1 Dec 89 10:38:51 GMT
References: <5006 at quack.UUCP>
Sender: adnan at sgtech.UUCP
Distribution: comp
Organization: Star Gate Technologies, Inc.
Lines: 96
In-reply-to: mrapple at quack.UUCP's message of 29 Nov 89 23:01:43 GMT

In article <5006 at quack.UUCP> mrapple at quack.UUCP (Nick Sayer) writes:

   I don't know if this is the proper way to ask, but if it is,
   how can I get a copy of the pathalias program? Thanks in
   advance for any assistance.

[I am doing a followup because the answer may help a lot of people.]

There is an anonymous UUCP archive called osu-cis which has pathalias
along with lots of other stuff (including the GNU software).  Here is
their "how to get" file (edited to save space).  Call them up and grab
your own copy of GNU.how-to-get.  It will tell you how to get
pathalias.  I also recommend looking at their ls-lR.Z file.

 -----
-rw-rw-r--  1 karl        28633 Nov 20 08:57 GNU.how-to-get

This file (osu-cis!~/GNU.how-to-get) describes how to get the
following software from osu-cis via semi-anonymous UUCP:

C++ Test Suite	Compress	ET++	GNU /bin Utilities
GNU Assembler GNU Awk	GNU Bash	GNU Bison
GNU C++ Compiler	GNU C++ Library	GNU C Compiler	GNU Chess
GNU DBM	GNU Debugger	GNU Diff	GNU Emacs
GNU Emacs Ada support	GNU Emacs Franz interface
GNU Emacs Lisp Manual	GNU Go	GNU Gperf & Cperf	GNU Grep
GNU Indent	GNU Lex	GNU Make	GNU Pins & Art
GNU Plot & Plot2PS	GNU Sed	GNU Tar	GNUS	Ghostscript	Gnews
Ispell	JOVE	KA9Q	Kermit	Leif	MIT C Scheme	Mg2a	NNTP
News	Oops	PCRRN	Patch	Pathalias	Protoize
Proxy ARP	RCS	RFCs & IDEAS	SB Prolog	STDWIN
Sendmail	Smail	Tcsh	VM

There's a lot of other available miscellany that isn't explicitly
listed here.  You can find out about it in the file osu-cis!~/ls-lR.Z

The Computer and Information Science Department of the Ohio State
University provides Free Software Foundation GNU products (and others)
via UUCP only as a redistribution service.  Anything found here is
only and exactly as it would be found on the indicated Internet hosts,
were one to acquire it via anonymous FTP (like we did); or else saved
it as it flowed past on the Usenet source distribution newsgroups.
OSU CIS takes no responsibility for the contents of any of the
distributions described in this message.  See the Distribution
document (emacs/etc/DISTRIB when you unpack and build Emacs) and the
GNU Emacs General Public License (emacs/etc/COPYING, similarly).

Much of the GNU software is in beta-test.  For a list of the current
statuses (stati?), ask gnu at prep.ai.mit.edu for a copy of the latest
FSF order form.

How to reach osu-cis via uucp
===============================
Here is a set of L.sys or Systems file lines suitable for osu-cis:

#
# Direct Trailblazer
#
osu-cis Any ACU 19200 1-614-292-5112 in:--in:--in: Uanon
#
# Direct V.32 (MNP 4)
#
osu-cis Any ACU 9600 1-614-292-1153 in:--in:--in: Uanon
#
# Micom port selector, at 1200, 2400, or 9600 bps.
# Replace ##'s below with 12, 24, or 96 (both speed and phone number).
# NOTE: 9600 bps Micom access may not yet be operational, or may be flaky.
#
osu-cis Any ACU ##00 1-614-292-31## "" \r\c Name? osu-cis nected \c GO \d\r\d\r\d\r in:--in:--in: Uanon

Modify as appropriate for your site, of course, to deal with your
local telephone system.  There are no limitations concerning the hours
of the day you may call.

We are deeply grateful to Philips Components of Eindhoven, the
Netherlands for the donation of a Trailblazer Plus and a Codex 2264
for use by the community at large.

Where the files are
===================
Most items exist on osu-cis for distribution purposes in compressed
tar form, exactly what you find on the indicated hosts in the
specified origin files.  Most items are cut into pieces for the sake
of uucp sanity.  This separation helps if your uucp session fails
midway through a conversation; you need restart only with the part
that failed, rather than the whole beast.  The pieces are typically
named with a root word, followed by letter pairs like "aa" and "bj,"
meaning that the pieces are all named with the root word, followed by
a dash and the suffixes indicated, using the letters inclusive between
the two limits.  All pieces but the last are 100,000 bytes long, and
the fragmentary last piece has some smaller size.
 -----
--
Adnan Yaqub
Star Gate Technologies, 29300 Aurora Rd., Solon, OH, USA, +1 216 349 1860
 ...cwjcc!ncoast!sgtech!adnan ...uunet!abvax!sgtech!adnan


-- 

--
 dennisg at kgw2.bwi.WEC.COM   | Dennis P. Glatting
 ..!uunet!tron!kgw2!dennisg |

-----------------------------

From: skidrow at ceres.ucsc.edu
Subject: Re: ftp in background?
Keywords: ftp, background
Date: 9 Aug 90 20:33:38 GMT
Sender: usenet at darkstar.ucsc.edu
To:       info-unix at sem.brl.mil

masticol at athos.rutgers.edu (Steve Masticola) writes:


>I would like to ftp in several files from a remote site (using
>anonymous ftp). The site is busy during most daylight hours, and even
>when I can connect, the connection has been unreliable. Is there any
>utility that can transfer files in background, and will retry on a
>broken or uncompleted connection?

>Thanks for your help,
>- Steve (masticol at athos.rutgers.edu)

	Annette DeSchon has written a background FTP utility (BFTP)
	which you can use to repeatedly attempt to copy files over
	the net.  BFTP features session logging to record errors,
	verification of transfer parameters prior to copying, and
	many other useful features.

	Really handy for connecting to ftp-servers in obscure foreign
	places, or overloaded servers with time/user limits.

	Available at gatekeeper.dec.com (pub/net) and most other
	PD-sites.  There's an RFC that covers it.

						- Gary M. Lin
						skidrow at ceres.ucsc.edu

-----------------------------

From: John Lacey <john at basho.uucp>
Subject: Using Lex (and Yacc) on a string.
Date: 10 Aug 90 01:29:27 GMT
To:       info-unix at sem.brl.mil

Normally, of course, one wants a scanner (and a parser) to work from 
a file, perhaps stdin.  Sigh.  Well, I want one that works from a string.

I am using Flex 2.3, and Bison 1.11.  I tried the following few #define's:

#undef  YY_INPUT
#define YY_INPUT(buf,result,max_size) \
{ \
for ( result = 0;  *ch_this && result < max_size; result ++ ) \
   buf[result] = *ch_this++; \
}

#define YY_USER_INIT \
   if ( scan_init ) { \
      if ( yy_flex_debug ) \
         printf ( "-- initializing for scan %d\n", scan_init ); \
      ch_this = inbuffer; \
      scan_init = 0; }

with the following couple of definitions and declarations in the scanner:

static char * ch_this;
extern char * inbuffer;
extern int scan_init;

and with inbuffer and scan_init defined in the code that calls yyparse().
This didn't work.  Well, actually, it works the first time yyparse() is 
called, but not again.  Now, YY_USER_INIT is used inside an if statement
that checks yy_init, so I moved it out of there in the scanner skeleton
so that YY_USER_INIT is seen every time the scanner is called.  Still 
no go.

Has anyone done this, or see a way to do it, or know a way to do it, or ....

Thanks.

-- 
John Lacey, 
   E-mail:  ...!osu-cis!n8emr!uncle!basho!john  (coming soon: john at basho.uucp)
   V-mail:  (614) 436--3773, or 487--8570
"What was the name of the dog on Rin-tin-tin?"  --Mickey Rivers, ex-Yankee CF

-----------------------------

From: Pat Broderick <ptb at ittc.wec.com>
Subject: Re: Using Lex (and Yacc) on a string.
Date: 10 Aug 90 14:41:51 GMT
Followup-To: comp.lang.c
To:       info-unix at sem.brl.mil

In article <1990Aug10.012927.5558 at basho.uucp>, john at basho.uucp (John Lacey) writes:
> Normally, of course, one wants a scanner (and a parser) to work from 
> a file, perhaps stdin.  Sigh.  Well, I want one that works from a string.
> ...

Recently I had occasion to do something similar.  What we did was
roughly as follows:

   - strings to be parsed are maintained in memory 
   - to parse a string a global pointer known to lex is set to point at
     the beginning of the string
   - the input() macro was redefined in terms of this pointer (standard
     uses getc(yyin))

The things needed might look something like:

LEX:

# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)   /* standard defn from lex */

# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):(*yynyy++))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)                   ^^^^^^^^^^

					/* modified defn to use string */

extern char *yynyy;			/* will pt to start of string */


Function invoking parser:

char *yynyy;			/* globally visible */

 ....

    yynyy = start_of_string;
    yyparse();


This works fine for us, hope it helps.
-- 
Patrick T. Broderick           |ptb at ittc.wec.com |
                               |uunet!ittc!ptb   |
                               |(412)733-6265    |

-----------------------------

From: Lawrence Harris <lawrence at nvanbc.uucp>
Subject: Need program to attach a pseudo tty to tcp/ip port
Keywords: pty tcp/ip
Date: 10 Aug 90 06:37:59 GMT
To:       info-unix at sem.brl.mil

I have an emulex terminal server and want to be able to put a modem
on one of the server ports.  I have been able to put a printer on
a port using a custom print filter that opens a tcp connection the
the port and then copies standard in.  What I need is a program that
will attach itself between a pseudo tty and the terminal server port
so that I can use 'cu' or 'kermit' to talk to the modem.

This sound like something that should have been done before so I thought
I would ask if some kind soul would send me a program that either will
do the trick or act as an example.

Thanks, Lawrence Harris

ps. The system is running XENIX 386.

 ----------
UUCP:  ubc-cs!van-bc!nvanbc!lawrence (home) ...!nvanbc!hcs!lharris (work)
MAIL:  100 13511 Commerce Parkway, Richmond, B.C., Canada, V6V 2J8
PHONE: (604) 420-9518 (home), 273-490 (work), 273-2764 (fax)

-----------------------------

From: "Jay A. Konigsberg" <jak at sactoh0.uucp>
Subject: Re: Get process name w/o using argv[0] in C function?
Date: 10 Aug 90 12:02:34 GMT
To:       info-unix at sem.brl.mil

In article <837 at hls0.hls.oz> george at hls0.hls.oz (George Turczynski) writes:
>In article <13491 at smoke.BRL.MIL>, gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>> In article <1990Aug4.051827.16438 at nbc1.ge.com> scott at nbc1.GE.COM (Scott Barman) writes:
>> >I cannot think of one rational or even irrational reason *not* to use
>> >global variables.
>> 
>> Really? I thought this was commonly taught in structured software development
>> courses.
>
>Yes, it is, as a principle, to discourage people from using
>globals and no locals, as they might have gotten used to with
>such things as BASIC.  It develops the ideas of information
>hiding and so on.
>
>The use of NO globals is however, only adopted by extremists.
>

Yes, this is correct. In fact, there are some cases where the only
way to do something is *with* globals - though these situtations are
rare, they do exist. Also, there are times when you want something
to be global to a set of functions. For example the getch() & ungetch()
functions in K&R where the buf[] and bufp vars are shared.

Another case where globals are required involves the use of a signal
catcher() routine. If this routine needs information other than the
signal number, the only way to get it there is via a global (when
invoked by catching the signal that is). The case where I used this
was returning from "raw" to "cooked" char mode. The catcher() routine
had to reset ICANON and a couple of termio.??? values to their original
form.

Accucally, if things like globals and the neferious "goto" were really
_that_ bad, they wouldn't be included in the language. The fact of the
matter is though, sometimes they are needed. Just have good and
supportable reasons for using them.

-- 
 -------------------------------------------------------------
Jay @ SAC-UNIX, Sacramento, Ca.   UUCP=...pacbell!sactoh0!jak
If something is worth doing, its worth doing correctly.

-----------------------------

From: "BURNS,JIM" <gt0178a at prism.gatech.edu>
Subject: Re: Get process name w/o using argv[0] in C function?
Date: 11 Aug 90 02:34:58 GMT
To:       info-unix at sem.brl.mil

in various articles by (Jay A. Konigsberg),(George Turczynski),(Doug Gwyn),
& (Scott Barman):
>>> >I cannot think of one rational or even irrational reason *not* to use
>>> >global variables.
>>> Really? I thought this was commonly taught in structured software development
>>> courses.
>>Yes, it is, as a principle, to discourage people from using
>>globals and no locals, as they might have gotten used to with
>>such things as BASIC.  It develops the ideas of information
>>hiding and so on.
>>The use of NO globals is however, only adopted by extremists.
> Yes, this is correct.
[Discussion in defense of globals in certain cases.]

 I understood the current emphasis was on not MODIFYING globals in
 subroutines, as this is a side-effect, and can be hard to debug for future
 code maintainers, unless the usage of globals is carefully documented in
 comments sections. It's much cleaner to pass a global as a parameter than
 to let subs modify them (& some say even to access them, since later
 programmers may say "Well, I'm using it anyway - Why can't i modify it?"),
 since it's more obvious you intended for the sub to have access to the
 variable.

 The only time it is critical that subs not reference globals (other than
 system globals such as errno) is in canned library packages, which can't
 1) be dependent on the proper global environment being correctly setup,
 and 2) use global names internally that may collide with global names you
 have defined.

 Of course, the classic text-book example on using globals for information
 hiding is in writing massage routines for a small internal database. All
 you want to do is pass the data/key to be operated on, and the operation
 itself. You do NOT want to pass around the data structures for the database
 itself, so that the massagers will be free to change the implementation
 when database growth demands a reorganization of data or access method.
 (If you pass n arrays as the database in every call to the massage
 routines, you have to track down every one of those calls if the database
 structure changes.) '#include'-ing the appropriate set of global 'extern's
 in only the massage routines hides the database structure from the rest of
 the program.

 And then you have (SysV) Fortran programmers like me that are working on
 parent/child programs (some 78 in my system) where the only efficient
 solution to data sharing is some sort of IPC. I'm defining my COMMON to be
 in shared memory (HP-UX).
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a at prism.gatech.edu

-----------------------------

From: Patrick Hertel <afsipmh at cid.aes.doe.ca>
Subject: Re:In defense of Larry WAS What's wrong with this Bourne shell script?
Date: 10 Aug 90 12:43:55 GMT
To:       info-unix at sem.brl.mil


 In sum the argument is that when someone asks for a solution to a Bourne
problem the answer should be Bourne.
 While I would agree in the case where the reply was made throgh e-mail a
posting is also for the edification of the unwashed and alternate solutions
should certainly be welcome. I see no purpose, within reason, in limiting
replies. I apologize for a posting which is not really appropriate to
this forum, I don't want to start a debate and detract from this newsgroup's
real purpose.


-- 
Pat Hertel                 Canadian Meteorological Centre
Analyst/Programmer         2121 N. Service Rd.
phertel at cmc.aes.doe.ca     Dorval,Quebec
Environment Canada         CANADA           H9P1J3

-----------------------------

From: Eduardo Krell <ekrell at ulysses.att.com>
Subject: Re: ksh question: what's the difference between [ ... ] and [[ ... ]] ?
Keywords: ksh
Date: 10 Aug 90 13:54:12 GMT
Sender: netnews at ulysses.att.com
To:       info-unix at sem.brl.mil


Answer from Dave Korn:

The primary difference between [ and [[ is that [ is a command
(equivalent to the test command), whereas [[ is part of the shell
grammar.  There are a few minor differences as well.  In particular,
[ uses -a and -o for and and or, whereas [[ uses && and || for this.

Because [ is a command, all shell expansions are performed before
the [ command is executed.  The only way to distinguish between
operators and operands is by the results of expansions.  For example,
	[ "$1" ]
can have several meanings that depend of the value of $1.  If $1
is -t, then this is a test for a terminal.  If $1 is of the form,
-<letter>, where letter is one of the unary operators that require an
operand, then this is an error.  Otherwise, this evaluates to true when
the string is not null.  Note that the use of double quotes is critical
with [ since otherwise it need not expand to a single argument which
leads to unexpected results.

There are many other anomalies with [.  Here are a few:
	1.	To test string variables you have to precede the
		variable with a character that is not a - to prevent
		it being interpreted as an operator.
	2.	[ -f * ] tests the first file name and ignores the
		rest, unless the second name is -a, -o, or a binary
		operator such as =.
	3.	[ -f "$1" ] yields a syntax error when $1 is =.

The [[...]] construct was added to ksh88 to overcome these problems.
Since [[...]] is part of the shell, it can differenciate between
operators and operands before expansion. (This means that the operators
cannot be variable unless you use eval).  In addition, word splitting
and file name expansion are not performed inside [[...]] eliminating
many of the most common scripting errors.  Because no file expansion is
done, pattern characters (*,? and [) can be used for string comparison.

The [[...]] construct was in draft 8 of the IEEE 1003.2 shell and
utilities standard, but was removed from draft 9 because it was felt
that some of these problems could be fixed by eliminating compound
operations, -a, -o, !, and () in test ([) from the standard and requiring
that -t require an operand.  The number of arguments could then determine
which argument was an operator.  Writing a compound command would
requiring the use the && and || of the shell instead.  The ! command was
added to the shell grammar for this purpose.  Unfortunately, there
was no coordination between changes in test and the shell language
so that the changes in test were never made and the [[...]] was not
restored.  Therefore, unless there is a change in future version of
the standard, the [[...]] will remain a KornShell extension rather
than part of the POSIX shell language.


David Korn
ulysses!dgk
    
Eduardo Krell                   AT&T Bell Laboratories, Murray Hill, NJ

UUCP: {att,decvax,ucbvax}!ulysses!ekrell  Internet: ekrell at ulysses.att.com

-----------------------------

From: Chris Davies <chris at vision.uucp>
Subject: Re: Working with sed
Date: 10 Aug 90 14:23:41 GMT
To:       info-unix at sem.brl.mil

In article <27372 at unix.cis.pitt.edu> nr3m at unix.cis.pitt.edu (Matthew A Henry) writes:
>I'm writing a script that uses sed,

I'm assuming by this that you don't mean 'working with a sed script'.

>and am having trouble with one
>part.  I have a file that contains typical unix paths, one per
>line, and would like to remove everything after the last forward 
>slash (/).

Why use sed?  You've said you're using a script with sed in it, so why not use
something different.  On SysV and SunOS 4.0.3_EXPORT (therefore probably BSD
systems in general??) you can use _d_i_r_n_a_m_e to do exactly what you require.

>In other words I would like the string:
>	/aaa/bbb/ccc/ddd/eee
>to be changed to:
>	/aaa/bbb/ccc/ddd

Check out _b_a_s_e_n_a_m_e too.  Thus,

	% dirname '/aaa/bbb/ccc/ddd/eee'
	/aaa/bbb/ccc/ddd/eee
	% basename '/aaa/bbb/ccc/ddd/eee'
	eee
	%

Chris
-- 
VISIONWARE LTD         | UK: chris at vision.uucp     JANET: chris%vision.uucp at ukc
57 Cardigan Lane       | US: chris at vware.mn.org    OTHER: chris at vision.co.uk
LEEDS LS4 2LE          | BANGNET:  ...{backbone}!ukc!vision!chris
England                | VOICE:   +44 532 788858   FAX:   +44 532 304676
 -------------- "VisionWare:   The home of DOS/UNIX/X integration" --------------

-----------------------------

From: David Neill-OKCy Mktg 405-278-4007 <dwn at swbatl.sbc.com>
Subject: Re: Working with sed
Date: 10 Aug 90 17:43:33 GMT
To:       info-unix at sem.brl.mil

>In article <27372 at unix.cis.pitt.edu> nr3m at unix.cis.pitt.edu (Matthew A Henry) writes:
>I'm writing a script that uses sed,
>and am having trouble with one
>part.  I have a file that contains typical unix paths, one per
>line, and would like to remove everything after the last forward 
>slash (/).

sed -e 's/\/[^\/]*$//' filename

-- 
name & address   (this account) -> uunet!swbatl!dwn OR dwn at swbatl.sbc.com
David Neill       office -> 405-291-1990 -> uunet!swbatl!oktext!mktco
Mgr - Mktg.(SWBTCo) home -> 405-749-1141 -> uunet!swbatl!oktext!frodo!david

-----------------------------

From: David Davison <david at slammer.uucp>
Subject: Needed: "user friendly" batch job scheduler
Keywords: batch job
Date: 10 Aug 90 15:15:07 GMT
To:       info-unix at sem.brl.mil


I have a need for a batch job scheduler that I can allow unsophisticated users
to use.  Menu driven would be great, fairly bulletproof, load leveling by 
time of day would be wonderful.  Any suggestions would be appreciated.
Environment is Sequent S81(2), unisys 6000 (20), harrix hcx(3).

Please email replies to
david at slammer.UUCP
 ...!gatech!bagend!slammer!david

Standard disclaimers.

-----------------------------

From: Dan_Jacobson at att.com
Subject: article "Get Ready for GNU Software" in Computer World magazine
Date: 10 Aug 90 16:21:42 GMT
Sender: Dan Jacobson <danj1 at cbnewse.att.com>
Followup-To: gnu.misc.discuss
To:       info-unix at sem.brl.mil

There's a 1/2 page article "Get Ready for GNU Software," in Computer
World magazine, Aug. 6, 1990, page 102, by Simson L. Garfinkel.

Quotes:
"...Stallman, who by many accounts may be the world's best programmer."

"...GNU Emacs, is becoming the standard Unix programmer's editor."

"...Stallman was awarded a $240,000 ``Genius Grant'' from the MacArthur
Foundation."
-- 
Dan_Jacobson at ATT.COM +1-708-979-6364

-----------------------------

From: Maarten Litmaath <maart at cs.vu.nl>
Subject: Re: Suid script security
Date: 10 Aug 90 16:34:52 GMT
Sender: news at cs.vu.nl
To:       info-unix at sem.brl.mil

In article <14920003 at hpdmd48.boi.hp.com>,
	markw at hpdmd48.boi.hp.com (Mark Wolfe) writes:
)...
) 1)  Just what are the security risks involved? (i.e. how would someone attack
)     a system via one of these).

See below.

) 2)  What can I do to make this as secure as possible?

Convert it to a C program or use the indir(1) package I wrote (or something
equivalent).  It's in one of the latest volumes in comp.sources.unix.
 -------------------------------------------------------------------------------
			Setuid Shell Scripts
			--------------------
			how to get them safe

			  Maarten Litmaath
			  (maart at cs.vu.nl)


Consider a setuid root shell script written in Bourne shell command language
and called `/bin/powerful'.
The first line of the script will be (without indentation!):

	#!/bin/sh

If it doesn't begin with such a line, it's no use to chmod it to 6755 or
whatever, because in that case it's just a shell script of the `old' kind:
the Bourne shell receives an exec format error when trying to execute it, and
decides it must be a shell script, so it forks a subshell with the script name
as argument, to indicate from which file the commands are to be read.
Shell scripts of the `new' kind are treated as follows: the kernel discovers
the magic number `#!' and tries to execute the command interpreter pointed out,
which may be followed in the script by 1 argument.
Before the exec of the interpreter the uid and gid fields somewhere in the user
structure of the process are filled in.
Setuid script scheme (kernel manipulations faked by C routines):

	execl("/bin/powerful", "powerful", (char *) 0);

	  |
	  V

	setuid(0);
	setgid(0);      /* possibly */
	execl("/bin/sh", "sh", "/bin/powerful", (char *) 0);

Now, what if the name of the very shell script were e.g. "-i"? Wouldn't that
give a nice exec?

	execl("/bin/sh", "sh", "-i", (char *) 0);

So link the script to a file named "-i", and voila!
Yes, one needs write permission somewhere on the same device, if one's
operating system doesn't support symbolic links.

What about the csh command interpreter? Well, 4.2BSD provides us with a csh
which has a NEW option: "-b"! Its goal is to avoid just the thing described
above: the mnemonic for `b' is `break'; this option prevents following
arguments of an exec of /bin/csh from being interpreted as options...
The csh refuses to run a setuid shell script unless the option is present...
Scheme:
	#!/bin/csh -b
	...

	execl("-i", "unimportant", (char *) 0);

	  |
	  V

	setuid(0);
	setgid(0);
	execl("/bin/csh", "csh", "-b", "-i", (char *) 0);

And indeed the contents of the file "-i" are executed!
However, there's still another bug hidden, albeit not for long!
What if I could `get between' the setuid()/setgid() and the open() of the
command file by the command interpreter?
In that case I could unlink() my link to the setuid shell script, and quickly
link() some other shell script into its place, couldn't I?
Right.
Yet another source of trouble for /bin/sh setuid scripts is the reputed IFS
shell variable. Of course there's also the PATH variable, which might cause
problems. However, one can circumvent these 2 jokers easily.
A solution to the link()/unlink() problems would be the specification of the
full path of the script in the script itself:

	#!/bin/sh /etc/setuid_script
	shift		# remove the `extra' argument
	...

Some objections:
1)
	currently the total length of shell + argument mustn't exceed 32 chars
	(easily fixed);
2)
	4.[23]BSD csh is expecting a `-b' flag as the first argument, instead
	of the full path (easily fixed);
3)
	the interpreter gets an extra argument;
4)
	the difficulty of maintaining setuid shell scripts increases - if one
	moves a script, one shouldn't forget to edit it... - editing in turn
	could turn off the setuid bits, so one shouldn't forget to chmod(1)
	the file `back'... - conceptually the solution above isn't `elegant'.

How does indir(1) tackle the problems? The script to be executed will look
like:
	#!/bin/indir -u
	#?/bin/sh /etc/setuid_script
	...

Indir(1) will try to open the script and read the `#?' line indicating the
real interpreter and a safe (absolute) pathname of the script. But remember:
the link to the script might have been quickly replaced with a link to another
script, i.e. how can we trust this `#?' line?
Answer: if and only if the file we're reading from is SETUID (setgid) to the
EFFECTIVE uid (gid) of the process, AND it's accessible and executable for
the REAL uid (gid), we know we're executing the original script (to be 100%
correct: the original link might have been replaced with a link to ANOTHER
accessible and executable setuid (setgid) script of the same owner (group)
-> merely a waste of time).
To check the condition stated above reliably, we use fstat(2) on the file
descriptor we're reading from, and stat(2) on the associated file name.
We compare inode and device numbers to make sure we're talking about the
same file.  Can you figure out why using stat(2) alone would be insecure?

Feature: we always check if the REAL uid (gid) has access to the setuid
(setgid) script, even if the effective id already differed from the real id
BEFORE the script was executed.  (There isn't even a way to find out the
original effective id.)
If you want the original effective id to be used, you should set the real id
accordingly before executing the script.

To deal with IFS, PATH and other environment problems, indir(1) resets the
environment to a simple default:

	PATH=/bin:/usr/bin:/usr/ucb

When you need e.g. $HOME, you should get it from /etc/passwd instead of
trusting what the environment says. Of course with indir(1) problem 4 remains.

				--------
--
   "UNIX was never designed to keep people from doing stupid things, because
    that policy would also keep them from doing clever things."  (Doug Gwyn)

-----------------------------

From: Vicki Brown <vlb at magic.apple.com>
Subject: Re: Suid script security
Date: 10 Aug 90 19:41:32 GMT
Sender: usenet at apple.com
Sender: 
To:       info-unix at sem.brl.mil


In article <14920003 at hpdmd48.boi.hp.com> markw at hpdmd48.boi.hp.com (Mark Wolfe) writes:
>
>    I know that suid scripts are a bad idea from reading comp.questions and
>comp.wizards over the last year or so. It seems that just about every guru
>in the world has posted a warning NOT to do it, so I decided I would follow
>the advice (it's a rare subject that all guru's agree on). However, it appears
>that I'm now about to have one of these ugly animals forced on me from above,
>so I'd like some advice:
>
> 1)  Just what are the security risks involved? (i.e. how would someone attack
>     a system via one of these).
>
> 2)  What can I do to make this as secure as possible?

Warning - very long response ahead.  Proceed at your own risk.
<FF>
There was a very interesting paper in the USENIX Association's publication,
 ;login: ( "How To Write a Setuid Program", Matt Bishop, ;login:
Vol 12, Number 1, January/February 1987).  An excerpt:
	
    Some versions of UNIX allow command scripts, such as shell scripts,
    to be made setuid ... Unfortunately, given the power and complexity
    of many command interpreters, it is often possible to force them to
    perform actions which were not intended, and which allow the user to
    violate system security.  This leaves the owner of the setuid script
    open to a devastating attack.  In general, such scripts should be avoided.

    ... suppose a site has a setuid script of sh commands.  An attacker
    simply executes the script in such a way that the shell ... appears
    to have been invoked by a person logging in.  UNIX applies the setuid
    bit on the script to the shell, and ... it becomes interactive...

    One way to avoid having a setuid script is to turn off the setuid
    bit on the script, and ... use a setuid [binary] program to invoke it.
    This program should take care to call the command interpreter by its full
    path name, and reset environment information such as file descriptors
    and environment variables to a known state.   However, this method
    should be used only as a last resort and as a temporary measure,
    since with many command interpreters it is possible even under these
    conditions to force them to take undesirable action.

The biggest problem with shell scripts is that you (the programmer /
administrator) have very little control over the programs which run within
the script.  As a very real example, I ran across a script which allowed
users to enter bug reports, using the "vi" editor.  The script was
setuid root, because it wanted to save files in funny places.  The programmer
had guarded against shell escapes (a known feature of vi), by making this
script the login shell.  However, he couldn't guard against another feature
	:e /etc/passwd

You can attempt to make your script as safe as possible by
	1) being very restrictive in your choice of UID.  That is,
	   make the script setuid for a non-privileged user, rather than root
	   (for example, if it must write a log file, could the log file
	   live in some locked area, accessed only by a new and otherwise
	   non-privileged account?)
	2) making the script setgid rather than setuid, with a very
	   restricted GID (see #1)
	3) ensuring that the script is short, very simple, and does not
	   make use of commands such as `vi', `mail' or anything interactive.
	   setuid programs should do ONE thing only, and in a non-complex
	   manner.
	4) setting the PATH, IFS, and other environment variables explicitly
	   within the script
	5) locking down the permissions on the script.  If possible allow it
	   to be run only by group members.  Never allow write permission.
	6) If your version of UNIX permits, take away read permission for
	   anyone other than the owner.  It's a bit harder to break
	   something if you can't see how it works.
	7) Rewrite it in C (carefully)
	8) Convince your management that they don't really need this.

If you plan to keep the script, or re-write it, try and get a copy of the
paper.  If you can't find it, send me mail.
   Vicki Brown   A/UX Development Group		Apple Computer, Inc.
   Internet: vlb at apple.com			MS 58A, 10440 Bubb Rd.	
   UUCP: {sun,amdahl,decwrl}!apple!vlb		Cupertino, CA  95014 USA
              Ooit'n Normaal Mens Ontmoet?  En..., Beviel't?
          (Did you ever meet a normal person?  Did you enjoy it?)

-----------------------------

From: Rob Bunten <rbunten at miclon.uucp>
Subject: SUMMARY: finding disk usage of partitions
Date: 10 Aug 90 17:07:16 GMT
To:       info-unix at sem.brl.mil

Thanks for the responses to my original request for the disk usage of
directories, not including stuff mounted from other partitions. The responses
were from:

xie at math.arizona.edu
    suggested using df(1) :-)

dietrich at cernvax.cern.ch
    sent a program which is used to determine the number of files and
    directories and the occupied disk space in a file hierarchy beginning at
    startdirectory. I have the source, but haven't managed to get it to run on
    SunOS.

meissner at osf.org
    mentions that the gnu fileutils 1.3 package contains a du rewrite that adds
    a -f option to prevent du from crossing filesystem boundaries.

tmdg at ti.co.uk
    has a program that reports file fragmentation that could possibly be
    adapted.

eirik at elf.tn.cornell.edu
    suggested the following (this is what I used):

    Apparently you want a way to tell du not to cross mount points; if
    not, I am probably answering a different question than the one you
    asked.  It also sounds like you are ignoring all but local partitions.
     
    Assuming you have root permissions on the machine with the disks,
    there is a way of doing what you want.  It is, in a sense, cheating,
    but I'd rather cheat than lose.  :-)
      
    Here's the idea: export all file systems you're interested in to
    localhost, and mount them via NFS.  As an example, the following shows
    the usage in my root partition:
       
    exportfs -i -o root=localhost,access=localhost /
    mount -n localhost:/ /mnt
    du /mnt
    mount -f localhost:/ /mnt
    umount /mnt

chip at chinacat.unicom.com
    has written a du reimplementation. It is more oriented towards the SysV
    world, but it might be usable.

paul at ixi-limited.co.uk
    suggests:

    find / -fstype nfs -prune -o -type f -exec du -s {} \; | \
    awk ' { total = total + $1 } END { print total }'

    However, this doesn't do quite what I wanted, as I wanted the totals for
    each directory.

Sorry for the delay in summarizing (the original posting was on 4th July).

-----------------------------

From: QQ11 at liverpool.ac.uk
Subject: HP-UX 7.0 problems with ps(1) and awk(1) in pipe
Date: 10 Aug 90 17:32:04 GMT
To:       info-unix at sem.brl.mil

I have a simple csh script which ran without any problems at HP-UX 3.1
on our 9000/850. However at 7.0 the behaviour is different. The different
behaviour has proved consistent enough for me to seek help from you.

The script fetches a file from another system every 24 hours and the
script is started by cron(1M). The process waits until the file arrives.
If for  some reason the  transfer has not taken  place 24 hours  later, I
want the  earlier process killed. The  following line of code  is used to
find the old PID.

set exists=`ps -uqq11 | awk '$4 == "getus.csh" && $1 != x { print $1 }' x=$$ -`

This looks for the PIDs of the program and finds the older one if it
exists (if it is found kill(1) is used).

This worked fine at HP-UX 3.1 but at 7.0 a "spurious" PID is found
(presumably as a result of executing part of the above pipe). The
resulting kill(1) fails since the process is already dead.

Here is output of ps -uqq11 in same script before the pipe:

 11752 ?        0:00 sh
 11942 ?        0:00 ps
 11764 ?        0:00 getus.csh

I would be grateful if any HP-UX 7.0 guru can explain precisely what is
happening i.e. why does the other process get included at 7.0 and not
at 3.1 (for 9000/300 fans, HP-UX 3.1 on the 800 was similar to
6.5 on the 300s).

While I'm aware that I can do the whole thing differently
(send *good* suggestions to me if you want :-)), I'd like to get to
the root of the problem.

Thanks.

Alan Thew
University of Liverpool Computer Laboratory
Bitnet/Earn: QQ11 at LIVERPOOL.AC.UK or QQ11%UK.AC.LIVERPOOL @ UKACRL
UUCP       : ....!mcsun!ukc!liv!qq11        Voice: +44 51 794 3735
Internet   : QQ11 at LIVERPOOL.AC.UK or QQ11%LIVERPOOL.AC.UK @ NSFNET-RELAY.AC.UK

-----------------------------

From: Bob Palowoda <palowoda at fiver.uucp>
Subject: rexecd for ESIX?
Date: 10 Aug 90 17:54:03 GMT
To:       info-unix at sem.brl.mil


 Has anyone have a working example of rexecd for ESIX?  Specificly I am looking
for one based off of 4.3 tahoe. 

---Bob

-- 
Bob Palowoda   palowoda at fiver              |   *Home of Fiver BBS*
Home {sun}!ys2!fiver!palowoda              | 415-623-8809 1200/2400
     {pacbell}!indetech!fiver!palowoda     |     An XBBS System                
Work {sun,pyramid,decwrl}!megatest!palowoda| 415-623-8806 1200/2400/19.2k TB+

-----------------------------

From: Guy Harris <guy at auspex.auspex.com>
Subject: Re: help sought - securing a terminal/line
Date: 10 Aug 90 18:29:46 GMT
To:       info-unix at sem.brl.mil

>You're saying V.4 doesn't use inittab?

I'm saying it doesn't necessarily run "getty" out of "inittab".

>Um, this is not good. The flexibility of inittab has been very helpful. I
>don't want to go back to kludging a login or getty front-end again.

Um, this is not good.  You're making some inferences that aren't
justified based purely on what I said, and that aren't, in fact,
correct....

"ttymon" will listen on a whole bunch of ports, and spin off a process
when the port comes up.  The process can run whatever program you want
it to.

You can also run "getty" out of "inittab", if you want to, or any other
program.

>What else does V.3.2 have that V.4 hasn't?

A shared library mechanism that requires you to explicitly ask for the
shared version of a library, for one thing....  (S5R4's, like the SunOS
4.x one from which it's derived, gives you the shared library by default
if there is one.)

Go buy the S5R4 documentation - or some subset thereof, the entire
documentation set is rather expensive and only crazy completists like me
buy it out of our own pockets.

-----------------------------

From: Guy Harris <guy at auspex.auspex.com>
Subject: Re: help sought - securing a terminal/line
Date: 10 Aug 90 18:32:49 GMT
To:       info-unix at sem.brl.mil

>Fear not; the V.4 init still understands inittab.  All Guy was
>referring to was the advent of ttymon, a STREAMS-based tty port
>monitor that provides a more convenient way to deal with terminals
>than the old inittab method.

And also gives you a few additional bells and whistles, such as
autobauding (not the bit where you hit BREAK to get it to cycle through
speeds, although "ttymon" does support that, but the bit where you type
a character and, based on what the character looked like, "ttymon"
guesses the speed of the line; same sort of thing as the 4.[23]BSD "getty"
supports).  It does permit you to run some program other than "login"
on some port when it comes up.

-----------------------------

From: "BURNS,JIM" <gt0178a at prism.gatech.edu>
Subject: Re: help sought - securing a terminal/line
Date: 11 Aug 90 01:20:33 GMT
To:       info-unix at sem.brl.mil

in article <2103.26bf3e39 at miavx1.acs.muohio.edu>, pemurray at miavx1.acs.muohio.edu (Peter Murray) says:
> In article <1990Aug7.111611.434 at warwick.ac.uk>, cudcv at warwick.ac.uk (Rob McMahon) writes:
>> Assuming we're talking BSD here (that certainly looks like a 4.3 /etc/ttys
>> file to me ...), can't you just use the `lo' gettytab entry for this:
>>       lo    str    /usr/bin/login   program to exec when name obtained
> Yes, I'm dealing with BSD (Ultrix, to be exact).

Umm, the original poster (Tony Rhodes?) specifically asked for an HP-UX
solution. In that case, altho' /etc/ttys exists, /etc/inittab would be the
most appropriate solution since it avoids getty clones, and allows you to
automatically respawn the app. [Oracle, etc.] if it aborts. One possible
disadvantage is stty settings may not be correct if getty/login don't run
first. (I've been bit by this on HP-UX.) However, since the original poster
mentioned the need for several different Oracle apps., this could be
handled by embedding the appropriate command tail option in a script that
also runs stty (, and probably should also do something like 'trap "exit" 2
3' to prevent breaking out before Oracle starts - the inittab respawn will
then restart it). At a minimum on HP-UX, you will need to do an 'stty icrnl
ocrnl ixon'. One more point - as of HP-UX 7.0 (6.5?) if you need to do a
set[gu]id on the script, the first line MUST be '#!/bin/ksh' (or what ever
shell you want).
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a at prism.gatech.edu

-----------------------------

From: Guy Harris <guy at auspex.auspex.com>
Subject: Re: C-shell programming
Keywords: csh, multiple file input
Date: 10 Aug 90 18:45:22 GMT
To:       info-unix at sem.brl.mil

>Appropriate use of /dev/fd could make it even neater, if you don't already
>have sorted files.

And if you *do* have "/dev/fd", which most UNIX systems at this point
don't have, although I think S5R4 might have it.

-----------------------------

From: Guy Harris <guy at auspex.auspex.com>
Subject: Re: How to tell if a process exists
Date: 10 Aug 90 18:53:25 GMT
To:       info-unix at sem.brl.mil

>	Hmmm -- must be running Reverse Polish Unix down under, 'cause my
>manual sez: " kill [-sig] processid... ", and I've been doing it that way
>for a looooooooong time.

He was referring to the "kill()" library routine, not the "kill"
command....

-----------------------------

From: Vicki Brown <vlb at magic.apple.com>
Subject: Re: How to tell if a process exists
Date: 10 Aug 90 19:44:33 GMT
Sender: usenet at apple.com
Sender: 
To:       info-unix at sem.brl.mil


In article <7733 at amelia.nas.nasa.gov> samlb at pioneer.arc.nasa.gov.UUCP (Sam Bassett RCS) writes:
>In article <1823 at necisa.ho.necisa.oz> boyd at necisa.ho.necisa.oz (Boyd Roberts) writes:
>>Wrong.  RTFM --  kill(pid, 0)
>
>	Hmmm -- must be running Reverse Polish Unix down under, 'cause my
>manual sez: " kill [-sig] processid... ", and I've been doing it that way
>for a looooooooong time.
>
>	What kind of UNIX _are_ you running??

  --->   C   <---  		( man 2 kill 8^)
   Vicki Brown   A/UX Development Group		Apple Computer, Inc.
   Internet: vlb at apple.com			MS 58A, 10440 Bubb Rd.	
   UUCP: {sun,amdahl,decwrl}!apple!vlb		Cupertino, CA  95014 USA
              Ooit'n Normaal Mens Ontmoet?  En..., Beviel't?
          (Did you ever meet a normal person?  Did you enjoy it?)

-----------------------------

From: Doug Gwyn <gwyn at smoke.brl.mil>
Subject: Re: How to tell if a process exists
Date: 10 Aug 90 21:47:42 GMT
To:       info-unix at sem.brl.mil

In article <7733 at amelia.nas.nasa.gov> samlb at pioneer.arc.nasa.gov.UUCP (Sam Bassett RCS) writes:
-In article <1823 at necisa.ho.necisa.oz> boyd at necisa.ho.necisa.oz (Boyd Roberts) writes:
->Wrong.  RTFM --  kill(pid, 0)
-	Hmmm -- must be running Reverse Polish Unix down under, 'cause my
-manual sez: " kill [-sig] processid... ", and I've been doing it that way
-for a looooooooong time.

Doing what, incorrectly reading your manual?

-----------------------------

From: Terry Laskodi <terryl at osf.osf.org>
Subject: Re: How to tell if a process exists
Date: 10 Aug 90 22:16:13 GMT
Sender: news at osf.org
To:       info-unix at sem.brl.mil

In article <7733 at amelia.nas.nasa.gov> samlb at pioneer.arc.nasa.gov.UUCP (Sam Bassett RCS) writes:
>In article <1823 at necisa.ho.necisa.oz> boyd at necisa.ho.necisa.oz (Boyd Roberts) writes:
>>Wrong.  RTFM --  kill(pid, 0)
>
>	Hmmm -- must be running Reverse Polish Unix down under, 'cause my
>manual sez: " kill [-sig] processid... ", and I've been doing it that way
>for a looooooooong time.
>
>	What kind of UNIX _are_ you running??


     Well, you're both right. Boyd was describing kill(2); Sam was describing
kill(1).....

-----------------------------

From: Mike Verstegen <mdv at domain.com>
Subject: make's usage of VPATH
Keywords: make VPATH
Date: 10 Aug 90 20:30:19 GMT
Sender: mdv at comtst.uucp
To:       info-unix at sem.brl.mil


A recent posting's comment about VPATH in make prompted me to use strings(1)
to check our make to see if our makes were configured with this feature.
Both of our systems' (3B2 V.3.1 and ISC 2.0.2) makes had the text VPATH in
them. Then, using the documentation for nmake, I tried to get VPATHs to work.
Unfortuanately, it did not. Either I don't understand VPATH as used in make,
or make doesn't understand what I'm asking for.

What I think VPATHs do is to provide alternate locations from source files
in make's dependency analysis. For example, if I'm working on a project and
I want to try out a private modification I could do the following:

Directory contents:

	/u/official.d		work.d
	=============		======
	foo.c			foo.c
	bar.c

Makefile contents:

	OBJ=foo.o bar.o
	fubar:	$(OBJ)
		cc -o fubar $(OBJ)

Commands executed:
	cd work.d
	VPATH=.:/u/official.d	# also tried putting this in Makfile, no change
	export VPATH
	make foobar

Results:
	Make:  Don't know how to make bar.o.  Stop.

I think (acutally I thought):
make would look in work.d and see foo.c in . (the first component in VPATH)
and compile to foo.o as usual [it did].  Then, it would look for bar.c
in . and see that it was not there. make would then look in /u/offical.d
(the next component in VPATH), see it there, and use that as the file for
complication [it did not].

Since VPATH is not a doucmented feature (at least that I can find) I know
I cannot expect it to work, though I really would like this capability. I would
appreciate any feedback on whether what I have described above is a correct
expection and, if so, why doesn't it work? If it's not supposed to work (i.e.
VPATH was there just to fool people like me), maybe I'll try to track down
nmake which claims to support this feature.

Please e-mail replies and I'll summarize if there is enough interest.

--
Mike Verstegen
 ..!uunet!comtst!mdv
mdv at domain.com

-----------------------------

From: Randal Schwartz <merlyn at iwarp.intel.com>
Subject: Re: Printer Accounting File Parsing
Date: 10 Aug 90 22:37:46 GMT
Sender: news at iwarp.intel.com
To:       info-unix at sem.brl.mil

In article <24110 at adm.BRL.MIL>, BKEHOE%widener writes:
| 
|  Here's something that should be simple to solve..it can be in anything (C/
| awk/shell/whatever).
|  I need to parse down the results of the printer accounting file into a total
| for each user for that 2-week or month-long period of time, and send mail to
| those users that've gone above 50 pages saying something like "Calm down".
| I've been futzing in awk but can't seem to pull it off -- and in C my string
| manipulation seems to be off (admittedly I haven't spent a *lot* of time
| hacking it out).
|  Oh, I'm running SunOS 4.0.3 if yer interested. Here's what the file typically
| looks like:
| 
| --cut--
| 	 2.00	laverne:brendan
| 	 3.00	shirley:quairoli
| 	17.00	laverne:doan
| 	 1.00	sabrina:neveln
| 	 5.00	laverne:jennifer
| 	 9.00	ashley:ware
| --cut--
|  It'd be nice if I could assess the # of pages they print off of each client
| too, but that may be overkill.
|  Thanks for your help..

Good that you said "whatever", so I won't get flamed for using Perl...

==================================================
#!/usr/bin/perl

while (<>) {
	($pages,$host,$user) = /^\s+(\S+)\s+(\S+):(\S+)$/;
	$usertotal{$user} += $pages;
	$hosttotal{$host} += $pages;
}

print "Total by user:\n";
for (sort keys usertotal) {
	printf "%20s %5d\n", $_, $usertotal{$_};
}

print "Total by host:\n";
for (sort keys hosttotal) {
	printf "%20s %5d\n", $_, $hosttotal{$_};
}
==================================================

Season to taste.

Just another Perl hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

-----------------------------

From: Larry Wall <lwall at jpl-devvax.jpl.nasa.gov>
Subject: Re: Printer Accounting File Parsing
Date: 11 Aug 90 00:02:38 GMT
To:       info-unix at sem.brl.mil

In article <24110 at adm.BRL.MIL> BKEHOE%widener at pucc.princeton.edu writes:
: 
:  Here's something that should be simple to solve..it can be in anything (C/
: awk/shell/whatever).
:  I need to parse down the results of the printer accounting file into a total
: for each user for that 2-week or month-long period of time, and send mail to
: those users that've gone above 50 pages saying something like "Calm down".
: I've been futzing in awk but can't seem to pull it off -- and in C my string
: manipulation seems to be off (admittedly I haven't spent a *lot* of time
: hacking it out).
: ...
:  It'd be nice if I could assess the # of pages they print off of each client
: too, but that may be overkill.

No problem.

 ---------- CUT HERE ----------
#!/usr/bin/perl

$THRESHOLD = 50;

while (<>) {
    ($pages, $wherewho) = split(' ');
    ($where, $who) = split(/:/, $wherewho);
    $sum{$who} += $pages;
    $client{$who} .= "$where " unless $clientsum{$wherewho};
    $clientsum{$wherewho} += $pages;
}

foreach $who (keys %sum) {
    next if $sum{$who} < $THRESHOLD;
    @clients = sort split(' ', $client{$who});
    $breakdown = '';
    if (@clients >= 2) {
	$breakdown = "Breakdown:\n\tMachine \tPages\n";
	foreach $client (@clients) {
	    $breakdown .= sprintf("\t%-16s%5d\n",
		$client, $clientsum{"$client:$who"});
	}
    }
    open(MAIL,"|/bin/mail $who") || die "Can't run mail: $!\n";
    print MAIL <<EOF;
Subject: printer usage

Dear $who:

You printed $sum{$who} pages in the last accounting period.  Calm down.
$breakdown
Sincerely,
The Printer Accounting Daemon
EOF
    close MAIL;
}

Larry Wall
lwall at jpl-devvax.jpl.nasa.gov

-----------------------------

From: Bob Willey <bob at consult.uucp>
Subject: Re: backing up an entire unix/xenix system
Keywords: Backup
Date: 10 Aug 90 22:19:11 GMT
Followup-To: comp.unix.xenix
To:       info-unix at sem.brl.mil

In article <4 at icdi50.UUCP> steve at icdi50.UUCP (Steve M. Ciarciello) writes:
>Does anybody know of a utility that will back up an entire disk drive to
>streaming tape under SCO Xenix or Unix.
>The utility that I would like to have would allow the end user to backup 
>every block of the disk thereby allowing a complete disk restore from the
>tape. This would therefore include the operating system and all filesystems.
>I ask this question because I come from a world of mini computers that would
>backup everything. A restore of the entire system from this type backup was
>Steve Ciarciello
>CompuData, Inc.
>Philadelphia, PA

This is a common problem.  Using tar and the like will only give
you mixed results.  You must be very careful.
We have been using CTAR from MicroLite with EXCELLENT results.
It does a complete backup of ALL files including character, fifo, etc.
It also comes with a utility to create a rootable/bootable floppy.
This creates all the necessary utilities, and YOUR kernel and device
drivers so that if you have a crash.
1. Replace disk
2. Boot up from rootable/bootable CTAR disk
3. Pick NEW Disk (format and all done)
4. Restore option (use most recent tape)
5. Reboot system and you are up and running.

Much easier that the horse X#$% you have to do using tar, and reinstalling
Unix/Xenix.
You can reach MicroLite  on uunet!mlite!info   uunet!mlite!tom
We have this installed at ALL customer sites and would not leave
home without it.  We consider it a mandatory option.

Hope this helps.

-- 
>.. CCS Enterprises, Inc.           ..    Bob Willey, CDP     ..<
>.. P.O. Drawer 1690                ..    uunet!consult!bob   ..<
>.. Easton, Maryland  21601         ..    (301) 820-4670      ..<
>.......................BBS: (301) 476-5098.....................<

-----------------------------

From: Ken Boi <boi at richsun.cpg.trs.reuter.com>
Subject: AWK Language Question
Date: 10 Aug 90 22:25:24 GMT
Sender: news at richsun.cpg.trs.reuter.com
To:       info-unix at sem.brl.mil

According to the book "The AWK Programming Language", there
are built-in string functions. One of them is 'gsub'. I have 
tried using it with the following comand line statement which
is very close to the example in the book:

		awk '{ gsub(/USA/, "United States"); print }' awkdata

where 'awkdata' is any text file. I get the error messages:

		awk: syntax error near line 1
		awk: illegal statement near line 1

Anybody know why?

-----------------------------

From: NRAO Array Operations Center <nraoaoc at jupiter.nmt.edu>
Subject: permissions and parameters on terminal line
Date: 10 Aug 90 23:01:05 GMT
Sender: Ruth Milner <rmilner at zia.aoc.nrao.edu>
To:       info-unix at sem.brl.mil

I have a user with a device attached to a serial line which he is writing a
program to talk to. The problem is this: I don't particularly want to install
his program setuid root, so how do I get the system to set the ownership of
the terminal device at boot time so that it will stay that way as long as the
system is up? Currently, every time he runs the program he has to first run
something I gave him the change the ownership, and then after his program
finishes the device reverts to root.

Running a daemon on the line is not a nice solution, either, since if it dies
for some reason the same problem crops up. Ideally I would like to be able
to say something in /etc/rc.local like:

chown -permanent him /dev/tty1c
stty -permanent 4800 raw /dev/tty1c

Obviously these commands won't work, but is there something else in stock
UNIX which will? init won't work because every time it wakes up it interferes
with his program; I have had to turn it off on that line.

The system is a Solbourne 5/801 (SPARC CPU chip) running OS/MP 4.0c (= SunOS
4.0.3).

Thanks in advance. Please reply by email and I will post the final solution.
-- 
Ruth Milner
Systems Manager                     NRAO/VLA                    Socorro NM
                            rmilner at zia.aoc.nrao.edu

-----------------------------

From: william n bell <wnbell at acsu.buffalo.edu>
Subject: Emacs
Date: 11 Aug 90 00:50:06 GMT
Sender: news at acsu.buffalo.edu
Nntp-Posting-Host: lictor.acsu.buffalo.edu
To:       info-unix at sem.brl.mil

Who can I contact to get a Unix version of emacs?
Is it public domain?? WHere can I find it??

Send email. Thanks.



-- 

Out Of Touch BBS - 716-825-4268 from 8pm-8am!
 FIDO 1:260/170... Online games!

-----------------------------

From: "here kitty, kitty..." <daveb at llama.ingres.com>
Subject: Demented question -- anyone retargeted yacc for nawk?
Date: 11 Aug 90 01:12:15 GMT
To:       info-unix at sem.brl.mil

After doing a bunch of programming in nawk recently, I found myself
wondering if anyone has retargeted a yacc-like parser generator for awk. 
I don't know how useful this would be, but it has potential amusement
value [much like Roger Rohrbach's lisp written in old-awk].  It might
also be handy for prototyping "little languages" you don't want to do
via recursive descent.

from right field,
-dB

"Bottom of the 4th, Cooper pitching"	- tibetan baseball
David Brower:  daveb at rtech^H^H^H^H^Hingres.comd

-----------------------------

From: James Brister <brister at decwrl.dec.com>
Subject: Timeout on shell command.
Date: 11 Aug 90 02:24:33 GMT
Sender: News <news at wrl.dec.com>
X-Checksum-Snefru:  8b1c0fca 68a8627c 3a923ed5 0f83a013
To:       info-unix at sem.brl.mil

I'd like to have a shell script run a command, but if that command doesn't
finish in X seconds, then the script should kill it, if the command
finishes sooner then the script should immediately continue. Any ideas on
how one could achieve this?

Thanks

James
--
James Brister                                           brister at decwrl.dec.com
DEC Western Software Lab.                                 .....!decwrl!brister
"Politics is comedy with pretense" -- Mark Alan Stamaty

-----------------------------


End of INFO-UNIX Digest
***********************



More information about the Comp.unix.questions mailing list