HDTenEightyP/NetNews huggingface dataset:
From: urlichs@smurf.sub.org (Matthias Urlichs)
Newsgroups: comp.unix.programmer
Subject: Re: what is a socket file?
Date: 11 Oct 1992 18:44:41 +0100
Organization: University of Karlsruhe, FRG
NNTP-Posting-Host: 127.0.0.1

In comp.unix.programmer, article <josef.717923427@uranium>,
  Josef Moellers <mollers.pad@sni.de> writes:
> 
> "The name space used by the Unix domain protocols consists of
> pathnames.
> ...
> The 4.3BSD implementation creates a file in the file system with the
> specified pathname, although there are comments in the 4.3BSD manuals
> indicating that future versions might not create these files. This is
> somewhat misleading, however, because these filesystem entries are not
> true "files". For example, we cannot open these files with the 'open'
> system call. These files have a type of S_IFSOCK as reported by the
> 'stat' or 'fstat' system calls." [Stevens, 1990]
> 
Dumb question: If you can't open the file, how do you call fstat() on it?
My manual entry on fstat() does not list connect() as a valid way to obtain
a file descriptor for fstat().

> If You use AF_UNIX sockets and adhere to a strict naming convention, You
> might be able to use the path names to advertise the availability of
> certain services.

s/might/can/. The INN NetNews server does this. You don't need any "strict
naming convention" any more than with any other file name; the advantage is
that you can hide the service behind an non-world-accessible directory.
Difficult to do with Internet-domain sockets.  ;-)

-- 
Q: Why didn't they tell jokes in Jonestown?
A: The punch lines were too long.
-- 
Matthias Urlichs  --  urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de   /(o\
Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- Germany  --  +49-721-9612521     \o)/
From: winney@DAL.MOBIL.COM (Randy Winney)
Newsgroups: comp.unix.programmer
Subject: Re: personalized xlock
Date: 8 Oct 92 15:08:01 GMT

In article <1b094aINNpop@goldwing.ksu.ksu.edu>, hendric@goldwing.ksu.ksu.edu (Richard Hendricks) writes:
|> Hello,
|>  I'm an amateur C programmer, and a complete newbie to programming on Unix and
|> Xwindows.  I would like to write my own Xloxk program that will print a 
|> picture of celluar automata (out of an old Scientific American) on the screen
|> while xlocked.  I need help with a few things...
|> 	1.  how do you set-up the graphics mode? (ie. XXXX by XXXX by XXX colors?)
|> 	2.  How do you put pixels on the screen? 
|> 	3.  is there some way to have it take over the screen w/out a window?
|> 				(a la the original Xlock?)
|> 	4.  What's the limit on array sizes?  (I plan on using arrays of   
|> 					short integers to help reduce mem. use)
|> 	5.  Is there any way to have Xlock run the program for me? (saves a lot)
|> 	6.  How would you get data form the command line?  i.e.:
|> 	  	mylock pearl	
|> 		Run mylock, password pearl?
|> 		(How do i get the program to read in pearl?) 

I did the same thing to make my own version of xlock that would display
some neat string art graphics. It's much easier if you just start with
the xlock source code and modify it to display the graphics you want.
Since my graphics just involved drawing line segments, I started with
the code that implements the "qix" option in xlock, since it does something
similar. After modifying qix.c and re-making xlock, it now displays
my graphics when I run the qix option. I didn't bother adding a new option.

If you are new to X and C, starting with the original xlock code gives
you a great example to study.

-- 
Randy Winney       winney@dal.mobil.com
Mobil Exploration & Producing Technology Center
Dallas, Texas
Newsgroups: comp.unix.programmer
From: tone@leland.stanford.edu (Tony Lin)
Subject: Intercepting logout/hangup signal?
Keywords: signals
Organization: DSG, Stanford University
Date: Mon, 12 Oct 92 04:10:32 GMT

Hi everyone!
  I'm new at systems programming, and I was just wondering if any of you
