From: postmaster@vd1.hanscom.af.mil (SMTP MAILER)
Newsgroups: comp.unix.questions
Subject: Mail Delivery Problem
Date: 7 Sep 92 21:31:09 GMT


 ----Reason for mail failure follows----
Sending mail to recipient(s) woodfordm :
  Couldn't make final delivery.

 ----Transcript of message follows----
Received: from gw1.hanscom.af.mil by vd1.hanscom.af.mil with SMTP ; 
          Mon,  7 Sep 92 14:18:12 EST
Date: 6 Sep 92 16:40:00 EST
From: INFO-UNIX@BRL.MIL
Subject: INFO-UNIX Digest  V16#001
To: "woodfordm" <woodfordm@vd1.hanscom.af.mil>

Return-Path: <info-unix-request@sem.brl.mil>
Received: from SEM.BRL.MIL by gw1.hanscom.af.mil with SMTP ; 
          Sun,  6 Sep 92 16:39:48 EST
Received: from SEM.BRL.MIL by SEM.BRL.MIL id ab22412; 6 Sep 92 15:34 EDT
Received: from sem.brl.mil by SEM.BRL.MIL id aa22387; 6 Sep 92 15:15 EDT
Date:       Sun, 06 Sep 92 15:15:49 EST
From:       The Moderator (Mike Muuss) <Info-Unix-Request@BRL.MIL>
To:         INFO-UNIX@BRL.MIL
Reply-To:   INFO-UNIX@BRL.MIL
Subject:    INFO-UNIX Digest  V16#001

INFO-UNIX Digest          Sun, 06 Sep 1992              V16#001

Today's Topics:
                       Help with emacs,gnus,stty
             Re: question about Env. Variable "TAE and WS"
                  Re: How to prevent a large core-dump
             Re: Shared memory baby question on ultrix 4.2
                  Re: missing /etc/resolv.conf - help
                        MS Windows 3.1 via UNIX
                     MS Windows 3.1 via SCO UNIX ?
      Wanted: UNIX system/network programming book recommendation
                           Re: Dear vi guru,
          How and where to search old postings of a newsgoup??
                           Re: AWK and arrays
                    Re: Shell Scripts vs. C programs
                              time server?
                          Unix Script Debugger
             Re: need script to rename uppercase filenames
                           Re: AWK and arrays
             Re: need script to rename uppercase filenames
                         Re: vi (cut and paste)
    Looking for good online UNIX tutorial...is there such a animal?
                     Re: Awk: Beginner needs help!
                       UNIX-like OS for PC's ???
                 Re: reliable signals under BSD / SVR4
             Re: need script to rename uppercase filenames
                       changing name of core file
                     Password generator / checker?
                  Re: Awk and getting the current date
                          Re: awk with columns
                        Re: Unix Script Debugger
                            signal handling
             Re: need script to rename uppercase filenames
                 Re: reliable signals under BSD / SVR4
                  Re: Awk and getting the current date
                 Re: reliable signals under BSD / SVR4
-----------------------------------------------------------------

From: Steve Franklin <franklin@ug.cs.dal.ca>
Subject: Help with emacs,gnus,stty
Date: 3 Sep 92 21:21:22 GMT
To:       info-unix@sem.brl.mil

Okay, so I have a question or two with emacs. 
   First of all, Emacs often uses the ctrl-s key in it's various
commands. However, there is a problem with this, because it suspends
data flow over my modem to the computer host. (ctrl-q continues this of
course.) I found one solution using a program called "screen" which lets
you send "^a s" to send teh ctrl character "ctrl-s", but this is rather
clumsy. How can I (manipulating sttys perhaps?) accomadate this, so that
ctrl-s's wonderful suspend-flow feature is disabled? I can  disable
ctrl-z with
stty susp def (?) , but I can't figure it out for ctrl-s... Any thoughts
would be welcomed with great enthusiasm.
   Also, with gnus, I can't seem to figure out how to designate a specific
 .newsrc, OR a specific NNTPSERVER. If you could help me with this I would
be most appreciative. Can I have two *elc files? One for NNTPSERVER #1,
and .newsrc #1, and one for NNTPSERVER #2, and .newsrc #2?
   Any thoughts are welcomed.
thanks in advance.
   steve
