[comp.unix.questions] Three-way write

brian@bucc2.UUCP (10/15/87)

> /* ---------- "Three-way write" ---------- */
> Hi!
> 
> I'm looking for C source code to a three (or more) way write program.
> Does something like this exist??
> 

  I am currently writing such a program. It will only run on SysV, though,
since I am using shared memory.


...............................................................................

						       { bucs1!brian
  Brian Michael Wendt	 {uiucdcs,cepu,ihnp4}!bradley! {       brian
 						       { bucc2!brian

karl@ddsw1.UUCP (Karl Denninger) (10/19/87)

In article <15100001@bucc2> brian@bucc2.UUCP writes:
>
>> /* ---------- "Three-way write" ---------- */
>> I'm looking for C source code to a three (or more) way write program.
>> Does something like this exist??
>  I am currently writing such a program. It will only run on SysV, though,
>since I am using shared memory.

I've posted a up-to 15 user chat program for System III and later (it uses
named pipes) to alt.sources a while ago.  It's written for System V, and
would have to be hacked for other systems, but should be pretty close...

Anyone who needs it, feel free to mail.  If I get enough interest I will
consider a repost of the current version.

-- 

Karl Denninger				UUCP : ...ihnp4!ddsw1!karl
Macro Computer Solutions		Dial : +1 (312) 566-8909 (300-1200)
"Quality solutions at a fair price"	Voice: +1 (312) 566-8910 (24 hrs)

mpl@sfsup.UUCP (M.P.Lindner) (10/22/87)

In article <273@ddsw1.UUCP>, karl@ddsw1.UUCP writes:
> In article <15100001@bucc2> brian@bucc2.UUCP writes:
> >> I'm looking for C source code to a three (or more) way write program.
> >> Does something like this exist??
> >  I am currently writing such a program. It will only run on SysV, though,
> >since I am using shared memory.
> 
> I've posted a up-to 15 user chat program for System III and later (it uses
> named pipes) to alt.sources a while ago.  It's written for System V, and
> would have to be hacked for other systems, but should be pretty close...

Has anyone ever considered writing a "write" program that writes to ttys?
Amazingly enough, this is how the two way "write" program does it, and guess
what?  It's portable!  I know there are certain drawbacks, like each user
must know all the other users in the conversation, but guess what?  It's
portable.

Sorry to sound facetious, but I'm sick of porting little programs like "this
does a cat backwards, and uses semaphores."  Peace.

Mike Lindner
attunix!mpl

brad@bradley.UUCP (10/26/87)

why not have the program sent through comp.sources.unix?

brian@bucc2.UUCP (10/27/87)

> /* Written  5:06 pm  Oct 21, 1987 by sfsup.UUCP!mpl in bucc2:comp.unix.ques */
> Has anyone ever considered writing a "write" program that writes to ttys?
> Amazingly enough, this is how the two way "write" program does it, and guess
> what?  It's portable!  I know there are certain drawbacks, like each user
					  ^^^^^^^^^^^^^^^^^
> must know all the other users in the conversation, but guess what?  It's
> portable.
> 
> Sorry to sound facetious, but I'm sick of porting little programs like "this
> does a cat backwards, and uses semaphores."  Peace.
> 
> Mike Lindner
> attunix!mpl
> /* End of text from bucc2:comp.unix.ques */

  You sure are right there are certain drawbacks! In order to make the
wonderful, standard, portable write command work everyone on the system has
permission to write to your tty. Consider the implications of that. Novices
troublemakers can have fun by doing things like cat a.out > /dev/tty101, and
worse. People who know what they are doing can send wonderful control sequences
to your terminal. Wonderful control sequences that will make the system think
_you_ typed whatever _they_ want it to think. Like rm -r *


...............................................................................

  I heard it on the grep-vine...
						       { bucs1!brian
  Brian Michael Wendt	 {uiucdcs,cepu,ihnp4}!bradley! {       brian
 						       { bucc2!brian

allbery@ncoast.UUCP (10/28/87)

As quoted from <2241@sfsup.UUCP> by mpl@sfsup.UUCP (M.P.Lindner):
+---------------
| In article <273@ddsw1.UUCP>, karl@ddsw1.UUCP writes:
| > In article <15100001@bucc2> brian@bucc2.UUCP writes:
| > >> I'm looking for C source code to a three (or more) way write program.
| > >  I am currently writing such a program. It will only run on SysV, though,
| > >since I am using shared memory.
| > I've posted a up-to 15 user chat program for System III and later (it uses
| > named pipes) to alt.sources a while ago.  It's written for System V, and
| 
| Has anyone ever considered writing a "write" program that writes to ttys?
| Amazingly enough, this is how the two way "write" program does it, and guess
| what?  It's portable!  I know there are certain drawbacks, like each user
+---------------

The purpose of the IPC is to prevent the output of three different users all
being jumbled together; think of it as a "write spooler", that's basically
the idea.  Since there is no way to write to a tty "atomically" (try it!
--and no, O_APPEND doesn't work on character devices), this is the only way
to "spool" tty writes.
-- 
Brandon S. Allbery		     necntc!ncoast!allbery@harvard.harvard.edu
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery
			 "Uncle _who_?" -- Lt. Worf