HDTenEightyP/NetNews huggingface dataset:
From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao)
Newsgroups: comp.unix.programmer
Subject: Re: Which pipe sent SIGPIPE w/o trying to write to it??
Date: 10 Apr 92 13:26:03 GMT
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');

In article <92100.170337PJS100T@ODUVM.BITNET> Pam Skillman <PJS100T@ODUVM.BITNET> writes:
>Here's the situation:  I've got several pipes to several different processes
>and I receive a SIGPIPE.  

>I don't want to try to write anything to each of
>these pipes as some of the processes are running tools and such and I don't
>want anything I send interpreted by them.  Is there a way to do this??  

I don't know what you mean when you say "I don't want to try to write
anything to each of these pipes". The only way SIGPIPE gets generated is
when you write on a pipe with no one to read it. Since you get SIGPIPE, you
must already be writing something to that pipe yourself. (Unless you forked 
off a process, gave it a pipe and the process wrote on the pipe with no one to 
read it. In that case you'd have no control over the write()ing).

Here, you can simply ignore SIGPIPE by signal(SIGPIPE, SIG_IGN), and on each 
write() check to see if errno == EPIPE. If so, then there was no reader on the 
pipe you just wrote to.

	-Kartik
Newsgroups: comp.unix.programmer
From: adrian@milton.u.washington.edu (Adrian Mariano)
Subject: Re: Signals to child processes
Organization: University of Washington
Date: Thu, 16 Apr 1992 04:12:35 GMT

In <1992Apr14.231513.27308@u.washington.edu> I wrote:

>I have a program which is running a telnet as a child process (a
>pipe).  If I hit ^Z (sending SIGTSTP to the parent), the child telnet
>receives some signal which causes it to lose its connection.

>If I hit ^Z when using telnet directly, it is tramsmitted to the
>remote host which then drops the connection, but if I use ^] to get to
>the telnet prompt first, I can suspend the telnet without problems.  
>How can I duplicate this behavior when the telnet is running as the
>child?


I determined that when I press ^Z, SIGTSTP is being sent to both
parent and child.  The child telnet is catching the signal and
translating it into a ^Z character which it sends to the remote host.
The remote host then cuts the connection.  

I have tried to determine what sends SIGTSTP to the child with no
success.  I tried trapping various signals in the parent, but the
child ALWAYS received the SIGTSTP.  Is it even possible to prevent
this from happening?
From: pjh@mccc.edu (Pete Holsberg)
Newsgroups: comp.unix.programmer
Subject: Re: Korn Shell
Date: 13 Apr 92 18:47:29 GMT
Organization: The College On The Other Side Of Route One

In article <1992Apr08.123522.6876@bcsl.uucp> newman@bcsl.uucp (Robert Newman  Programmer) writes:
=Hello
=
=Could anyone direct me in the direction of locating some books or
=documentation on programming within the Korn shell.

UNIX Desktop Guide to the Korn Shell, Valley, Prentice Hall Computer
Publishing (SAMS, Hayden, whoever).

Pete
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
FAX: 609-586-6944            1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu       Trenton Computer Festival: April ??-??, 1993
Newsgroups: comp.unix.programmer,comp.lang.c,comp.unix.questions
From: kucharsk@solbourne.com (William Kucharski)
Subject: Re: Can one simulate ftruncate() and fchmod() ?
Organization: Solbourne Computer, Inc., Longmont, CO
Date: Wed, 8 Apr 1992 22:41:05 GMT

While reading article <1992Apr03.091904.19206@Logix.DE>, I noticed that
jpm@Logix.DE (Jan-Piet Mens) said the following:
 >The subject actually says it all. I need to simulate the BSD
 >calls ftruncate() and fchmod() in SYS5. I'm all out of ideas.
 >Can someone help ?

As far as ftruncate() goes, one from the vaults:

If you have the F_FREESP fcntl on your system (most releases of SVR3.2 do),
you can use the undocumented (in SVR3) F_FREESP command to write a version
of ftruncate():

==================================[ Cut Here ]==================================

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>