--
aasdSteveFranklin-Subliminal Psychology Major.ks;dlasBlueJaysRULEkasdfeahsdbfl
sd;lfaswoq[eBuyMeAQuadra!!!mbnZMXCNdfsba;KdSPAMiuroqiyetIBMSuxiweuryth'ewr;mxn
qpuepriuPartyOneqtuj;,n.,xnc,kjasFlameMeNot!;lkj;lkgkjd;askElvisLivesjhfquweru
zx.cfranklin@ug.cs.dal.ca,sk;t;lrut[Superboy@ac.dal.cav.zx,Physics!eq3rwkh;oHA

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

From: John Ruschmeyer <jruschme@nyx.cs.du.edu>
Subject: Re: question about Env. Variable "TAE and WS"
Date: 3 Sep 92 18:14:53 GMT
X-Disclaimer: Nyx is a public access Unix system run by the University
	of Denver for the Denver community.  The University has neither
	control over nor responsibility for the opinions of users.
To:       info-unix@sem.brl.mil

In article <3501@babcock.cerc.wvu.wvnet.edu> hongman@cathedral.cerc.wvu.w
net.edu (Guo Hongman) writes:
>
> Can any tell me what's TAE and WS meaning ? What are they used for ? Ho
 to
>
> use them ?
>
>
> Thanks in advance !!


The Transportable Application Environment Plus (TAE+) is an X11-based
GUI builder which was developed by NASA and runs on a variety of
platforms.

$TAE should be the root of the TAE+ directory tree.
 
<<<John>>>

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

From: Dave Gordon <dsg@impmh.uucp>
Subject: Re: How to prevent a large core-dump
Date: 1 Sep 92 15:08:13 GMT
To:       info-unix@sem.brl.mil

In <1992Aug25.173056.13401@utwente.nl> soos@math.utwente.nl (Adwin Soos) writes:

>A few weeks or even months ago I have read some discussion about the problem
>of preventing a core-dump. I remember that there were some suggestions on how
>to prevent that a large core-dump will be made. 
>This problem is now occurring at our place where someone is writing a large
>program and in some test-cases there is a core dump for more than 60 Mb.
>This person is not using this core to debug it so maybe we can just stop the
>creation of this core for this person.

One simple method that should work on all UN*X systems is to create a file
named "core" in the working directory of the offending program, and give
it no permissions:
	echo > core
	chmod 0 core
Then the program will not produce a core, since the file "core" already
exists, but is unwritable (see signal(2)).
-- 
			Dave
			====

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

From: Dave Gordon <dsg@impmh.uucp>
Subject: Re: Shared memory baby question on ultrix 4.2
Keywords: shared memory permissions
Date: 1 Sep 92 15:56:24 GMT
To:       info-unix@sem.brl.mil

In comp.unix.questions deano@piglet.otago.ac.nz writes:

> Help Help Help
>
> I don't understand shared memory.  Sorry, but all I can find in the
> documentation for our DECstations is the man pages which tell me what to use
> and what to pass but not HOW to use ?!?!?!?!?!?
>
> at the moment I do this :
>
> key = ftok("/tmp", 'a');
> shmid = shmget(key, 64, IPC_CREAT | IPC_EXCL);
> s = shmat(shmid, 0, SHM_R | SHM_W);
>
> *s = 1; /* BARF BARF BARF, kernel acces since s == -1 */
>
> help help help



deano's problem is in the parameters to the shmget(2) call ...
the third parameter should include the permissions (modes) for
the new segment; the manual page on our system reads:

	  The low-order 9 bits of shm_perm.mode are set equal to the
		    low-order 9 bits of shmflg.

The shared-memory segment is created with no permissions for
anybody, so the shmat(2) call fails (returns -1).

The permissions are just like those used for files, except that
there is no 'execute' mode.  So the third parameter could be
	    (IPC_CREAT|IPC_EXCL|0666)
which gives read/write permission to everybody, or some other modes,
according to what is wanted.

ipcs(1) will display the status of shared memory segments including
permissions.


PS:
deano: I tried to mail this to deano@piglet.otago.ac.nz, but it
bounced at uknet.ac.uk; are you sure about your mail address??
-- 
			Dave
			====

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

From: Simon Langley <slangley@constant.demon.co.uk>
Subject: Re: missing /etc/resolv.conf - help
Date: 2 Sep 92 20:59:51 GMT
X-Newsreader: Tin 1.1 PL5
To:       info-unix@sem.brl.mil

Sabina Wolfson (swolfson@nyx.cs.du.edu) wrote:
: wait a minute or two for it to default to the /etc/hosts file and then
: specify another namer server -- this is a pain)?  Or is there some way
: I can send a request to another name server (I know which namer server
: my site should be using)?
: 
my resolv.conf just says:
nameserver 158.152.1.65

and it uses this host as the nameserver.  However, there are other changes
that may need to be made and these are system dependent.  Which UNIX are
you using.
 
-- 
   Simon Langley                   (preferred)   slangley@constant.demon.co.uk
   Hampstead, London                             slangley@cix.compulink.co.uk

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

From: Robert Mohrmann <rlm@wyvern.twuug.com>
Subject: MS Windows 3.1 via UNIX
Date: 3 Sep 92 14:07:47 GMT
To:       info-unix@sem.brl.mil

FIRST OF ALL ARE THESE POSTS GETTING OUT? I'VE NEVER USED NN BEFORE.


      My company department has a problem. We are currently running an
internal software package that was designed to run under "MS Windows 2.1".
The computers that we are running this on are 386 clones running
SCO Unix v3.2 and the VPIX (DOS emulator).

      The problem is, the department in charge of the internal software
package is releasing a new version of it and is not going to support the
old one any more. :-( The new version will only run on "MS Windows 3.1"
which does not work under VPIX. Open Desk Top (ODT) does supply a DOS
shell but the price at this time of ODT is prohibitively high for my
department.

      Does anybody have any suggestions on how to get around this
dilemma? One idea we had was to reformat the hard disk and to set up one
partition for DOS and another for UNIX. But, we don't know if it is
possible to switch between the two operating systems. Another idea would
be to find some other company that supplies DOS shell software, like
ODT's version, as a separate software package that can be bought for a
little amount of money.

Information:
                    Zenith 386
                    SCO UNIX v3.2
                    VPIX v1.1 (DOS emulation package)
                    8M bytes RAM
                    150M Hard Drive
                    VGA graphics card
                    Shades of grey VGA monitor



**-- rlm@wyvern.twuug.com --***********************************************
|    Robert Lee -SAURIAN- Mohrmann  |    Exodus 4:1-5    Numbers 21:5-9   |
***************************************************************************
-- 
**-- rlm@wyvern.twuug.com --***********************************************
|    Robert Lee -SAURIAN- Mohrmann  |    Exodus 4:1-5    Numbers 21:5-9   |
***************************************************************************

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

From: Robert Mohrmann <rlm@wyvern.twuug.com>
Subject: MS Windows 3.1 via SCO UNIX ?
Date: 4 Sep 92 00:21:21 GMT
To:       info-unix@sem.brl.mil


      My company department has a problem. We are currently running an
internal software package that was designed to run under "MS Windows 2.1".
The computers that we are running this on are 386 clones running
SCO Unix v3.2 and the VPIX (DOS emulator).

      The problem is, the department in charge of the internal software
package is releasing a new version of it and is not going to support the
old one any more. :-( The new version will only run on "MS Windows 3.1"
which does not work under VPIX. Open Desk Top (ODT) does supply a DOS
shell but the price at this time of ODT is prohibitively high for my
department.

      Does anybody have any suggestions on how to get around this
dilemma? One idea we had was to reformat the hard disk and to set up one
partition for DOS and another for UNIX. But, we don't know if it is
possible to switch between the two operating systems. Another idea would
be to find some other company that supplies DOS shell software, like
ODT's version, as a separate software package that can be bought for a
little amount of money.

Information:
                    Zenith 386
                    SCO UNIX v3.2
                    VPIX v1.1 (DOS emulation package)
                    8M bytes RAM
                    150M Hard Drive
                    VGA graphics card
                    Shades of grey VGA monitor
-- 
**-- rlm@wyvern.twuug.com --***********************************************
|    Robert Lee -SAURIAN- Mohrmann  |    Exodus 4:1-5    Numbers 21:5-9   |
***************************************************************************

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

From: Paul Moore <sp_pm@space.alcbel.be>
Subject: Wanted: UNIX system/network programming book recommendation
Date: 4 Sep 92 12:57:03 GMT
X-Received: by usenet.pa.dec.com; id AA16184; Fri, 4 Sep 92 10:49:48 -0700
X-Received: by inet-gw-1.pa.dec.com; id AA02305; Fri, 4 Sep 92 10:49:46 -0700
X-Received: from ub4b.buug.be by mcsun.EU.net with SMTPid AA28231 (5.65b/CWI-2.174); Fri, 4 Sep 1992 19:49:30 +0200
X-Received: from alcbel.UUCP by ub4b.buug.be (5.65c/ub4b_02)id AA11878; Fri, 4 Sep 1992 19:49:27 +0200
X-Received: from se.alcbel.be by alcbel.be (4.1/SMI-4.1)id AA06300; Fri, 4 Sep 92 14:54:07 +0200
X-Received: by se.alcbel.be (5.57/SE_03)id AA18228; Fri, 4 Sep 92 14:57:41 +0200
X-Received: from btmpjw.space by space.alcbel.be (4.1/SMI-4.0)id AA08149; Fri, 4 Sep 92 14:57:03 +0200
X-To: comp.unix.questions.usenet
To:       info-unix@sem.brl.mil


Hello,


I'm looking for books that deal with UNIX network and system programming.

A book that has been recommended to me is:

    UNIX Network Programming, by W. Richard Stevens

Are there any other books available in this field?


I've heard that Stevens has another book available, just recently published:

    Advanced UNIX SYstem Programming

or some such similar title. Has anyone seen this book, or offer any comments?


Please email responses, as I don't have a News connection. As usual, I'll summarise responses if there is sufficient interest.


Thanks in advance for any replies,

- Paul

 -------------------------------------------------------------------------------
email: sp_pm@space.alcbel.be       smail: Paul Moore
                                          Alcatel Bell Telephone,
phone: (+32) 3/829.5024                   Space Dept.,
                                          Berkenrodelei 33,
                                          2660 Hoboken,
                                          Belgium.

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

From: Wade Guthrie <wade@nb.rockwell.com>
Subject: Re: Dear vi guru,
Date: 3 Sep 92 22:58:58 GMT
To:       info-unix@sem.brl.mil


In article <1992Sep3.163059.10935@uhura1.uucp>, bryan@uhura1.uucp (Bryan Curnutt) writes:
> In article <1992Sep2.233330.18751@ncar.ucar.edu> tparker@music.scd.ucar.edu (Tom Parker) writes:
> >In article <1992Sep2.224136.24163@nsisrv.gsfc.nasa.gov> schieb@shark.gsfc.nasa.gov (Brian D. Schieber) writes:
> >>Dear vi guru,
> >> 
> >> I like to use tabs alot in just about every session of vi I
> >>work with, It would be great if I had a macro or whatever that
> >>could replace the tabs with the appropriate number of spaces
> >>in a file WHILE in vi. Do you have such a macro?
> >
> >Check if your system has the 'expand' command.  This command converts
> >tabs to spaces, and vice versa.
> 
> ... but is not what Brian asked for.

Well, not true. . .
The 'vi' user can use 'expand' from within 'vi'.  For example, to expand
tabs to 4 spaces throughout the file, one should do the following.
	1G
This will move the pointer to the beginning of the file.  Then,
	!Gexpand -4
Where the '!' says "I wanna do some external command", the 'G' says
"and I wanna do it from the current location (the top, 'cause of the
'1G') to the end ('cause 'G' says go to the end)" and the command
is "expand -4" which does the expansion (check out expand(1)).


> If your system does have the 'expand' command, then something like
> 
>     :map g :%!expand -4^M
> 

ya don't need 'map', but this DOES work. . .

Hope this helps.

Wade

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

From: Atiqullah Hashmi <hashmi@cse.uta.edu>
Subject: How and where to search old postings of a newsgoup??
Date: 4 Sep 92 00:37:29 GMT
To:       info-unix@sem.brl.mil

Hi netters,

I want to search some postings on the newsgroup 'misc.jobs.offered'.
(or any other newsgroup for that matter).
Can any kind soul tell me 'how' and 'where' to get the postings of 
last few months.

Thanks.

hashmi
-- 
 ---------------------------------
Atiqullah Hashmi                     
UTA (Univ. of Texas at Arlington)   
hashmi@cse.uta.edu                 

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

From: Mark Christopher <christo@bcarh803.bnr.ca>
Subject: Re: AWK and arrays
Date: 4 Sep 92 18:45:56 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep4.030733.27724@newshost.anu.edu.au>,
aps583@huxley.anu.edu.au (Anthony P Scott) writes:
|>Suppose I want to read a bunch of letters one to a line
|>and output the position in the alphabet that they occupy.
|>
|>ie
 .. replace 'a' with '1', 'b' with '2', etc...

|>One way I visualized doing this is to write an array called alph[letter]
|>such as:
|>
|>alph[a] =1
|>alph[b] = 2
|>alph[c] = 3

You need to say:  alph["a"] = 1; alph["b"] = 2; alph["c"] = 3; etc...

|>and then read the lines of text as another array called charact[NR]

Why do you need to save them in an array?  Couldn't you just do:

	{ print alph[$1] }

|>and the use the charact array to subscript the alph array ie
 ...
the code didn't work because you didn't initialize your array "alph"
correctly.

What would be wrong with:
	{
		print index("abcdefghijklmnopqrstuvwxyz",substr($1,1,1))
	}

This would print 0 if the first letter of the first arg was not a
lowercase letter.



|>I hope this is not a silly question.

No such thing as a silly question.  Learn how to find the answers
yourself.  Read the man page, read the book, see the movie.  You
will find the answers faster.

-- 
Mark Christopher        Bell-Northern Research          christo@bnr.ca

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

From: Stephen Harris <sweh@spuddy.uucp>
Subject: Re: Shell Scripts vs. C programs
Keywords: shell script, C
Date: 3 Sep 92 21:33:36 GMT
To:       info-unix@sem.brl.mil

In article <123@steiny.com> steiny@steiny.com (Don Steiny) writes:
>	This may be a matter of scale, but 1000 lines is not a very large 
>program.     Besides, there are still many systems that do not have ksh,
>unfortunately, I have to use them all the time.   Even on Sun's, ksh is
>a "local" program and is not always there.

You're right - 1000 lines of C code is not a lot.  1000 lines of shell script
in one program is quite a bit.  (This was just the main message router program.
The whole system comes close to 7000 lines).
On one of the machines, once I had ksh compiled OK, it was easier to write
ksh scripts than c programs (Altos 3068).  Heck!  On this machine the C
compiler would barf on its own include files!
#include <machine.h>

That one line program through up tonnes of cpp errors.  Blugh.

>a different kettle of fish than 20,000+ line program that run on dozens of
>systems.     Ask Larry Wall, the author of perl and rn.   He wrote perl 
>partially because of the portablity problems with the shell.

I would NEVER write 20,000+ line program in script.
In fact, I would try hard and not write a 20,000 line program!
20 1,000 lines programs sound better :-)  And these 1,000 lines programs
I *might* write in ksh.....
-- 
                               Stephen Harris
               sweh@spuddy.uucp    ...!uknet!axion!spuddy!sweh

 * Meeeeow ! Call Spud the Cat on > +44 203 638780 < for free Usenet access *

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

From: "Frederick W. Au" <fau@phantom.uucp>
Subject: time server?
Date: 4 Sep 92 18:12:32 GMT
To:       info-unix@sem.brl.mil


I am looking for a time-server like thing to synchronize (more or
less) the clocks on machines spred over a number of subnets.  do you
know of any host (like *.mil, or uunet) or any hardware (like having a
dedicated clock connected to one of the servers) that would do
something like that.  Any hints would be appreciated.  Please respond
by email and i will summarize later...


				Fred Au
				...!uunet!csfb1!phantom!fau

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

From: Kevin Simonson <simonson@cs.washington.edu>
Subject: Unix Script Debugger
Keywords: unix script debug
Date: 4 Sep 92 20:16:04 GMT
To:       info-unix@sem.brl.mil


     I've been writing Unix scripts for a little bit now.  Whenever I have
trouble with one I always end up inserting a bunch of "echo" statements
into it to try to figure out what's wrong with it, and this has always
solved the problem for me eventually.

     My question is whether I'm wasting time with this farely brute force
method.  Does anyone know of a Unix script debugger to solve the problem
without editing the script?  Or even an automated editor that inserts
"echo" statements?  Any information on this would be helpful.

                                     ---Kevin Simonson

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

From: x91clifton1@gw.wmich.edu
Subject: Re: need script to rename uppercase filenames
Date: 4 Sep 92 21:23:44 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep4.162044.2242@netlabs.com>, lwall@netlabs.com (Larry Wall) writes:
> In article <1992Sep03.151245.11128@Celestial.COM> bill@Celestial.COM (Bill Campbell) writes:
> :         s/\s+$//;   # strip all trailing whitespace including ^M
> 
> Unfortunately, that also deletes the ^J.  Since the script unlinks the
> DOS file, you've just thrown away information that's not easily
> reconstructable.  (In fact, the files won't even be editable unless you
> use GNU emacs.)  It would be safer to move the DOS file to a temporary
> subdirectory until you're sure the translation works right.
> 
> I don't want to discourage anyone from helping people, but help is not
> what booby traps are generally construed as...  :-)
> 
> Larry Wall
> lwall@netlabs.com

Since this post is from Larry Wall how about:

#!/usr/local/bin/perl
# lwr--change uppercase filenames to lowercase.

foreach $upr (@ARGV)    {
        ($lwr = $upr) =~ y/A-Z/a-z/;
        rename($upr, $lwr) || die "lwr: $upr->$lwr: $!\n";
}

;-)

