HDTenEightyP/NetNews huggingface dataset:
From: mmoore%peruvian.utah.edu@cs.utah.edu (Michael Moore)
Newsgroups: comp.unix.programmer
Subject: determining directories.
Date: 13 Apr 92 22:35:26 GMT
Article-I.D.: hellgate.1992Apr13.163526.4248
Reply-To: mmoore%peruvian.utah.edu@cs.utah.edu
Organization: University of Utah, CS Dept., Salt Lake City

In article <1992Apr13.201312.15424@usenet.ins.cwru.edu>, chet@odin.INS.CWRU.Edu (Chet Ramey) writes:

	Hello, I have what I hope is a simple question.

	I need to go down a list of pathnames and determine if the given
file is a directory or not.  My problem is that it thinks just about 
everything is a directory.  I think I am doing something wrong when 
checking the st_mode bit field.  This is the code that I currently have :

----------------------------------------------------------------------------
  DIR *dp;
  struct dirent *d;
  struct stat stat_buff;
  char s[255];

  getwd(s);
  dp = opendir(s);
  d = (struct dirent *) readdir(dp);
  while (d != NULL) {
    int i;
    char stemp[255];
    char fname[255];

    i = strlen(end);    /* end holds the string filenames must end in */
    /* fb->curdir is the current directory we are in, so if we are looking
       at the file /usr/skel/.cshrc, fb->curdir is "/usr/skel" */
    sprintf(stemp, "%s/%s",fb->curdir, d->d_name); /* construct path name */
    stat(stemp, &stat_buff); /* stat the file */
    if (stat_buff.st_mode & S_IFDIR) { /*is it a directory? This is my prob*/
      sprintf(fname, "%s/",d->d_name); /* if so, add a '/' at the end */
      d->d_namlen++;
    }
    else
      sprintf(fname, "%s",d->d_name);
    /* The following if statement is only true if 'fname' ends in the string
       indicated in the 'end' variable */
    if (!strncmp(&fname[d->d_namlen-i], end, i) && d->d_namlen > i) {
      strcpy(fb->files[count], fname, d->d_namlen);
      count++;
    }
    d = (struct dirent *) readdir(dp); /* continue reading */
  }
 ---------------------------------------------------------------------------


	Please, if you can help me in any way, I would greatly appreciate it.

	-Sincerely,

	Michael Moore

-- 
 ----------------------------------------------------------------------
| Michael Moore (mmoore@peruvian.utah.edu)  Phone : (801) 359-6552     |
|          University of Utah, Computer Science Department             |
 ----------------------------------------------------------------------
Newsgroups: comp.unix.programmer
From: rsalz@uunet.uu.net (Rich Salz)
Subject: Re: Efficiently reading a file question
Organization: UUNET Technologies Inc, Falls Church, VA
Date: Sun, 12 Apr 1992 19:24:46 GMT

In <780@kepler1.rentec.com> andrew@rentec.com (Andrew Mullhaupt) writes:
>In article <ktcmbvINNe4e@alhena.usc.edu> ajayshah@alhena.usc.edu (Ajay Shah) writes:
>>I have a C program which spends a lot of time reading lines
>>from a text file using fgets().
>If your UNIX has it, try memory mapping the file.
If Ajay's program follows the typical fgets loop:
	while (fgets(buff, sizeof buff, infile) != NULL) {
	    if ((p = strchr(buff, '\n')) != NULL)
		*p = '\0';
	}
Then mmap is typically much SLOWER because you end up taking a
pagefault every time you clobber the newline.

I believe the fastest way is to use read into a big buffer, and return
pointers to that, filling the buffer as needed.  I use this in a package
I will be releasing soon, and tests show it is about 20% faster then fgets
(including C News stdio speedups).
	/r$
Newsgroups: comp.unix.programmer,comp.unix.ultrix
From: tcasey@leo.unm.edu (Dionysus)
Subject: Profiling C using Pixie
Date: Fri, 10 Apr 92 12:14:42 GMT
Organization: University of New Mexico, Albuquerque
Summary: Profile and still have 'system()' calls?
Keywords: Ultrix 4.2

