HDTenEightyP/NetNews huggingface dataset:
From: ccx018@cch.coventry.ac.uk (Leslie Griffiths (Griff))
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: Need (today's date - 2 WORKING days) [was: Need (today's date + [1-7]]
Date: 30 Jul 92 13:12:27 GMT
Organization: Coventry University

In article <1992Jul29.031546.26997@bnd2.bnd.oz.au> johnw@bnd2.bnd.oz.au (John Warburton) writes:
>From article <1992Jul28.072025.13886@cssc-syd.tansu.com.au>, by colinl@cssc-syd.tansu.com.au (Colin Lynch):
>> bernie@metapro.DIALix.oz.au (Bernd Felsche) writes:
>> 
>> 
>>     Having done this, just set a macro for the length (in seconds) of one
>> day:
>> 
>>        #define ONE_DAY	((60) * (60) * (24))
>> 

Call me stupid, but I thought the number of seconds in a day was constant.

i.e.

	#define ONE_DAY 86400

Cheers

-- 
Griff				\\         	ccx018@uk.ac.cov
^^^^^		       		 :-=       	^^^^^^^^^^^^^^^^
		        	//
Xref: sparky comp.unix.programmer:4015 comp.unix.internals:1631
From: tasos@cs.bu.edu (Anastasios Kotsikonas)
Newsgroups: comp.unix.programmer,comp.unix.internals
Subject: Signals propagated from child to parent
Date: 30 Jul 92 14:54:27 GMT
Followup-To: comp.unix.programmer
Organization: Computer Science Department, Boston University, Boston, MA, USA
Originator: tasos@cs

Greetings to all. Subject should have been "AIX bashing".

Well, can somebody clarify the following: when a forked child receives
a signal is the parent supposed to get the same signal (SIGSEGV for example)?

If a A forks B, B forks C, C dies, B receives SIGCLD, is A supposed to get
SIGCLD too?

If A forks B, A does a system(), is A supposed to receive SIGCLD? Well on AIX
not only it does, but the subsequent wait(), that we are supposed to execute
when catching SIGCLD, blocks for ever waiting for B to die!!!!!!!!

If A forks B and B exits normally (exit (0)) is A supposed to be told
after the SIGCLD and wait() that WIFSIGNALED is TRUE AND WTERMSIG == SIGHUP?

If the answers to all of the above are NO, then can somebody explain to me
why this f* AIX 3.1.7 and earlier behaves so differently than all other UNIXes?

Thanks in advance,

Tasos
-- 
--
Tasos Kotsikonas |   tasos@cs.bu.edu    | Work : Advanced Visual Systems
Ex BU Country	 |                      | email: tasos@avs.com
Club Member.	 |                      | Duties: none
From: fazc016@hq.dla.mil (Don Costello)
Newsgroups: comp.unix.programmer
Subject: Summary: getlogin() problem
Date: 27 Jul 92 11:38:29 GMT
Organization: HQ Defense Logistics Agency/DASC, Cameron Station, VA
X-Newsreader: Tin 1.1 PL4


Thanks to the following people, the getlogin() problem (which is really
not a problem) is finally solved:

leo@ine.philips.nl
graham@castle.edinburgh.ac.uk
Matt Schroth
cjc@ulysses.att.com
David A. Wagner
John Eric Fosler
David Myers
cjc@ulysses.att.com

It seems that, according to the man page, (which I obviously didn't
read too thoroughly :-) getlogin reads /etc/utmp, returning the ID of
the owner of whatever tty the user is on.  When doing an su to another login, 
there is no utmp entry for the new login, only the original one.

The following is the solution:

#include <all-the-normal-stuff>
#include <pwd.h>

char     *username;
struct   passwd *userinfo;

userinfo=getpwuid(getuid());
username=userinfo->pw_name;