/Doug
--
Douglas Clifton [99clifto@lab.cc.wmich.edu]

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

From: John Navarra <navarra@casbah.acns.nwu.edu>
Subject: Re: AWK and arrays
Date: 5 Sep 92 03:07:16 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep4.184556.6202@bnr.ca> christo@bnr.ca writes:
>No such thing as a silly question.  Learn how to find the answers
>yourself.  Read the man page, read the book, see the movie. 
                                              ^^^^^^^^^^^^^^ 

There's an *AWK* Movie?? Wow, I totally missed it! ;-)

bogus! I will have to check my local video store for a tape.

-tms

-- 
You can get further with a kind word | You can get further with a kind word
and a gun than a kind word alone.    | and a phaser than a kind word and a gun.
          --al capone                |           -- John Navarra
=======From the Lab of the MaD ScIenTIst....navarra@casbah.acns.nwu.edu========

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

From: Don Costello <fazc016@hq.dla.mil>
Subject: Re: need script to rename uppercase filenames
Date: 3 Sep 92 17:10:19 GMT
X-Newsreader: Tin 1.1 PL4
To:       info-unix@sem.brl.mil

slix@svcs1.UUCP (Bill Miller) writes:
: Hi, everyone.
: 
: I'm fairly new to unix, and I need a script or procedure to do the following:
:  
: I have some source code in DOS (many separate files) that I tarred under
: DOS and untarred under 386BSD.  The big problem is that all the files
: came through in UPPERCASE and I need a script to mv (rename) them all
: to lowercase quickly.
:  
: Since they're in DOS text format, I realize I also need to strip the 
: extra carriage returns on each line.  I've been successful in doing this
: with:
:  
:   cat (file) | tr -d '\015' > (newfile)
:  
: It would be nice to combine both of these so that I could rename the
: files to uppercase and strip the extra newlines all in one fell swoop
: instead of doing it one file at a time.

  I'm assumming you want to rename the files FROM upper TO lower
  case...

  Use "tr" like you did above to change the filename.  The following works
  on BSD4.3:

     #!/bin/sh
     #
     for oldfname in *
     do
        cat $oldfname | tr -d '\015' > `echo $oldfname | tr [A-Z] [a-z]`
     done

  You still have to remove the "$oldfname" before you end.  I really
  don't think there is a way to do it all at once because you are
  reading the *contents* of the file and sending the lines, less the
  "^M", to a newfile (lowercase of the original).

  My suggestion for the future... PKZip the files on your PC, then UnZip
  (using Info-Zip "unzip") and the files will be lower case and the CR/LF 
  translated correctly.

  But then again, your question breeds shell practice... :-)).

  Cheers  -- dcc --