In article <1992Apr3.021350.2263@uai.com> mrl@uai.com (Mark R. Ludwig) writes:
>My post expressed the desire to determine where an application is
>spending its CPU time.
>----------------------------------------------------------------------

>From: Peter Montgomery <pmontgom@math.ucla.edu>

>	The VAX is not amongst your top 3, but Ultrix has a
>good tool called pixie.

>[[ Peter and I went back and forth a couple times before I realized that
>   this tool, pixie, turns out to be only on RISC/Ultrix.  It is
>   apparently not on the VAX architecture.  What added to the
>   confusion is that DEC's numbering scheme is not by itself unique.
>   Peter referred to his DEC 3100 which is decidedly different from
>   our VAX 3100. ]]


Ok, I did this.  I have a program the does a 'system()' call, works
with out pixie.

I run pixie on the executable, produce exectuable.pixie, and 
executable.Addrs.  Everything appears ok up to here.

Then I run the pixie executable.

Everytime I does a 'system()' call, the pixie executable get a SEGV
  _dwmult (it does not give a file or line number).

Is there *any* way to get pixie to do debugging on this?  Am I doing 
something wrong?

The machine is a DECstation 5000/something, running 4.2.

thanks
tim
From: peterh@ukelele.UUCP (Peter Hartzler)
Newsgroups: comp.unix.programmer
Subject: Re: indirect goto
Date: 10 Apr 92 02:32:40 GMT
Distribution: dc
Organization: GAU Technologies, Fairfax County, VA

amichail@descartes.waterloo.edu (Amir Michail) writes:

>switch(d){
>case 1 : goto l1;
>case 2 : goto l2;
>case 3 : goto l3;
>}
>The only problem is, d could have many values in my program,
>perhaps 10000 or so.
>Is there any other way I could do this?

If your values of d are contiguous, you could use d to index into an array
of pointers, as in goto VectTabl[d];, where VectTabl would be your array of
locally scoped addresses - void *VectTabl[]  = {l0, l1, l2, ... , ln};

>Also, I have another question about trapping segmentation violations.

>Suppose, I have an array A of size 10.  Then
>the statement a = A[2000] will cause a segmentation violation.  The
>point is I wish to trap it and perform some action, then return
>to the code and continue processing.  However, I keep getting
>repeated segmentation violations as 'a = A[2000]' is executed over and
>over again.  I tried putting an index i, i.e. a = A[i], then changing
>i back to 0 in my error handler routine.  However, this does not
>fix the problem.  Any clue on how to do this?

Is i in scope in your error routine? i.e., global or passed by reference.
-- 
Peter Hartzler (peterh@ukelele.UUCP)
From: ian@airs.com (Ian Lance Taylor)
Newsgroups: comp.unix.programmer
Subject: Re: Question about Process(es)
Date: 10 Apr 92 21:48:02 GMT

jik@athena.mit.edu (Jonathan I. Kamens) writes:

>So, in order to find out if a process is running it, you kill(2) it
>with signal 0 and check for errors.  If there are none, then it is
>running.  If there was an error, and errno is EPERM, then the process
>is running and you don't have permission to kill it.  If there was an
>error, and errno is ESRCH, then the process isn't running.  Any other
>errors and something bizarre is going on :-).

POSIX 1003.1-1988 gives explicit latitude to the kill call to return
ESRCH even if the process really does exist.  This is for ``an
implementation that provides extended security controls,'' perhaps to
prevent a program from counting the number of existing processes,
which could be used a somewhat inefficient covert channel.  Or, who
knows, maybe there's a better reason.

Since my code depends on kill returning ESRCH and EPERM as usual, from
time to time I wonder if there are any systems out there which
actually return ESRCH for an existing process.  Anybody know?
-- 
Ian Taylor                     ian@airs.com                    uunet!airs!ian
First person to identify this quote wins a free e-mail message:
``Do you make a grievance of weighing so many pounds only, instead of three
  hundred?  Then why fret about living so many years only, instead of more?''
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.programmer
Subject: Re: How to write the ANSI C time functions
Date: 15 Apr 92 22:01:44 GMT
Organization: Auspex Systems, Santa Clara