"username" now points to the name of the current (su'd) login id
(userinfo->pw_name), not the original.

Thanks again to all who have helped.

  ==- 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: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.programmer
Subject: Re: named pipes (was: Finger and .plan, .project)
Date: 29 Jul 92 21:05:52 GMT
Organization: Auspex Systems, Santa Clara

>:     ln -s ~/.plan /plans/$USER
>
>Wow... Another good idea that Domain/OS has had for years...
>
>It does away with things like "5bin, 5usr" etc... you can have
>/bsd4.3/[bin, usr, etc] and /sys5.3/[bin, usr, etc] and then you
>can "ln -s /usr /'($SYSTYPE)'/usr"...

Except that in at least one system with "5bin" and the like, "5bin" is
*not* a complete set of System V versions of programs; it's just a set
of programs where the SV and BSD versions couldn't be (or weren't)
merged into one common version.  In that system, there's no notion that
you have two completely separate BSD and SV universes, with a brick wall
between them - a notion that seems to be dying off, and frankly, *I*
sure as hell won't miss it....

The general "object-oriented" file system in Aegis seemed like a nice
idea (not having used it, I've no idea what problems it had in
practice), though.
From: bcschu@skws02.monsanto.com (Brett Schultz)
Newsgroups: comp.unix.programmer
Subject: Better way to find out the number of lines in a file
Date: 27 Jul 92 19:57:54 GMT
Organization: Monsanto Company

This is kind of similar to the how many files in a directory question, but
is there a trick to find the number of lines in a file?

Thanks

Brett

PS

The files are big so I don't really want to do a gets loop with a counter
unless I have to.
Newsgroups: comp.unix.programmer
From: ajg@controls.ccd.harris.com (Arnold Goldberg)
Subject: Re: I am stumped on this one!!!
Organization: Harris Controls and Compositions
	<Brx394.4qL@undergrad.math.waterloo.edu> <13744@auspex-gw.auspex.com>
Date: Sun, 26 Jul 1992 20:44:05 GMT

>>>>> On 26 Jul 92 02:14:54 GMT, guy@Auspex.COM (Guy Harris) said:

	Guy> (Also, try not leaving every single line of the original posting in your
	Guy> followup; it makes it rather hard to find the stuff that *doesn't* come
	Guy> from the original posting....)

I concur completely and unreservably.  Especially when working from home
with a 2400 baud connection !!

arnold
--
------------------------------------------------------------------------
Arnold Goldberg                            Email:  ajg@ccd.harris.com
Phone: (407)242-5051                       Snail:  Harris Corporation
Fax  : (407)242-4262                               407 John Rodes Blvd.
                                                   Melbourne, FL 32905

The opinions expressed are my own and do not in any way represent Harris 
------------------------------------------------------------------------
From: chuck@IMSI.COM (Chuck Ocheret)
Newsgroups: comp.unix.programmer
Subject: Re: Help! Output going everywhere...
Keywords: pipes, widgets, children
Date: 28 Jul 92 19:12:39 GMT
Organization: Investment Management Services Inc., NYC

In article <1992Jul24.040517.3375@tc.cornell.edu> reed@theory.tc.cornell.edu writes:
>
>...  Now the real problem.  How do I get it out
>if I am hung up in an XtMainLoop call (or do I need to change to something
>else [gasp! handle my own events????])?  I thought of using a SIGIO signal
>handler...

Eek! Don't use a signal handler for *anything* if you can avoid it.  Xt
is not especially signal clean.  It is not safe or portable to make Xt
calls from withing a signal handler (or many other calls for that
matter).  Once you have the file descriptor you want to read from call
XtAppAddInput().  This is precisely the type of thing the Xt founding
fathers (and mothers) had in mind when they provided it.

~chuck
-- 
 Chuck Ocheret, Director of Technology | (212)339-2784 phone
        Investment Management Services | (212)339-2845 fax
         12 E. 49th Street, 35th Floor | chuck@IMSI.COM
                New York, NY 10017 USA | uupsi!bacon!chuck || uunet!bacon!chuck
Newsgroups: comp.unix.programmer
From: rickt@gvls1.gvl.unisys.com (Rick Thompson)
Subject: Shared Memory and Semaphores
Organization: Unisys Defense Systems, Great Valley Labs, Paoli, Pa
Date: Thu, 23 Jul 1992 15:51:58 GMT