-- 
+------------------------------------+---------------------------+
| Don Costello, DASC-ZSC             |  It's hard to cram this   |
| DLA Cameron Station, VA            |  signature into just 4    |
| TEL: (703) 274-7215  AV: 284-7215  |  lines!!!                 | 

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

From: Alex Martelli <martelli@cadlab.sublink.org>
Subject: Re: vi (cut and paste)
Keywords: vi
Date: 2 Sep 92 13:40:55 GMT
To:       info-unix@sem.brl.mil

sgr@alden.UUCP (Stan Ryckman) writes:

:In article <1992Aug17.200149.7817@s912%bnf.com> bibb@s912%bnf.com (Ken Bibb) writes:
:>In <3815@keele.keele.ac.uk> phd85@seq1.keele.ac.uk (D.H. Holden) writes:
:>> hi, 
:>>    Does anyone know how you cut a range of text to one
:>>    of the named buffers, where the range does not cover
:>>   an integer number of lines, i.e., 
:>>  How do i cut from here > text  text text ..........
:>>  ............... n number of lines .....
:>> ...... to here <  into the named buffer "a for example?
:>>    Cheers,
:>>              Dave.
:>In the following texT:
:>aaabbbbbb
:>bbbbbbbbb
:>bbbbccccc
:>
:>I'll assume you want to cut the b's out and save them into buffer a.
:>1) position the cursor at the beginning of the range to be cut (1Gfb will work
:>   in this example).
:>2) ma (mark the location with marker a)
:>3) move to the end of the range (Gfc will work in this example)
:>4) "ad`a will cut the range and put it into buffer a
:
:NOT!
:
:This grabs all three full lines.  (I tried it!  Did you?)