could help me.  I'm writing a small program that I'm planning to run in
the background.  When I hangup, this program normally would continue to
run if I don't explicitly kill it.  I would like to know if there is some
kind of signal that I can intercept that would tell me that the user has
pressed CTRL-D and is about to log off, so that my program can terminate
itself immediately.  I've tried to write a handler that intercepts
SIGHUP, SIGQUIT, and SIGTERM, but it doesn't work.  Maybe I'm just doing
it wrong.  If you know anything about this, could you sent me some sample
code explaining what I should do?   Any suggestions would be greatly
appreciated.
  Thanks.

						Tony Lin
						tone@leland.Stanford.EDU

Xref: sparky comp.unix.programmer:4951 comp.unix.sysv386:15569
From: spxtrb@thor.cf.ac.uk (Tim Barnett - programmer)
Newsgroups: comp.unix.programmer,comp.unix.sysv386
Subject: TLI - how to find the name of transport provider special file ?
Date: 14 Oct 92 11:50:49 GMT
Organization: University of Wales College at Cardiff
X-Mailer: Cardiff Computing Maths PP Mail Open News Gateway

Does anyone know how to find the name of the special files for use with
the TLI function t_open() ?  Stevens' book mentions that the WIN/TCP
package uses /dev/ip, /dev/tcp and /dev/udp - but does not mention how
to discover the file names on other systems.

I would like to be able to write portable programs using TLI, but there
may be no portable way to determine the file names, so any information
pertaining to particular systems  (especially SCO UN*X)  would be
gratefully received.

While I am picking people's brains, does anyone know if it is guaranteed
that the STREAMS clone device will be called /dev/spx on systems which
support STREAMS, or does that name vary also  (Stevens' book does not
seem to mention whether or not this is the case).

(Email replies may be best, as few people seem interested in using TLI :-)
Thanks in advance for any information,
Tim

============================================================================
Tim Barnett, GW programmer (UN*X), Cardiff University.
Newsgroups: comp.unix.programmer
From: mjn@pseudo.uucp (Murray Nesbitt)
Subject: Re: stdout vs stderr (was Re: Should I use syslog?)
Organization: Private system in Toronto, ON
Date: Sat, 10 Oct 1992 09:18:54 GMT


cariapa@angelo.amd.com (Sandeep Cariapa) writes:

>In article <bosullvn.718484862@unix1.tcd.ie> bosullvn@unix1.tcd.ie (Bryan O'Sullivan) writes:
>>mike@inform.co.nz (Mike Williams) writes:
>>
>>>  * A colleague has the impression that re-directing stderr is somehow
>>>    different from re-directing stdout, and that "2> /dev/console" may be
>>>    safe when "> /dev/console" is not.  Does this have any foundation?
>>
>>I strongly doubt it.  Stderr and stdout behave in the same way on
>>evrything I've come across.
>
>	Bzzt! Wrong answer! Stderr is indeed different from stdout.

[program and "test" deleted]

>bach :/tmp/sandeep 94 > ./a.out > out
>This is stderr
>bach :/tmp/sandeep 96 > ./a.out >& out
>
>
>	Keep in mind that ./a.out >& out is the C-Shell version of
>Bourne's ./a.out 2> out. 

Wrong.  From the csh(1) man page:

       The forms involving & route the diagnostic output into
       the specified file as well as the standard output.

What did you think your example proved anyway?

``Standard output'' and ``standard error'' are just names given to two
user file descriptors.  There are no differences in the way in which
they are implemented.

-- 
Murray
Newsgroups: comp.unix.programmer
From: tpeland@polaris.utu.fi (Tero Jyri Michael Pelander)
Subject: Re: non-blocking I/O lib and lightweight processes.
Organization: University of Turku, Finland
Date: Wed, 7 Oct 92 09:45:37 GMT

s8923098@macnab.mqcs.mq.oz.au (Josef WIDJAJA) writes:
>in a program that creates lightwight processes?

Would you care to explain what is that? I do fork() but this is new.

>Also, can someone explain what a non blocking socket is?

A socket that will return error EWOULDBLOCK when the operation (read/
write/...) would normally start waiting for data to arrive/leave. If you
are creating a socket then add fcntl(*socket, F_SETFL, FNDELAY) after listen()
to make it nonblocking.
Newsgroups: comp.unix.programmer
From: steve
Subject: utilities
Keywords: utilites
Organization: Bell-Northern Research
Date: Wed, 7 Oct 1992 19:34:43 GMT

 
Newsgroups: comp.unix.programmer
From: simon@giaec.cc.monash.edu.au (simon shields)
Subject: monitor program ideas wanted ?
Organization: Monash University, Melb., Australia.
Date: Thu, 8 Oct 1992 05:43:23 GMT


 
 Hi
 I'm running on a 
 HP-UX giaec A.08.07 A 9000/720 2001133857
 
 I'm trying to write a simple monitor program. Its supposed to keep
 some stats on commands a person (myself), enters during a session. It
 has to be completely transparent to the user (run in the background).
 
 I was wondering whether anyone here could give me a kick start on how
 I should write it. 
 
 Any ideas sincerely appreciated.
 
 thanks from simon
From: lodwick@vixvax.mgi.com
Newsgroups: comp.unix.programmer
Subject: lp -oerase files
Date: 16 Oct 92 15:52:20 GMT
Organization: Management Graphics, Inc.

I am trying to create a model interface program for the lp scheduler.
I would like to offer an -oerase option to simulate the lpr -r switch.
From looking at other model interface programs I see others have tried:

	for file in $files
	do
	        goprint
	        rm -f $file
	done

From what I can tell this will not always produce the desired results.

What I have observed is that if the file to be printed resides on the
same partition as the lp scheduler, a link to the file is made and placed
in /usr/spool/lp/request/printer-name/.  This is the filename that will
be given to the model interface program, thus, when you do the rm you
are only removing the link.

Am I missing something obvious?

Phil Lodwick
Management Graphics, Inc.        E-mail: lodwick@mgi.com 
1401 E 79th St.	                 Voice1: +1-612-851-6145
Bloomington, MN 55425 USA        Voice2: +1-612-854-1220
Newsgroups: comp.unix.programmer
From: boutell@cshl.org (Tom Boutell)
Subject: Arrow Keys under Curses?
Organization: Cold Spring Harbor Labs
Date: Thu, 8 Oct 1992 13:35:38 GMT

I want to be able to recognize the arrow keys under BSD curses, specifically
the BSDish curses included with SunOS. I note that the SysV version
*does* recognize arrow keys, but I can't find a way to do it in BSD.
Is there any portable means of accomplishing this? Thanks - please
respond by email.

-- 
Tom Boutell, boutell@cshl.org

Clausthaler is the best non - alcoholic beer in the known universe.
From: ddv@unix.brighton.ac.uk (Domenico De Vitto)
Newsgroups: comp.unix.programmer
Subject: Re: getcwd() cacheing
Date: 15 Oct 92 12:41:10 GMT
Organization: University of Brighton, UK

The disks are cached, so EVERYTHING is cached.

(I think..........)
Dom
From: ssurgui@ucdacm.denver.colorado.edu (Scott Surguine)
Newsgroups: comp.unix.programmer
Subject: Signal Question
Date: 8 Oct 92 23:55:17 GMT

I am new to Sys Programming.  Trying to write a skeleton Daemon Process.
This Daemon must ignore Terminal stop signals.  I have only used the
signal system call sparingly  and still really don't quite understand it.

My question is this: the signal call is of the syntax:
                      
    int (*signal(sig,func))() .  I'm not quite sure how to read this
    but I'm sure that herein lies the answer to the question of how
    to read the following line in signal.h

    #define SIG_IGN  (int(*)())1

    Is this A pointer to function of type integer that returns a value of
    1?  Can't be...   or can it?  Curious how signal actually works.
    
Scott A. Surguine


    
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.misc,comp.unix.wizards,comp.unix.admin
From: proact@netcom.com (Proactive Software)
Subject: Need public domain source control system
Organization: ProActive Software, Inc.
Date: Wed, 7 Oct 1992 23:24:53 GMT

My company is using the SCCS for now and we have tried to look into
PVCS but it is too expensive.

I will appreciate any information about public domain source control
system: where to get the source code, etc.
I am also looking for RCS and converter to convert SCCS format to RCS
format.

Please reply by e-mail as I don't have good Usenet News access.
Thank you.

Lak Ming Lam
lml@proactive.com
From: aldavi01@rigel.spd.louisville.edu (Arlie Davis)
Newsgroups: comp.unix.programmer
Subject: Re: Question about Internet Services
Date: 8 Oct 92 00:25:38 GMT
Organization: University of Louisville

In <1av8p2INNnfu@early-bird.think.com> barmar@think.com (Barry Margolin) writes:

> In article <4632@moscom.com> jmp@moscom.com (Joe Palumbos) writes:
> >I'm running under SunOS 4.1.2, and after doing a bind() (using a
> >port of '0' on an AF_INET/DGRAM socket), then a getsockname(), the 
> >port-number assigned is '1'.  ...And not only that, port-number 1 
> >is already assigned in my /etc/services table ('tcpmux   1/tcp').