Hello,

  I have a couple questions regaurding shared memory and semaphores.

  1)  I've created a shared memory area using shmget and my processes
      can communicate correctly.  However, it is possible for any one of
      the processes to remove the partion even though the others are still
      using it.  The processes are all running under the same user so any
      process has permission to remove it.  Is there a way to prevent the
      removal if the memory is still in use?

  2)  I need the ability to lock out a portion of shared memory in
      some critical regions of the code.  Is it possible using semget and
      semctl to do this?  Again, the processes using the shared memory are
      running under the same user.


      Thanks,

      Rick  rickt@gvl.unisys.com

Newsgroups: comp.unix.programmer
From: bjg28027@uxa.cso.uiuc.edu (Skydive!)
Subject: Better way to count files in dirs
Organization: University of Illinois at Urbana
Date: Mon, 27 Jul 1992 15:42:51 GMT

Hello,

I'm modifying some code that I've written in C previously and would like to try
to improve on it.  Right now, in order to determine the number of files
in a directory I am doing a system call "ls -1 | wc -l > tmp" and then opening
the file and fscanf the number.  Obviously this is a very ugly way to do
this and I would like to improve it.

Are there some functions in <dirents> library that I am missing?

Thanks.

bgolden@ncsa.uiuc.edu
From: mycroft@hal.gnu.ai.mit.edu (Charles Hannum)
Newsgroups: comp.unix.programmer
Subject: Re: Named pipes
Date: 27 Jul 92 22:11:33 GMT
Organization: /etc/organization


In article <92033@bu.edu> tesco@bumetb.bu.edu (Dances With Babes) writes:
>
> mknod testpipe p
> cat testpipe &
> ls > testpipe
> The "cat" process ends after the ls is sent to the screen.

This is the way named pipes have worked since The Dawn of Time.  If you
want to have multiple processes write to the pipe, you need the reader
to reopen it.  In the shell, you could do something like this:

(while :;do cat testpipe;done)&

-- 
- Charles Hannum, mycroft@ai.mit.edu
  White atheist male (WAM) pride!
Newsgroups: comp.unix.programmer
From: mun@corp.hp.com (Duane T. Mun)
Subject: Re: MAKE Question - am I asking too much?
Keywords: MAKE HELP 
Organization: Hewlett-Packard
Date: Tue, 21 Jul 1992 18:38:52 GMT

In article <drt.711704826@brolga> drt@brolga.cc.uq.oz.au (David Taylor) writes:
> 
> We have a set of programs (C and C/SQL) being worked on by multiple
> programmers. Usually each program has a "main()" source file and
> several support modules with header files. These support modules are
> shared accross most of the programs.
> 
> All the source is stored on a common area and access is controlled 
> via RCS. I am trying to set up a common makefile that will:
> 
> - checkout any files that are needed to satisfy the make.

$(HDRS) $(SRCS):	# Check out sources and headers as needed
	co $@

This isn't a perfect answer, but it seems to work.  You might want to
try GNU Make, I think they have built in rules for RCS.

> - pre-compile the C/SQL files.
> - compile the C files

test.o: dclgen.h	# set up dependancies

.SUFFIXES: .c .sc	# define suffix rules

.c.o:			# how to make .o from .c
	$(CC) $(CFLAGS) -c $< $(INCDIRS)

.sc.o: 			# how to make .o from .sc
	$(CPP) -C -P $< > $*.cpp	# get dclgen stuff
	$(ESQLC) $*.cpp
	$(CC) $(CFLAGS) -c $*.c $(INCDIRS)
	rm -f $*.cpp $*.c

> - link the program.

test : $(OBJS)		# link
	$(LD) $(LDFLAGS) -o $@ $? $(LIBDIRS) $(LIBS)

If you want to see the entire makefile, let me know.

Hope this helps.

--
From: cedman@714-725-3165.nts.uci.edu (Carl Edman)
Subject: Re: Making ``.plan'' EXECUTE a Program ???
Newsgroups: comp.unix.programmer
Reply-To: cedman@golem.ps.uci.edu (Carl Edman)
Date: 24 Jul 92 15:25:23 GMT