You are wrong.  Yes, I did try Ken's suggestion, and it works perfectly!
Your mistake is probably that sub 4), where Ken specifies a ` (reverse
quote) you used a ' (quote); THAT would grab the three full lines!

:Dave presumably wants to have the remaining text be:
:aaaccccc
:
:and the buffer to contain:
:bbbbbb
:bbbbbbbbb
:bbbb

Which is EXACTLY what Ken's sequence does.

:"Mark" (the "m" command) only marks the line, NOT the cursor
:position within the line.

You are wrong.  m DOES mark the column position within the line; then,
if you use a ' (quote) to get back to the mark, you'll use the full
marked line, but if you use a ` (backquote) you'll get the exact
portion of the line.

:Am cross-posting to comp.editors, since someone there may know
:for sure whether there _is_ a way to do this, and if I'm wrong I'd
:like to know.  But please, _TRY_ it before posting!

The cross-posting was a good idea, since I'm reading this in
comp.editors.  And yes, I do know for sure, and YES, I *DID*
try the exact sequence of commands which you claim fail, and
they work like a charm.
-- 
Email: martelli@cadlab.sublink.org                   Phone: ++39 (51) 6130360
CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: ++39 (51) 6130294 

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

From: William Daul <billd@informix.com>
Subject: Looking for good online UNIX tutorial...is there such a animal?
Date: 4 Sep 92 18:10:08 GMT
Originator: billd@cheetah
To:       info-unix@sem.brl.mil

Please let me know where to look.

Thanks,  --Bill
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 William Daul             Advanced Support      INFORMIX SOFTWARE INC.
 4100 Bohannon Dr.        (415) 926-6488 - wk
 Menlo Park, CA. 94025    uunet!infmx!billd  or  billd@informix.com

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

From: Samuel Kamens <snk@fork.bae.bellcore.com>
Subject: Re: Awk: Beginner needs help!
Keywords: awk unix
Date: 4 Sep 92 20:22:38 GMT
To:       info-unix@sem.brl.mil