> I suspect you're not accessing the sockaddr structure correctly, so that's
> not the actual port.  After the server does this, does "netstat -an" show a
> binding for "udp ... *.1 *.*"?

Perhaps Joe Palumbos is on a little-endian machine, and is not using
ntohs() on the port returned from getsockname()?  The port address may
be 65536, not 1.

> The children shouldn't be binding to the port, they should be connecting to
> it.  In general, one process (the server) binds and everyone else (clients)
> connects.
> -- 
> Barry Margolin
> System Manager, Thinking Machines Corp.

> barmar@think.com          {uunet,harvard}!think!barmar
-- 
lrwx------   1 aldavi01 emacsstu       9 Jun  6 12:43 .signature -> /dev/null
Xref: sparky comp.unix.programmer:4961 comp.lang.c:15026
From: kumars@kolva.East.Sun.COM (Kumar Srinivasan)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: How/where does one get mkmf utility ?
Keywords: mkmf
Date: 15 Oct 92 16:41:20 GMT
Reply-To: kumars@kolva.East.Sun.COM
Organization: Sun Microsystems
NNTP-Posting-Host: kolva.east.sun.com

Hello,

I need "mkmf" a utility which makes a [M]makefile. Could some one
tell me where/how I can get this for Suns. 
Please Email me your reply as I do not read the net often.

Thanks

Regards,

Kumar Srinivasan
Languages Support Engineer
E-mail  : kumar.srinivasan@East.Sun.COM or
          kumars@sunesc.East.Sun.COM
Tel     : 508/794-5259
Sun Ext : 25259
From: pavelg@hpmwtd.sr.hp.com (Pavel Gazur)
Date: Wed, 14 Oct 1992 01:26:43 GMT
Subject: How can I connect from home
Organization: HP Santa Rosa Site (SRSD MWTD)
Newsgroups: comp.unix.programmer


I just bought a 386SX system and I want to find out how can I access 
these 'notes' from the home system. Do I need a fax or modem or both
what software, and how do I get the address. Do I have to be in UNIX
or can I do it from DOS. How do I find out list of all notes that
there are available. Is this the right place to ask for this.
	Thanks for help ( have to start somewhere).
From: rstevens@noao.edu (W. Richard Stevens)
Newsgroups: comp.unix.programmer
Subject: Re: what is a socket file?
Date: 12 Oct 92 12:54:15 GMT
Organization: National Optical Astronomy Observatories, Tucson, AZ, USA

>>> For example, we cannot open these files with the 'open'
>>> system call. These files have a type of S_IFSOCK as reported by the
>>> 'stat' or 'fstat' system calls." [Stevens, 1990]
>>> 
>>Dumb question: If you can't open the file, how do you call fstat() on it?

Call socket() to get the descriptor, then call fstat().  Also, since
a Unix domain socket whose name has been bound has a name in the
fileystem, you can stat() or lstat() it.

*But*, the results are highly system dependent.  SunOS 4.x returns a
filetype of FIFO for a Unix domain socket descriptor.  4.4BSD returns
nothing (the man page warns about this under BUGS).  SunOS handles
a Unix domain pathname OK, and a TCP socket OK.  SVR4, on the other
hand, returns character-special for Unix domain and TCP socket descriptors.

	Rich Stevens  (rstevens@noao.edu)