>Hmmm. Didn't you really mean to say 00:00 UTC, Jan 1, 1970?

Yup.  I started out aiming towards saying "12 midnight", and then
swerved, but didn't fix stuff to the left of the cursor. :-)
From: bill@bilver.uucp (Bill Vermillion)
Newsgroups: comp.unix.programmer
Subject: Re: mass rename
Date: 6 Apr 92 14:15:57 GMT
Organization: W. J. Vermillion - Winter Park, FL

In article <$j3Hd#1h6@cs.psu.edu> schwartz@roke.cs.psu.edu (Scott Schwartz) writes:

>A friend of mine comments that you have to be careful with these rename
>scripts.  He once used the perl version to increment the suffix on a
>glob of files foo.0, foo.1, etc.  Of course, it moved foo.0 onto foo.1,
>foo.1 onto foo.2, and left him with just one file in the end.  A robust
>solution would discover, if it could,  a safe ordering for the rename
>operations.  You may also want to consider clashes with existing but
>not argument files.

This sound to me like the programmer did not understand what he
was doing.

You have to be aware of the same type things anytime you move
items around - eg block moves of memory etc.  I'd chalk this up
to programmer error.   A good many of us have done that once,
and then you learn!


-- 
Bill Vermillion - bill@bilver.uucp 
                - ..!{peora|ge-dab|tous|tarpit}!bilver!bill
From: johann@mrz.lm.sub.org (Johann Lehner)
Newsgroups: comp.unix.programmer
Subject: Looking for better RPCGEN !
Date: 7 Apr 92 14:49:07 GMT
Organization: Muenchener Rechenzentrum, Munich/Bavaria
X-Md4-Signature: 98786c286beb368e4e4d070b60fb37f6

The standard RPCGEN delivered with SCO Unix NFS-Development is unable
to handle 2-dim arrays like "name[30][5]" and generates a lot of fixed
code. If you know about a better RPCGEN please tell me about.

For future developments i'm also searching for an RPCGEN for COBOL
programms. 

Many thanks for help.
--
Johann Lehner, johann@mrz.lm.sub.org
Xref: sparky comp.unix.programmer:2431 comp.unix.questions:6270 comp.unix.misc:2092 comp.std.c:1834
From: nowlola@elof.iit.edu (Olatunji Nowlin)
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.misc,comp.std.c
Subject: Input within a time frame
Date: 16 Apr 92 23:31:26 GMT
Article-I.D.: iitmax.1992Apr16.233126.4177
Distribution: na
Organization: Illinois Institute of Technology, Chicago



Does anyone know how I would be able to get a character
of input within a certain time limit (say 3 seconds?).

The getchar() , getc() etc., routines don't use time
limits (you can take as loooong as you want, which
is not desirable in the program).  Is there some
routine that would get the input within a certain
time frame?

PS This thing is really bugging me because I can't think
   of any solution.

PPS This is on a Unix system btw.

O. Nowlin

What .sig?
Newsgroups: comp.unix.programmer,comp.unix.shell
From: leisner@johnker.henr801@xerox.com (Marty Leisner x76704 siena)
Subject: Which which returns status
Reply-To: leisner.henr801c@xerox.com
Organization: Xerox
Date: Wed, 15 Apr 1992 14:57:59 GMT

The which command on my Sun (SunOS 4.1.1B) doesn't return status.

I want to do something like:
	if(command exists)
		then execute command
	else 	
		execute simpler command.

I don't want to code path names in my file -- I'd rather do a which command
which I can test...

Anything out there to do this (it will be relatively simple to hack up the which command...)