In article <5608@ucsbcsl.ucsb.edu>, 6500scv1@ucsbuxa.ucsb.edu (Steven C. Velasco) writes:
> 
> HI,
> I am new to unix, and really new to awk, so hopefully somebody can
> answer this question real easily.  I have hundreds of SAS program
> files written for MVS, that we now need to run on UNIX.  
> The files from MVS look like this :
> 
> COMMAND? list unnumbered
> //MVS JCL statements
> //MVS JCL statements
> //MVS JCL statements
> DATA _NULL_ ;
>    SET SASLIB.DATASET ;
> MORE SAS STATEMENTS
> RUN ;
> 
> I can get awk to print out the lines that don't contain the string  "//"
> or "COMMAND?" in $1, but I would like to have
> something that replaces the entire line  "COMMAND? list unnumbered"
> (this is always the first line, and occurs just once) 
> with the string: "libname saslib /usr2/username/datasets"  or, to 
> somehow put the "libname" string in the first line of each file.
> So the resulting file would look like this:
> 
> libname saslib '/usr2/username/datasets' ;
> DATA _NULL_ ;
>    SET SASLIB.DATASET ;
> MORE SAS STATEMENTS ;
> RUN ;
> 
> below is my feeble attempt to do this.  When I run this program, I
> get a message saying something like 'awk: cant set $0 at record 1':
> 
> $1 !~ /\/\// { if ( $0 ~ /COMMAND? list unnumbered/ ) 
> $0 = "libname saslib /usr2/username/datasets ;" 
> print >FILENAME }  
> 
> What am I doing wrong?  I would appreciate any help or suggestions.

I think what you're doing wrong is using the wrong tool!

Try it with sed, as follows:

sed \
-e "s:COMMAND? list unnumbered:libname saslib'/usr2/username/datasets';:" \
-e /^COMMAND/d \
-e /^\/\//d \
filename > outfile.


You could also do it in awk, as follows:

awk '/^COMMAND?/ 	{ print "libname saslib '/usr2/username/datasets' ;"
			  next
			  }
     /^\/\//            { next }
			{ print }
' infile



See which one you like better!!

Sam Kamens					Bell Communications Research
snk@bae.bellcore.com				Phone: (908) 699-7509
444 Hoes Lane  Room RRC 1D-210
Piscataway, NJ 08854

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

From: Mike Kelley <kelley@kelley.nist.gov>
Subject: UNIX-like OS for PC's ???
Date: 4 Sep 92 21:22:47 GMT
To:       info-unix@sem.brl.mil

I am looking to put a UNIX-like operating system on a PC-compatible
computer.  As this is for personal use, expense is a major
consideration.  Could someone please tell me where to find information
concerning the advantages or disadvantages of the various UNIX and
UNIX-like (e.g. COHERENT, QNX, ... ) systems currently available?

My system is currently a 286 class machine. However, as I am looking to
upgrade to a 386 or 486 in the near future anyway, information on the
software available on any of these would be useful.

Thanks in advance for whatever help you might be able to provide.


-- 
Mike Kelley
Bldg 220, Rm B206
National Institute of Standards and Technology
Gaithersburg, MD 20899
(301) 975-3722  FAX (301) 926-2746
INTERNET:	kelley@epg.nist.gov
BITNET:		mkelley@nbsenh.BITNET

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

From: Terry Lambert <terry@thisbe.npd.novell.com>
Subject: Re: reliable signals under BSD / SVR4
Keywords: signals, reliable, software interrupts
Date: 4 Sep 92 21:32:03 GMT
To:       info-unix@sem.brl.mil

In article <acourtny.715602566@unix1.tcd.ie>, acourtny@unix1.tcd.ie (Antony A. Courtney) writes:
|> In <1992Sep4.004436.24755@gateway.novell.com> terry@thisbe.Eng.Sandy.Novell.COM (Terry Lambert) writes:
|> 
|> >In article <acourtny.715556934@unix1.tcd.ie> acourtny@unix1.tcd.ie (Antony A. Courtney) writes:
|> >>There are some "hacks" to get around this, if you're environment lets you
|> >>write the centralized control loop for the program.  But usually SIGIO is
|> >>useful in cases where that isn't possible, e.g. when using an X toolkit.
|> >
|> >	Wrong.  In XTMainAppLoop() in the X toolkit, there are hooks for
|> >adding input sources to be "select()"ed on.
|> > [...]
|> 
|> 	I didn't assert that it was totally impossible, just that it was a
|> "hack".  Adding extra input sources before passing control to XTMainAppLoop()
|> is a bit like saying "take over the control flow and tell me when something
|> happens that you understand (X events).  Oh, and also please tell me about
|> anything else that happens on these descriptors, even though you have no idea
|> what they are for and you don't know how to deal with them."  I humbly suggest
|> that this is hardly what one would call "elegant".

	Well, a hack's basically what you are doing.  The other method, which
*truly* is a hack, is to select on your descriptors AND the Xfd, and call an
unrolled XtMainAppLoop() for the processing of X events only.  Certainly the
registration of imput sources is more elegant than that.  And there's no
requirement that the input sources can not be registered as part of a callback
routine *after* entering XtMainAppLoop(), unless you are talking about command
line parameters on which the main thread of execution is supposed to act.

	The problem is that your application is using a toolkit at all, given the
non-event-driven nature of it, since a toolkit assumes that you will be doing
event callback processing.  This is fine for word processors and calculators
and such, but sucks out for anything with multiple input sources (like telnet or
xterm or talk).  There is a problem when you try to mix thread of execution
paradigms, like clasical procedural and event based programming styles.

	Perhaps what you really need is to start with XtMainAppLoop() as your
main procedural function, or simply use the object drawing code directly, if
what you are doing is antithetical to "toolkit" programming.

|> >	Read the fine manual.
|> 
|> 	I have read the fine manual on select() for my Unix system.  Too bad X
|> toolkits hide "all that underlying system control flow stuff" from me...

	Perhaps I was to flip here, in not siting the O'Reilly X Toolkit
programmer's guide (Hi Tim!  I want a commision!), seeing as you appear to
have gotten the impression I was referring to the UNIX manual page on select().
I was referring to where you would find documentation on the input registration
mechanisms I cited, not denigrating your desire to use select().

	Another alternative would be to download the X Toolkit from one of the
