Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!wuarchive!usc!rutgers!cmcl2!adm!news From: postmaster@sandia.gov (SMTP MAILER) Newsgroups: comp.unix.questions Subject: Mail Delivery Problem Message-ID: <24213@adm.BRL.MIL> Date: 19 Aug 90 15:07:01 GMT Sender: news@adm.BRL.MIL Lines: 1147 ----Reason for mail failure follows---- Sending mail to : Could not be delivered for three days. ----Transcript of message follows---- Date: 16 Aug 90 06:00:00 MDT From: info-unix@BRL.MIL Subject: INFO-UNIX Digest V10#118 To: "jnjortn" Return-Path: Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Thu, 16 Aug 90 05:48:39 MDT Received: from SEM.BRL.MIL by SEM.BRL.MIL id ab21242; 16 Aug 90 5:59 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa21216; 16 Aug 90 5:46 EDT Date: Thu, 16 Aug 90 05:45:40 EST From: The Moderator (Mike Muuss) To: INFO-UNIX@BRL.MIL Reply-To: INFO-UNIX@BRL.MIL Subject: INFO-UNIX Digest V10#118 Message-ID: <9008160546.aa21216@SEM.BRL.MIL> INFO-UNIX Digest Thu, 16 Aug 1990 V10#118 Today's Topics: Call for Discussion: comp.benchmarks Re: get terminal speed from shell script Filesizes of [mdn]dbm-files Cshell question: taking wordlists as a single string Re: Cshell question: taking wordlists as a single string Re: Recursion without -R Re: Timeout on shell command. Re: redirecting standard i/o from an exec'ed programme Re: directory reading Re: 'foo bar' <- What's the meaning of? Re: -F option for awk More questions about how to issue a C-SHELL command within a C program Re: More questions about how to issue a C-SHELL command within a C program login shell suspend Re: directory "indexer" Re: Compiling GNU Bourne Again SHell (bash) on SUN OS Re: How to issue a C SHELL command within a C program Re: How to issue a C SHELL command with Re: What's wrong with this Bourne shell script? New UNIX Network Questions MACH stripped from AT&T code ? recursive variable substitution in csh getting the exit value of an exec'd program Re: getting the exit value of an exec'd program Wanted: login & getty source (non-AT&T) Re: Spy Programs?? TeX and LaTeX Docs and man pages How does a C program know its input is being redirected? ----------------------------------------------------------------- From: SILL D E Subject: Call for Discussion: comp.benchmarks Date: 5 Aug 90 21:44:27 GMT Sender: lear@turbo.bio.net Followup-To: news.groups Approved: lear@turbo.bio.net To: info-unix@sem.brl.mil "There are lies, damned lies, and benchmarks," to paraphrase someone whose name escapes me at the moment. Like it or not, though, benchmarks are a fact of life in the computing world. So in the spirit of `knowing thy enemy', I'd like to propose the formation of an unmoderated newsgroup for: - Discussions about benchmarks including: . hardware benchmarks . numeric benchmarks . operating system benchmarks . compiler benchmarks . graphics benchmarks . window system benchmarks . multiple interactive user load simulations . validity of benchmarks/benchmarking . benchmarking as a procurement tool . benchmarking anecdotes - Publishing benchmark results . especially user-run rather than vendor-run - Publishing benchmark source code and availability info . including bug fixes/reports If it's warranted, I'll issue a Call for Votes at least 14 days after this posting. -- Dave Sill (de5@ornl.gov) Martin Marietta Energy Systems Workstation Support ----------------------------- From: Jim Rogers Subject: Re: get terminal speed from shell script Date: 13 Aug 90 15:38:11 GMT To: info-unix@sem.brl.mil If your version of stty writes only to stderr then you can redirect that in a useful manner: speed=`stty speed 2>&1` This will place the the speed of your terminal in the variable speed even if stty writes to stderr. Jim Rogers Hewlett Packard Company ----------------------------- From: Axel Dunkel Subject: Filesizes of [mdn]dbm-files Date: 14 Aug 90 12:28:17 GMT To: info-unix@sem.brl.mil I want to build a [mn]dbm database with several thousand records about 300 bytes each. Although I know that dbm leaves big holes in its files, they are just too big: 1000 records with 300k of data result in a file of 16 MEGABytes, 2MB of data become a 500 MB file. The problem occurs at backup time: tar/cpio don't leave the holes out and so try to backup several GIGAbytes of data which makes Backups nearly impossible. Any suggestions on how to reduce the filesizes/holes of n/m/dbm? --- Axel Dunkel (ad@cat.de or ad@cat.uucp or ..!unido!cat!ad) C.A.T. Kommunkations-System, Frankfurt, West Germany ----------------------------- From: Andy Clews Subject: Cshell question: taking wordlists as a single string Date: 14 Aug 90 12:58:11 GMT To: info-unix@sem.brl.mil I have a Csh script called "whatnews" which takes words as arguments and searches the file /usr/lib/news/newsgroups for lines containing any one of those words, the requirement being to show users what newsgroups are there that may be something to do with the searched word. It is not case sensitive (i.e. it uses fgrep -i) whatnews biology "whatnews" then proceeds to show me all lines in /usr/lib/news/newgroups that contain the string "biology". If several words are supplied as a list, whatnews searches the file for each of these words. 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. 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?) No joy as yet with TFM. Any help appreciated; email probably best. I will summarise if possible. Thanks for listening. -- 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: Randal Schwartz Subject: Re: Cshell question: taking wordlists as a single string Date: 16 Aug 90 06:59:17 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article <3251@syma.sussex.ac.uk>, andy@syma (Andy Clews) writes: | I have a Csh script called "whatnews" which takes words as arguments and | searches the file /usr/lib/news/newsgroups for lines containing any one | of those words, the requirement being to show users what newsgroups are | there that may be something to do with the searched word. It is not | case sensitive (i.e. it uses fgrep -i) | | whatnews biology | | "whatnews" then proceeds to show me all lines in /usr/lib/news/newgroups | that contain the string "biology". If several words are supplied as a | list, whatnews searches the file for each of these words. 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. | | 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?) | | No joy as yet with TFM. Any help appreciated; email probably best. I | will summarise if possible. Thanks for listening. Well, you can try this Perl script: ================================================== snip snip #!/usr/bin/perl for (@ARGV) { s/\W/\\$1/g; # de-magicize $all .= "$_|"; # and create regular-expression } chop($all); # remove last "|" open(G,"/usr/lib/news/newsgroups") || die "Cannot open newsgroups: $!"; while () { print if /$all/io; } close(G); ================================================== snip snip Untested, but it should do the job. -- /=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: Rich Kaul Subject: Re: Recursion without -R Date: 15 Aug 90 00:57:29 GMT Sender: kaul@icarus.eng.ohio-state.edu To: info-unix@sem.brl.mil 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. Or if you were smart enough to grab the free, PD version that Gordon Moffet posted a while ago. I still have a copy sitting around somewhere so drop me a line if you want it. -rich ----------------------------- From: Georg Wittig Subject: Re: Recursion without -R Keywords: recursion Date: 15 Aug 90 09:31:41 GMT To: info-unix@sem.brl.mil rjshaw@ramius.ocf.llnl.gov (Robert Shaw) writes: >What are some quick tricks for getting programs like chmod and chown to >descend into all subdirectories? Programs without a -R option, that is. find . -exec chmod go-rw {} \; --or-- find . -type f -exec chmod go-rw {} \; -- Georg Wittig GMD-Z1.IT | wittig@gmdzi.gmd.de | "Freedom's just another word P.O. Box 1240 | wittig@zi.gmd.dbp.de | for nothing left to lose" D-5205 St. Augustin 1 | | (Kris Kristofferson) West Germany | (+49) 2241 14-2294 | ----------------------------- From: "Liam R. E. Quin" Subject: Re: Timeout on shell command. Date: 15 Aug 90 04:56:49 GMT To: info-unix@sem.brl.mil brister@decwrl.dec.com (James Brister) writes: >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. tchrist@convex.COM (Tom Christiansen) writes: >Here's timeout.c; syntax is 'timeout seconds command'. That is probably the neatest solution. Another way (if you need a shell-only solution) is Process One: # write my PID ($$) to a tmp file, tmp1 echo $$ > $tmp1 # run command $command # mark ourselves as done: /bin/rm -f $tmp1 # if tmp2 exists, kill that process test -f $tmp2 && kill `cat $tmp2` Process Two: # write my PID to a file, tmp2 echo $$ > $tmp2 # wait a while sleep 27 # mark ourselves as done so the other half does not kill us now /bin/rm -f $tmp2 # kill the other half if it is still running test -f $tmp1 && kill `cat $tmp1` Now do ProcessOne & ProcessTwo & wait If you have other background tasks, write these three "lines" out to a temporary file and execute that -- then the wait will only wait for ProcessOne and ProcessTwo. If you don't want the PIDs to appear when you do the Process1 &, you can play tricks with /bin/sh -c "command &" which won't print the PID of the background process on most systems, but only works with simple commands (no |, &&, etc) without care. The variant ( /bin/sh -c "exec 2>&3; command" & ) 3>&2 2>/dev/null works better. It says, ^^^^ Run the thing in ( ) with file descriptor 3 open in addition to the standard 0, 1 and 2 (2 is standard error, used for messages). Make file descriptor 3 be the same as descriptor 2. Having done that, send everything written ^^^^^^^^^^^ on file descriptor 2 (standard error) to /dev/null -- in other words, throw away all error messages. This will throw away the PID, which is what we want, but will also throw away any error messages generated by "command". The exec 2>&3; tells the /bin/sh _inside_ the ( ) to make file descriptor 2 be the same as file descriptor 3, which we previously opened as the original standard error. So this restores standard error messages for the command inside the quotes. Which is what we need. Well, you might say that it would be less arcane to include the C program `timeout' given by Tom Christiansen, and to compile it on the fly, but in practice the commands are likely (I hope) to be simple, and the first form with /bin/sh -c "command" will probably work fine. Lee -- Liam R. E. Quin, lee@sq.com, {utai,utzoo}!sq!lee, SoftQuad Inc., Toronto ----------------------------- From: "Jay A. Konigsberg" Subject: Re: Timeout on shell command. Date: 16 Aug 90 02:12:09 GMT To: info-unix@sem.brl.mil In article <1990Aug12.221658.27776@uncle.uucp> donlash@uncle.UUCP (Donald Lashomb) writes: >In article brister@decwrl.dec.com (James Brister) writes: >>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? > >I'd approach it like this- > >#!/bin/sh ># ># run the command in the background ># remember its process ID ># sleep for X seconds ># kill the background command --- note: if ># the background command is finished, then ># the kill will fail benignly. ># >command & >cmdpid=$! >sleep $X >kill $cmdpid > When I saw the original post, I almost answered with this type of solution. However, it lacks an important part of the request. If the command finishes early, execution will still wait for the sleep to complete. However, there just may be a way if the sleep is placed in its own file. # main program file SEC={number here} # set the number of seconds to wait command & # execute in background cmdpid = $! # save the PID sleepit $SEC $cmdpid & # sleep in background wait $cmdpid # wait for the process to complete or be killed # sleepit - sleep $1 sec and then kill -9 $2 sleep $1 kill -9 $2 2>/dev/null #don't want those nasty error messages. My thanks to Donald Lashomb's post. Without it, I wouldn't have come up with this solution. -- ------------------------------------------------------------- Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak If something is worth doing, its worth doing correctly. ----------------------------- From: Doug Gwyn Subject: Re: redirecting standard i/o from an exec'ed programme Keywords: popen, io, exec, system Date: 15 Aug 90 13:29:21 GMT To: info-unix@sem.brl.mil In article <377@fe2o3.UUCP> michael@fe2o3.UUCP (Michael Katzmann) writes: >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? This should probably be added the the FAQ list. The problem with trying to pipe both input and output to an arbitrary slave process is that deadlock can occur, if both processes are waiting for not-yet-generated input at the same time. Deadlock can be avoided only by having BOTH sides follow a strict deadlock-free protocol, but since that requires cooperation from the processes it is inappropriate for a popen()-like library function. ----------------------------- From: Doug Gwyn Subject: Re: directory reading Date: 15 Aug 90 13:31:24 GMT To: info-unix@sem.brl.mil In article bglenden@mandrill.cv.nrao.edu (Brian Glendenning) writes: > if (dp->d_ino == 0) > continue; >It looks like modern readdir(3)'s only return pointers to valid entries, >and NULL at the end, so a test of this type is no longer required. Yes, all versions of readdir() are expected to filter out "deleted" entries so there is no need to test for that in the application. ----------------------------- From: Chris Torek Subject: Re: 'foo bar' <- What's the meaning of? Date: 15 Aug 90 13:55:44 GMT To: info-unix@sem.brl.mil Please, before asking about `foo', read the introduction to the net and ask locally. It always creates a stream of interminable partial, wrong, or otherwise not-quite-perfect answers which then cause further followups like this one. The word `foo' has been around for a long time. It appeared in old `Smokey Stover' cartoons in the 1920s and/or 30s (often on a license plate or other out-of-the-way place). The connection between `foo', `bar', and `foobar' and `fubar' is obvious; the connection between this foo and the one in the cartoons is less so. In WWII the armed forces came up with a whole series of acronyms, including FUBAR, SNAFU, and JANFU (F-ed Up Beyond All Recognition; Situation Normal---All F-ed Up; Joint Army-Navy F-Up). In the 1970s engineers at DEC designed the `Star' (the VAX-11/780) and snuck a `FUBAR' register into the Unibus adapter. In the 1950s and early 1960s the TMRC (Tech Model Railroad Club) at MIT made much use of many `nonsense words' which eventually became `hacker's jargon'. For details, see _The_Hacker's_Dictionary_ by Guy L. Steel Jr. You will find some of the above and a great deal more (e.g., the distinction between frob and tweak). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris (New campus phone system, active sometime soon: +1 301 405 2750) ----------------------------- From: Irving Wolfe Subject: Re: -F option for awk Keywords: awk field-separator Date: 15 Aug 90 13:57:33 GMT To: info-unix@sem.brl.mil In <491@llnl.LLNL.GOV> rjshaw@ramius.ocf.llnl.gov (Robert Shaw) writes: >print; or print $0; don't do the right thing because the lines come >out with spaces as the field separators instead of the character given >to the -F option. If you change any field, $1 to $NF, then print or print $0 re-composes $0 from all the individual fields, stringing them together with the output separator OFS which defaults to space unless you change it. If you don't touch any fields, awk should just print the originally input $0. Thus awk -F: '/^i/' /etc/passwd (here) produces irv:-------------:101:1:0000-Irving Wolfe(0000):/u/irv:/bin/gsh and awk '/^i/' /etc/passwd produces irv:-------------:101:1:0000-Irving Wolfe(0000):/u/irv:/bin/gsh exactly the same thing. Both print the /etc/passwd lines that begin with i exactly as is. But awk -F: '/^i/ {$2 = "hoho"; print}' /etc/passwd produces: irv hoho 101 1 0000-Irving Wolfe(0000) /u/irv /bin/gsh It will replace all the :s with spaces. You need awk -F: 'BEGIN {OFS = FS} /^i/ {$2 = "hoho"; print}' /etc/passwd which produces irv:hoho:101:1:0000-Irving Wolfe(0000):/u/irv:/bin/gsh -- Irving Wolfe Happy Man Corp. irv@happym.wa.com 206/463-9399 ext.101 4410 SW Point Robinson Road, Vashon Island, WA 98070-7399 fax ext.116 SOLID VALUE, the investment letter for Benj. Graham's intelligent investors Information free (sample $10 check or credit card): email patty@happym.wa.com ----------------------------- From: jian@kuhub.cc.ukans.edu Subject: More questions about how to issue a C-SHELL command within a C program Date: 15 Aug 90 14:09:17 GMT To: info-unix@sem.brl.mil Yesterday I asked for help about how to issue a C-SHELL command within a C program. I was lucky: serveral people came up with immediate answers. I very much appreciate those answers. According to the answers and what I read from the menu, system() and execlp() should work without any doubts. However, I can't make it. What I want to do is to issue a csh command to change terminal type within a C program. I did try: system("csh -cf \"setenv TERM adm3a"); and system("/bin/csh -c 'setenv TERM adm3a"); and execlp("/bin/csh", "csh", "-c", "setenv TERM adm3a", (char *) 0); There was not any runtime errors if I embeded one of above statements into my C program. But none of them can change the terminal type. I don't know why. 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. Jian Q. Li jian@kuhub.cc.ukans.edu ----------------------------- From: Randal Schwartz Subject: Re: More questions about how to issue a C-SHELL command within a C program Date: 15 Aug 90 22:15:04 GMT Sender: news@iwarp.intel.com To: info-unix@sem.brl.mil In article <25285.26c9113d@kuhub.cc.ukans.edu>, jian@kuhub writes: | Yesterday I asked for help about how to issue a C-SHELL command within a C | program. I was lucky: serveral people came up with immediate answers. I very | much appreciate those answers. | | According to the answers and what I read from the menu, system() and execlp() | should work without any doubts. However, I can't make it. What I want to do | is to issue a csh command to change terminal type within a C program. I did | try: | system("csh -cf \"setenv TERM adm3a"); | and | system("/bin/csh -c 'setenv TERM adm3a"); | | and | execlp("/bin/csh", "csh", "-c", "setenv TERM adm3a", (char *) 0); | | There was not any runtime errors if I embeded one of above statements into my | C program. But none of them can change the terminal type. I don't know why. | 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. Aha. As I said in my private mail, *why* would you want to execute a csh command? Now I can see. The short answer: You *cannot* change an environment variable (such as TERM) from a child process. The shell provides a *copy* of its environment to the children processes (such as your C program), so changes to that copy (or in your case, using a further csh which has its *own* copy), will not affect the parent shell. This is by design, so don't ask "Well, are they going to fix this some day?" The longer answer: If you invoke a program from the shell in such a way that the shell is going to expect an answer back and take action on that, you can get away with it. For example, if your program "pickterm" is invoked from the csh as: setenv TERM `pickterm` then all "pickterm" has to do is output the desired term-type on stdout. If you need interaction, you may need to arrange for the csh to get it from a file. For example, pickterm /tmp/$$ && setenv TERM `cat /tmp/$$` rm /tmp/$$ in which case pickterm would open /tmp/$$ for output, put the desired termtype into it after interacting with the user, and then exit successfully. Either of these solutions could be wrapped up inside an alias to prevent the nitty gritties from being exposed to the poor user. 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: "Frank P. Bresz" Subject: Re: More questions about how to issue a C-SHELL command within a C program Date: 16 Aug 90 04:48:55 GMT Sender: news@ittc.wec.com To: info-unix@sem.brl.mil In article <1990Aug15.221504.348@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article <25285.26c9113d@kuhub.cc.ukans.edu>, jian@kuhub writes: [ Stuff deleted ] >| execlp("/bin/csh", "csh", "-c", "setenv TERM adm3a", (char *) 0); >| >| There was not any runtime errors if I embeded one of above statements into my >| C program. But none of them can change the terminal type. I don't know why. >| 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. >The short answer: >You *cannot* change an environment variable (such as TERM) from a >child process. The shell provides a *copy* of its environment to the >children processes (such as your C program), so changes to that copy >(or in your case, using a further csh which has its *own* copy), will >not affect the parent shell. This is by design, so don't ask "Well, >are they going to fix this some day?" Why not just use the putenv system call with something akin to: putenv("TERM=adm3a"); /* notify subprocess that it is an adm3a terminal */ -- +--------------------+ |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: rjshaw@ramius.llnl.gov Subject: login shell suspend Date: 15 Aug 90 16:29:18 GMT Sender: usenet@llnl.llnl.gov To: info-unix@sem.brl.mil Hi. Who knows the history behind "Can't suspend a login shell (yet)." Is there a day when we will be able to do so, or is the "yet" a joke that I don't understand? When I rlogin somewhere and ~ CNTL-Z isn't that a suspension of the login shell on the remote machine? Isn't suspension just sleeping? No, I haven't read either of the internals books yet, but I'm planning to get to the Berkeley one any day now [ half :-) half :-( ] Thanx in advance for responses =============================================================================== rjshaw@ramius.llnl.gov _____ ____ ____ ______ R o b / / / / / / / / / / / -------- / --/ / / / / / / / / / --------------------------- /-- / / / / / / / / S h a w /____/ /_/_/ /_/_/ /_____/ The Cosby's are precisely what's wrong with television today... =============================================================================== ----------------------------- From: Robert Hartman Subject: Re: directory "indexer" Keywords: search,directory,index Date: 15 Aug 90 16:42:40 GMT Sender: Bert Beaton To: info-unix@sem.brl.mil In article <335@nih-csl.nih.gov> tpersky@alw.nih.gov (Ted Persky) writes: >It has come to my attention that our staff on the whole spends >a great deal of time during the day searching for that one >certain file in a large directory tree. For example, try finding >a certain fragment of source code in the X11 distribution. >The people in our lab always seem to be asking each other >to help them locate the path name for "foo.c". If you have the BSD version of find, you can use the "fast-find" feature to build the database you want. This wasn't documented very well in the BSD man page. However, if you can get at a copy of a Sun 4.x man page, it's documented there. -r ----------------------------- From: Chet Ramey Subject: Re: Compiling GNU Bourne Again SHell (bash) on SUN OS Date: 15 Aug 90 18:15:54 GMT Sender: news@usenet.ins.cwru.edu Followup-To: gnu.bash.bug To: info-unix@sem.brl.mil In article <24173@adm.BRL.MIL> hsw@sparta.com (Howard Weiss) writes: $ I've got a copy of the Bourne Again SHell (bash) - version 1.05 that $ On the SUN, the make file says that its compiling for a SUN 3 running $ OS 4, but has problems with the bash-Makefile (fixed by commenting out $ the offending lines which are setting up stuff to build backup files) and $ then has problems with compiling y.tab.c (which is the result of running $ yacc on parse.y). I have already gotten and included all the latest $ patches for this version and have sent off a message to bug-bash but $ have not heard anything. $ $ Has anyone had this problem and/or does anyone know of a fix. I'm not $ versed in yacc (and don't really want to be). The yacc problem is solved by changing the lines in parse.y that read if (interactive) YYACCEPT; else YYABORT; to read if (interactive) { YYACCEPT; } else { YYABORT; } YYACCEPT and YYABORT became compound statements in SunOS 4.1 yacc. You will also need to use the SunOS malloc, because of the `localtime' bug (take USE_GNU_MALLOC out of the appropriate section in machines.h). There are a number of problems with bash 1.05. All have been fixed for the next release (whenever that is). Chet -- Chet Ramey ``Levi Stubbs' tears run down Network Services Group his face...'' Case Western Reserve University chet@ins.CWRU.Edu ----------------------------- From: Ambarish Malpani Subject: Re: How to issue a C SHELL command within a C program Date: 15 Aug 90 18:23:15 GMT To: info-unix@sem.brl.mil In article <25279.26c7fd35@kuhub.cc.ukans.edu> jian@kuhub.cc.ukans.edu writes: >How can I issue a statment that executes a C SHELL command within a C program? >I would appreciate any helps. > >Jian Q. Li >jian@kuhub.cc.ukans.edu Try using the system() library routine eg. system("pwd"); Ambarish sun!valid!ambarish ----------------------------- From: Guy Harris Subject: Re: How to issue a C SHELL command with Date: 15 Aug 90 20:28:08 GMT To: info-unix@sem.brl.mil >> How can I issue a statment that executes a C SHELL command within a C program? >> I would appreciate any helps. > >You can use the "system" call. Use "man system" for more info. Well, sort of. In order to run a *C* shell command, as the original poster specified, rather than a *Bourne* shell command, as "system()" does on any valid implementation, you have to construct a Bourne shell command that runs the C shell, asking it to run a C shell command.... In general, I'd recommend replacing the C shell command in question with a Bourne shell command, if at all possible, and just using "system()". ----------------------------- From: Mark Harrison Subject: Re: What's wrong with this Bourne shell script? Date: 15 Aug 90 18:36:10 GMT To: info-unix@sem.brl.mil In article , fpb@ittc.wec.com (Frank P. Bresz) writes: > Where is Jon's addcol. I tried to write one a while back and kept > screwing it up. I would like to see a working version. 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! -- Mark Harrison harrison@necssd.NEC.COM (214)518-5050 {necntc, cs.utexas.edu}!necssd!harrison standard disclaimers apply... ----------------------------- From: "Frank P. Bresz" Subject: Re: What's wrong with this Bourne shell script? Date: 16 Aug 90 04:54:19 GMT Sender: news@ittc.wec.com To: info-unix@sem.brl.mil In article <1990Aug14.171056.17982@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article , fpb@ittc (Frank P. Bresz) writes: >| >or if you have Jon's addcol, even simpler: >| >| > stat -s * | addcol -2 >| >| Where is Jon's addcol. I tried to write one a while back and kept >| screwing it up. I would like to see a working version. >for addcol -1, try: > perl -ane '$s += $F[0]; print "$s\n" if eof;' >for addcol -2: > perl -ane '$s += $F[1]; print "$s\n" if eof;' >Others may be derived by noticing the pattern. :-) >Just another Perl hacker, 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. -- +--------------------+ |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: Chuck Brown Subject: New UNIX Network Questions Keywords: sequent unisys banyan government Date: 15 Aug 90 18:59:30 GMT Followup-To: comp.unix.questions To: info-unix@sem.brl.mil We (City of Savannah) are in the first phases of a conversion from a Unisys 1100/90 mainframe environement to a UNIX environment. Our network will (if current plans hold out) consist of a reasonably large UNIX box (Sequent / Unisys), an inter-building fiber backbone, and 6 Banyan servers with 400-600 nodes, all 386sx/VGA systems. The applications on the UNIX system will all be accounting based. The Banyan applications will be Word Processing, e-mail, spreadsheet, general office productivity) The UNIX applications will be primarily Informix based. Several questions have come up, and we would appreciate any information, comments, or critisims. - What would be the reason for selection of Unisys over Sequent, if any, since the box is physically the same? (U6000/80, 10 processors, 128 meg, 9 gig of mass storage). - Banyan claims that this type of arrangement will be difficult to manage with Novell, Novell claims otherwise. Opinions? - Applications we are looking for for this and other areas include: Municiple (fund) accounting Police/Fire Computer Aided Dispatch Parking Citations Utility Billing Vehicle Maintenance All comments welcome! Thanks in advance. ============================================================================== Chuck Brown City Of Savannah Systems Programmer 133 Montgomery St. Voice: (912) 944-4793 Room 507 uunet\!pirates\!univac Savannah, GA 31402 ============================================================================== ----------------------------- From: Klaus Moeller Subject: MACH stripped from AT&T code ? Date: 15 Aug 90 19:58:40 GMT To: info-unix@sem.brl.mil Hi It was said somewhere( I don't know where) that the MACH Kernel contains no AT&T code anymore. Is this right or has somebody made a joke or is this planned for the future? As far as I know, MACH still contains BSD code and BSD contains AT&T code. Has the AT&T code been removed from MACH or is it still in the system via the BSD code ? Thanks Klaus -- / Klaus Moeller, Leiteweg 2, 2940 Wilhelmshaven, West - Germany \ < moeller@uniol.uucp 078326@DOLUNI1.BITNET > \ Fill what's empty, empty what's full and scratch where it itches / ----------------------------- From: Jeff MacDonald Subject: recursive variable substitution in csh Date: 15 Aug 90 21:49:37 GMT To: info-unix@sem.brl.mil In the C-shell, how does one evaluate a variable which contains the name of a variable in order to get the value of the variable contained by the variable that one is evaluating? To wit: set x = 'ABC' set y = '$x' set z = # some function of y such that $z == "ABC" Don't ask how I got into this predicament, it's not funny! -- Jeff MacDonald ([decvax|samsung|ima|ulowell]!cg-atla!jmacdon) Agfa/Compugraphic Division 200-2-9F (jmacdon@cg-atla.agfa.com) 200 Ballardvale, Wilmington MA 01887 (508) 658-0200, extension 5406 Hi, Mom! ----------------------------- From: Atul Parulekar Subject: getting the exit value of an exec'd program Date: 15 Aug 90 22:39:52 GMT To: info-unix@sem.brl.mil 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. ----------------------------- From: "BURNS,JIM" Subject: Re: getting the exit value of an exec'd program Date: 16 Aug 90 04:25:11 GMT To: info-unix@sem.brl.mil in article <1990Aug15.223952.1175@NCoast.ORG>, atul@NCoast.ORG (Atul Parulekar) says: > 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. Exec doesn't return a status - it doesn't return at all. Use wait(2) in the parent program. Its man page describes the union wait status variable returned by wait(2) and its variants. (Exact return type also varies between wait() variants and diff. unices.) -- BURNS,JIM Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332 uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a Internet: gt0178a@prism.gatech.edu ----------------------------- From: Mike Van Pelt Subject: Wanted: login & getty source (non-AT&T) Date: 15 Aug 90 23:41:37 GMT To: info-unix@sem.brl.mil Is there a public domain and/or copylefted (i.e., GNU) version of the getty and login programs that do not require an AT&T source liscence? I would like to add some local security features here, and this would be very helpful. (We're running SunOS, which is BSD-derived.) Please email, and I will summarize any responses. -- Mike Van Pelt Headland Technology/Video 7 Use a pun, go to jail. ...ames!vsi1!v7fs1!mvp ----------------------------- From: "Jay A. Konigsberg" Subject: Re: Spy Programs?? Date: 16 Aug 90 01:46:26 GMT To: info-unix@sem.brl.mil 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). Other options include re-writing the shell, taping into their history file and putting a `tee -a` into their .profile. Each method has varying levels of information available. One last option, available to anyone on a system, is to write a shell daemon that does periodic "ps -lfu u_name" (or similar) to check their processes and CPU activity. While this meathod doesn't show exactly what a user is doing, it does provide useful information to an administrator. -- ------------------------------------------------------------- Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak If something is worth doing, its worth doing correctly. ----------------------------- From: Rob Freyder Subject: TeX and LaTeX Docs and man pages Date: 16 Aug 90 02:39:50 GMT To: info-unix@sem.brl.mil I have binaries for TeX and LaTeX for Xenix... but I need docs and man pages ... Can someone tell where I can get via anonymous uucp... or by email ?? Thanks. -- Rob Freyder Core Laboratories a division of ____ ____ ____ Western Atlas International Inc. \ \ / /\ / /\ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- \ \/ / \ / / \ Humans (318) 235-9431 \ / / \ / /\ \ Internet rob@lafayet.UUCP \/___/ \/___/ \___\ Bang ...!uunet!rouge!lafayet!rob ----------------------------- From: "M. Pinghua Young" Subject: How does a C program know its input is being redirected? Keywords: input, stdin, redirect, pipe, C program Date: 16 Aug 90 05:00:13 GMT Sender: "M. Pinghua Young" To: info-unix@sem.brl.mil I am writing a program that prompts users for various inputs. However, the user can also put the input in a file and pipe it to my program, or use input redirection "<". In this case I don't want the program to prompt anything. Can anyone tell me how to achieve that? Please send me e-mails. Thank! -- | M. Pinghua Young | Confucius Said: | | pinghua@suwatson.bitnet | "Life Begins at 30" | | mpyoung@portia.stanford.edu | But He Died At 29. | ----------------------------- End of INFO-UNIX Digest ***********************