HDTenEightyP/NetNews huggingface dataset:
From: jmp@moscom.UUCP (Joe Palumbos)
Newsgroups: comp.unix.programmer,comp.unix.sysv386
Subject: Re: I/O of login shell
Date: 31 Jul 92 13:24:48 GMT
Distribution: usa
Organization: Moscom Corp., Pittsford, NY
X-Newsreader: Tin 1.1 PL3

erica@wariat.org (Lady of the BitMode) writes:
: Hi.
: 
: I'm running SVR4. First a very very brief to help along the way.
: When a person logins into a unix system the system must first:
: 1) spawn a getty from teriminal
: 2)  getty runs login
: 3) then getty exec users specified shell, [...]
: 4) user gets 3 basic file handles:
:    stdout 0, stdin 1, stderr 2.
: 
: [.....]
: 
: PS: I'm gonna go try the above. I know it's not going tobe a trivial task! :(
: 
: Thankyou:
: 
: Erica C. Ramsey
: 

Lady Erica,

This looks like it should work; but you have your stdin & stdout fd's 
mixed up.  If you look in unistd.h, you'll see defines for these:

	#define   STDIN_FILENO   0
	#define   STDOUT_FILENO  1
	#define   STDERR_FILENO  2

Good luck.
-- 
Joe Palumbos	jmp@moscom.com		{rit,tropix,ur-valhalla}!moscom!jmp
From: css1rs@ainur.ee.surrey.ac.uk (Russell Smithers)
Newsgroups: comp.unix.programmer
Subject: undefined type of structure
Date: 29 Jul 92 08:49:33 GMT
Organization: University of Surrey, Guildford, England
X-Newsreader: Tin 1.1 PL4

Ive allready posted basicly the same question but it hasn't shown up
here, so Im posting again.

Basicly im using GCC v1.4 and the compiler gives me this error :

<I am boromir> make
gcc -g -DSUN -ansi  -target sun4 -c  manage.c
manage.c: In function add_group:
manage.c:38: invalid use of undefined type `struct group_buff'
manage.c:39: invalid use of undefined type `struct group_buff'
*** Error code 1
make: Fatal error: Command failed for target `manage.o'

The structure in question has previously been defined as global
and has been mad extern in all source files, this is the chunk of
code I get the error on :

    34  add_group()
    35  {
    36          int ok=1;
    37
    38          pretty_string(group_buffer.Group_Name);
    39          ok=group_exists(group_buffer.Group_Name);
    40

Any help on this is greatly apprecited, if ive missed something
basic then I would realy appreciate it fully or partly explained.

Thanks netters.
From: meb@BEAU.ATLANTA.DG.COM (Michael Brown)
Newsgroups: comp.unix.programmer
Subject: timer/scheduler package
Date: 29 Jul 92 19:40:31 GMT


I am searching for source code for scheduling events
that does the following:

1) Add an event to a table (queue or tree)
2) Delete an event from a table
3) Modify the event time
4) Keep the events in chronological order
5) For each event, generate an ALARM signal

Does anyone know of a package that does this?
Please send mail directly to me as I don't read
the net news frequently.  Thanks...

-----------------
Michael E. Brown
meb@atlanta.dg.com

switch( opinion ){
case MINE:
	printf( "YES\n" );
	break;
case OTHERS:
	printf( "NO\n" );
	break;
}
From: kron@ueshiba.Corp.Sun.COM (Kenneth Kron)
Newsgroups: comp.unix.programmer
Subject: Re: #include file dependancies
Date: 23 Jul 1992 18:22:09 GMT
Organization: Sun Microsystems, Inc.
Distribution: world
Reply-To: kron@ueshiba.Corp.Sun.COM
NNTP-Posting-Host: ueshiba.corp.sun.com

How about the -E option to cc
ueshiba% cc -E test.c | grep "# 1"
# 1 "test.c" 
# 1 "./used.h" 1
ueshiba% more *
::::::::::::::
notused.h
::::::::::::::
#define NOTUSED
::::::::::::::
test.c
::::::::::::::
#ifdef DONT
#include "notused.h"
#endif
#include "used.h"
::::::::::::::
used.h
::::::::::::::
#define USED

---
kron@mentor.sun.com
Stolen sig of the month ---
'Whatever you can do, or dream you can, begin it.  Boldness
has genius, power and magic in it.'  -  Goethe


Newsgroups: comp.unix.programmer
From: aej@manyjars.WPI.EDU (Allan E Johannesen)
Subject: Re: Changing a User's Password
Organization: Worcester Polytechnic Institute, Worcester, MA 01609-2280
Date: Tue, 21 Jul 1992 13:59:56 GMT

>>>>> On Monday, 20 Jul 1992 15:40:06 CDT, <NIBMSCM@NDSUVM1.BITNET> said:

NIBMSCM> I am trying to set up new users on a Sun System from within a
NIBMSCM> 'C' program.  Everything seems to be working fine except I am
NIBMSCM> not able to set up a password for the new user.  Some how I
NIBMSCM> need each users password setup before they logon for the
NIBMSCM> first time.

Use crypt() to generate one.  e.g.

char
  *ky="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./",
  salt[2],
  result[14];

char *
generate_passwd(input)
char *
  input;
{ int
    now;
  time(&now);
  salt[0] = ky[now % 64];
  salt[1] = ky[(now / 64) % 64];
  return(strcpy(result,crypt(input,salt))); }

The above chooses a "random" salt and runs a word across the crypt.
My assumption was that you just wanted the mechanics.
Newsgroups: comp.unix.programmer
From: ksc@cbnewsk.cb.att.com (kenneth.s.cobler)
Subject: Shared memory question
Organization: AT&T
Date: Wed, 22 Jul 1992 22:11:16 GMT
Followup-To: ksc@cbnewsk.att.com

Forgive my intrusion upon your bandwidth...but,
I received some email about a question on shared memory of which
I removed the email before I could reply to the sender only.

The subject of the query was why on a particular system, the
shared memory bombs with a segmentation violation when allocating
more than 127 ints of shared memory ?  If this sounds familiar,
please email a message to me.

Kenneth Cobler		ksc@cbnewsk.att.com or ken@ihlpm.att.com
AT&T Bell Laboratories	attmail!cbnewsk!ksc or attmail!ihlpm!ken
2000 N. Naperville Rd.
Naperville, IL  60566
From: osycs@giac1.oscs.montana.edu (Craig Spannring)
Newsgroups: comp.unix.programmer
Subject: What is exp10?
Date: 22 Jul 92 16:05:42 GMT
Article-I.D.: coe.1992Jul22.160542.10486
Organization: Geographic Information & Analysis Center Montana State University


I have an Ultrix box and need to compile some code that was written on 
a Sun.  The program won't link because of a undefined symbol 'exp10'.
Is that a function in one of the Sun libraries?  If so, how is it defined?
If not, could it be in the NAG libraries?

-- 
====================================================================
 Six of one, 110 (base 2) of       | Craig Spannring
 another.                          | osycs@giac1.oscs.montana.edu
 ----------------------------------+--------------------------------
Newsgroups: comp.unix.programmer
From: bbobak@undergrad.math.waterloo.edu (Brad Bobak)
Subject: Re: I am stumped on this one!!!
Organization: University of Waterloo
Date: Sat, 25 Jul 1992 18:52:00 GMT

In article <1992Jul25.165451.21726@infoac.rmi.de>, siebeck@infoac.rmi.de (Wolfgang Siebeck ) writes:
> bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
> 
> >In article <1992Jul24.204944.18516@cbfsb.cb.att.com> rajeev@cbnewsf.cb.att.com (rajeev.dolas) writes:
> >>
> >>Hello all,
> >>
> >>		pbuf = pars_wbuf;
> >>		cp_line = (char *)malloc(sizeof(strlen(pars_wbuf)));
> 
> 
> > You're allocing the sizeof an int, which is likely four bytes.
> > You also forgot to alloc space for the '\0'. Try it again with:
> 
> >	cp_line = (char*)malloc(sizeof(strlen(pars_wbuf) + 1));
> 
> or better:
> 
> 	cp_line = (char*)malloc(strlen(pars_wbuf) + 1);

 Ooops, a little slip there ;)

> 
> 
> >>		strcpy(cp_line, "\0");
> >>		tmp_line = cp_line;
> 
> -ws
> --
> siebeck@infoac.rmi.de (Wolfgang Siebeck)
>
From: kenc@kedeng.UUCP (Ken Cornetet)
Newsgroups: comp.unix.programmer
Subject: IPC questions
Date: 22 Jul 92 16:28:05 GMT
Organization: Kimball Electronics, Jasper IN

I'm building an application using IPC under ESIX 5.3D (SYSVR3.2).  I
have a process which reads packets off an ARCnet card and shoots the
packets down different message queues depending on the packet type. 
A server process reads packets off the other end of each queue.  My
problem is that if one queue over-runs (I'm using the IPC_NOWAIT flag in
the msgsnd), all queues become clogged - a msgsnd to ANY queue returns
error EAGAIN.  The reader for the full queue never returns from the
msgget call.

I have a couple of questions

1.  Why does one queue filling stop all queues ?  My tunable parameters
are:  MSGMNB = 4096, MSGSSZ = 8, and MSGSEG = 1024.  If I understand how
these play together, this means the maximum number of bytes allowed on a
queue is 4096 (MSGMNB), and the maximum bytes pending system wide is
8192 (MSGSSZ*MSGSEG).  It looks like one queue filling up should leave
4096 bytes left for other queues.

2.  I use ftok(3C) with the same path parameter and different id
parameter to generate each message queue id.  Does this make the queues
"related" in some way ?

3.  What should I do when I detect a queue over-run ?  Should the writer
process read all the data out of the queue ?  Should the writer close
and re-open the queue ?

4.  As a side issue, would raising the tunable parameter MSGSSZ from 8
to 16 or 32 improve performance of system IPC ?  Has anyone played with
this value ?

Please email responses to ...!uunet!coplex!nos850!ezelmo!kenc.  I don't
think this system (kedeng.uucp) is in the maps yet.
-- 
Ken Cornetet                            Kimball Electronics
uunet!coplex!nos850!ezelmo!kenc         Phone: (812) 634-4482
From: donn@carson.u.washington.edu (Donn Cave)
Newsgroups: comp.unix.programmer
Subject: Re: Named pipes
Date: 28 Jul 92 16:38:24 GMT
Article-I.D.: u.1992Jul28.163824.15886
Organization: University of Washington

tesco@bumetb.bu.edu (Dances With Babes) writes:


| I have recently discovered named pipes but can't seem to get them to do
| what I want.  Is it possible to use a background process to read from a
| named pipe while many other processes write to that named pipe.
| When i try to test this capability in the unix k shell the background
| process ends.

| ex. 
| mknod testpipe p
| cat testpipe &
| ls > testpipe
| The "cat" process ends after the ls is sent to the screen.

| I've been told by IBM tech support that this is the way it supposed to work.
| This is on an RS6000 running AIX ver 3.2.2. 

IBM tech support is right, but not exercising much imagination.  Try this:

  mknod testpipe p
  (echo holding; sleep 60) > testpipe &
  ls > testpipe

The pipe should stay open as long as there's at least one process holding it
open for write.

	Donn Cave, University Computing Services, University of Washington
	donn@cac.washington.edu
Newsgroups: comp.unix.programmer
From: beha@logware.de (Berthold Hienger)
Subject: Wanted: preemptive threads within a UNIX process
Keywords: threads lightweight processes libraries
Organization: Logware GmbH Berlin Germany
Date: Wed, 29 Jul 1992 13:00:59 GMT


We are in desperate search for a C++ library providing us with classes for preemptive
multitasking within an UNIX process (preemptive scheduling of lightweight processes).
The library should provide support for both SCO and SUN OS.
Does anybody know something about such a library or a C product, which could be used for
building one ?

Thanks in advance for any kind of information.



			Berthold Hienger

   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 ___________________________________________________________ /*
|   Logware GmbH      E-Mail                                | * 
|  Berthold Hienger  |                                      | *
|  1000 Berlin 65    |           beha@logware.de            | * 
|  Schwedenstr. 9    |                                      | *
|___________________________________________________________|/



Newsgroups: comp.unix.programmer
From: ratner@ficus.cs.ucla.edu (David Ratner)
Subject: Re: /tmp files
Organization: UCLA, Computer Science Department
Date: 31 Jul 92 18:14:27 GMT

scairns@is.morgan.com writes:


>Is there a system call to randomly generate unique file names
>in /tmp?  

>Or alternatively, anyone have any code examples which do this?

>I need to send output temporarily to a unique file in /tmp, do some
>work with it and than discard it.

>Thanks in advance.

Usually, people use the process-id of the running process and append that
to some set string to get a unique, temporary filename.  (The process-id
is guarranteed to be unique until the program exits).
Use getpid() to get the process id.

Dave 
--
* *  ***  *     *    |   Dave "Van Damme" Ratner
* *  *    *    * *  / \  ratner@cs.ucla.edu
* *  *    *    ***  \ /  
***  ***  ***  * *   |   "Wham Bam, thank you Van Damme!"	
Newsgroups: comp.unix.programmer
From: maki@jit.dec.com (Watanabe Maki)
Subject: Re: keeping unix time synchronised
Organization: Financial dist./EIC/DS/DEC-Japan
Date: Wed, 29 Jul 1992 04:24:12 GMT

In article <1992Jul21.024920.27358@cssc-woll.tansu.com.au> andrew@cssc-woll.tansu.com.au (Andrew Zahra) writes:

> Is there any simple way to keep the system time on a number of unix machines
> in sync? Previously I used a script and the rdate command on sun workstations.
>
> Now I have a number of ULTRIX workstations and want to do the same thing. 
> Problem is that rdate doesn't seem to work the same way on the ULTRIX machines.

You can use ntp or timed or dts(DCE, and DECnet/OSI) on your ULTRIX system.
By the way, what's wrong with the rdate on ULTRIX?

maki

--
----------------------------------------------------------------
Watanabe Maki <maki@jit.dec.com>    Easynet: TKOV50::MA_WATANABE
From: tlg@uknet.ac.uk (Tim.Goodwin)
Newsgroups: comp.unix.programmer
Subject: Re: Better way to find out the number of lines in a file
Date: 31 Jul 92 12:08:06 GMT
Organization: UKnet

In article <5412@ucsbcsl.ucsb.edu> 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack) writes:
>Somebody has done it.  On our system (HPUX 8.0) we have a command
>called 'wc' which counts the lines, words, and characters in a file.

If you're only interested in the number of lines,

    grep -c '^'

is, on my system at least, much faster than

    wc -l

(That's GNU grep, of course.  It even seems to go faster than a naive
mmap()ing line counter I have.)

Tim.
-- 
The GNU is in fact the legendary and much-berated | ; who am i
feeping creature - Malcolm Wallace.               | uknet.ac.uk!tlg
Newsgroups: comp.unix.programmer
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Named pipes
Originator: tchrist@pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Date: Mon, 27 Jul 1992 23:16:14 GMT
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of mycroft@hal.gnu.ai.mit.edu (Charles Hannum):
:
: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)&

Or have the writers all write to a common descriptor:

    ( wtr1; wtr2; wtr3 ) > testpipe

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

"The number of UNIX installations has grown to 10, with more expected."
    - _The UNIX Programmer's Manual_, Second Edition, June, 1972.
Newsgroups: comp.unix.programmer
From: merritt@climate.gsfc.nasa.gov (John H. Merritt)
Subject: Re: NAWK - ?Diff. printf output order when using a pipe.
Organization: Climate and Radiation Branch
Date: Sun, 26 Jul 1992 22:11:56 GMT

In article <1992Jul26.033811.21614@nsisrv.gsfc.nasa.gov>, merritt@climate.gsfc.nasa.gov (John H. Merritt) writes:
|> Explain why the following 'nawk' program produces:
[ output deleted ]

|> Here is the program:
|> ---- cut test.nawk ----
|> BEGIN {
|> 	printf("This is the BEGIN section\n");
|> }
|> 
|> 	{ printf("%s %s %s\n",$1,$2,$3) | "cat" }
|> 
|> END {
|> 	close("cat")
|> 	printf("This is the END section\n");
|> }

Already there is misunderstanding about what I want in the way of answers.
I want a solution to getting the same output when seeing the output
at the terminal or redirecting it to a file.  Answers of the form:
"Don't pipe it into cat." are not what I want to see.  In my real problem,
I am piping the output into sort (or anything else) and the BEGIN and
END sections are more complicated.  This example was the
shortest nawk program which illustrates the problem.

I WANT THE PIPE TO REMAIN.

If there is something like 'fflush' in AWK, that would be great.
So far 'close' was the closest thing I found, but the exact syntax eludes
me -- if it is the right thing at all.


-- 
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
John H. Merritt --> merritt@climate.gsfc.nasa.gov
"I am generally intolerant of ignorance,
but I have made an exception in your case."
From: davids@davids.b11.ingr.com (David Reed Smith)
Subject: Re: #include file dependancies
Reply-To: davids@davids.b11.ingr.com
Organization: Intergraph Corp., Huntsville, AL
Date: Thu, 23 Jul 1992 14:46:52 GMT

>>>>> On Wed, 22 Jul 1992 16:45:44 GMT, ajg@controls.ccd.harris.com
>>>>> (Arnold Goldberg) said:


    Arnold> We here have a very large source tree.

    Arnold> What I'm looking for is a script or utility that will
    Arnold> somehow tell me which #include files are not actually
    Arnold> needed for a source file.

    Arnold> any takers???


    Arnold> arnold

Arnold, sometime back I wrote a perl script that does what you want.
Besides perl, it makes use of 2 public domain packages: 'mkmf' and
'mkid'.

mkmf is a program that figures out makefile dependencies.

mkid is, according to the man page:

 Mkid builds a database that stores numbers and identifier
          names, as well as the names of the files in which they
          occur.  Mkid is particularly useful with large programs
          spread out across multiple source files.  It serves as an
          aid for program maintenance and as a guide for perusing a
          program.

The process works like this:

(1) You run mkmf to figure out the dependencies.  'mkmf' inserts
    the /usr/include .h files dependencies in your makefile.

(2) Run mkid on all the source files, all the local include files, and
    all the system includes - even system includes included by other
    system includes (which mkmf figures out for you).  It is easy to
    set up a target in your makefile to do this.

(3) Run the perl script on a C file.  It uses the 'fid' program
    (included in the mkid package) to query the database for all the
    identifiers that occur both in a include file and the C file.
    If no identifiers occur in the include file that are used by the C
    file, it reports that the include file is unused.  This process is
    continued for all the include files that the C file uses.

If that doesn't scare you off, and you would still be interested in
what I've done, send me some mail.  I'll post the perl script if there
is enough interest.

davids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Smith				davids@davids.b11.ingr.com (Internet)
Intergraph Corporation	 		uunet!ingr!b11!davids!davids (UUCP)
Huntsville, AL 35807			(205) 730-5752
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
David Smith				davids@davids.b11.ingr.com (Internet)
Intergraph Corporation	 		uunet!ingr!b11!davids!davids (UUCP)
Huntsville, AL 35807			(205) 730-5752
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Newsgroups: comp.unix.programmer
Subject: SIGIO & sockets.  is this right?
From: kwang@zeus.calpoly.edu (Kevin Wang aka The Scarecrow)
Date: Wed, 22 Jul 1992 00:48:46 GMT
Organization: The Outland Riders

I am trying to use fcntl() to turn on O_ASYNC so that my program
will receive a SIGIO when any data comes in across any of its sockets.
However, it doesn't seem to be working.

system is AIX (yes, yes, I know) V 1.2.1

Here's how I turn it on:
 void SIGIO_ON(int sock)
{
    int hold;

    hold = fcntl(sock, F_GETFL, 0);
    hold = fcntl(sock, F_SETFL, hold | O_ASYNC);
    if (-1 == hold)
        {
        perror("SIGIO_ON");
        }
    return;
}


and here's the code that's supposed to be interrupted by the SIGIO:
        wakeupcall = FALSE;
        signal(SIGALRM, AlarmHandler);
        signal(SIGIO, AlarmHandler);
        alarm(30);  /* wake me up in 30 seconds */
        loop = AcceptConnect(sock, addr, addrlen);
        errsave = errno;
        signal(SIGIO, SIG_IGN);
        signal(SIGALRM, SIG_IGN);  /* ignore alarms */
        alarm(0);  /* cancel alarm */

all that AlarmHandler does is sets wakeupcall, a global int to TRUE,
so that I know a signal occurred.

inside of AcceptConnect lies the accept() for sockets.  the man pages
says it will return -1 if interrupted by a signal.  why isn't it being
interrupted?

   - Kevin Wang 
...And now, for your local station identification, on the hour, every hour...
kwang@hermes.calpoly.edu or kwang@gauss.elee.calpoly.edu
---
   A source is a source, of course of course,  Unless, of course, the 
   source is a curse;  And if, of course, the source is a curse,  Then a 
   termcap entry's required.
From: darcy@druid.uucp
Newsgroups: comp.unix.programmer
Date: 18 Jul 92 04:24 MDT
Subject: Re: Duplication of malloc() definit
Nf-ID: #R:9219708.3101@mulga.cs.mu.oz.au:-2146214427:1992Jul18.002407.20753@druid.uuc:-1486557757:001:554
Nf-From: druid.uucp!darcy    Jul 18 04:24:00 1992


jmp@moscom.UUCP (Joe Palumbos) writes:
>Can someone tell me why the memmory allocation routines are
>defined in both malloc.h and in stdlib.h?  (i.e.: malloc(),

Because some older compilers used malloc.h and so for compatibility with
programs which use it malloc.h is included.  ANSI puts these functions
in stdlib.h and this is the right header to use.

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   There's no government
Toronto, Ontario, Canada           |   like no government!
+1 416 424 2871          DoD#0082  |

Newsgroups: comp.unix.programmer
From: reed@agps.lanl.gov (Reed_Kevin)
Subject: Blocking I/O
News-Software: VAX/VMS VNEWS 1.41    
Organization: Los Alamos National Laboratory, Mech. and Elec. Eng
Date: Mon, 27 Jul 1992 20:10:00 GMT

In a program that I am writing, I need to alternate back and forth
between blocking and non-blocking I/O.  While I have found that
fcnt(0,FSETFL,O_NDELAY) will allow me to use non-blocking I/O
the man pages do not specify how to unset the O_NDELAY flag.
Does anyone have any ideas?

Please email reponses to me, if there is interested, I will
sumarize.

Kevin Reed
reed@agps.lanl.gov

Newsgroups: comp.unix.programmer
From: dwthoma1@eos.ncsu.edu (DAVID W THOMAS)
Subject: Re: /tmp files
Originator: dwthoma1@c00041-118dan.eos.ncsu.edu
Reply-To: dwthoma1@eos.ncsu.edu (DAVID W THOMAS)
Organization: North Carolina State University, Project Eos
Date: Fri, 31 Jul 1992 18:49:28 GMT


In article <1992Jul31.095122@is.morgan.com>, scairns@is.morgan.com writes:
|> Is there a system call to randomly generate unique file names
|> in /tmp?  

yep, try tempnam(3s).

(e.g.  tempnam("/usr/spool/batch", "job")  --> /usr/spool/batch/jobAAA12345
       tempnam("/tmp", "mine")             --> /tmp/mineAAA12345
)

it uses a combination of the string you give it, the current process id,
and other letters so that multiple temporary files can be generated
by the same program.

you also get to choose which directory to use, and it checks in that directory
to ensure the file name is unique (at the time the name is created).

David W. Thomas
dwthoma1@eos.ncsu.edu
Xref: sparky comp.unix.programmer:4013 comp.unix.questions:9576