many ftp sites (export.lcs.mit.edu, gatekeeper.dec.com, wuarchive.wustl.edu,
etc.) and reimplement the main loop callback mechanism procedurally.  I did
this for "TERM for X Windows" with only a little difficulty about 2 or 2 1/2
years ago.

	I don't think anyone who has tried to do a complex job using an X
interface toolkit would argue that they are suitable for complex jobs; however,
I normally look at problems in light of "how can I *make* this work".  This is
pretty much how you can *make* it work.  Good luck on your problem.


					Terry Lambert
					terry_lambert@gateway.novell.com
					terry@icarus.weber.edu

---
Disclaimer:  Any opinions in this posting are my own and not those of
my present or previous employers.

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

From: Bill Miller <slix@svcs1.uucp>
Subject: Re: need script to rename uppercase filenames
Date: 4 Sep 92 22:02:14 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep3.083107.11920@athena.mit.edu>, benjy@athena.mit.edu (Benjamin B Thomas) writes:
B
> Try:
> 
> #!/bin/csh 
> foreach i ($argv)
> setenv file $i
> cat $file | tr -d '\015' > `echo foo | nawk '{print tolower(ENVIRON["file"])}'`
o> rm $file
I tried that, but it doesn't work.  It simply zero-lengths the first
file it finds and then promptly goes to bed - in a loop and doesn't
process further.  Killing it locks up the system.  I don't understand
one or two things.  i dont seem to have 'nawk', I guess I could try
substituting 'awk'?  Also, what is 'foo'?  Does csh understand 'foo' to
mean something special, or is it trying to echo a file called 'foo' which
I don't have?

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

From: Dan Stanger <dxs@evolving.com>
Subject: changing name of core file
Date: 3 Sep 92 21:06:50 GMT
To:       info-unix@sem.brl.mil

does anyone know how to change the name of the core file that will be
created if a program fails.  we have several programs running in the
same directory so if more than one of them fails the core file from
one overwrites the other.  we would like to change the name to
program.core or somthing like that.

thanks

dxs@evolving.com

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

From: Ian Macky <ian@centric.com>
Subject: Password generator / checker?
Date: 3 Sep 92 23:01:49 GMT
Originator: ian@raven
To:       info-unix@sem.brl.mil

I recently rank the 'crack' program on our firewall machine and had some nasty
surprises!  Yikes!

So, does anyone have a password generator program?  The kind that makes 'typable',
pronounceable passwords, but ones that are meaningless?  I'd like to make it
available to my users for those who can't make up random gubbish on their own.

Also, what about a version of the passwd program that applies crack-style rules to
the user's choice and refuses to let them enter obviously crackable passwords in
the first place?

--ian

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

From: Mark Christopher <christo@bcarh803.bnr.ca>
Subject: Re: Awk and getting the current date
Date: 3 Sep 92 22:20:04 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep3.135708.28491@rtf.bt.co.uk>, duplain@rtf.bt.co.uk
(Andy Duplain) writes:
|>In article <1992Sep1.214207.1@sc9> mbrodesky@sc9 writes:
|>>How can I get the current date in a AWK program
 ...
|>		#!/bin/sh
|>		awk -e 'BEGIN { 
|>			date="'`date`'"
|>		}
 ...

Or in nawk:

	nawk 'BEGIN { "date" | getline; date=$0}
        {
          print date,$0
        }'

Not tough.  Learn to read the manual.
-- 
Mark Christopher        Bell-Northern Research          christo@bnr.ca

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

From: Mark Christopher <christo@bcarh803.bnr.ca>
Subject: Re: awk with columns
Date: 3 Sep 92 22:24:16 GMT
To:       info-unix@sem.brl.mil

In article <29098@hydra.Helsinki.FI>, karell@cs.Helsinki.FI (Esa Karell)
writes:
|>Could someone tell me what would be the easisest
|>way to accomplish this with awk.

|>X    Y  T        P I
|>1    2  3        4 5

|>I'd need to swap the values of Y & T so output should look:
|>
|>X    Y  T        P I
|>1    3  2        4 5
|>.    .  .        . .
|>
|>All the blanks between the columns should remain the same.

Well, what do you think?  Two easy ways:

Come up with a printf format string and say

	{ printf "....format....",$1,$3,$2,$4,$5 }

or else find the column numbers and do:

	{ print substr(..),substr(..),... }

-- 
Mark Christopher        Bell-Northern Research          christo@bnr.ca

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

From: "S.Ramakrishnan" <ramakris@csgrad.cs.vt.edu>
Subject: Re: Unix Script Debugger
Keywords: unix script debug
Date: 4 Sep 92 23:44:57 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep4.201604.717@beaver.cs.washington.edu> simonson@cs.washington.edu (Kevin Simonson) writes:
>
>     I've been writing Unix scripts for a little bit now.  Whenever I have
>trouble with one I always end up inserting a bunch of "echo" statements
>into it to try to figure out what's wrong with it, and this has always
>solved the problem for me eventually.
>
>     My question is whether I'm wasting time with this farely brute force
>method.  Does anyone know of a Unix script debugger to solve the problem
>without editing the script?  Or even an automated editor that inserts
>"echo" statements?  Any information on this would be helpful.
>
>                                     ---Kevin Simonson

If you are using perl there is a debugger available.

If you are using csh/sh, you can run it in the "debugging" mode
as

  #sh -x <script> or % csh -x <script>

which displays the statements as they are executed and the values of
the intermediate expressions and variables as a statement is  executed.
Of course, this still doesn't beat having a debugger shc as that for perl.

---
S Ramakrishnan, CS Dept, McBryde Hall, VaTech

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

From: Dan Stanger <dxs@evolving.com>
Subject: signal handling
Date: 3 Sep 92 23:14:14 GMT
To:       info-unix@sem.brl.mil