BTW -- since which sources the .cshrc file (which is strange since I thought the
-f option negates this), setting the path in the .cshrc file does unexpected 
things.

 
marty
leisner.henr801c@xerox.com
Member of the League for Programming Freedom
(You get what you pay for -- except in software)
Xref: sparky comp.unix.programmer:2394 comp.unix.questions:6210 comp.unix.misc:2068 comp.lang.c:7642
From: patel@enuxha.eas.asu.edu (Jayesh A. Patel)
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.misc,comp.lang.c
Subject: Programming using RPC
Date: 15 Apr 92 10:17:18 GMT
Followup-To: poster
Organization: Arizona State University

Greeting:

Can anyone suggest me references about programming  using
RPC (Remote Procedure Call) ?

Please email. I will summarize if appropriate.

Jayesh Patel
patel@enuxha.eas.asu.edu
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.unix.programmer
Subject: Re: sockets
Date: 13 Apr 1992 20:54:01 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <13971@star.cs.vu.nl> jkreyka@cs.vu.nl (Kreijkamp J) writes:
>Hello, I'm trying to make a communication channel with sockets,
>but it isn't going very well at the moment...

Try getting the book "Unix Network Programming" by W. Richard Stevens.

>Can anyone PLEAAAASEE tell me how to connect two sockets?

You mentioned the word in your very question: use the connect() call.

>  s1 = socket(PF_UNIX, SOCK_STREAM, 0);
>  s2 = socket(PF_UNIX, SOCK_STREAM, 0);

Call one of them the server and the other the client.  You use bind() on
the server socket to give it a name and then listen() to inform the system
that it should accept connections for that name.  Then you can call
connect() on the client socket, specifying the same name, and accept() on
the server socket.

>If possible also code how to unconnect, and more important how to 'unbind'
>names if 'bind' is used.

You unconnect with close().  To unbind, I think you can just bind a
different name.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
From: jik@athena.mit.edu (Jonathan I. Kamens)
Newsgroups: comp.unix.programmer
Subject: Re: Need help writing Front End
Date: 7 Apr 92 15:15:34 GMT
	<1992Apr6.210239.9818@ringer.cs.utsa.edu>
	<1992Apr7.140858.21311@rsd0.rsd.dl.nec.com>
Organization: Massachusetts Institute of Technology

In article <1992Apr7.140858.21311@rsd0.rsd.dl.nec.com> randy@rss.dl.nec.com (Randy Bullard) writes:

(Randy: Please keep the lines in your postings less than 80 characters
long in the future.)

   If you need access to both stdin and stdout for the program, then
   you'll have to create new file descriptors and fork/exec the
   program with these new file descriptors in its environment as stdin
   and stdout (or somesuch nonsense.  I've done it before but can't
   remember the exact procedure.  popen() definitely won't do it
   though).  See Richard Stevens "Unix Network Programming" or Marc
   Rochkind's "Advanced Unix Programming" for code examples on how to
   do this.

Better yet, see the comp.unix.questions FAQ, which answers this
question.

The original poster should have read the FAQ before posting.  The
people who have answered so far should have sent mail rather than
posting an answer to a question that is answered in the FAQ.

For the FAQ-impaired:

Subject: Welcome to comp.unix.questions [Monthly posting]
Newsgroups: comp.unix.questions,news.answers

Subject: Frequently Asked Questions about Unix (1/4) [Monthly posting]
Subject: Frequently Asked Questions about Unix (2/4) [Monthly posting]
Subject: Frequently Asked Questions about Unix (3/4) [Monthly posting]
Subject: Frequently Asked Questions about Unix (4/4) [Monthly posting]
Newsgroups: comp.unix.questions,comp.unix.shell,news.answers

Available in the indicated USENET newsgroup(s), or via anonymous ftp from
pit-manager.mit.edu (18.172.1.27) in the files:

/pub/usenet/news.answers/unix-faq/unix-intro
/pub/usenet/news.answers/unix-faq/part1
/pub/usenet/news.answers/unix-faq/part2
/pub/usenet/news.answers/unix-faq/part3
/pub/usenet/news.answers/unix-faq/part4

Also available from mail-server@pit-manager.mit.edu by sending a mail message
containing any or all of:

