Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!cmcl2!adm!news From: postmaster@sandia.gov (SMTP MAILER) Newsgroups: comp.unix.questions Subject: Mail Delivery Problem Message-ID: <24227@adm.BRL.MIL> Date: 20 Aug 90 16:03:21 GMT Sender: news@adm.BRL.MIL Lines: 1454 ----Reason for mail failure follows---- Sending mail to : Could not be delivered for three days. ----Transcript of message follows---- Date: 17 Aug 90 06:26:00 MDT From: info-unix@BRL.MIL Subject: INFO-UNIX Digest V10#119 To: "jnjortn" Return-Path: Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Fri, 17 Aug 90 06:10:11 MDT Received: from SEM.BRL.MIL by SEM.BRL.MIL id ab01304; 17 Aug 90 5:57 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa01300; 17 Aug 90 5:45 EDT Date: Fri, 17 Aug 90 05:45:36 EST From: The Moderator (Mike Muuss) To: INFO-UNIX@BRL.MIL Reply-To: INFO-UNIX@BRL.MIL Subject: INFO-UNIX Digest V10#119 Message-ID: <9008170545.aa01300@SEM.BRL.MIL> INFO-UNIX Digest Fri, 17 Aug 1990 V10#119 Today's Topics: Re: Recursion without -R Re: need help with FATAL error in unix 3.2u Coherent info Re: Coherent info Sys V or BSD for PDP 11/73 Wanted Re: More questions about how to issue a C-SHELL command within a C program Re: What's wrong with this Bourne shell script? Re: Cshell question: taking wordlists as a single string Re: Timeout on shell command. Printing with terminalservers Re: getting the exit value of an exec'd program Help on tools like SCCS, SPRs etc.. extracting files from a tar file Re: Cshell question. Or: How to make a fool of yourself Sending mail with explicit INTERNET address Re: Spy Programs?? Looking for a BCD library for Unix / C /-happy Re: /-happy Re: redirecting standard i/o from an exec'ed programme Unix supporting HANGUL (Korean) avail? Re: help sought - securing a terminal/line LaserWriter II printcap entry needed Looking for an adduser script. Changing back slashes to forward slashes Re: Changing back slashes to forward slashes addcol - # [Was: Re: What's wrong with this Bourne shell script?] Re: Converting to uppercase/lowercase in sed Re: MACH stripped from AT&T code ? sort with a tab as separator ----------------------------------------------------------------- From: micah altman Subject: Re: Recursion without -R Date: 15 Aug 90 17:53:22 GMT Sender: Net News To: info-unix@sem.brl.mil In article kaul@icarus.eng.ohio-state.edu (Rich Kaul) writes: >In article <13595@ulysses.att.com> swfc@ulysses.att.com (Shu-Wie F Chen) writes: > find . -print | xargs chown foo > > Of course, this only works if you have xargs, which is from System V and > is also available on SunOS in their System V software installation option. ... > If your version of find supports the -exec option you could recursively step through files and change the owner to "foo" by issueing the command find . -exec chown foo {} \; ( And yes, the "\;" at the end is necessary ) - Micah Altman Computational Juggler ----------------------------- From: "Dik T. Winter" Subject: Re: Recursion without -R Date: 16 Aug 90 10:43:13 GMT Sender: news@cwi.nl To: info-unix@sem.brl.mil In article <1990Aug15.175322.23868@odin.corp.sgi.com> micah@sgi.com (micah altman) writes: > find . -exec chown foo {} \; > And do this only if user foo is in the local password file, not if foo is known through yellow pages. -- dik t. winter, cwi, amsterdam, nederland dik@cwi.nl ----------------------------- From: "Andrew A. Burgess" Subject: Re: need help with FATAL error in unix 3.2u Keywords: parity error, NMI, floppy access, gateway2000 Date: 15 Aug 90 19:34:16 GMT To: info-unix@sem.brl.mil In article <601@bigbroth.UUCP> rk@bigbroth.UUCP (rohan kelley) writes: >Problems with unix 3.2u BellTech (Interactive) installation in >Gateway2000-25 cache system. > >Error message: >FATAL:Parity error on the motherboard >PANIC:Parity error address unknown > Trying to dump 1024 pages (etc) ... >Crash occurs when accessing the floppy drive (either 0 or 1) but only >at intermittent times. Commands current have been cpio and format. If ... I had a similar problem with an old AMI motherboard once. I first noticed that it would drop about one byte per million when reading from the tape drive. Repeating the read was successful. Note that there were no error messages from the tape drive -- it thought the tape had read correctly. I only became aware of a problem when doing a compare of disk to tape after a backup. Then I noticed that reading floppys had a similar problem. The only common denominator I could think of was that both subsystems used the motherboard DMA controller to transfer data. So I created a little test under DOS. I made a 500Kb file of random data and put two copies on a 1.2MB floppy. I then ran the DOS comp (file compare) program endlessly. The files would miscompare in a few minutes. Eventually the program would crash. My guess was that this one bye in a million was not just vanishing but instead being written to a 'random' location. This could be your problem. If so then a replacement motherboard would solve it (assuming you have a marginal component somewhere rather than a bad motherboard design). If the dealer is willing to swap and maybe give you another week or so to test, you might get lucky. Then again this is a WILD GUESS! You might also try writing a test program like mine. Good luck Andy -- Andy Burgess Independent Consultant uunet!silma!cichlid!aab aab@cichlid.com ----------------------------- From: Greg Montgomery Subject: Coherent info Date: 15 Aug 90 21:59:00 GMT To: info-unix@sem.brl.mil I'm looking for some info and opinions on Coherent from any users of it... I've talked to a tech at MW, and it sounds good, and a 386 version and DOS emulation is under development, so I've been considering getting it, but would like some opinions.. Please email any replies. Thanks... Greg ---- Greg Montgomery Internet: greg@turbo.atl.ga.us UUCP (smart): greg@turbo.UUCP UUCP (route): {rutgers,ogcise,gatech}!emory!turbo!greg ----------------------------- From: TURNER KENNETH WADE Subject: Re: Coherent info Date: 17 Aug 90 00:06:01 GMT Sender: news@boulder.colorado.edu To: info-unix@sem.brl.mil In article <2kTyN1w162w@turbo.atl.ga.us> greg@turbo.atl.ga.us (Greg Montgomery) writes: >I'm looking for some info and opinions on Coherent from any users of >it... I've talked to a tech at MW, and it sounds good, and a 386 version >and DOS emulation is under development, so I've been considering getting >it, but would like some opinions.. Hope this helps. Wade Turner ----------------------------- From: "Jay A. Snyder" Subject: Sys V or BSD for PDP 11/73 Wanted Date: 16 Aug 90 02:16:37 GMT To: info-unix@sem.brl.mil Does any one out there no where to get a copy of SYSV or BSD, or any version of unix newer than V7 for a DEC LSI 11/73 based system? echo wrong group flames >/dev/null -- ============================================================================== Jay A. Snyder "Let Me Up! I've had enough" wa3wbu!gdx!jay@uunet.uu.net uunet!wa3wbu!gdx!jay ----------------------------- From: Randal Schwartz Subject: Re: More questions about how to issue a C-SHELL command within a C program Date: 16 Aug 90 07:34:52 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article , fpb@ittc (Frank P. Bresz) writes: | Why not just use the putenv system call with something akin to: | | putenv("TERM=adm3a"); /* notify subprocess that it is an adm3a terminal */ Nope. That changes the *current* process (the C program), not the parent process (the parent shell). You *must* involve the parent process if you want programs invoked after the C program to see the change (unless you intend the C program to perform all the future invocations... yuck). Just another UNIX hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: Doug Gwyn Subject: Re: More questions about how to issue a C-SHELL command within a C program Date: 16 Aug 90 14:22:10 GMT To: info-unix@sem.brl.mil In article <25285.26c9113d@kuhub.cc.ukans.edu> jian@kuhub.cc.ukans.edu writes: > system("/bin/csh -c 'setenv TERM adm3a"); (You're missing a quote ') >But none of them can change the terminal type. I don't know why. Your problem is that no change made to the environment variables of a subprocess can affect the environment variables of an ancestor process. This is why most of us make sure our TERM environment variable is properly set up by a file that is SOURCED, not executed in a subprocess, when our shell starts up (e.g. .profile or .login). ----------------------------- From: Guy Harris Subject: Re: More questions about how to issue a C-SHELL command within a C program Date: 16 Aug 90 19:22:26 GMT To: info-unix@sem.brl.mil >Would someone point me another way to change terminal type within a C program >or give me some hints what I did wrong. I would appreciate any helps. As noted, the environment isn't "global", so setting an environment variable such as TERM in one process won't affect its value in any other existing processes; it'll only affect its initial value in processes forked from that process. If you want to change the value of an environment variable in a process running some arbitrary C program, check whether your system has the "putenv" routine (look for PUTENV(3) in the manual - unless you have some SCO system wherein they "improved" the manuals by changing the names of the sections, in which case I've no idea what the name would be). If not, see whether it has the "setenv" routine. If it has one or the other of those routines, the manual page should show you how to set an environment variable using the routine. Why do you need to change the setting of TERM within a program? The ultimate problem may lie deeper. (Also bear in mind that you should set TERM *before* you call *any* "curses" or "termcap" routines; otherwise, "curses" or "termcap" will start out using the old value of TERM, not the new value.) ----------------------------- From: Peter da Silva Subject: Re: More questions about how to issue a C-SHELL command within a C program Date: 16 Aug 90 19:43:41 GMT To: info-unix@sem.brl.mil In article <25285.26c9113d@kuhub.cc.ukans.edu>, jian@kuhub.cc.ukans.edu writes: > execlp("/bin/csh", "csh", "-c", "setenv TERM adm3a", (char *) 0); You can't set your environment from a subshell. An environment is owned by a process and inherited by its children, but never passed back. You need to do something like print the commands on standard output, the way "tset" does: 47 % tset -s set noglob; setenv TERM at/386 console ; unset noglob; 48 % grep tset .login tset -s ... >/tmp/tset$$ source /tmp/tset$$ rm /tmp/tset$$ 49 % This way the variables get set in the parent shell and so stick around after the subshell or your C program (which is also a child of the shell) exits. If you just want to set variables for programs you call, try "putenv". -- Peter da Silva. `-_-' +1 713 274 5180. 'U` peter@ferranti.com (currently not working) peter@hackercorp.com ----------------------------- From: Randal Schwartz Subject: Re: What's wrong with this Bourne shell script? Date: 16 Aug 90 07:37:29 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article , fpb@ittc (Frank P. Bresz) writes: | That would be fine if I had or wanted pearl. I was under the | impression that Jon's addcol was an awk script (I think that's where the | original thread came from anway) in which the -# was the column you wanted | to add and it would magically add up the numbers in column 1 or 7 or | whatever column you wanted under argumentalized control instead of having | separate scripts for each possible set of columns you want to add. Well, the script in awk is almost as easy: ... | awk '{ $x += $3 } END { print $x }' | who needs anything else? (But in Perl you can write it in one line. :-) Just another Perl hacker, more-or-less, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: Andy Clews Subject: Re: Cshell question: taking wordlists as a single string Date: 16 Aug 90 13:00:47 GMT To: info-unix@sem.brl.mil In article <3251@syma.sussex.ac.uk>, I wrote: > > Basically, then, can Cshell cope with word-lists as single arguments, or > must I write a C program to do the job (or try sh or ksh?) > The solution was staring me in the face and I didn't see it until Jay Plett sent me this solution: % xxx "a b c" d e f a b c d e f % cat xxx #! /bin/csh -f while ( $#argv ) echo $1 shift end So you must use a while loop rather than a foreach loop. So obvious now I look at it. *sigh* Thanks to Jay for the enlightenment. -- Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England JANET: andy@syma.sussex.ac.uk BITNET: andy%syma.sussex.ac.uk@uk.ac ----------------------------- From: Brad Appleton Subject: Re: Cshell question: taking wordlists as a single string Date: 16 Aug 90 15:26:41 GMT Sender: news@travis.csd.harris.com To: info-unix@sem.brl.mil In article <3251@syma.sussex.ac.uk> andy@syma.sussex.ac.uk (Andy Clews) writes: In article <3251@syma.sussex.ac.uk> you write: > The difficulty arises because I want to do (for example) > > whatnews "bug reports" > >where the intended effect is to search out all lines containing the >string "bug reports". At the moment it splits this up into "bug" and >"reports" and does two searches. This is because the script contains a > foreach i ($*) >loop for repeated searches. Quoting (single or double) doesn't help. Dont use "$*" in this case, use $argv and a while loop! The following should work in the manner you desire: @ i=1 while ( $i <= $#argv ) cmd "$argv[$i]" ##dont forget those quotes! . . . @ i++ end Im sure there are other solutions too (probably better ones) but this works (on my machone anyway) and should be easy to understand. Any other solutions out there? hope this helps! ______________________ "And miles to go before I sleep." ______________________ Brad Appleton brad@travis.ssd.csd.harris.com Harris Computer Systems ...!uunet!hcx1!brad Fort Lauderdale, FL USA ~~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~ ----------------------------- From: Maarten Litmaath Subject: Re: Timeout on shell command. Date: 16 Aug 90 14:13:25 GMT Sender: news@cs.vu.nl Followup-To: comp.unix.questions,alt.sources.d To: info-unix@sem.brl.mil In article <3716@sactoh0.UUCP>, jak@sactoh0.UUCP (Jay A. Konigsberg) writes: )... )command & # execute in background What if the command is supposed to run in the _foreground_? The following timeout shell script can be easily converted to a C program if desired. --------------------cut here-------------------- #!/bin/sh # @(#)timeout 6.2 90/03/01 Maarten Litmaath prog=`basename $0` usage="Usage: $prog [-signal] [timeout] [:interval] [+delay] [--] " SIG=-KILL # default signal sent to the process when the timer expires, # unless a delay option has been given: then it is -TERM sigopt=0 timeout=60 # default timeout interval=15 # default interval between checks if the process is still alive delay= # (if specified) the delay between posting the given signal and # destroying the process (kill -KILL) while : do case $1 in --) shift break ;; -*) SIG=$1 sigopt=1 ;; [0-9]*) timeout=$1 ;; :*) EXPR='..\(.*\)' interval=`expr x"$1" : "$EXPR"` ;; +*) EXPR='..\(.*\)' delay=`expr x"$1" : "$EXPR"` case $sigopt in 0) SIG=-TERM esac ;; *) break esac shift done case $# in 0) echo "$usage" >&2 exit 2 esac ( for t in $timeout $delay do while test $t -gt $interval do sleep $interval kill -0 $$ || exit t=`expr $t - $interval` done sleep $t kill $SIG $$ && kill -0 $$ || exit SIG=-KILL done ) 2> /dev/null & exec "$@" -- "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: Klaus Harbo Subject: Printing with terminalservers Keywords: print terminalserver Date: 16 Aug 90 14:30:07 GMT To: info-unix@sem.brl.mil I want to be able to hook up printers on terminalservers, so that we can place our printers anywhere in the house. We use Ultrix on DECStations version 3.1. Our terminalservers are Bridge CS200. As far as I understand you can assign one of the physical ports on the terminalserver to have a separate IP address. What's needed then, is some kind of software that will send open a (TCP?) connection to that IP address, and send the print job to that port. Does anyone know of such software, and will the solution I suggest do the job? I do not know a lot about terminalservers, but I suppose it contains the software needed to handle TCP connections, directing the output to the physical port on the terminalserver assigned to the printer. Thanks in advance. -Klaus |--------------------------------------------------------------------------| | Klaus Harbo | | | Euromath Center | e-mail: harbo@euromath.dk | | Universitetsparken 5 | phone: +45 3135 3133 ext. 417 | | DK-2100 Copenhagen | fax: +45 3135 0427 | |--------------------------------------------------------------------------| -- |--------------------------------------------------------------------------| | Klaus Harbo | | | Euromath Center | e-mail: harbo@euromath.dk | ----------------------------- From: Doug Gwyn Subject: Re: getting the exit value of an exec'd program Date: 16 Aug 90 14:40:38 GMT To: info-unix@sem.brl.mil In article <1990Aug15.223952.1175@NCoast.ORG> atul@NCoast.ORG (Atul Parulekar) writes: >May be the answer is in the manual, but I have not been able to find it. >My problem is that if I run a program using fork and execvp, how do I get >the exit value of the exec'd program into the main program. Via wait(). The general procedure for running a subprocess is, in outline: switch ( (pid = fork()) ) { case -1: Punt( "unable to fork" ); /*NOTREACHED*/ case 0: /* child */ args[0] = "command"; execvp( args[0], args ); /* WARNING: uses $PATH */ _exit( 127 ); /*NOTREACHED*/ default: /* parent */ while ( (w = wait( &status )) != pid ) if ( w == -1 && errno != EINTR ) break; if ( w == -1 ) { Punt( "child disappeared" ); /*NOTREACHED*/ } else if ( (status & 0xFF) != 0 ) { /* (status & 0x7F) is the signal number */ /* (status & 0x80) != 0 iff core dumped */ Punt( "child terminated abnormally" ); /*NOTREACHED*/ } else status = status >> 8 & 0xFF; /* exit status */ } ----------------------------- From: 35G-PATEL Subject: Help on tools like SCCS, SPRs etc.. Date: 16 Aug 90 14:48:33 GMT To: info-unix@sem.brl.mil We are in planning phase for a year long system software dvl project. We are working on a UNIX system. We are planning to use SCCS for source control. 1) Is there any other software that is like/better than SCCS? (preferably from public domain) 2) Software to manage MRs (modification requests) and QARs (Quality Assurance Report) to track bug fixes during development/field test? 3) Package that can combine both of these features to keep software in sync with any updates from QARs etc. 4) Are there any other groups for these questions? You may mail me directly. I will post the results sometime in the future. Thankx. vsp@unx.dec.com -- ============================================================================= ___ ___ ___ ___ ___ ___ ___ Vipul Patel ----------------------------- From: Bob Fyfe Subject: extracting files from a tar file Keywords: tar Date: 16 Aug 90 15:05:39 GMT To: info-unix@sem.brl.mil I have a faculty member who has brought a tape with him from a different site. It is a tar tape and the files were stored using absolute pathnames. The difficulty is that we don't have the same file structure names and so when I would try to restore the files, it fills up the root file structure quickly (we don't keep a whole lot of space available in that partition). I was wondering if there are any PD programs that exist or whether someone has written a script to get around this problem. I could write a script to extract a file at a time and then move it but its a hassle trying to maintain the directory structure that the faculty member has and preserve modification dates. I've also considered writing a C program using the chroot function and doing a system call to tar but that seems messy too. Is there anything out there available or am I missing something in my own backyard? Any help would be appreciated. You can direct email any solutions to me. Bob Fyfe *************************************************************************** * Bob Fyfe / EMT-A/ Ham Radio KA8YWQ | INTERNET: fyfe@andy.bgsu.edu * * University Computer Services | BITNET: fyfe@bgsuopie * * Bowling Green State University (OH)| UUCP: ...!osu-cis!bgsuvax!fyfe * *************************************************************************** -- *************************************************************************** * Bob Fyfe / EMT-A/ Ham Radio KA8YWQ | INTERNET: fyfe@andy.bgsu.edu * * University Computer Services | BITNET: fyfe@bgsuopie * * Bowling Green State University (OH)| UUCP: ...!osu-cis!bgsuvax!fyfe * *************************************************************************** ----------------------------- From: Andy Clews Subject: Re: Cshell question. Or: How to make a fool of yourself Date: 16 Aug 90 15:43:14 GMT To: info-unix@sem.brl.mil In article <3269@syma.sussex.ac.uk>, I stupidly wrote: > So you must use a while loop rather than a foreach loop. So obvious now > I look at it. *sigh* I am making a rather embarrassing fool of myself. Marten Litmaath very correctly pointed out that foreach i ($*:q) etc. will work just as well. *And* it's all in TFM. I apologise for wasting net bandwidth. I will now shut up. *SIGH* It's been one of them days.... -- Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England JANET: andy@syma.sussex.ac.uk BITNET: andy%syma.sussex.ac.uk@uk.ac ----------------------------- From: Dan Mercer Subject: Sending mail with explicit INTERNET address Date: 16 Aug 90 16:10:15 GMT To: info-unix@sem.brl.mil I have accounts on two different systems tcp/ip'd together across an Ethernet backbone. Neither node is on the backbone, but the networks they are on are gated to the backbone. On my home system, where I have sysadmin privileges, the remote system is in my /etc/hosts file. On the remote system, where I'm a guest, my home system has not been put in their /etc/hosts file despite numerous requests. I can ftp and telnet from the remote to my home system by using explicit decimal dot addressing. My problem is, how do I mail stuff to myself by the same method? TIA -- Dan Mercer Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) "MAN - the only one word oxymoron in the English Language" ----------------------------- From: Isaac Rabinovitch Subject: Re: Spy Programs?? Date: 16 Aug 90 16:57:53 GMT To: info-unix@sem.brl.mil In <3715@sactoh0.UUCP> jak@sactoh0.UUCP (Jay A. Konigsberg) writes: >In article <24123@adm.BRL.MIL> senetza@hg.uleth.ca (Leonard Senetza) writes: >>I have a few 'hostile' users on my system here. I was wondering if anyone has >>a 'spy' type of program that would allow me to watch/record/control other >>users' sessions. I could possibly write one myself, but why re-invent the >>wheel? >> >There are a few ways to do this. However, assuming you _are_ the >administrator of the system, there is one reasonably easy way. >Take the cables running to these hostile users terminals and splice into >them. Assuming everyone (including yourself) is using the same type of >terminal, you can then run the T from the splice to your terminal. To >be on the safe side, you probably don't want to connect the "write" pin >(2 or 3, I can never remember). A similar, and possibly more useful, approach would be to run the cable through a PC running one of those RS-232 diagnostic programs that captures data. Of course, you'd need a PC with two serial ports. Permanent records are always useful when legality time comes 'round. And if the bad guy isn't using your usual type of terminal, you can just save everything until you can figure out how his escape codes work. -- ergo@netcom.uucp Isaac Rabinovitch atina!pyramid!apple!netcom!ergo Silicon Valley, CA uunet!mimsy!ames!claris!netcom!ergo Disclaimer: I am what I am, and that's all what I am! ----------------------------- From: Stig Jacobsen Subject: Looking for a BCD library for Unix / C Keywords: BCD,library Date: 16 Aug 90 17:06:40 GMT Sender: news@slyrf.dkuug.dk Followup-To: comp.lang.c To: info-unix@sem.brl.mil Does anyone know of a BCD library for Unix? It doesn't matter whether it is commercial, free, whatever (I haven't seen any at all!). Please mail me any info that you have - thanks in advance. -- Stig Jacobsen shj@login.dkuug.dk fidonet 2:231/16.0 ----------------------------- From: John H Merritt Subject: /-happy Date: 16 Aug 90 17:20:49 GMT Sender: news@dftsrv.gsfc.nasa.gov To: info-unix@sem.brl.mil Explain why '/////' is valid in the following statement: cd /./../tmp/////../././bin It is interesting that any permutation of '.', '..', '/' and directory names can be used with, at least, csh, sh, and tcsh to yield a valid path name. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ John H. Merritt # Yesterday I knew nothing, Applied Research Corporation # Today I know that. merritt@iris613.gsfc.nasa.gov # ----------------------------- From: Randal Schwartz Subject: Re: /-happy Date: 16 Aug 90 21:50:45 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article <3139@dftsrv.gsfc.nasa.gov>, merritt@iris613 (John H Merritt) writes: | Explain why '/////' is valid in the following statement: | | cd /./../tmp/////../././bin | | It is interesting that any permutation of '.', '..', '/' and directory | names can be used with, at least, csh, sh, and tcsh to yield a valid | path name. The null pathname (look carefully between the consecutive "/"-s, and you'll see them there) is a valid synonym for the "current directory". So aaa////bbb is the same as aaa/././././bbb, except that you don't have to stat "." four additional times (it'd be fast, but it still takes time). Just another Unix hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: "William (Bill" MMDF-Warning: Parse error in original version of preceding line at BRL.MIL Subject: Re: redirecting standard i/o from an exec'ed programme Keywords: popen, io, exec, system Date: 16 Aug 90 17:38:04 GMT Sender: news@sun13.scri.fsu.edu To: info-unix@sem.brl.mil In article <377@fe2o3.UUCP> michael@fe2o3.UUCP (Michael Katzmann) writes: > >I have a task that requires the ability to fork off another programme but >to supply it's standard input and output. The SysV manuals describe > > FILE *popen( command, type ) > char *command, *type; > >which execs the command a la "system()" and creates a pipe. "type" and be >"r" if you want to read from the standard output of "command", or "w" if >you want to write to standard input. However there doesn't seem to be any >way to use this routine to do both similtaneously. > >What is the usual way to to this? > >Important points: The exec'ed command must run asynchronously (obvious if > the parent is supplying input.) > > The child process id must be available to the parent. > (so that it can be killed if necessary) > > >Any ideas would be appreciated. > > >--------------------------------------------------------------------- >email to >UUCP: uunet!mimsy!{arinc,fe2o3}!vk2bea!michael > _ _ _ _ > Amateur | VK2BEA (Australia) ' ) ) ) / // > Radio | G4NYV (United Kingdom) / / / o _. /_ __. _ // > Stations| NV3Z (United States) / ' (_<_(__/ /_(_/|_ >Michael Katzmann >Broadcast Sports Technology. >2135 Espey Ct. #4 >Crofton Md. 21114 USA > >Ph: +1 301 721 5151 Although, as a response on the net indicates, there can be problems connecting both stdin and stdout from a child if you aren't very careful about protocols there are cases where it is useful. As you have discovered popen() won't do it, though. I have waited to see if a detailed answer was provided by others. Since I haven't seen one I will post part of a program I wrote which does this. The key is that the child inherits stdin and stdout from the parent, so the parent changes his own stdin and stdout to pipes before spawning the child, using dup() to change file desciptors. The purpose of this program is to run all permutations of given string through the program used by the standard spell script looking for all the words which can be formed from the letters in the input, as when solving word puzzles such as "Jumbles" found in many newspapers. I have omitted the details and tried to leave everything necessary to (1) see how to do the i/o redirection you wanted to do and (2) see the whole structure of the process tree in which this was used in a realistic (or at least fun) application. The permutation generator created the list of permutations in sorted order since this was much faster than creating the whole list and then sorting, even if space permitted. It also actually generated two separate streams of permutations since that was actually more efficient than splitting one up and avoided possible deadlock problems. I hope the editting jobs leaves enough for you to see what is going on without getting lost in details. Incidentally I tried to email the whole thing but got "host not known". Can experienced netters suggest how I might be able to use the routing show at the top of a post to reply even when my local host doesn't know the final destination? /* anagram.c - extracted fragments to show redirection */ #include #include #ifndef SPELLPROG #define SPELLPROG "/usr/bin/spellout" #endif #ifndef DICT #define DICT "/usr/dict/hlista" #endif /* Omitting some irrelevant stuff here */ main(argc,argv,envp) int argc; char **argv, **envp; { int pipe1[1], pipe2[2]; char word[21]; int i; #define TOCHILD pipe1[1] #define FROMCHILD pipe2[0] #define TOPARENT pipe2[1] #define FROMPARENT pipe1[0] /* Stuff omitted */ pipe(pipe1); pipe(pipe2); if (fork()==0) { if (fork()==0) { /* Child to invoke spell program in a pipeline */ /* Close unused pipes */ close (TOCHILD); close (FROMCHILD); /* Change stdin and stdout to pipe */ close(0); dup(FROMPARENT); close(1); dup(TOPARENT); /* Invoke spell command */ execl(SPELLPROG,"spellout",DICT,(char *)0); /* No return to here. For completeness make parent terminate */ } else { /* Process to send distinct permutations to spelling checker */ /* Close unused pipes */ close(FROMCHILD); close(TOPARENT); close(FROMPARENT); /* Switch stdout to TOCHILD pipe */ close(1); dup(TOCHILD); /* Send all distinct permutations to spell child */ /* by writing them to stdout - details omitted */ } } else { /* Root process invokes permute() to display accepted permutations */ /* Close unused pipes */ close(TOCHILD); close(TOPARENT); close(FROMPARENT); /* Change stdin to pipe from speller */ close(0); dup(FROMCHILD); /* Generate permutations in sorted order; Read misspellings from pipe; Print everything not on misspell list; - details omitted */ } } ----------------------------- From: Maarten Litmaath Subject: Re: redirecting standard i/o from an exec'ed programme Date: 16 Aug 90 18:53:10 GMT Sender: news@cs.vu.nl To: info-unix@sem.brl.mil In article <410@sun13.scri.fsu.edu>, mayne@VSSERV.SCRI.FSU.EDU (William (Bill) Mayne) writes: )... ) /* Close unused pipes */ ) close (TOCHILD); ) close (FROMCHILD); ) /* Change stdin and stdout to pipe */ ) close(0); ) dup(FROMPARENT); close(FROMPARENT); /* !!! */ ) close(1); ) dup(TOPARENT); close(TOPARENT); /* !!! */ I've deleted the rest of the code, but there were still a few other places where calls to close() should be added. Always close every unused file descriptor (esp. when dealing with pipes), else you will get bitten one day; example scenario: - the child exits - the parent reads from the pipe to the child - the parent still has the write side of the pipe open - the read hangs... -- "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: Russ Romero Subject: Unix supporting HANGUL (Korean) avail? Date: 16 Aug 90 17:58:21 GMT Sender: news@hacgate.uucp To: info-unix@sem.brl.mil Looking for a version of UNIX from a COTS vendor which supports the Korean character set HANGUL. As I understand it (rather, think I understand it), this is a 27 letter set of phonetic characters, using a two byte code. Anyway, if you know about it, you know better what it is than I. Please e-mail (doubt there's widespread interest in this). Any clues accepted. THANKS rrome@1lkernel.hac.com ====================================================== Russ Romero ============================================ (brilliant opinions proprietary) ----------------------------- From: Peter Murray Subject: Re: help sought - securing a terminal/line Date: 16 Aug 90 18:03:55 GMT To: info-unix@sem.brl.mil In article <1990Aug14.161816.3450@chinet.chi.il.us>, les@chinet.chi.il.us (Leslie Mikesell) writes: > Does anything support the now-ubiquituous devices that announce the connection > speed in ASCII before bringing up CD or does everyone still have to > write their own code for this if they don't want the users to have to > send something before getting the login prompt? I found the source code for AGETTY, an alternative getty for SYSV, at gatekeeper.dec.com (annonymous FTP) when I was working with this problem before. This program should do the trick for you, and it is (relatively) easy to port it to BSD, if you need to. Peter -- Peter Murray Neat UNIX Stunts #7: pemurray@miavx1.bitnet 215 Foxfire Dr #308 csh> %blow murrayp@apsvax.aps.muohio.edu Oxford, OH 45056 NeXT Mail: pmurray@next4.acs.muohio.edu ----------------------------- From: "Joe.Fernandez" Subject: Re: help sought - securing a terminal/line Date: 16 Aug 90 20:11:31 GMT Sender: news@iss-rb.sandiego.ncr.com To: info-unix@sem.brl.mil In article <=D25VBE@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes: >In article <3846@auspex.auspex.com>, guy@auspex.auspex.com (Guy Harris) writes: >> For UNIX-like systems with "ttymon", such as System V Release 4, I think >> there's some other magic you can do to arrange that "ttymon" run your >> program when the port starts up. > >You're saying V.4 doesn't use 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. inittab still exists in SVR4. ttymon is a STREAMS-based port monitor that detects connection requests on the tty ports. It replaces the getty processes. SVR4 now has one process doing the work that lots of getty processes had to do in in pre-SVR4. A connection request is when one non-break char followed by a new line char is received on the port. When ttymon detects the connection request it executes the service process that has been configured for that port. One example of a service process is our old friend the login process. But you can create your own specific service process. This is unlike pre-SVR4 where the only service process that can be invoked from getty is 'login'. inittab starts the ttymon and any other port monitors (e.g., listen) that may exist on the system. Users can develop their own port monitors. --Hope this helps ============================================================================ Joe Fernandez NCR Corporation, MS# 9140 (619) 485-2186 16550 W. Bernardo Dr. uunet!ncrlnk!ncr-sd!iss-rb!robin!joe San Diego, CA 92127 ----------------------------- From: Martin Brooks Subject: LaserWriter II printcap entry needed Keywords: Sun4 Apple Date: 16 Aug 90 18:30:42 GMT To: info-unix@sem.brl.mil Does anyone have an /etc/printcap entry that would work with an Apple LaserWriter II connected to a Sun4/280 via serial port? If so, please send mail. Thanks in advance. -- Martin Brooks - Georgia Tech - Atlanta, Georgia, USA uucp: ...!gatech!prism!mb33 Internet: mb33@prism.gatech.edu ----------------------------- From: Jamie Gobble Subject: Looking for an adduser script. Date: 16 Aug 90 19:12:17 GMT Sender: news@duke.cs.duke.edu To: info-unix@sem.brl.mil Hi, Do any of you have an adduser script written perl or awk? If so, or if you know of another good approach, please drop me a line. Thanks, Jamie. p.s. Of course, I'll summarize and post if enough of you me to want. --- Jamie Gobble, sounds like "go-bull" Computational Neuroscience Lab Dept. of Neurobiology O_o -Ack! inet: jamie@neuro.duke.edu Duke Univ. Med. Ctr., Box 3209 =( )= bnet: GOBBL001@DUKEMC Durham, N.Carolina 27710, USA U Work (919) 684-5748 ----------------------------- From: Ramon F Herrera Subject: Changing back slashes to forward slashes Keywords: tr, sed, PC, port Date: 16 Aug 90 19:46:44 GMT Sender: Mr Background To: info-unix@sem.brl.mil I have a question for those {sed, grep, awk, tr} wizards out there. I'd like to change all the occurrences in a file of a line like this: #include "dira\dirb\incl.h" to #include "dira/dirb/incl.h" but only for the lines that begin with "#include". As you may have guessed, I am porting a PC-DOS program to Unix. thanks, Ramon -- Ramon F. Herrera Research Laboratory of Electronics Massachusetts Institute of Technology ramon@iona.mit.edu ----------------------------- From: Lee F Kolakowski Subject: Re: Changing back slashes to forward slashes Date: 16 Aug 90 20:33:32 GMT Sender: Mr Background To: info-unix@sem.brl.mil On Thu, 16 Aug 90 19:46:44 GMT, ramon@skye.mit.edu (Ramon F Herrera) said: > I have a question for those {sed, grep, awk, tr} wizards out there. > I'd like to change all the occurrences in a file of a line like this: > #include "dira\dirb\incl.h" > to > #include "dira/dirb/incl.h" > but only for the lines that begin with "#include". Try: awk ' { if ($0 ~ /^#include/) gsub(/\\/, "/") print }' filename Frank Kolakowski ====================================================================== |lfk@athena.mit.edu || Lee F. Kolakowski | |lfk@eastman2.mit.edu || M.I.T. | |kolakowski@wccf.mit.edu || Dept of Chemistry | |lfk@mbio.med.upenn.edu || Room 18-506 | |lfk@hx.lcs.mit.edu || 77 Massachusetts Ave.| |AT&T: 1-617-253-1866 || Cambridge, MA 02139 | |--------------------------------------------------------------------| | #include | | One-Liner Here! | ====================================================================== -- Frank Kolakowski ====================================================================== |lfk@athena.mit.edu || Lee F. Kolakowski | |lfk@eastman2.mit.edu || M.I.T. | |kolakowski@wccf.mit.edu || Dept of Chemistry | |lfk@mbio.med.upenn.edu || Room 18-506 | |lfk@hx.lcs.mit.edu || 77 Massachusetts Ave.| |AT&T: 1-617-253-1866 || Cambridge, MA 02139 | |--------------------------------------------------------------------| | #include | | One-Liner Here! | ====================================================================== ----------------------------- From: Rouben Rostamian Subject: Re: Changing back slashes to forward slashes Keywords: tr, sed, PC, port Date: 16 Aug 90 20:57:51 GMT Sender: newspost@umbc3.umbc.edu To: info-unix@sem.brl.mil In article <1990Aug16.194644.14376@athena.mit.edu> ramon@skye.mit.edu (Ramon F Herrera) writes: | |I have a question for those {sed, grep, awk, tr} wizards out there. |I'd like to change all the occurrences in a file of a line like this: | |#include "dira\dirb\incl.h" | |to | |#include "dira/dirb/incl.h" | |but only for the lines that begin with "#include". | sed outfile -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County rostamian@umbc.bitnet Baltimore, MD 21228, U.S.A. rostamian@umbc3.umbc.edu ----------------------------- From: Randal Schwartz Subject: Re: Changing back slashes to forward slashes Keywords: tr, sed, PC, port Date: 16 Aug 90 21:53:18 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article <1990Aug16.194644.14376@athena.mit.edu>, ramon@skye (Ramon F Herrera) writes: | | I have a question for those {sed, grep, awk, tr} wizards out there. | I'd like to change all the occurrences in a file of a line like this: | | #include "dira\dirb\incl.h" | | to | | #include "dira/dirb/incl.h" | | but only for the lines that begin with "#include". perl -pi~ -e 's#\\#/#g if /^#include/' file1.c file2.c file3.c ... Pretty darn simple with Perl. Even leaves you a backup. 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@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: "Frank P. Bresz" Subject: addcol - # [Was: Re: What's wrong with this Bourne shell script?] Date: 16 Aug 90 20:19:19 GMT Sender: news@ittc.wec.com To: info-unix@sem.brl.mil In article <416@necssd.NEC.COM> harrison@necssd.NEC.COM (Mark Harrison) writes: >Here is a simple one in awk. Replace $4 with your column number. > awk '{ tot += $4} END{print tot}' > ^^ >If you put this into a shell script called addcol, you can say > awk '{ tot += $'$1'} END{print tot}' >and invoke it by > addcol 4 >Example: How many bytes in my files? > ls -l c* | awk '{ tot += $4} END{print tot}' > ls -l c* | addcol 4 >Hope this helps! It is EXACTLY what I was looking for. Thank you very much for weeding through and figuring out what I really wanted.!! -- +--------------------+ |fbresz@ittc.wec.com | My opinions are my own, I'm not paid |uunet!ittc!fbresz | enough to make an official statement |(412)733-6749 | +-----------------------------------+ |Fax: (412)733-6444 | | THIS SPACE FOR SALE!!! | +--------------------+ +-----------------------------------+ ----------------------------- From: Randal Schwartz Subject: Re: Converting to uppercase/lowercase in sed Date: 16 Aug 90 23:21:51 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article <3766@umbc3.UMBC.EDU>, rostamia@umbc5 writes: | Is there a way to convert characters to uppercase or to lowercase in sed? | In EX the command | s/asdf/\U&/ | changes the string asdf to ASDF, but ed and sed do not seem to be as | sophisticated as ex :-( | | Any ideas? yeah, the not very well documented "y" command. y/a-z/A-Z/ uppercases the pattern space. You'll have to juggle the pattern and hold spaces if you want just part of a line uppercased. Or get Perl. :-) -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ----------------------------- From: Melinda Shore Subject: Re: MACH stripped from AT&T code ? Date: 17 Aug 90 01:06:57 GMT To: info-unix@sem.brl.mil In article <3229@uniol.UUCP> moeller@uniol.UUCP (Klaus Moeller) writes: >It was said somewhere( I don't know where) that the MACH Kernel >contains no AT&T code anymore. This is a *very* common misconception. The current Mach kernel contains significant amounts of BSD code and requires an AT&T license. The 3.0 Mach kernel will be free of AT&T code, but how useful it will be to the average user without an environment, filesystem, device drivers, etc. (all would require licenses) is left as an exercise for the reader. -- Melinda Shore shore@mtxinu.com mt Xinu ..!uunet!mtxinu.com!shore ----------------------------- From: phd_ivo@gsbvxb.uchicago.edu Subject: sort with a tab as separator Date: 17 Aug 90 01:21:42 GMT Sender: News Administrator To: info-unix@sem.brl.mil How do I indicate to sort that my field-separation character is the tab (^I)? I know that there is a tab option (-t) in sort, but I don't know how to specify ^I ( or \t, for that matter).. No, the default is not this tab, but any whitespace character according to my documentation. Thanks for any help. /ivo welch ivo@next.agsm.ucla.edu ----------------------------- End of INFO-UNIX Digest ***********************