int
ftruncate(fd, length)
int     fd;     /* file descriptor */
off_t   length; /* length to set file to */
{
        extern  long    lseek();

        struct  flock   fl;
        struct  stat    filebuf;

        if (fstat(fd, &filebuf) < 0)
                return(-1);

        if (filebuf.st_size < length) {
                /* extend file length */

                if ((lseek(fd, (length - 1), SEEK_SET)) < 0)
                        return(-1);

                /* write a "0" byte */

                if ((write(fd, "", 1)) != 1)
                        return(-1);
        } else {
                /* truncate length */

                fl.l_whence = 0;
                fl.l_len = 0;
                fl.l_start = length;
                fl.l_type = F_WRLCK;    /* write lock on file space */

                /*
                 * This relies on the UNDOCUMENTED F_FREESP argument to
                 * fcntl(2), which truncates the file so that it ends at the
                 * position indicated by fl.l_start.
                 *
                 * Will minor miracles never cease?
                 */

		if (fcntl(fd, F_FREESP, &fl) < 0)
			return(-1);

        }

        return(0);
}
==================================[ Cut Here ]==================================
-- 
| William Kucharski, Solbourne Computer, Inc.     | Opinions expressed above
| Internet: kucharsk@solbourne.com   Ham: N0OKQ   | are MINE alone, not those
| Snail Mail: 1900 Pike Road, Longmont, CO  80501 | of Solbourne Computer, Inc.
| President, "Just the Ten of Us" Fan Club        | "It's Night 9 with D2 Dave!"
Xref: sparky comp.unix.programmer:2371 comp.unix.questions:6182
From: sium@syma.sussex.ac.uk (Siu Mak)
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: Moving the cursor
Date: 13 Apr 92 19:08:00 GMT
Organization: University of Sussex at Brighton

In article <4kZTiB1w164w@curlie.UUCP>, thierry@curlie.UUCP (Thierry Lach   )
writes:
> sfd@bezier.berkeley.edu (Scott Drellishak) writes:
>
> > I'm using the curses library in a project, and have the following
> > question: How can I move the cursor into the corner of the screen (out
> > of the way) after a refresh?  I've tried using the mvcur() function,
> > but this only confuses the rest of curses, and messes up the next
> > refresh.  The documentation I have is woefully sucky.  Either pointers
> > to better docs or specific solutions are greatly appreciated.
> >
> > Scott
>
> Tell the window   "leaveok(window,FALSE)", then use
> "wmove(window,y,x)" followed by "wrefresh(window)".  That works
> for me...
>
> Thierry Lach				UUCP: sharkey!sycom!curlie!thierry
> My opinions are mine and mine alone.

There is a low-level function call named setsyx().
As I use curses library to write my dissertation too, I do need the cursor
sometime when my program is prompting for an input, leaveok() will just leave
the screen cursor and disable the mobility of the cursor, after that, I did
use setsyx() to reset the position of the cursor to the top left corner.
I hope I could answer your question !
I will have my program code put in the ftp.uu.net soon.
From: rob@wzv.win.tue.nl (Rob J. Nauta)
Newsgroups: comp.unix.programmer
Subject: Re: logging outgoing telnet sessions to catch 'hackers'
Date: 9 Apr 92 10:20:04 GMT
Organization: Sex, UNIX & Rock 'n Roll

In article <3148@wzv.win.tue.nl> wietse@wzv.win.tue.nl (Wietse Venema) writes:
->l1ngo@copper.denver.colorado.edu (Swift) writes:

->>We're running Dynix on a Sequent S81 and are considering methods of
->>logging outgoing telnet sessions. We can log which sites connect to
->>ours (by putting tcp_wrapper between inetd and the server daemons), but
->>we're trying to determine the best way to log users connections
->>to other hosts. Frequently, another site might report incidences of
->>possible hacking from our site and we'd like to know who's doing it.

Hello

I'm not sure about the ethical side of this. This is an invasion of
privacy, which should be dealt with carefully. Logging and examining
all telnet sessions is like opening and reading all incoming mail,
letters and taping all phonecalls.

But, if you really want to have total control (some people would say
fascist), you can easily modify the telnet binary to log in a directory
somewhere, in fact I once adapted the telnet source for this purpose
but be warned, on an active system it'll generate more logfiles that
you'll be able to read. Also, if something happens, your logs won't make
good evidence, i'm sure any judge will be appalled by such system
management that keeps such detailed logs, also logs you generate
yourself without police supervision are probably unacceptable as legal
evidence.

->Some IP routers have a facility to do packet accounting. For example,
->some CISCO models can produce statistics of source/destination host,
->number of packets, and number of bytes, for each 30 minute period.
->This information has been very useful when our site was under attack,
->but also when an attack was launched from one of our systems.