send usenet/news.answers/unix-faq/unix-intro
send usenet/news.answers/unix-faq/part1
send usenet/news.answers/unix-faq/part2
send usenet/news.answers/unix-faq/part3
send usenet/news.answers/unix-faq/part4

Send a message containing "help" to get general information about the
mail server.

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
Newsgroups: comp.unix.programmer
From: drd@siia.mv.com (David Dick)
Subject: Re: recursively moving to directories
Organization: Software Innovations, Inc.
Date: Thu, 16 Apr 92 04:05:13 GMT

In <4r9Hctyp6@cs.psu.edu> schwartz@roke.cs.psu.edu (Scott Schwartz) writes:


>chet@odin.INS.CWRU.Edu (Chet Ramey) writes:
>   Without chown -R, use find piped to xargs.
>   find . -print | xargs /etc/chown foo

>Hopefully you have no filenames with whitespace in them.  If you have
>gnu find/xargs, it is safer:

>   find . -print0 | xargs -0 /etc/chown foo

If you don't worry so much about the efficiency of forking chown
for every file, you can just

    find . -exec chown {} \;

Then you'll have no problems with special characters in filenames--
the names never get parsed in a command line.

David Dick
Software Innovations, Inc. [the Software Moving Company]
From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao)
Newsgroups: comp.unix.programmer
Subject: Re: Re : non-blocking accept()
Date: 10 Apr 92 17:11:13 GMT
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');

In article <FRANL.92Apr10121115@draco.centerline.com> franl@centerline.com (Fran Litterio) writes:

>Is it worth pointing out that select() is not part of Posix.1, so by
>using it you run the risk that your code will not port to some pure
>System V/Posix.1 machines?  Just how many systems don't provide
>select() anyway?

What? select() is a really useful system call. Other ways of concurrently 
checking for I/O on multiple file descriptors are not appropriate all the
time. Is there something remotely resembling select() ?

	-Kartik
From: PJS100T@ODUVM.BITNET (Pam Skillman)
Newsgroups: comp.unix.programmer
Subject: Re: Which pipe sent SIGPIPE w/o trying to write to it??
Date: 13 Apr 92 14:45:39 GMT
Organization: Old Dominion University

In article <11364@mindlink.bc.ca>, Frank@mindlink.bc.ca (Frank I. Reiter) says:
>
>I believe the initial poster wants his SIGPIPE handler to find out which pipe
>was broken in order to decide what to do about it.
>
>Unless someone has a better idea I will have to try printing a nul to stdout
>to
>see if that causes ANOTHER signal just to find out which pipe caused the
>problem.
>
>I'd love to hear that better idea!
Yes!!  I'm sorry, obviously my question was not well stated.  All of my
processes have been forked and are running concurrently.  My handler will have
to "test" each pipe individually to generate ANOTHER signal, but I don't want
the tools running at the "live" processes to interpret what I send.  Thanks
to all that answered and Frank, If you come up with a solution I'd be intereste
d.
===============================================================================
 PJ  Skillman
 PJS100T@ODUVM.BITNET       //       Old Dominion University
 PJS100T@ODUVM.CC.ODU.EDU   //       Norfolk, Virginia
From: giulio@unicorp.sublink.org (Giulio Bertellini)
Newsgroups: comp.unix.aix
Subject: Public Domain reimplementation of the (AT&T) curses library.
Date: 8 Apr 92 06:43:03 GMT
Organization: Sublink Network

In porting an application package to IBM RISC 6000 and DEC Ultrix 4.2
environments I have found that the functions 

                 curs_set() 

                 isendwin()

are missing.  

I would appreciate indication of possible sources
of equivalent functions.

Thank you very much in advance,

giulio bertellini             (giulio@unicorp.sublink.org)

-- 

Giulio Bertellini         --*--       INTERNET:  giulio@unicorp.sublink.org
                    Via G. Govone, 56 - 20123 Milano, ITALY  +39-2-33608282