Tom Christiansen <tchrist@convex.COM> writes
> > This is because it was possible to do the following
> > ln -s <any file> ~/.plan
> > finger <my username>
> > and read any file on the system on some versions of unix.
> > The simplist fix is to just have fingerd refuse to read
> > anything not a regular file. 
> 
> Seem to me that doing this in fingerd:
> 
>     if (fork) return;
>     setuid(-2);
>     (do file reading
>     exit(0);
> 
> Would have been better.

Why even start up fingerd as root at all ? Most systems which I'm aware have  
'nobody' as the user for fingerd. BTW, a forked finger (my god, what images  
does that evoke ?) does the file reading for fingerd.

This of course wouldn't work for a fingerd/finger hack, I once wrote which  
checks whether the .plan or .project files have their executable bits set and  
if executes them as the finger target user if so. That avoids all that nasty  
pipe business which breaks under NFS and requires a constantly running daemon.

	Carl Edman
Xref: sparky comp.unix.programmer:3881 comp.unix.questions:9371 comp.lang.c:11550
From: rick@rick.infoserv.com (Rick Klement)
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.lang.c
Subject: Re: #include file dependancies
Summary: how I did it...
Date: 24 Jul 92 04:39:20 GMT
Followup-To: comp.lang.c
Distribution: comp
Organization: Rick's Place, San Jose, CA, USA

In article <AJG.92Jul22114544@sp1.ccd.harris.com>, ajg@controls.ccd.harris.com (Arnold Goldberg) writes:
> 
> We here have a very large source tree.
> 
> What I'm looking for is a script or utility that will somehow tell
> me which #include files are not actually needed for a source file.
> 
> any takers???

I did this specifically for BCC++ on (ugh!) MSDOS written in C, so no
code included here. (Would rather have done it in perl :-)

Here's how:

1) for each argument to program (assumed to be name of C file)
2) spawn (?) compile for this program, verifying good compile
	(or go to next file)
3) read and store line numbers of all #include statements.
4) store original copy somewhere
5) make new file by same name with one #include left out (line missing)
	(I started from highest line number to lowest, meant I
	didn't have to adjust line numbers)
6) recompile, checking for compile error
7) if compile error, re-insert #include line, if no error, leave out
8) repeat from 5) for each include...
9) if last compile fails, do one more compile

Assumptions...

a) I have a very consistent organization for all my compiles, they are
all the same, so it's no trouble to figure out how a file is compiled.
This knowledge is built into the include remover. (I don't believe in
custom make files.)

b) I have plenty of time. For 'n' #includes, I actually compile the
file 'n+2' times (I want to leave a good object when I am done).
However, this process doesn't destroy anything, so it could be run
overnight.

c) This still doesn't work all the time. There are cases where an include
file is required for what it defines at link time (compile still works,
link fails), but I think this is bad design and am trying to get the
person responsible to change this design...


This was written to go along with an environment for compiling that
recognized Borland error messages like 'prototype missing for printf'
and automatically inserted #includes (from a preprocessed list), but
because some functions are in more than one include file, generally too
many includes were inserted.  Also, some of us like to write programs
by copying an existing file and changing things (like removing
graphics), so we generally have too many #includes.

Conclusions:

It (mostly) works.
It seems ugly.
-- 
Rick Klement - email:   rick@infoserv.com

#include <standard.disclaimer>
RULE #7: When you can say something in a positive way or a negative way,
         don't say it in the negative way.
Xref: sparky comp.unix.programmer:3909 comp.unix.questions:9420
From: bernard@cpio1.UUCP (Bernard Fouche)
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: Bidirectional Pipes
Keywords: pipes
Date: 24 Jul 92 10:12:57 GMT
Organization: CPIO S.A.


In article <1992Jul14.061826.11689@Unibase.SK.CA>, roe@Unibase.SK.CA (Roe Peterson) writes:
> 890025d@dragon.acadiau.ca (Andy DeWolfe) writes:
> Sorry, but there is no such beastie as a bi-directional pipe.  The
> pipe(2) system call will return two file descriptors, one open for
> write, and one open for read.  Have the reader close the write end, and
> the writer close the read end.
> 
> You can't use pipe to communicate in both direction over one file
> descriptor.