I remember that :-) Just recording hostnames is a much safer option
than logging entire sessions, and it requires no further modifications.

->	Wietse Venema

Rob

-- 
+-----------------------+
| Rob J. Nauta          |       "In the end, all time spent is wasted time."
| rob@wzv.win.tue.nl    |
| Phone: +31-40-833777  |
From: mdk@hare.udev.cdc.com (Mike Kail x2441)
Newsgroups: comp.unix.programmer
Subject: Re: determining directories.
Date: 14 Apr 92 12:28:38 GMT
Article-I.D.: shamash.40944
Reply-To: mdk@hare.udev.cdc.com (Mike Kail x2441)
Organization: Control Data Corporation, Arden Hills, MN

In article <1992Apr13.163526.4248@hellgate.utah.edu>, mmoore%peruvian.utah.edu@cs.utah.edu (Michael Moore) writes:
|> 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*/

What you need to do here is:
	if ((stat_buff.st_mode & S_IFMT) == S_IFDIR) { /* this is a directory */
		...

|>  ---------------------------------------------------------------------------
|> 
|> 
|> 	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             |
|>  ----------------------------------------------------------------------

Hope this helps...
-- 
+---------------------------------------------------------------+
| Mike D. Kail				mdk@hare.udev.cdc.com	|
| Control Data Corporation					|
| ARH215				(612) 482-2441		|
| 4201 North Lexington Avenue					|
| Arden Hills, MN  55126					|
+---------------------------------------------------------------+
| "When I race my mind is full of doubts; Who will come in 	|
|  second?  Who will come in third?" - Morceli			|
+---------------------------------------------------------------+
Newsgroups: comp.unix.programmer
From: phil@ux1.cso.uiuc.edu (Phil Howard)
Subject: non-blocking connect() error returns
Organization: University of Illinois at Urbana
Date: Mon, 13 Apr 1992 20:02:59 GMT

How do error statuses like ECONNREFUSED and ENETUNREACH get returned when
a connect() is done on a non-blocking socket?  How will this be reflected
if a fork() occurs between connect() and the error condition coming back
(or a successful connection)?

Is close() the correct way to cancel a non-blocking connect()?

[ References to systems w/o select() is not applicable to this thread unless   ]
[ the discussion refers to the available standardized replacement for select() ]
[ (whatever that might be which I cannot determine from my POSIX book).        ]
Newsgroups: comp.unix.programmer
From: ets@wrkgrp.COM (Edward T Spire)
Subject: Re: Scripting in general
Organization: The Workstation Group
Date: Tue, 14 Apr 92 16:00:36 GMT

bengtl@maths.lth.se (Bengt Larsson) writes:
: My wish would be for a new, C-like scripting language, with dynamic
: typing, and string handling (and regexps) builtin. There was a man page
: posted for such a language about a year ago. I can repost it, if there's
: interest.
: 
: With such a language you could possibly implement quite a lot of things
: as scripts, in a safe way. Perl is a little too much... Perl IMO.

REXX is a popular scripting language you might want to look into.
Originally developed by IBM, it is now available for many other systems.
While it does not (yet) directly support regexp's, it can be extended to
do so, and it certainly meets your other requirements.

========================================================================

Ed Spire                           email: ets@wrkgrp.com      (on uunet)
The Workstation Group              voice: 800-228-0255
6300 River Road, Suite 700            or  708-696-4800
Rosemont, Illinois  60018            fax: 708-696-2277
Newsgroups: comp.unix.programmer
From: eigenstr@nyssa.cs.rose-hulman.edu (Todd R. Eigenschink)
Subject: Re: recursively moving to directories
Organization: Rose-Hulman Institute of Technology
Date: Tue, 7 Apr 1992 05:56:53 GMT

In article <1992Apr7.004137.10446@cbr.dwr.csiro.au> marcus@cbr.dwr.csiro.au (Marcus Schnell) writes:

   Hi all,

   Beginners shell programming question:

   I want to recursively move down directories and changing the owner of
   the file. This script would be run by root. ie. examine each directory
   entry, if a file change owner to X, it directory cd to that directory.

   Thanks ,

   Marcus

   ****************************************************************************
   *    Marcus Schnell                      marcus@helios.cbr.dwr.csiro.au    *
   *    CSIRO Division of Water Resources   Phone   : (+61 6) 246 5707        *
   *    GPO Box 1666                        FAX     : (+61 6) 246 5800        *
   *    Canberra                            Int FAX : (+61 6) 246 5800        *
   *    ACT  2601    **********************************************************
   *    Australia    *          insert ".disclaim" here...                    *
   ****************************************************************************


Boy, this one's easy!  (Unless I'm misunderstanding something... :)

	chown -R new-owner starting-path