Newsgroups: comp.unix.aix
From: jsalter@ibmpa.awdpa.ibm.com
Subject: Re: C question involving redeclared functions and aix
Organization: IBM PSP Development, Palo Alto, CA
Distribution: na
Date: Thu, 9 Apr 92 21:43:40 GMT

In article <1992Apr9.161422.11909@uwm.edu> duncan@convex.csd.uwm.edu (Shan D Duncan) writes:
>Function malloc cannot be redeclared
>Function calloc cannot be redeclared

This means that you've redeclared the malloc() and calloc() declarations.
The #ifndef AUX code doesn't help with AIX.  Since malloc() and calloc()
are declared in the system <stdlib.h> header file, the code you have is
either including that, or including something that includes that file.

Add:

#ifndef	_IBMR2

around the malloc() and calloc() declarations in the code.

>I did try setting MALLOCTYPE=3.1 - since this was suppose to
>compile under 3.1.5 using bsdcc.

This only provides use of the 3.1.5 vs. the 3.2 malloc() subroutine.  Not
how they're declared.

>-Shan

Jim Salter  ---  (415) 855-4427
T465-4427 --- IBM PSP Palo Alto  1510 Page Mill  MS/35A  Palo Alto, CA  94304
Internet/IBM Net: jsalter@ibmpa.awdpa.ibm.com	VNET/PROFS: JSALTER at AUSVMQ
Newsgroups: comp.unix.aix
From: ajg@controls.ccd.harris.com (Arnold Goldberg)
Subject: IBM Assembly HELP
Organization: Harris Controls and Compositions
Date: Fri, 17 Apr 1992 13:32:48 GMT



IBM provides the cs command compares Compare with the integer pointed 
to by Destination.  If they are equal, Value is stored in the integer
pointed by Destination and cs returns 0. If the values are dif-
ferent, cs returns 1, and the value pointed by Destination is not
affected.  The compare and store are executed as an atomic opera-
tion; therefore no process switches occur between them.

int cs (Destination, Compare, Value)
int *Destination;
int Compare;
int Value;

I need the same thing, except the Destination is to be a character.
The solution is most likely an assembly subroutine, but I don't
have AIX assembly manuals.  Could someone please help.

Post or email to sdk@ccd.harris.com


Thanks!!

-- 
------------------------------------------------------------------------------
Arnold Goldberg                                Email:  ajg@ccd.harris.com
Phone: (407)242-5051                           Snail:  Harris Corporation
Fax  : (407)242-4268                                   407 John Rodes Blvd.
From: peter@ski.austin.ibm.com (Peter Jeffe 512.838.4019)
Newsgroups: comp.unix.aix
Subject: Re: AIX 3.2 named crashing...
Date: 9 Apr 92 20:31:36 GMT
Organization: The Kernel Group, Inc.

In article <quekcINNdtf@grasp1.univ-lyon1.fr> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes:
>An IBMer told me that 3.2 named has been entirely rewritten, obviously
>it has been entirely badly rewritten, even worse than 3.1.

Sorry, but they were wrong.  There were several new features added to
comply with suggestions in rfc-1123, and there are several bug fixes
that bring it "close" to BIND 4.8.3, but it was hardly rewritten.
AIX named is still essentially BSD BIND.  And while there may have
been one or two bugs added along with the new features, 3.2 named
should be basically as reliable as 3.1.

>The solution I applied under 3.1.3 was to compile the Berkeley BIND.
>I don't remember problems, but if you do so, don't forget to compile
>and link with the bsd library (it compiles without but the code is just
>not working).

I don't think I have found a problem yet in AIX named that wasn't also
present in BIND 4.8.3, although I'm sure there are some.  I know there
were a lot of changes between 4.8.1 and 4.8.3, but all or most of the
bugs I've seen from customer sites weren't among those fixed in 4.8.3.
Don't let me discourage you from picking up BIND, but don't think it
will fix all your problems; it's still a very messy bit of code
(perhaps when 4.8.4 comes out...).

-- 
peter jeffe  peter@aixwiz.austin.ibm.com
Newsgroups: comp.unix.aix