i want to write a program with the following structure

linked_list

handler()
{
   put structure on linked list indicating signal
}

main()
{
   loop
      disable signals
      check linked list to see if a signal occured
      enable signals
      /* location 1 */
      wait on message queue until message is sent
      disable signals
      check linked list to see if a signal occured
      enable signals
      process either message or signal
   end loop
}

since the wait on the message queue will be terminated if a signal
occurs the signal will be handled quickly.  however if the signal
occurs while the program is at location 1 then the signal will not
be handled until a message comes in.

is there a way around this?
thanks
dan stanger

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

From: Bill Miller <slix@svcs1.uucp>
Subject: Re: need script to rename uppercase filenames
Date: 4 Sep 92 23:24:19 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep3.120607.25089@umbc3.umbc.edu>, rouben@math13.math.umbc.edu (Rouben Rostamian) writes:

> I would suggest the quicker script:
> 
> #!/bin/sh
> for file in *[A-Z]*
> do
> mv $file `echo $file | tr '[A-Z]' '[a-z]'`
> done
> 
> This script changes all files names containing an uppercase letter 
> in the current directory to lowercase.  I would not strip the \015s
> so casually without knowing the contents of the files.

First of all, when I try that, it just stops, and starts echoing every
thing I type  since I first run it to a 'typescript' file which eventually
grows fairly large.  I can't kill the pid for the script - if I do that
the system hangs.

FWIW I use 386BSD and csh, but nothing so far has worked as intended.

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

From: Terry Lambert <terry@thisbe.eng.sandy.novell.com>
Subject: Re: reliable signals under BSD / SVR4
Keywords: signals, reliable, software interrupts
Date: 4 Sep 92 00:44:36 GMT
To:       info-unix@sem.brl.mil

In article <acourtny.715556934@unix1.tcd.ie> acourtny@unix1.tcd.ie (Antony A. Courtney) writes:
>There are some "hacks" to get around this, if you're environment lets you
>write the centralized control loop for the program.  But usually SIGIO is
>useful in cases where that isn't possible, e.g. when using an X toolkit.

	Wrong.  In XTMainAppLoop() in the X toolkit, there are hooks for
adding input sources to be "select()"ed on.  Since this is the toolkit used
to build most other toolkits (ie: Motif), this works there also.  The
routines of interest are:

	XtAddInput()
	XtAppAddInput()
	XtRemoveInput()
	XtRemoveAllInputs()

	Read the fine manual.


					Terry Lambert
					terry_lambert@gateway.novell.com
					terry@icarus.weber.edu

---
Disclaimer:  Any opinions in this posting are my own and not those of
my present or previous employers.

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

From: Andy Duplain <duplain@rtf.bt.co.uk>
Subject: Re: Awk and getting the current date
Date: 3 Sep 92 13:57:08 GMT
To:       info-unix@sem.brl.mil

In article <1992Sep1.214207.1@sc9> mbrodesky@sc9 writes:
>How can I get the current date in a AWK program

	I assume you mean "awk" not "nawk" or "gawk"; nawk and gawk
	allow commands to forked and the output from those commands
	to be read (RTFM for details).  In awk you will have to wrap
	the awk script in a shell script and assign the date to an
	awk variable:
	
		#!/bin/sh
		awk -e 'BEGIN { 
			date="'`date`'"
		}
		{
			print date
		}'
		
		(or something like that)
	
-- 
Andy Duplain, BT Customer Systems, Brighton, UK.            duplain@rtf.bt.co.uk
#define	DISCLAIMER      My views and opinions are my own, and not my company's

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

From: "Antony A. Courtney" <acourtny@unix1.tcd.ie>
Subject: Re: reliable signals under BSD / SVR4
Keywords: signals, reliable, software interrupts
Date: 3 Sep 92 21:48:54 GMT
To:       info-unix@sem.brl.mil

I have received a few good responses to my post, informing me that "reliable"
signals only guarantee "at least once" semantics on signal delivery.  This
should have been obvious to me since the kernel just keeps a mask of pending
signals for the process, and it is rather difficult to keep a "count" of
signals delivered with just a single bit.

Has anyone investigated other models for signal delivery?  Since signals are
meant to be analogous to interrupts, wouldn't it be useful to guarantee that
all signals sent are processed?  I would think this would be particularly
useful for programs that request async. I/O on a descriptor.

Come to think of it, doesn't it make it somewhat "tricky" to use async. I/O at
all?

If you do:

	...
	fcntl() to mark socket for async. i/o;
	fcntl() to mark socket for non-blocking i/o;
	signal(SIGIO,handler);
	...

handler(int sig)
{
	/* SIGIO implies we have something to read.  Since we may get
	 * more of them while processing this one, read as much as we
	 * can.
	 */
	while (1) {
		if (read(fd,BUFSIZE,&buf) < 0) {
			if (errno==EWOULDBLOCK) {
				/* nothing left to process */
				break;
			} else {
				perror("read");
				exit(1);
			}
		}
		store the buffer somewhere;
	}
}

This code has an obvious race condition, since the check for EWOULDBLOCK and
the return from the signal handler is non-atomic.  If data arrives on the
descriptor between the time of checking for EWOULDBLOCK and returning from
the signal handler, the SIGIO will not be delivered since there is already
one pending.  This will leave unprocessed data pending in the buffer for the
descriptor.

There are some "hacks" to get around this, if you're environment lets you
write the centralized control loop for the program.  But usually SIGIO is
useful in cases where that isn't possible, e.g. when using an X toolkit.

Comments?

	-antony
--
********************************************************************************
* Antony A. Courtney                              Email: acourtny@unix1.tcd.ie *
* Computer Science Department                            antony@george.lbl.gov *
* Trinity College, Dublin, Ireland                Phone: 01+353+1-607389       *

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


End of INFO-UNIX Digest
***********************
Newsgroups: comp.unix.questions