That will change ownership of all files and directories.  If you
_just_ want to change file ownerships, I believe this is what you
want:

Either
	find starting-path -type f -exec chown new-owner {} \;

or, better,

	find starting-path -type f -print | xargs chown new-owner

(The latter will build up a bunch of filenames and only exec chown
once, unless there are a lot of files, in which case xargs will handle
running chown multiple times.)

Example: find /usr/users/schmo -type f -print | xargs chown joe


Of course, I'm making no claims that this is what you really have in
mind...just my interpretation.  (Yes, this is the disclaimer. :)

--
Todd Eigenschink (eigenstr@CS.Rose-Hulman.Edu)
Assistant System Manager, News Administrator
Rose-Hulman Institute of Technology, Terre Haute, IN
"G++ is to C++ as Turbo Pascal is to Pascal--it's a great compiler,
 but for a language other than C++."  -- Fred Sullivan
Newsgroups: comp.unix.programmer
From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao)
Subject: Re: non-blocking accept()
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
Date: Thu, 9 Apr 1992 17:30:21 GMT

In article <1992Apr9.164413.17641@helios.physics.utoronto.ca> amid@bullet.ecf (AMID  Rudy) writes:
>'lo,
>
>  Can someone suggest to me exactly how to mark accept() non-blocking?  If
>I RTFM correctly, I have to set the file descriptor somehow.  I'm a novice
>Unix and C programmer so any help in this section is greatly appreciated.
>This is, btw, a socket programming project that I have to do in University.

Use fcntl on the socket. 

	fcntl(s, F_SETFL, FNDELAY);

	-Kartik
Xref: sparky comp.unix.programmer:2376 comp.admin.policy:731
From: vijay@cdsun.fnal.gov (Vijay Gurbani)
Newsgroups: comp.unix.programmer,comp.admin.policy
Subject: Re: logging outgoing telnet sessions to catch 'hackers' (summary)
Date: 14 Apr 92 17:15:20 GMT

>>l1ngo@copper.denver.colorado.edu (Swift) writes:
>>>Let me clarify this. I only intended to log which hosts a user connects to.
>>>Usually, this is all that's needed to find a hacker (at the very least, it
>>>narrows down the list of "suspects").
>>
>>I don't believe that is any of your business. Where someone telnets to,
>>who they send mail to, etc., should not be logged. Your plan sounds
>>an awful lot like "Big Brother" to me.

I beg to differ. Getting an account on a system is not a *right*, it is a 
*priviledge*, much like getting a driving licence. As with any priviledge,
there is a certain amount of responsibility that goes into maintaining your
end of the contract. For the account holder, that means no surreptitious
logins, trojan horses, or the like; for the system maintainer it means a
right to respect the privacy of the account holder. The moment an account
holder breaches his/her priviledges, I don't think the system maintainer
should be liable for keeping his end of the bargain intact. Now, the
question is how can the system maintainer know that the account holder is
keeping his end of the bargain up? By keeping log files, of course. 

Stretching my license analogy, just having a license to drive does not give
the licensee (account holder) the right to speed, and/or disregard traffic
protocols. If they do, they are held accountable to the police (system
maintainer). How does the police make sure that the licensee holds up his/her
end? By snooping (radar guns, hiding in an alley, etc) of course! Now would
you say that the police was violating your rights by shooting his radar gun
in your direction!?!

Just my $0.02 worth.

- vijay
--
 (____)    Chicago Bulls                       Vijay K. Gurbani
'(o  o)`   1991-92 NBA World Champions         Fermi National Accelerator Lab.
  \  /     05 23 24 33 54                      vijay@{cdsun,fnsg01}.fnal.gov
== OO =====All opinions are mine, of course====================================
Newsgroups: comp.unix.programmer,comp.unix.shell
From: mcook@mrc.dev.cdx.mot.com (Michael Cook)
Subject: Re: Which which returns status
Organization: Motorola Codex, Canton, Massachusetts
Date: Wed, 15 Apr 1992 18:56:49 GMT