Newsgroups: comp.unix.programmer
From: rick@sadtler.com (Rick Morris)
Subject: Re: stdout vs stderr (was Re: Should I use syslog?)
Organization: Sadtler Research Laboratories
Date: Fri, 9 Oct 1992 12:01:20 GMT

In article <1992Oct7.235620.24833@amd.com> cariapa@angelo.amd.com (Sandeep Cariapa) writes:
>In article <bosullvn.718484862@unix1.tcd.ie> bosullvn@unix1.tcd.ie (Bryan O'Sullivan) writes:
>>mike@inform.co.nz (Mike Williams) writes:
>>
>>>  * A colleague has the impression that re-directing stderr is somehow
>>>    different from re-directing stdout, and that "2> /dev/console" may be
>>>    safe when "> /dev/console" is not.  Does this have any foundation?
>>
>>I strongly doubt it.  Stderr and stdout behave in the same way on
>>evrything I've come across.
>
>	Bzzt! Wrong answer! Stderr is indeed different from stdout.

Very true.  A use:  I'm writing a program to drive a screen-oriented
application.  I use a pseudo-terminal, the slave side being the
application, the master the program.  Stdin and Stdout are used to
communicate between the two.  Stderr is left alone (goes to the
terminal).  Thus, the program runs and all stdout goes as input to
the application.  All stderr goes to the screen.  Extremely useful
to log what's going on.  Otherwise, if no stderr, I would have to
open some log file and tail -f it.  (Isn't UNIX wonderful?  There's
always another way...)

-Rick.
-- 
Rick Morris                            Email:  rick@sadtler.com
Sadtler Research Labs, Philadelphia   -But I speak for myself
---------------------------------------------------------------
Newsgroups: comp.unix.programmer
From: mkosciel@ajax.mitre.org (Michael P. Koscielniak)
Subject: Flushing Sockets?
Organization: The MITRE Corporation
Distribution: global
Date: Wed, 7 Oct 1992 19:52:40 GMT

Is there a way to flush a socket?

Something similar to flushing a file descriptor like
fflush(fd).


Email responses to: mkosciel@mitre.org

Thanks.
From: hendric@goldwing.ksu.ksu.edu (Richard Hendricks)
Newsgroups: comp.unix.programmer
Subject: personalized xlock
Date: 7 Oct 1992 22:15:22 -0500
Organization: Kansas State University
NNTP-Posting-Host: goldwing.ksu.ksu.edu
Summary: writing own xlock for xwindows
Keywords: c, xlock, programming

Hello,
 I'm an amateur C programmer, and a complete newbie to programming on Unix and
Xwindows.  I would like to write my own Xloxk program that will print a 
picture of celluar automata (out of an old Scientific American) on the screen
while xlocked.  I need help with a few things...
	1.  how do you set-up the graphics mode? (ie. XXXX by XXXX by XXX colors?)
	2.  How do you put pixels on the screen? 
	3.  is there some way to have it take over the screen w/out a window?
				(a la the original Xlock?)
	4.  What's the limit on array sizes?  (I plan on using arrays of   
					short integers to help reduce mem. use)
	5.  Is there any way to have Xlock run the program for me? (saves a lot)
	6.  How would you get data form the command line?  i.e.:
	  	mylock pearl	
		Run mylock, password pearl?
		(How do i get the program to read in pearl?)
I would greatly appreciate any help from any person.  this is not a class
project, just something to amuse me. :)
I would prefer e-mail responses, as i don't frequent this group, remember,
i'm just an amateur.
hendric@matt.ksu.ksu.edu   or, in event that pukes on you :-)  try
hendric@ksuvm.ksu.ksu.edu

Thanks!  May all your bugs infest your enemies!
-richard hendricks
-hendric@matt.ksu.ksu.edu
Xref: sparky comp.unix.programmer:4972 comp.unix.questions:12161
From: paul@alantec.com (G. Paul Ziemba)
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: popen()/pclose() and SIGCHLD
Date: 16 Oct 92 07:51:58 GMT
Followup-To: comp.unix.programmer

ben@st-canard.spc.edu (Ben Cohen) writes:

>	main()
>	    installs SIGCHLD handler
>	    fork()/exec() [and we need to catch death of this child]
>	    calls foo()

>	foo()
>	    popen()
>	    pclose()

Surprise, it won't work. Some years back I ran into this and, after
looking at BSD popen (which probably hasn't changed as of SunOS 4.1),
I saw it was obviously 1) broken and 2) incompatible with any other use
of SIGC(H)LD.

I ended up writing my own popen. To solve the problem above, the
replacement popen() will have to be integrated with the SIGCHLD
handler so that things get sorted out properly.

good luck,

 ~!paul
-- 
Paul Ziemba  paul@alantec.com	alantec!paul  408.955.9000 x227

"The first TV I ever owned...I threw from a third story window at a burglar"
 - sjackson@parc.xerox.com
From: rdorich@jade.tufts.edu (Rob)
Newsgroups: comp.unix.programmer
Subject: writing to a fcntld file... (again)
Date: 16 Oct 92 01:36:01 GMT
Organization: Tufts University - Medford, MA
Originator: rdorich@jade.tufts.edu

Dear netters (again):

  I received a few answers to my previous question about locking files
using fcntl.  They worked fine just as long as I didn't write to write
something to the file.  When I try to run the following program, it
just goes into state D (with ps, waiting for a device I think). The
write man pages say that control won't be returned to write until the
stuff has been written.  
  
  Can any of you guys be kind enough to tell me what's wrong with my
short program below?

  Thanx a lot,

	Rob


#include <stdio.h>
#include <fcntl.h>

main() {
  int file_fd,lock_fd;
  struct flock lock;
  
  if ((file_fd = open("test",O_WRONLY|O_CREAT,0600)) < 0 ) exit(1);
  
  lock.l_whence = SEEK_SET;
  lock.l_start = 0;
  lock.l_len = 0;
  lock.l_type = F_WRLCK;

  lock_fd=fcntl (file_fd,F_SETLKW,&lock);       /* wait until able to lock */
   
  write (lock_fd,"hello 1\n",8);

  printf("successfully set read lock on file1, from %i\n",getpid());
  printf("gone, from %i\n",getpid());
}

-- 

-------------------------------------------------------------------------------
Roberto Dorich           |           /~~  \ /  ~~/~~ /~~/  /~~  /|  /    /~~
                         |    SKI   /--    X    /   /__/  /--  / |/ |   /--
Newsgroups: comp.unix.programmer
From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
Subject: Re: Capturing CC output using popen
Reply-To: subbarao@fc.hp.com
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
Date: Mon, 12 Oct 1992 14:16:57 GMT

In article <1992Oct12.061114.7711@organpipe.uug.arizona.edu> dave@cs.arizona.edu (Dave Schaumann) writes:
>In article <1992Oct12.104935.13146@phillip.edu.au>, t9014199@phillip writes:
>>Hi there,
>>
>>	I am writing a program that calls cc from within it. I need to be
>>	able to store the compiler errors and warnings that may occur.
>>
>>	I have tries to use popen to capture the output and store it in 
>>	a buffer. BUT since cc sends it errors to stderr, I am unable
>>	to capture the output.
>
>
>I'm not a unix.wizard, so there may be an easier/better way... But one way
>to do it is to create a pipe, fork() off a process, redirect the fork()ed
>process's stderr stream to the pipe, and then run "cc" using your favorite
>exec function.

Or, you can still use popen(), as follows:

If you want to throw the output away, do this:
popen("cc foo.c -o foo 2>&1 >/dev/null");

If you want to merge stdout and stderr, do this:
popen("cc foo.c 2>&1");

	-Kartik
From: fkao@buengf.bu.edu (Frank Kao)
Newsgroups: comp.unix.programmer
Subject: Post Script Document Printing Problem
Date: 14 Oct 92 13:35:03 GMT
Organization: College of Engineering, Boston University, Boston, MA, USA
Originator: fkao@buengf.bu.edu

Hi Netters,

Is there any utilities out there that can read a post script document file,
and print the result onto a regular vt series terminal?

thanks in advance for your response
fkao
Newsgroups: comp.unix.programmer