Yes you can, since System V Release 4.0 at least. Get the man page of
pipe(2) for this release...
-- 
-----------------------------------------------------------------------------
Bernard Fouche  VOX   : +(33) (1) 48.04.56.30  FAX :  (33) (1) 48.04.98.95|
Email : bernard@cpio1.UUCP or cpio1!bernard@gna.org (try both!)
Postal Mail : CPIO S.A., 13-15 Rue de la Verrerie, 75004 Paris, France
Newsgroups: comp.unix.programmer
From: mjn@pseudo.uucp (Murray Nesbitt)
Subject: Re: expanding ~'s in a directory name.
Organization: Private system in Toronto, ON
Date: Fri, 31 Jul 1992 12:37:05 GMT


In article <1992Jul29.012629.14000@gucis.cit.gu.edu.au> aroll@gucis.cit.gu.edu.au (Ashley Roll) writes:

>My problem is how do I expand ~'s. I want to expand then the way that csh does

>Has anyone written or got code that will do this that I can use? Or is there
>a library function that will do this.

I don't care^H^H^H^Hknow about the csh, but the following should work
with sh and ksh:

#include <stdlib.h>

char *expanded_tilde;

    expanded_tilde = getenv("HOME");


To be completely honest, it should work under the csh, too.

Murray
-- 
Until my site's in the maps, please reply to "druid!pseudo!mjn".
From: jpr@jpradley.jpr.com
Newsgroups: comp.unix.programmer
Date: 18 Jul 92 05:46 MDT
Subject: Re: Need (today's date + [1-7] days)
Nf-ID: #R:1992Jul16.145836.15586@avalon.nw:-575817766:1992Jul18.014634.9436@jpradley.j:1193763918:001:1514
Nf-From: jpradley.jpr.com!jpr    Jul 18 05:46:00 1992


In article <1992Jul16.145836.15586@avalon.nwc.navy.mil> dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus) writes:
>I realize that date/time-related questions are common here, so no flames
>if this has been asked before...
>
>If I can get today's date in a shell script or C program, how can I find
>out the dates of the next week? For example, if I know today is
>"Wed Dec 30 1992", how can I have the program now that the next seven days
>are going to be "Thu Dec 31 1992", "Fri Jan 1 1993", etc (taking the
>case in which both month and year could change).
>
>I could sit down and take the brute-force approach and hard-code a bunch
>of cases, but I'm looking for something more simple. I've noticed that
>you can go "at now + 3 days ..." and you get the date/time back (but
>you also get an at job put in the queue...) so I was thinking that there
>may be a system call or C function that I don't know about which does
>this. So, any suggestions, please email and I'll post a summary if there
>is interest.

You could change your location. You move 15 degrees about the earth as
you add or subtract 1 to or from your TZ. And space and time are equivalent,
no?

Play with this script:

	set -v
	TZ=5 date
	TZ=-19 date
	TZ=-43 date
	TZ=-163 date

What it shows me:

	TZ=5 date
	Fri Jul 17 20:46:58  1992
	TZ=-19 date
	Sat Jul 18 20:46:58  1992
	TZ=-43 date
	Sun Jul 19 20:46:58  1992
	TZ=-163 date
	Fri Jul 24 20:46:58  1992
-- 
Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160,1341

Xref: sparky comp.unix.programmer:3872 comp.unix.misc:3004
From: herberj@prism.CS.ORST.EDU (John Wesley Herberg)
Newsgroups: comp.unix.programmer,comp.unix.misc
Subject: Driver Compiling Problem w/libc.a
Date: 23 Jul 92 18:28:24 GMT
Organization: Oregon State University, Computer Science Dept.

I am writing a driver and am having problems compiling it whenever I reference
a routine from the c library.  I compile the driver modules into one using
ld -x -r & then attempt to compile that module into the kernel.  Whenever I
do, I receive a "Duplicate symbol free in libc.a(malloc.o)" error.  