leisner@johnker.henr801@xerox.com (Marty Leisner x76704 siena) writes:

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

How about this:

  % ksh -c 'whence "$@"' commands
-- 
 ==========================================================
 Michael.Cook@merlin.dev.cdx.mot.com          (617)821-7590
 Motorola/Codex, 20 Cabot Blvd, C2-135, Mansfield, MA 02048
 ==========================================================
Newsgroups: comp.unix.programmer
From: spm2d@uvacs.cs.Virginia.EDU (Steven P. Miale)
Subject: Re: Scripting in general
Organization: University of Virginia Computer Science Department
Date: Wed, 15 Apr 1992 00:41:45 GMT

In article <AXEL.92Apr15015335@avalanche.cs.tu-berlin.de>, axel@cs.tu-berlin.de (Axel Mahler) writes:
> In article <1992Apr14.160036.18526@wrkgrp.COM> ets@wrkgrp.COM (Edward T Spire) writes:
>    bengtl@maths.lth.se (Bengt Larsson) writes:
>    : My wish would be for a new, C-like scripting language, with dynamic
>    : typing, and string handling (and regexps) builtin. There was a man page
>    : posted for such a language about a year ago. I can repost it, if there's
>    : interest.

Try Python - it has regular expressions built in, POSIX support
(including fork), sockets, etc. String handling is built in,
as well as dynamic-length lists. VERY easy to learn - an hour or
two, max.

You can FTP it from ftp.cwi.nl.

Steve

-- 
Steven Miale - spm2d@virginia.edu   | Backwards compatibility is backward.
Undergraduate Researcher            |
Department of Computer Science      |
University of Virginia              |
From: olias@sunhillo.uucp (Mitch Gorman)
Newsgroups: comp.unix.programmer
Subject: Re: Designing Client-Server Communications
Date: 13 Apr 92 17:22:24 GMT
Article-I.D.: sunhillo.1992Apr13.172224.15640
Organization: Digital Systems Corp., Cherry Hill, NJ

In article <kufq3kINNql9@early-bird.think.com> barmar@think.com (Barry Margolin) babbles:
>
>>TCP with 1 port (is it possible?)
>
>Not possible.  TCP is a one-to-one protocol.

	True, but it's the pair of endpoints that make it unique.  If he's
got multiple machines out there as clients to the heartbeat provider (acting
as server), there's no problem.  And if the heartbeater is the client,
there's still no problem, as it would have to make connections to the
snapshotters (or shapsnotters :), probably from a "known machines" list, and
each of those connections would also be unique.

	Not necessarily the most efficient way of doing it, perhaps, but
definitely workable.
-- 
Mitch						"If I had my way, I'd just walk
olias@sunhillo.uucp				through those doors, and wander
emrys@cellar.org				down the Champs d'Elysees..."
cellar!emrys@tredysvr.tredydev.unisys.com	- Joni Mitchell (no relation)
Newsgroups: comp.unix.programmer
From: franl@centerline.com (Fran Litterio)
Subject: Re: Re : non-blocking accept()
Organization: CenterLine Software, Inc.
Date: Fri, 10 Apr 1992 17:11:15 GMT

In article <JIK.92Apr10094338@pit-manager.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:

> In article <92100.172140PJS100T@ODUVM.BITNET> PJS100T@ODUVM.BITNET (Pam Skillman) writes:
> 
>    Another alternative provided in 4.3BSD is the select system call.  This is
>    the preferred method (I believe).
> 
> I do not see why it would be classified as the "preferred" method.  If
> you wish to write your program in a way that makes select() the best
> tool for the job, then you can use select().  If, on the other hand,
> you wish to write the program in a way that makes it more appropriate
> to use non-blocking I/O on the server socket and pay attention to
> EWOULDBLOCK, then you can do that.  Neither is "preferred," and each
> is more appropriate in some situations.
> 
> In any case, what you neglected to mention in your posting is that if
> a programmer DOES want to use select(2) to determine if a server
> socket has a pending connection ready to be accept(2)ed, then he/she
> should select the socket for read, and select will indicate that it is
> ready to be read if there are pending connections.

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?
--
franl@centerline.com   || Fran Litterio                               
uunet!centerline!franl || CenterLine Software R&D                     
617-498-3255           || 10 Fawcett St, Cambridge, MA, USA 02138-1110
Newsgroups: comp.unix.programmer,comp.unix.questions