I know this has something to do w/how archive libraries are linked , but
don't know how to avoid it.  I'd greatly appreciate if someone could help
me out.
-- 
-----------------------------------------------------------------------
John W. Herberg	     		      Internet: herberj@prism.cs.orst.edu
From: bloomer@rodson.crd.ge.com (John Bloomer)
Newsgroups: comp.unix.programmer
Subject: Re: Sockets vs. TLI (Summary)
Date: 24 Jul 92 13:31:56 GMT
Organization: GE Corp. Research & Development, Schenectady, NY

Programming at the RPC level is a good way to isolate yourself from
the underlying TLI/socket and transport issues you may not care about.

OSF/DCE's RPC supports a number of transports and connection schemes,
including sockets.  They are moving to support TLI from what I'm told.

The old well-known Sun RPC (ONC version 4.0) is basically
sockets-only.  It allows one to easily mix-in the IPCs you like best,
performing IPCs or RPCs across the network, on the same machine or even
the same process with little XDR penalty (esp. if your machine already
things in network order bytes, e.g., a SPARC).

The newer Solaris-era TI-RPC is a superset, with backward compat. to
ONC 4.0.  It adds transport independence (built on TLI) in a clever,
run-time or compile-time fashion.  If you continue to require socket fd
fiddling (e.g., within X11), you need to plan this in.

You've got to start thinking about name serving instead of ports.
These daemons must be running too.  All three RPC systems are
available now.  The last two can be downloaded for free (although I bet
you already have the 4.0 development tools).  There are other RPC
systems as well.


John J. Bloomer (issuing my opinions, not those of GE or O'Reilly and Assoc.)
KWC317, General Electric Corporate Research and Development
PO Box 8, Schenectady NY 12301
-- 
John J. Bloomer 518-387-6964 (dialcomm 833) FAX -7332
KWC317, General Electric Corporate Research and Development
PO Box 8, Schenectady NY 12301
Newsgroups: comp.unix.programmer
From: richmond@flipper (Stupendous Man)
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.wizards,comp.sys.sun.misc
Subject: Need help with socket problem on Sun
Date: 29 Jul 92 18:12:09 GMT
Organization: University of California, Berkeley
NNTP-Posting-Host: flipper.berkeley.edu


We are using a Sun Sparcstation II running Sun 4.1.2 UNIX to control our
automatic telescope at the Astronomy department's Leuschner observatory.
We have a very local Ethernet in which we send digital images from
a PC or Mac into the Sun.  We are using sockets to read the data from the
remote machine and write it to a Sun disk file.  Below is the code stub
to do it.

#define BUF_SIZE 4096

    FILE *fp2;

    fp = open(fname, O_RDWR);          /* open local disk file */
    fp2 = fopen("/dev/console", "w");	


    InternetSocket = socket(AF_INET,SOCK_STREAM,0);  /* open Ethernet */
    gethostbyname( ... );
    connect ( ... );
    while (not done) {
         read(InternetSocket,data,BUF_SIZE);  /* suck in remote data */
         write(fp, data, BUF_SIZE);           /* write to local disk */
#ifdef FOO
         fputc('.', fp2);             /* WRITE to console .. see below */
         fflush(fp2);
#endif
   }

  Note the crazy write to the console, inside the '#ifdef FOO' section: 
If we do not include it, it takes us 25 seconds to transfer 500kBytes; 
if we do write to the console, it takes only 5 seconds!  
The size of BUF_SIZE plays little role, nor do the
types of machines on the other end.  We used to use an IBM RT running
AIX to do the same thing  as the Sun (without printing to the screen) and
it took about 8 seconds (mainly disk time).

  Our question is why this printout speeds things up so remarkably.  I would
love to get rid of it since we get dots filling up our console screen
whenever we take a picture (it also can crash Open Windows).

  Any stab in the dark would help.  Thanks in advance!

-- 
--
"Haven't you got better things to do        Michael Richmond
 with your time than grope a cat?"          richmond@bkyast.berkeley.edu