From matty@cs.su.oz.au Tue Mar  8 00:13:49 1994
Date: Tue, 8 Mar 1994 00:09:51 EST
To: matty@cs.su.oz.au (James Matthew Farrow)
Subject: Re: 9term and 9wm...
Status: RO

TODO
====

-	send multiple backspaces to kill multibyte chars in raw mode.
-	add documentation about scrolling & output behaviour?
-	add #defines for flow control

Any ideas?

From dhog@plan9.cs.su.oz.au Tue Mar  8 00:13:49 1994
Received: by staff.cs.su.oz.au with postie; Tue, 08 Mar 1994 00:13:49 +1100
Received: by staff.cs.su.oz.au with MHSnet; Tue, 08 Mar 1994 00:13:47 +1000
Received: by basser.cs.su.oz.au with MHSnet; Tue, 08 Mar 1994 00:13:45 +1000
Received: from plan9.cs.su.oz.au by MHSnet id 3hSnNX46p+SnNK; Tue, 08 Mar 1994 00:13:42 +1000
Received: from lore.plan9.cs.su.oz.au (insecurely) by joyce.cs.su.OZ.AU;
	Tue, 08 Mar 1994 00:12:35 +1000
Date: Tue, 8 Mar 1994 00:09:51 EST
From: David Hogan <dhog@plan9.cs.su.oz.au>
To: matty@cs.su.oz.au (James Matthew Farrow)
Subject: Re: 9term and 9wm...
X-Frobozz-Id: <19940308001351.0.in.frobozz@staff>
Status: RO

> What sort of support for 9wm do you want to see in 9term?

1.  9term should desist from adding its own extra border if 9wm is
    running (or if told not to by resource/option).  It should look
    for a resource called 9WM_RUNNING, and if it exists _and_ contains
    a valid window id, then 9wm is running.  (note that I haven't
    actually added this feature to 9wm yet...)

2.  9term should provide a resource on its top level window whose
    contents represent whether or not it is in hold mode.  When the
    mode changes, the resource changes, and 9wm can find this out by
    soliciting PropertyNotify events.

When all the appropriate changes have been made to both 9term and 9wm,
we should check that it looks the same as 8½ (:-)

From rap@doc.ic.ac.uk Tue Aug  3 04:30:14 1993
Received: by joyce.cs.su.OZ.AU with postie; Tue,  3 Aug 1993 04:30:14 +1000
Received: from frigate.doc.ic.ac.uk insecurely by joyce.cs.su.OZ.AU;
	Tue, 03 Aug 1993 04:30:08 +1000
Received: from doc.ic.ac.uk by frigate.doc.ic.ac.uk with SMTP (PP) 
          id <01093-0@frigate.doc.ic.ac.uk>; Mon, 2 Aug 1993 19:29:52 +0100
From: Ross Paterson <rap@doc.ic.ac.uk>
Date: Mon, 2 Aug 93 19:29:47 BST
Message-Id: <3998.9308021829@cfast.doc.ic.ac.uk>
To: matty@cs.su.oz.au
Subject: Re: 9term... (was Re: ISO 10646 and MIME)
Status: O

Matty,

Thanks for making this stuff available.  It certainly is nice, though
I find sam's Smalltalk/Mac-style mouse interface hard going.  And the
way scrolling jumps up 3 lines is disconcerting.

I've placed a couple of files in your incoming directory:

	gb.bopomofo.16.bdf
	misc.unihan.16.bdf.Z

The relevant font file lines are:

	0x3100	0x3129	gb.bopomofo.16
	0x4e00	0x9fa5	misc.unihan.16

I know that under Plan 9 the unihan range is usually broken into pieces,
but don't think it gains anything under X, since any non-trivial section
of Chinese or Japanese text is going to require almost all of the segments.
But feel free to rearrange them.

The first font is extracted from CCLIB16.FS, a FangSong font that comes
with CCDOS, developed at the Institute of Software, Academia Sinica, PRC.
This font is in the public domain, I believe.

The second font is extracted from the following fonts in order of preference:
- the above mentioned CCLIB16.FS for GB 2312 characters,
- the HKU font chinese.16 for BIG-5,
- the public domain X font Jming16 for JIS 0208,
- the X font hanglm16 for KSC 5601.
The last font, from which 122 characters were extracted, carries the
copyright notice

	Copyright (c) 1987, 1988 Daewoo Electronics Co.,Ltd.

The font chinese.16 contains a header:

Copyright (C) 1990 Chinese Character Bitmap for Democracy News Propaganda.
Version 1.00
Produced By TheDog
All Rights Reserved

I don't know how to deal with this.  (I think it's the same font as big5.*)

That covers 16411 of the 20902 UniHan characters.  The rest are assigned
bitmaps containing their Unicodes in hexadecimal.

I used the FangSong font (though the X font Csong16 is more attractive)
because it matches the others better.  The priority for Chinese fonts
reflects my own interests, but I think the slight differences in font
style will be hard to notice in such a small bitmap.

Finally: I can live without diacritics etc, but what I would like is
the ability to preprocess the input stream (say to install a Chinese
input method).  I expect this isn't going to be as easy with the X
version as in Plan 9, but have you had any thoughts in this direction?
--
Ross Paterson <rap@doc.ic.ac.uk>
Department of Computing, Imperial College, London SW7

From matty@orthanc.cs.su.OZ.AU Sat Sep  4 13:33:39 1993
Newsgroups: comp.fonts
Path: basser.cs.su.oz.au!metro!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!xlink.net!math.fu-berlin.de!ajs.qub.ac.uk!ajs
From: ajs@clio.arts.qub.ac.uk (A.J. Sheehan)
Subject: Re: Complete UNICODE TT Font?
Message-ID: <ajs.66.0011837B@clio.arts.qub.ac.uk>
Sender: news@math.fu-berlin.de (Math Department)
Nntp-Posting-Host: ajs.qub.ac.uk
Organization: Arts Computing Unit, Queen's University, Belfast, Ireland
X-Newsreader: Trumpet for Windows [Version 1.0 Rev Final Beta #10]
References: <1993Aug27.062410.25132@scammell.ecos.tne.oz.au> <1993Aug27.142000.3606@CSD-NewsHost.Stanford.EDU>
Date: Fri, 27 Aug 1993 16:30:42 GMT
Lines: 52
Status: O

In article <1993Aug27.142000.3606@CSD-NewsHost.Stanford.EDU> bigelow@Sunburn.Stanford.EDU (Charles A. Bigelow) writes:
>From: bigelow@Sunburn.Stanford.EDU (Charles A. Bigelow)
>Subject: Re: Complete UNICODE TT Font?
>Date: 27 Aug 93 14:20:00 GMT

>In article <1993Aug27.062410.25132@scammell.ecos.tne.oz.au>
>pcm@scammell.ecos.tne.oz.au (Peter Murray) writes:
>>
>>Has anyone produced a complete TT font containing all
>>characters in the UNICODE standard?  If not TT, then
>>what about ATM.

>How about a big, but incomplete Unicode font? 
>Lucida Sans Unicode contains approximately 1750 characters of the Unicode
>standard. It is currently bundled with Microsoft Windows NT, as one large TT
>font. It includes the following Unicode subsets: ASCII, Latin1, European Latin,
>Extended Latin, Standard Phonetic, Modifier Letters,Generic Diacritics, Greek,
>Cyrillic, Hebrew, General  Punctuation, Sups & Subs, Currency, Letterlike,
>Arrows, Mathematical Operators, Control Pics, Form and Chart, Blocks, Geometric
>Shapes. 

>Future releases will expand this font to include more of the alphabetic sets,
>andmore of the symbol sets. All of the  characters are designed for the font,
>to make an integrated set that maintains harmony in proportions, weights,
>alignments, etc.  If a user switches from English to Russian in a text, for
>example, the style, weight, and visual size of the letters remains constant,
>while the shapes change.

>Although the two designers of this font would like to do the entire Unicode
>set, the vast size of the Han Chinese set is a reminder of Hippocrates' maxim,
>Ars longa, vita brevis.

>-- Chuck Bigelow
>   (one of the two ...)

Could this Unicode font be used outside Windows NT? Netware 4.0 comes  with 
support  for Unicode and this is apparently even available  for earlier 
Netware versions - at any rate the Unicode files are available with the 
Netware 4.0 client software though with no explanation of what to do with them!

Could anyone refer me to some guide to Unicode? I would prefer something 
non-technical in that Im not a font designer, just an interested would-be 
user of Unicodes great character set (1750 characters? !!!)




A.J. Sheehan

Arts Computing Unit
Queen's University, Belfast
Ireland

From iskandar@u.washington.edu Mon Sep 13 11:39:43 1993
Received: by joyce.cs.su.OZ.AU with postie; Mon, 13 Sep 1993 11:39:43 +1000
Received: from mead.u.washington.edu insecurely by joyce.cs.su.OZ.AU;
	Mon, 13 Sep 1993 11:39:38 +1000
Received: by mead.u.washington.edu
	(5.65/UW-NDC Revision: 2.28 ) id AA43644; Sun, 12 Sep 93 18:39:28 -0700
Date: Sun, 12 Sep 93 18:39:28 -0700
From: Alexandre Khalil <iskandar@u.washington.edu>
Message-Id: <9309130139.AA43644@mead.u.washington.edu>
X-Sender: iskandar@mead.u.washington.edu
To: matty@cs.su.oz.au, iskandar@u.washington.edu
Subject: Re: Complete UNICODE TT Font?
Newsgroups: comp.fonts,comp.editors
In-Reply-To: <1993Sep1.071730.29364@cs.su.oz.au>
References: <1993Aug27.142000.3606@CSD-NewsHost.Stanford.EDU> <ajs.66.0011837B@clio.arts.qub.ac.uk> <1993Aug27.191012.6639@CSD-NewsHost.Stanford.EDU> <1993Aug31.115224.21995@memex.co.uk>
Organization: University of Washington, Seattle
Cc: 
Status: O


  Hello James

  Do you have specific support for Arabic script languages ?

  I am asking because we need an xterm that support Arabic in some way.
-though I have no idea how the support of Unicode will mix with an
otherwise ASCII/8859-1 environment-

  Thanks

alex

In article <1993Sep1.071730.29364@cs.su.oz.au> you write:
>In article <1993Aug31.115224.21995@memex.co.uk>, peter@memex.co.uk (Peter Ilieve) writes:
>|> In article <1993Aug27.191012.6639@CSD-NewsHost.Stanford.EDU>
>|>   bigelow@Sunburn.Stanford.EDU (Charles A. Bigelow) writes:
>|> 
>|> >A different approach to a Unicode implementation is found in the "Plan 9"
>|> >operating system from AT&T Bell Labs.
>|> >...
>|> >Rob Pike and Ken Thompson have written a paper about this
>|> >flexible and interesting implementation, ...
>|> 
>|> Hello World or ... (the title has Greek, Katakana and Kanji in it as well)
>|> 
>|> It is available by FTP from research.att.com, probably in
>|> dist/plan9man/09utf.ps.Z, and from metis.com in pub/09utf.ps.Z.
>|> 
>|> For those with the Prime Time Freeware CD-ROMs, it is on Disc A in
>|> os/plan9/manual.taz.
>|> 
>|> 
>|> 		Peter Ilieve		peter@memex.co.uk
>|> 
>
>A terminal emulator for Unix using just this approach is available
>for ftp from ftp.cs.su.oz.au:/matty/unicode as 9term.tar.Z.  It
>comes with a selection of fonts covering large patches of the Unicode
>charset also available in that directory.  There is a set of pbm files
>showing the terminal in action for those who are interested.
>There is also a WWW page with a brief description and demo images
>available (http://www.gh.cs.su.oz.au/Users/matty/9term.html).
>
>The terminal program (9term) emulates an 8 1/2 window under X and Unix,
>and needs the libXg library package available from research.att.com
>as part of the Sam editor distribution.  The UTF version of this library,
>which 9term is based upon, is about to be released, check the /dist/sam
>directory on research (which is where it will appear, the current version
>is Mar 12) although you can mail me if your need/desire is urgent and
>I can arrange an interim version of the library and you can be labelled a
>beta-tester ;-).
>
>I have used the terminal constantly since last November and in tandem
>with sam provides me with a suite for editing Unicode files and composing
>Unicode documents and mail.
>
>I welcome email on this subject.
>
>					Matty.
>-- 
>James Matthew Farrow                    | "For in that moment I beheld the ruin
>matty@cs.su.OZ.AU                       | of my existence.  My world fell dark
>Basser Department of Computer Science   | and my life became a shallow dream.
>Sydney University - FAX: +61 2 692 3838 | `Odi et amo. Excrucior.'" - Tlindah


From sam-fans-owner@hawkwind.utcs.toronto.edu Sat Feb 12 02:06:36 1994
Received: by joyce.cs.su.OZ.AU with postie; Sat, 12 Feb 1994 02:06:36 +1100
Received: by basser.cs.su.oz.au with MHSnet; Sat, 12 Feb 1994 02:06:33 +1100
Received: from hawkwind.utcs.toronto.edu by MHSnet id 3hKtw9+4P+Ktvu; Sat, 12 Feb 1994 02:06:30 +1100
Received: from hawkwind.utcs.utoronto.ca (insecurely) by joyce.cs.su.OZ.AU;
	Sat, 12 Feb 1994 02:06:31 +1100
X-Claimed-Received: from hawkwind.utcs.toronto.edu
Received: from minster.york.ac.uk ([144.32.128.41]) by hawkwind.utcs.toronto.edu with SMTP id <24143>; Fri, 11 Feb 1994 10:01:22 -0500
From:	mhw@minster.york.ac.uk
Date:	Fri, 11 Feb 1994 09:58:32 -0500
Message-ID: <swordfish.760978870@minster.york.ac.uk>
>From: Mark H. Wilkinson <mhw>
Subject: samterm's bitmap depths.
To:	sam-fans@hawkwind.utcs.toronto.edu
Sender: "Mark H. Wilkinson" <mhw@minster.york.ac.uk>
X-Mailer: Sendmail/ream v4.12bv
Status: O

i've recently moved from a mono machine to a colour machine. having
built sam on this new machine i find that when i get a few windows open
within sam the machine starts to swap and generally get sluggish. what i
think is happening is that samterm is allocating all its bitmaps to be 8
bits deep (even though they're all monochrome) and it's clogging up the
server. i think 9term uses 1 bit deep bitmaps no matter what display it
runs on.

i've played around setting X resources, but to no effect (other than
BadMatch errors). anyone else experienced this and found a work around
or patch? or do colour suns just go slow?

-Mark.

From :steve@gec-epl.co.uk@a.gec-epl.co.uk Wed Feb 16 20:14:19 1994
Received: by staff.cs.su.oz.au with postie; Wed, 16 Feb 1994 20:14:19 -15150048
Received: by staff.cs.su.oz.au with MHSnet; Wed, 16 Feb 1994 20:14:17 +1100
Received: by basser.cs.su.oz.au with MHSnet; Wed, 16 Feb 1994 20:14:14 +1100
Received: from a.gec-epl.co.uk by MHSnet id 3hMSIE-Ye+MSHp; Wed, 16 Feb 1994 20:14:12 +1100
>From :steve@gec-epl.co.uk@a.gec-epl.co.uk Wed Feb 16 20:14:14 1994
Received: from ben.Britain.EU.net (insecurely) by joyce.cs.su.OZ.AU;
	Wed, 16 Feb 1994 20:18:40 +1100
X-Full-Sender-Address: @a.gec-epl.co.uk:steve@gec-epl.co.uk
Received: from a.gec-epl.co.uk by ben.britain.eu.net via PSS with NIFTP (PP) 
          id <sg.00985-0@ben.britain.eu.net>; Wed, 16 Feb 1994 09:13:52 +0000
Received: from zombie.gec-epl.co.uk (zombie.limbo.gec-epl.co.uk) 
          by vampire.gec-epl.co.uk (5.0/SMI-SVR4) id AA16252;
          Wed, 16 Feb 1994 09:16:28 +0000
Received: by zombie.gec-epl.co.uk (5.0/SMI-SVR4) id AA11459;
          Wed, 16 Feb 1994 09:12:09 +0000
Date: Wed, 16 Feb 1994 09:12:09 +0000
From: steve@gec-epl.co.uk (Steve_Kilbane)
Message-Id: <9402160912.AA11459@zombie.gec-epl.co.uk>
To: matty <matty@staff.cs.su.oz.au>
Subject: chording,mail
Cc: matty@cs.su.oz.au
X-Sun-Charset: US-ASCII
X-Face: Iqsa(US9p?)Y^W+6Ff[Z]<t?\A!eaL'DG{20*#{C1;'Ct&}L}B^/1(aYI@hP)4!<}7D=2gm 
        8!$T`8QNfK<te\20%A\`wm*wa2"^Up*Qs"X}KeV*3XeB2te&sKp*t`N;^BDh[6=K{ZBE=O>rM"uFE) 
        lFDjag1e]\/#2
Content-Length: 865
Status: O


there seems to be some problems with the mail between gec-epl.co.uk and
su.oz.au - we're getting some very weird bounces, although i think someone
is forwarding them by hand, somewhere. i'm cc'ing this to cs because there's
more likelihood of it getting through. does staff.cs have a postmaster alias?

still, i guess it's getting through, because you obviously got the message
about chords. did you get the solaris 2.3 patches, too?

sam doesn't currently have chords by default, although a patch has been
posted. it modifies libframe/frselect.c, samterm/flayer.c and samterm/main.c.
i can forward it if you like. unfortunately, i've deleted the message header,
so i don't know who originally posted it. but i can find out. personally,
i *really* like chords, and get somewhat irritated to discover (on a
regular basis) that 9term doesn't have them yet...

steve

From :steve@gec-epl.co.uk@a.gec-epl.co.uk Wed Feb 16 20:17:58 1994
Received: by joyce.cs.su.OZ.AU with postie; Wed, 16 Feb 1994 20:17:58 +1100
Received: by basser.cs.su.oz.au with MHSnet; Wed, 16 Feb 1994 20:17:55 +1100
Received: from a.gec-epl.co.uk by MHSnet id 3hMSHU-Y1+MSH3; Wed, 16 Feb 1994 20:17:53 +1100
Received: from ben.Britain.EU.net (insecurely) by joyce.cs.su.OZ.AU;
	Wed, 16 Feb 1994 20:17:32 +1100
X-Full-Sender-Address: @a.gec-epl.co.uk:steve@gec-epl.co.uk
Received: from a.gec-epl.co.uk by ben.britain.eu.net via PSS with NIFTP (PP) 
          id <sg.00985-0@ben.britain.eu.net>; Wed, 16 Feb 1994 09:13:52 +0000
Received: from zombie.gec-epl.co.uk (zombie.limbo.gec-epl.co.uk) 
          by vampire.gec-epl.co.uk (5.0/SMI-SVR4) id AA16252;
          Wed, 16 Feb 1994 09:16:28 +0000
Received: by zombie.gec-epl.co.uk (5.0/SMI-SVR4) id AA11459;
          Wed, 16 Feb 1994 09:12:09 +0000
Date: Wed, 16 Feb 1994 09:12:09 +0000
From: steve@gec-epl.co.uk (Steve_Kilbane)
Message-Id: <9402160912.AA11459@zombie.gec-epl.co.uk>
To: matty <matty@staff.cs.su.oz.au>
Subject: chording,mail
Cc: matty@cs.su.oz.au
X-Sun-Charset: US-ASCII
X-Face: Iqsa(US9p?)Y^W+6Ff[Z]<t?\A!eaL'DG{20*#{C1;'Ct&}L}B^/1(aYI@hP)4!<}7D=2gm 
        8!$T`8QNfK<te\20%A\`wm*wa2"^Up*Qs"X}KeV*3XeB2te&sKp*t`N;^BDh[6=K{ZBE=O>rM"uFE) 
        lFDjag1e]\/#2
Content-Length: 865
Status: O


there seems to be some problems with the mail between gec-epl.co.uk and
su.oz.au - we're getting some very weird bounces, although i think someone
is forwarding them by hand, somewhere. i'm cc'ing this to cs because there's
more likelihood of it getting through. does staff.cs have a postmaster alias?

still, i guess it's getting through, because you obviously got the message
about chords. did you get the solaris 2.3 patches, too?

sam doesn't currently have chords by default, although a patch has been
posted. it modifies libframe/frselect.c, samterm/flayer.c and samterm/main.c.
i can forward it if you like. unfortunately, i've deleted the message header,
so i don't know who originally posted it. but i can find out. personally,
i *really* like chords, and get somewhat irritated to discover (on a
regular basis) that 9term doesn't have them yet...

steve

From mhw@minster.york.ac.uk Mon Mar  7 23:25:54 1994
Received: by staff.cs.su.oz.au with postie; Mon, 07 Mar 1994 23:25:54 +1100
Received: by staff.cs.su.oz.au with MHSnet; Mon, 07 Mar 1994 23:25:52 +1000
Received: by basser.cs.su.oz.au with MHSnet; Mon, 07 Mar 1994 23:25:49 +1000
Received: from minster.york.ac.uk by MHSnet id 3hSmgq3LV+SmgP; Mon, 07 Mar 1994 23:25:48 +1000
Received: from minster.york.ac.uk (insecurely) by joyce.cs.su.OZ.AU;
	Mon, 07 Mar 1994 23:24:37 +1000
From: mhw@minster.york.ac.uk
Date: Mon, 7 Mar 94 13:13:21
Message-ID: <swordfish.763046679@minster.york.ac.uk>
>From: Mark H. Wilkinson <mhw>
Subject: Re: Faking it under Unix (was Re: Plan 9: The future) 
To: matty@cs.su.oz.au
Sender: "Mark H. Wilkinson" <mhw@minster.york.ac.uk>
X-Mailer: Sendmail/ream v4.12bv
Cc: 9fans@cse.psu.edu
Status: O

>                                                            Gary (and
> others) have been asking me about chording too so I've at least thought
> about it.

After doing the chord patch for sam I found it quite easy to do the same
thing for 9term. It relies on the one line change to libframe/frselect.c
to get it to work. I've not mailed it to the list though because I'm not
really happy about the way it works. If you study it closely, cut and paste
in 9term is actually inconsistent with sam in that pasted text does not
stay selected (at least in the version I run). I did a patch where chording
buttons 2 and 3 did cut and paste and found I didn't use it very much after
all. I know run a version where button 3 does send without appending a \n
to the text and this works quite nicely as it support picking things from
the previous text to be entered into the new command. It does annoy a little
when you want to edit some text for input to a command though.

Anyway, I can mail you both patches if you want (they're not that much
different anyway) and you can see what you think. I find 9term is dissimilar
enough from sam to require a slightly different style of working.

Look forward to the new version...

-Mark.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mark H. Wilkinson <mhw@minster.york.ac.uk>  : Research student in user
University of York, England                 : interface management systems

From arnold@cc.gatech.edu Tue Mar  8 00:13:37 1994
Received: by staff.cs.su.oz.au with postie; Tue, 08 Mar 1994 00:13:37 +1100
Received: by staff.cs.su.oz.au with MHSnet; Tue, 08 Mar 1994 00:13:35 +1000
Received: by basser.cs.su.oz.au with MHSnet; Tue, 08 Mar 1994 00:13:32 +1000
Received: from cc.gatech.edu by MHSnet id 3hSnNT46M+SnN9; Tue, 08 Mar 1994 00:13:30 +1000
Received: from burdell.cc.gatech.edu (insecurely) by joyce.cs.su.OZ.AU;
	Tue, 08 Mar 1994 00:12:22 +1000
Received: from penfold.cc.gatech.edu (arnold@penfold.cc.gatech.edu [130.207.3.249]) by burdell.cc.gatech.edu (8.6.4/8.6.4) with ESMTP id JAA06194 for <matty@cs.su.oz.au>; Mon, 7 Mar 1994 09:11:36 -0500
Received: from localhost (arnold@localhost) by penfold.cc.gatech.edu (8.6.4/8.6.4) id JAA07792 for matty@cs.su.oz.au; Mon, 7 Mar 1994 09:11:36 -0500
From: arnold@cc.gatech.edu (Arnold Robbins)
Message-Id: <199403071411.JAA07792@penfold.cc.gatech.edu>
Date: Mon, 7 Mar 1994 09:11:35 -0500
In-Reply-To: James Matthew Farrow's 48-line message on Mar  5,  6:18am
X-Ultrix: Just Say NO!
X-Important-Saying: Premature Optimization Is The Root Of All Evil.
X-Mailer: Mail User's Shell (7.2.5 10/14/92)
To: matty@cs.su.oz.au (James Matthew Farrow)
Subject: Re: Faking it under Unix (was Re: Plan 9: The future)
Status: O

> Ah, perhaps it's time for me to tidy up gtalk and make it available.
> It's an interface I wrote for talk a while back built on top of
> libXg/libtext.  It hasn't got bells and whistles but if there's
> interest I can put it up.

I'd  be interested in seeing this. Thanks.

> and
> trying to nail down David Hogan to add 9wm compatibility.

What are the chances of getting 9wm out to where we can play with it?

John's gwm is nice, but I'd be real interested in 9wm...

Thanks,

Arnold

P.S. And of course, I'm also looking forward to the next 9term.

From sam-fans-owner@hawkwind.utcs.toronto.edu Fri Mar 25 04:32:56 1994
Received: by staff.cs.su.oz.au with postie; Fri, 25 Mar 1994 04:32:56 +1000
Received: by staff.cs.su.oz.au with MHSnet; Fri, 25 Mar 1994 04:32:54 +1000
Received: by basser.cs.su.oz.au with MHSnet; Fri, 25 Mar 1994 04:32:51 +1000
Received: from hawkwind.utcs.toronto.edu by MHSnet id 3hYRoH1F3+YRmI; Fri, 25 Mar 1994 04:32:49 +1000
Received: from hawkwind.utcs.utoronto.ca (insecurely) by joyce.cs.su.OZ.AU;
	Fri, 25 Mar 1994 04:31:43 +1000
X-Claimed-Received: from hawkwind.utcs.toronto.edu
Received: from sequent.kiae.su ([144.206.136.6]) by hawkwind.utcs.toronto.edu with SMTP id <24181>; Thu, 24 Mar 1994 13:28:37 -0500
Received: by sequent.kiae.su id AA12893
  (5.65.kiae-1  for sam-fans@hawkwind.utcs.toronto.edu); Thu, 24 Mar 1994 21:18:45 +0300
To:	sam-fans@hawkwind.utcs.toronto.edu (Sam fans)
Subject: extra national support for X
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Id: <458.764532651.1@saukh.suug.msk.su>
Date:	Thu, 24 Mar 1994 13:10:52 -0500
Message-Id: <459.764532652@saukh.suug.msk.su>
From:	Nickolay Saukh <nms@saukh.suug.msk.su>
Status: O

This set of patches introduce table of translations
from X keycodes to runes. It is handy if you already
solved national problem for X ;-). All changes protected
by #ifdef KEYMAP ... #endif. The table looks like

	X_keycode	Unicode

Codes converted by strtol, so octal, decimal, hexadecimal
numbers are allowed.

diff --new-file --unified --recursive sam-4.1.orig/libXg/Gwin.h plan9/libXg/Gwin.h
--- sam-4.1.orig/libXg/Gwin.h	Thu Mar 24 20:47:32 1994
+++ plan9/libXg/Gwin.h	Thu Mar 24 20:42:55 1994
@@ -16,6 +16,10 @@
 #define XtCP9font   "P9font"
 #define XtNcomposeMod   "composeMod"
 #define XtCComposeMod   "ComposeMod"
+#if defined(KEYMAP)
+#define XtNp9keymap   "p9keymap"
+#define XtCP9keymap   "P9keymap"
+#endif
 
 /* External reference to the class record pointer */
 extern WidgetClass gwinWidgetClass;
diff --new-file --unified --recursive sam-4.1.orig/libXg/GwinP.h plan9/libXg/GwinP.h
--- sam-4.1.orig/libXg/GwinP.h	Thu Mar 24 20:47:33 1994
+++ plan9/libXg/GwinP.h	Thu Mar 24 20:42:55 1994
@@ -17,6 +17,9 @@
 	Mousefunc	gotmouse;	/* Notify app of mouse change */
 	String		selection;	/* Current selection */
 	String		p9font;
+#if defined(KEYMAP)
+	String		p9keymap;
+#endif
 	int		compose;
 } GwinPart;
 
diff --new-file --unified --recursive sam-4.1.orig/libXg/gwin.c plan9/libXg/gwin.c
--- sam-4.1.orig/libXg/gwin.c	Thu Mar 24 20:47:38 1994
+++ plan9/libXg/gwin.c	Thu Mar 24 20:42:56 1994
@@ -48,6 +48,10 @@
 		Offset(selection), XtRString, (XtPointer) NULL},
 	{XtNp9font, XtCP9font, XtRString, sizeof(String),
 		Offset(p9font), XtRString, (XtPointer) NULL},
+#if defined(KEYMAP)
+	{XtNp9keymap, XtCP9keymap, XtRString, sizeof(String),
+		Offset(p9keymap), XtRString, (XtPointer) NULL},
+#endif
 	{XtNcomposeMod, XtCComposeMod, XtRInt, sizeof(int),
 		Offset(compose), XtRImmediate, (XtPointer) 0}
 };
@@ -213,7 +217,11 @@
 	}
 	if(k == NoSymbol)
 		return;
-	if(k&0xFF00){
+#if defined(KEYMAP)
+	if((k & 0xFF00) == 0xFF00){
+#else
+	if((k & 0xFF00)){
+#endif
 		switch(k){
 		case XK_BackSpace:
 		case XK_Tab:
@@ -254,7 +262,7 @@
 			k = 0x81; /* PREVIEW -- "Scroll back" */
 			break;
 		default:
-			return;	/* not ISO-1 or tty control */
+			return;	/* not tty control */
 		}
 	}
 	/* Compensate for servers that call a minus a hyphen */
@@ -268,6 +276,22 @@
 			&& composing == -2)
 		composing = -1;
 	if (composing > -2) {
+#if defined(KEYMAP)
+		if((c = keyxlate(k)) == -1) {
+			if((k & 0xFF00))
+				return;
+		} else if((c & 0xff00)) {
+			k = (unsigned short)c;
+			composing++;
+			STUFFCOMPOSE();
+			composing = -2;
+			f = ((GwinWidget)w)->gwin.gotchar;
+			if(f)
+				(*f)(k);
+
+		} else
+			k = (unsigned short)c;
+#endif
 		compose[++composing] = k;
 		if ((*compose == 'X') && (composing > 0)) {
 			if ((k < '0') || (k > 'f') ||
@@ -296,8 +320,18 @@
 			composing++;
 			STUFFCOMPOSE();
 		}
-		c = (unsigned short)k;
 		composing = -2;
+#if defined(KEYMAP)
+		c = keyxlate(k);
+		if(c == -1) {
+			if((k & 0xFF00))
+				return;
+			else
+				c = (unsigned short)k;
+		}
+#else
+		c = (unsigned short)k;
+#endif
 	}
 
 	if (composing >= -1)
diff --new-file --unified --recursive sam-4.1.orig/libXg/libgint.h plan9/libXg/libgint.h
--- sam-4.1.orig/libXg/libgint.h	Thu Mar 24 20:47:39 1994
+++ plan9/libXg/libgint.h	Thu Mar 24 20:42:56 1994
@@ -90,3 +90,23 @@
 	UseCopyPlane,
 	UseFillRectangle
 };
+
+#if defined(KEYMAP)
+
+typedef struct Keymap Keymap;
+typedef struct KeyXtab KeyXtab;
+
+struct Keymap {
+	int nkeys;
+	KeyXtab* keyxtab;
+};
+
+struct KeyXtab {
+	unsigned long xkey;
+	Rune ukey;
+};
+
+Keymap* rdkeymapfile(char* name);
+
+extern Keymap	*_keymap;
+#endif
diff --new-file --unified --recursive sam-4.1.orig/libXg/rdkeymapfile.c plan9/libXg/rdkeymapfile.c
--- sam-4.1.orig/libXg/rdkeymapfile.c	Thu Jan  1 03:00:00 1970
+++ plan9/libXg/rdkeymapfile.c	Thu Mar 24 20:42:56 1994
@@ -0,0 +1,109 @@
+#if defined(KEYMAP)
+#include <libc.h>
+#include <libg.h>
+#include "libgint.h"
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+static char*
+skip(char *s)
+{
+	while (*s==' ' || *s=='\n' || *s=='\t')
+		s++;
+	return s;
+}
+
+static int
+keyxcmp(const void* n1, const void* n2)
+{
+	return (int)(((const KeyXtab *)n1)->xkey -
+	((const KeyXtab *)n2)->xkey);
+}
+
+Keymap *
+rdkeymapfile(char *name)
+{
+	Keymap *keymap;
+	KeyXtab* c;
+	int fd, i;
+	char *buf, *s;
+	struct stat sbuf;
+	unsigned long xcode, ucode;
+
+	fd = open(name, O_RDONLY);
+	if (fd < 0)
+		return 0;
+	if (fstat(fd, &sbuf) < 0)
+	{
+    Err0:
+		close(fd);
+		return 0;
+	}
+	buf = (char *)malloc(sbuf.st_size+1);
+	if (buf == 0)
+		goto Err0;
+	buf[sbuf.st_size] = 0;
+	i = read(fd, buf, sbuf.st_size);
+	close(fd);
+	if (i != sbuf.st_size)
+	{
+    Err1:
+		free(buf);
+		return 0;
+	}
+
+	s = buf;
+	keymap = (Keymap *)malloc(sizeof(Keymap));
+	if (keymap == 0)
+		goto Err1;
+	memset((void*)keymap, 0, sizeof(Keymap));
+
+	do {
+		xcode = strtol(s, &s, 0);
+		s = skip(s);
+		ucode = strtol(s, &s, 0);
+		while(*s && *s++ != '\n')
+			;
+		if(ucode>=65536) {
+    Err3:
+			if(keymap->keyxtab)
+				free(keymap->keyxtab);
+			free(keymap);
+			return 0;
+		}
+		if (keymap->keyxtab)
+			keymap->keyxtab = (KeyXtab *)realloc(keymap->keyxtab, (nkeys+1)*sizeof(KeyXtab));
+		else
+			keymap->keyxtab = (KeyXtab *)malloc(sizeof(KeyXtab));
+		if (keymap->keyxtab == 0) {
+			/* realloc manual says keymap->keyxtab may have been destroyed */
+			keymap->nkeys = 0;
+			goto Err3;
+		}
+		c = &keymap->keyxtab[keymap->nkeys];
+		c->xkey = xcode;
+		c->ukey = ucode;
+		keymap->nkeys++;
+	} while(*s);
+	free(buf);
+	qsort(keymap->keyxtab, keymap->nkeys, sizeof(KeyXtab), keyxcmp);
+	return keymap;
+}
+
+int
+keyxlate(unsigned long key)
+{
+	KeyXtab *xup;
+	KeyXtab	datum;
+
+	if(_keymap == 0)
+		return (-1);
+	datum.xkey = key;
+	xup = (KeyXtab *) bsearch(&datum, _keymap->keyxtab,
+		_keymap->nkeys, sizeof(KeyXtab), keyxcmp);
+	if(xup == 0)
+		return (-1);
+	return xup->ukey;
+}
+#endif /* defined(KEYMAP) */
diff --new-file --unified --recursive sam-4.1.orig/libXg/xtbinit.c plan9/libXg/xtbinit.c
--- sam-4.1.orig/libXg/xtbinit.c	Thu Mar 24 20:47:45 1994
+++ plan9/libXg/xtbinit.c	Thu Mar 24 20:42:57 1994
@@ -43,6 +43,9 @@
 unsigned long	_ld2dmask[6] = { 0x1, 0x3, 0xF, 0xFF, 0xFFFF, 0xFFFFFFFF };
 Colormap	_libg_cmap;
 int		_cmap_installed;
+#if defined(KEYMAP)
+Keymap		*_keymap;
+#endif
 
 /* xbinit implementation globals */
 #ifndef R3
@@ -112,6 +115,10 @@
 static XrmOptionDescRec optable[] = {
 	{"-p9fn",	"*p9font",	XrmoptionSepArg,        (caddr_t)NULL},
 	{"-p9font",	"*p9font",	XrmoptionSepArg,        (caddr_t)NULL},
+#if defined(KEYMAP)
+	{"-p9km",	"*p9keymap",	XrmoptionSepArg,        (caddr_t)NULL},
+	{"-p9keymap",	"*p9keymap",	XrmoptionSepArg,        (caddr_t)NULL},
+#endif
 };
 
 void
@@ -126,6 +133,9 @@
 	char *p;
 	XSetWindowAttributes attr;
 	int compose;
+#if defined(KEYMAP)
+	String keymapname;
+#endif
 
 	if(!class && argv[0]){
 		p = strrchr(argv[0], '/');
@@ -158,6 +168,9 @@
 	XtSetArg(args[n], XtNfont, &xf);		n++;
 	XtSetArg(args[n], XtNp9font, &fontname);	n++;
 	XtSetArg(args[n], XtNcomposeMod, &compose);	n++;
+#if defined(KEYMAP)
+	XtSetArg(args[n], XtNp9keymap, &keymapname);	n++;
+#endif
 	XtGetValues(widg, args, n);
 
 	if (compose < 0 || compose > 5) {
@@ -192,6 +205,12 @@
 		subfont = XFontStructtoSubfont(xf);
 		font = mkfont(subfont);
 	}
+#if defined(KEYMAP)
+	_keymap = 0;
+	if(keymapname) {
+		_keymap = rdkeymapfile(keymapname);
+	}
+#endif
 	/* leave screen rect at all zeros until reshaped() sets it */
 	while(!exposed) {
 		XFlush(_dpy);

From rc-owner@hawkwind.utcs.toronto.edu Tue Mar 29 13:18:55 1994
Received: by staff.cs.su.oz.au with postie; Tue, 29 Mar 1994 13:18:55 +1000
Received: by staff.cs.su.oz.au with MHSnet; Tue, 29 Mar 1994 13:18:53 +1000
Received: by basser.cs.su.oz.au with MHSnet; Tue, 29 Mar 1994 13:18:50 +1000
Received: from hawkwind.utcs.toronto.edu by MHSnet id 3hZtt508X+ZtsQ; Tue, 29 Mar 1994 13:18:48 +1000
Received: from hawkwind.utcs.utoronto.ca (insecurely) by joyce.cs.su.OZ.AU;
	Tue, 29 Mar 1994 13:17:13 +1000
X-Claimed-Received: from hawkwind.utcs.toronto.edu
Received: from archone.tamu.edu ([128.194.53.42]) by hawkwind.utcs.toronto.edu with SMTP id <24189>; Mon, 28 Mar 1994 22:15:05 -0500
Received: from merlin.resmel.bhp.com.au ([134.18.1.6]) by archone.tamu.edu with SMTP id <11416>; Mon, 28 Mar 1994 21:13:47 -0600
Received: from cerberus.bhpese.oz.au by merlin.resmel.bhp.com.au with SMTP id AA19648
  (5.67b/IDA-1.5 for <rc@archone.tamu.edu>); Tue, 29 Mar 1994 13:13:29 +1000
Received: from localhost by cerberus.bhpese.oz.au with SMTP
	id AA04481; Tue, 29 Mar 1994 13:13:31 +1000; sendmail 5.67a/Sm3.12RMPSU
	(from Sm@cerberus.bhpese.oz.au for rc@archone.tamu.edu)
Message-Id: <199403290313.AA04481@cerberus.bhpese.oz.au>
To:	noel@es.su.oz.au
Cc:	The rc Mailing List <rc@archone.tamu.edu>
Subject: Re: solaris 2.2 & rshd & rc 
In-Reply-To: Your message of "Mon, 28 Mar 94 21:54:26 EST."
             <199403291254.26792.out.bajem@es.su.oz.au> 
X-Face: '82~l%BnDBWVn])DV^cl_%bla$T]kNbRN&]>v{ED9["<q!|zi"
	<,S3"#^"+3RJ1C?IxA1IY'1("D;SJy,u6fdNH=kP!MC_\"dq0f
	X-kWdVOnVcT:xjp+v5AbX#NJ3D$nXLP&)Xb&D5)NA4z#KaZBR
Date:	Mon, 28 Mar 1994 22:13:28 -0500
From:	Scott Merrilees <Sm@cerberus.bhpese.oz.au>
Status: O


    From:	Scott Merrilees <Sm@cerberus.bhpese.oz.au>
    When doing a rsh command to a solaris 2.2 box, I find that the rc
    started by rshd hangs in a cpu loop after the command has terminated.
    Interestingly, SIGCLD is ingored in both rshd & rc.  Has anyone else
    fixed this problem ?

>From: noel@es.su.oz.au
>it's not that rc _ignores_ SIGCLD, it just doesn't touch it. when rc
>is started by login and forks a program, you will notice that SIGCLD
>is SIG_DFL. but when rc is started by rshd, it must be set to SIG_IGN.
>bad shit happens in sysvr4 when this is done, namely, a parent is not
>notified of the death of a child, so rc just sits in that wait loop
>waiting to pick up the status of the child it just forked, a status
>it will never get. i noticed the cpu in a tight loop when this happened.
>
>anyway, i just hacked the code to make sure SIGCLD is _always_ SIG_DFL.
>this seems to fix the problem.

That was my guess, I figure that rshd must be doing a process id
specific wait, such as waitpid(), and doesn't want to get hit with
SIGCLD signals.

After looking in fn.c:setsigdefaults(), I came up with the following
patch to fn.c:inithandlers().  This seems to work.  The patch is
relative to rc-1.4.

Sm
--
*** fn.c.orig	Tue Mar 29 12:37:04 1994
--- fn.c	Tue Mar 29 12:39:16 1994
***************
*** 45,50 ****
--- 45,54 ----
  			fnrm("sigterm"); /* ditto for SIGTERM */
  		}
  	}
+ #ifdef NOSIGCLD
+ 	rc_signal(SIGCLD, SIG_DFL);
+ 	delete_fn(signals[SIGCLD].name);
+ #endif
  }
  
  /* only run this in a child process! resets signals to their default values */

From matty@staff.cs.su.oz.au Fri Apr  1 18:22:14 1994
Newsgroups: comp.mail.mime
Path: news.cs.su.oz.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!vixen.cso.uiuc.edu!uchinews!quads!goer
From: goer@quads.uchicago.edu (Richard L. Goerwitz)
Subject: Re: multilingual text & MIME
Message-ID: <1994Mar28.152430.18671@midway.uchicago.edu>
Sender: news@uchinews.uchicago.edu (News System)
Reply-To: goer@midway.uchicago.edu
Organization: University of Chicago
References: <01HAHG3MPGES95MSZV@SIGURD.INNOSOFT.COM>
Date: Mon, 28 Mar 1994 15:24:30 GMT
Lines: 31
Status: O

NED@sigurd.innosoft.com (Ned Freed) writes:
>
>> In the past, I've noticed that the engineering community often pro-
>> ceeded quickly, without consulting the international business and
>> academic (spec. Humanities) communities.  I don't pretend to be a
>> hacker myself, but as a linguist I'd like very much to help out any
>> way I can.
>
>I think you're missing a key point here. It is not MIME's job to "handle"
>character sets. There are already lots of character sets in the world, with
>more on the way, and MIME has no business defining its own.

I responded privately, but since this note popped up here, let me resolve
an issue that is very commonly misunderstood by the engineering community.
Language changes do not equal font changes.  When you mix text in languages
that have different directionality things get more complicated.  I don't
want to turn this into a tutorial about, for example, Semitic languages
like Arabic and Hebrew.  Just take my word for it for now.  If you want to
implement anything requiring bidirectionality, or if you want to include
hooks for people to modify your code later, drop me a line.  This is an im-
portant issue, and all too often I find people who think they are "inter-
nationalizing" omitting these details.

It takes all types to get the ball rolling for a project with a multilingual
focus.  I wouldn't pretend do be an engineer, myself.  I'd just like to help
where I can.

-- 

   -Richard L. Goerwitz              goer%midway@uchicago.bitnet
   goer@midway.uchicago.edu          rutgers!oddjob!ellis!goer

From sam-fans-owner@hawkwind.utcs.toronto.edu Fri Apr  8 11:11:36 1994
Received: by joyce.cs.su.OZ.AU with postie; Fri, 08 Apr 1994 11:11:36 +1000
Received: by basser.cs.su.oz.au with MHSnet; Fri, 08 Apr 1994 11:11:34 +1000
Received: from hawkwind.utcs.toronto.edu by MHSnet id 3hd8xN5Fn+d8x5; Fri, 08 Apr 1994 11:11:32 +1000
Received: from hawkwind.utcs.utoronto.ca (insecurely) by joyce.cs.su.OZ.AU;
	Fri, 08 Apr 1994 11:11:30 +1000
X-Claimed-Received: from hawkwind.utcs.toronto.edu
Received: from drizzle.Stanford.EDU ([36.59.0.16]) by hawkwind.utcs.toronto.edu with SMTP id <24210>; Thu, 7 Apr 1994 21:08:22 -0400
Received: from hassle.Stanford.EDU (hassle.Stanford.EDU [36.59.0.161]) by drizzle.Stanford.EDU (8.6.4/8.6.4) with ESMTP id SAA06104 for <sam-fans@hawkwind.utcs.toronto.edu>; Thu, 7 Apr 1994 18:08:07 -0700
From:	Castor Fu <castor@drizzle.Stanford.EDU>
Received: from localhost (castor@localhost) by hassle.Stanford.EDU (8.6.5/8.6.4) id SAA18926 for sam-fans@hawkwind.utcs.toronto.edu; Thu, 7 Apr 1994 18:06:55 -0700
Message-Id: <199404080106.SAA18926@hassle.Stanford.EDU>
Subject: UTF tools
To:	sam-fans@hawkwind.utcs.toronto.edu
Date:	Thu, 7 Apr 1994 21:06:55 -0400
X-Mailer: ELM [version 2.4 PL23]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 272       
Status: RO

Anyone have the equivalent of enscript for UTF?  I've
been commenting my code using the unicode character set,
and I've got the urge to print it. . . .

I don't really need a full character set, but something which could 
handle the math ones would be nice. . .

	-castor

From sean@CS.Stanford.EDU Tue May  3 18:03:45 1994
Received: by staff.cs.su.oz.au with postie; Tue, 03 May 1994 18:03:45 +1000
Received: by staff.cs.su.oz.au with MHSnet; Tue, 03 May 1994 18:03:43 +1000
Received: from CS.Stanford.EDU by MHSnet id 3hlUJf4TY+lUJU; Tue, 03 May 1994 18:03:41 +1000
Received: from Xenon.Stanford.EDU. (insecurely) by staff.cs.su.OZ.AU.;
	Tue, 03 May 1994 17:17:13 +1000
Received:  by Xenon.Stanford.EDU (5.61+IDA/25-CS-eef) id AA14540; Tue, 3 May 94 01:03:12 -0700
Date: Tue, 3 May 94 01:03:12 -0700
From: Sean Quinlan <sean@CS.Stanford.EDU>
Message-Id: <9405030803.AA14540@Xenon.Stanford.EDU>
To: matty@cs.su.oz.au
Subject: Re:  9term and 9x...
Status: O

hey matty,
I download 9term and managed to get it to work mostly.
One problem I have, which you may already know,is that
you can't send too much text.  The problem appears to be
that if you send too much, then the shell on the other
end spits out enough output that the pipe fills and
you deadlock.  It seems you need to be able to read
the output from the shell in flush some how but the
code does not seem to be setup to enable this.  Do
you know about this problem?
thanks
sean

From netapp!netapp.com!byron@netcom.com Mon Aug 15 18:12:17 1994
Received: by staff.cs.su.oz.au with postie; Mon, 15 Aug 1994 18:12:17 +1000
Received: from uucp2-b.netcom.com. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from netapp!netapp.com!byron@netcom.com to matty@cs.su.oz.au);
	Mon, 15 Aug 1994 02:33:05 +1000
X-Claimed-Received: from netcomsv.netcom.com
Received: from netapp.UUCP by netcomsv.netcom.com with UUCP (8.6.4/SMI-4.1)
	id BAA12980; Mon, 15 Aug 1994 01:10:38 -0700
Received: from ghoti.netapp.com by netapp.com (4.1/SMI-4.1)
	id AA18851; Mon, 15 Aug 94 01:08:13 PDT
Received: by ghoti.netapp.com (4.1/SMI-4.1)
	id AA10760; Mon, 15 Aug 94 01:07:28 PDT
Date: Mon, 15 Aug 94 01:07:28 PDT
From: byron@netapp.com (Byron Rakitzis)
Message-Id: <9408150807.AA10760@ghoti.netapp.com>
To: matty@cs.su.oz.au
Subject: new 9wm
Status: O

Well, when I "delete" a window with the new 9wm, I still get the bogus
"broken pipe" message from X. Is that what you were trying to get rid
of?

I know twm has a distinction between f.close and f.kill, but I don't
know shit about programming in X, let alone a window manager.

From cjsv@octarine.cc.adfa.oz.au Mon Oct 17 09:57:44 1994
Received: by staff.cs.su.oz.au with postie; Mon, 17 Oct 1994 09:57:44 +1000
Received: from octarine.cc.adfa.oz.au (insecurely) by staff.cs.su.OZ.AU.
	(Mail from cjsv@octarine.cc.adfa.oz.au to matty@cs.su.oz.au);
	Mon, 17 Oct 1994 02:30:09 +1000
Received: (from cjsv@localhost) by octarine.cc.adfa.oz.au (8.6.8/8.6.6) id JAA17813; Mon, 17 Oct 1994 09:57:14 +1000
Message-Id: <199410162357.JAA17813@octarine.cc.adfa.oz.au>
From: Christopher.Vance@adfa.oz.au (CJS Vance)
Organization: Computer Science, University College, University of New South 
 Wales, Canberra
To: matty@cs.su.oz.au (James Matthew Farrow)
Subject: Re: btw, you should really use rc instead of csh 
In-reply-to: Your message of Wed, 12 Oct 1994 16:41:47 +1000.
             <19941012164147.26346.frobozz@staff.cs.su.oz.au> 
X-Mailer: exmh version 1.5phi 9/15/94
Date: Mon, 17 Oct 1994 09:57:14 +1000
Sender: cjsv@octarine.cc.adfa.oz.au
Status: O

matty@cs.su.oz.au (James Matthew Farrow) wrote:
|      I even tried Matty's libXg with utf fonts, but found there were a lot
|      of european characters missing, and dropped it.  I could never get
|      9term to behave properly.
|  
|  Gary sent me this mail a while back and I'd forgotten about it, sorry.
|  What characters did you find were missing and what were the problems
|  you were having with 9term?

It's been quite a while, so I'm working on memory.  When I get time I might
try again, and see if things have changed.  My OS version certainly has...

I seem to remember a number of the accented European characters were missing.
(I just used tcs, or something similar to try to get a dump of each of the
ISO 8859-* character sets, and found gaps.  I'm sure -1 was fine, but not some
of the others.  I was playing with it as a way of handling MIME mail for less
frequently used character sets.)

As for 9term, I had trouble getting stty settings and signal registration
right.  Given the apparent character set problems I didn't persevere as much as
I might otherwise.

>From memory, I was hoping to ask you about it at AUUG 93, but you were
apparently not available.

-- Christopher

From micro@cooper.edu Wed Oct 19 13:43:36 1994
Received: by staff.cs.su.oz.au with postie; Wed, 19 Oct 1994 13:43:36 +1000
Received: from cooper.edu (insecurely) by staff.cs.su.OZ.AU.
	(Mail from micro@cooper.edu to matty@staff.cs.su.oz.au);
	Wed, 19 Oct 1994 02:36:08 +1000
To: matty@staff.cs.su.oz.au
Subject: Re: 9term & 9x
Content-Length: 1078
X-Frobozz-Id: <19941019134338.0.in.frobozz@staff>
Status: O

it did work @ one point in time,  but i don't know
what's happening now.  when i try to enter a unicode
char, i get the bell symbol.

here is my 9term (xresource file).

! Plan 9 Stuff
Sam*font: fixed
Sam*foreground: grey
Sam*background: navy
Sam*width: 500
Sam*height: 600
*scrollForwardR: true
*saveUnder:	true
*backingStore:	WhenMapped
*p9font: /home/r/rp/lib/plan9/font/Xg/pelm/unicode.8.font
9term*debug: true

here are the stty settings (stty -a) when i invoke 9term as:
	9term -rv -ls -s -9wm -high 1000000 -unix

speed 9600 baud, 27 rows, 103 columns
parenb -parodd cs7 -cstopb -hupcl cread -clocal -crtscts 
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr -icrnl -iuclc 
ixon ixany -ixoff imaxbel 
isig iexten icanon -xcase echo echoe echok -echonl -noflsh -tostop 
echoctl -echoprt echoke 
opost -olcuc -onlcr -ocrnl -onocr onlret -ofill -ofdel 
erase  kill   werase rprnt  flush  lnext  susp   intr   quit   stop   eof
^H     ^U     ^W     ^R     ^O     ^V     ^Z/^Y  ^?     ^\     ^S/^Q  ^D     

thanks again

micro

PS	don't forget 9x  (bug  bug bug)  :)

From sam-fans-owner@hawkwind.utcs.toronto.edu Tue Nov  8 08:49:46 1994
Received: by staff.cs.su.oz.au with postie; Tue, 08 Nov 1994 08:49:46 +1000
Received: from hawkwind.utcs.utoronto.ca. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from sam-fans-owner@hawkwind.utcs.toronto.edu to matty@cs.su.OZ.AU);
	Tue, 08 Nov 1994 02:37:52 +1100
Received: from drizzle.Stanford.EDU ([36.59.0.16]) by hawkwind.utcs.utoronto.ca with SMTP id <23982>; Mon, 7 Nov 1994 16:42:45 -0500
Received: from hassle.Stanford.EDU (hassle.Stanford.EDU [36.59.0.161]) by drizzle.Stanford.EDU (8.6.8/8.6.4) with ESMTP id NAA01925 for <sam-fans@hawkwind.utcs.toronto.edu>; Mon, 7 Nov 1994 13:42:17 -0800
From:	Castor Fu <castor@drizzle.Stanford.EDU>
Received: (castor@localhost) by hassle.Stanford.EDU (8.6.8/8.6.4) id NAA01283 for sam-fans@hawkwind.utcs.toronto.edu; Mon, 7 Nov 1994 13:44:32 -0800
Message-Id: <199411072144.NAA01283@hassle.Stanford.EDU>
Subject: Japanese input and Sam
To:	sam-fans@hawkwind.utcs.toronto.edu
Date:	Mon, 7 Nov 1994 16:44:31 -0500
X-Mailer: ELM [version 2.4 PL23]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 465       
Status: O

Has anyone hacked japanese input methods into 'sam'?  

If I were to do this, what I would probably do is mash a tcl interpreter
into libXg and handle the input translations in tcl.  Then the code
in 'latin1.c' would be moved into an area which could be edited without
recompiling sam.

I suppose purists would feel this was sacreligious, but when using a large
character set like Unicode, I think having hard coded tables like
sam uses is sort of silly.

	-castor

From sam-fans-owner@hawkwind.utcs.toronto.edu Tue Nov  8 09:56:49 1994
Received: by staff.cs.su.oz.au with postie; Tue, 08 Nov 1994 09:56:49 +1000
Received: from hawkwind.utcs.utoronto.ca. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from sam-fans-owner@hawkwind.utcs.toronto.edu to matty@cs.su.OZ.AU);
	Tue, 08 Nov 1994 02:37:52 +1100
Received: from galapagos.cse.psu.edu ([130.203.2.12]) by hawkwind.utcs.utoronto.ca with SMTP id <23982>; Mon, 7 Nov 1994 17:53:35 -0500
Received: from localhost by galapagos.cse.psu.edu with SMTP id <12686>; Mon, 7 Nov 1994 17:53:08 -0500
To:	Castor Fu <castor@drizzle.stanford.edu>
cc:	sam-fans@hawkwind.utcs.toronto.edu
Subject: Re: Japanese input and Sam 
In-reply-to: Your message of "Mon, 07 Nov 1994 16:44:31 EST."
             <199411072144.NAA01283@hassle.Stanford.EDU> 
Date:	Mon, 7 Nov 1994 17:53:04 -0500
From:	Scott Schwartz <schwartz@galapagos.cse.psu.edu>
Message-Id: <94Nov7.175308est.12686@galapagos.cse.psu.edu>
Status: O


| Has anyone hacked japanese input methods into 'sam'?  

Since libXg already uses libXt, you might as well use the 
X11 style input methods (assuming anyone can figure them out :-))
instead of inventing yet another thing or messing with tcl.

From sam-fans-owner@hawkwind.utcs.toronto.edu Tue Nov  8 10:22:17 1994
Received: by staff.cs.su.oz.au with postie; Tue, 08 Nov 1994 10:22:17 +1000
Received: from hawkwind.utcs.utoronto.ca. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from sam-fans-owner@hawkwind.utcs.toronto.edu to matty@cs.su.OZ.AU);
	Tue, 08 Nov 1994 02:37:52 +1100
Received: from drizzle.Stanford.EDU ([36.59.0.16]) by hawkwind.utcs.utoronto.ca with SMTP id <23985>; Mon, 7 Nov 1994 18:19:18 -0500
Received: (castor@localhost) by drizzle.Stanford.EDU (8.6.8/8.6.4) id PAA02889; Mon, 7 Nov 1994 15:18:50 -0800
From:	Castor Fu <castor@drizzle.Stanford.EDU>
Message-Id: <199411072318.PAA02889@drizzle.Stanford.EDU>
Subject: Re: Japanese input and Sam
To:	schwartz@galapagos.cse.psu.edu (Scott Schwartz)
Date:	Mon, 7 Nov 1994 18:18:49 -0500
Cc:	sam-fans@hawkwind.utcs.toronto.edu
In-Reply-To: <94Nov7.175308est.12686@galapagos.cse.psu.edu> from "Scott Schwartz" at Nov 7, 94 05:53:04 pm
X-Mailer: ELM [version 2.4 PL23]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1760      
Status: O

> | Has anyone hacked japanese input methods into 'sam'?  
> 
> Since libXg already uses libXt, you might as well use the 
> X11 style input methods (assuming anyone can figure them out :-))
> instead of inventing yet another thing or messing with tcl.

This might be the right solution.  However, it scares me.  When looking
through libXg, it seems that libXg tries sufficiently hard to NOT to
look like an Xt widget that anyone wanting to fix this has a lot of
work ahead of themselves.

As for the question of using the X11 i18n mechanisms, I'll quote a few
portions of some relevant docs:

>From the X11R5 i18n docs:

	Bear in mind that input methods are a technology that has
	prviously been used only in {\em ad hoc} ways for specific
	languages.  . . One frustration is the     ambiguity, in places
	of the XIM specification. . .. .  None of the input methods
	that are shipped with X11R5 are part of the core distribution,
	and none are fully robust or well documented (not in English,
	at least). . .

>From the X11R6 release notes:

	The IM Protocol is a completely new protocol, based on
	experience with R5's sample implementations.  The following new
	features are added, beyond the mechanisms in the R5 sample
	implementations . . .

I agree that one doesn't want to re-invent the wheel; the question is,
which wheel do you want?  One of the input mechanisms which is widely used,
(SKK) is apparently NOT tied to X11,  was  designed under  Emacs-lisp,
and has even  been ported to the DOS environment.  It looks vastly simpler
than any of the XIM based methods.  By using TCL appropriate
interface might be able to support either system.  Trying to use one of
the X11Rn methods sounds like a sure way to guarantee compatibility problems.

	-castor

From :micro@cooper.edu@plan9.cs.su.oz.au Fri Dec  2 05:55:38 1994
Received: by staff.cs.su.oz.au with postie; Fri, 02 Dec 1994 05:55:38 +1000
Received: from lore.plan9.cs.su.oz.au. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from @plan9.cs.su.oz.au:micro@cooper.edu to matty@cs.su.oz.au);
	Thu, 01 Dec 1994 02:45:52 +1100
X-Frobozz-Id: <19941202055540.0.in.frobozz@staff>
X-Full-Sender-Address: @plan9.cs.su.oz.au:micro@cooper.edu
From: @plan9.cs.su.oz.au:micro@cooper.edu
Date: Fri, 2 Dec 1994 04:55:24 +1000
To: dhog@plan9.cs.su.oz.au, matty@plan9.cs.su.oz.au
Subject: 9wm, 9term and reshape
Content-Length: 253
Status: O

Thu Dec  1 13:39:37 EST 1994

i've been having an intermittent
problem with reshaping 9term
under 9wm.

after the reshape operation, data
fills the new 9term window, but the 
original window dimensions are actually
active.

micro

9wm Version 0.95-beta

From arnold@cc.gatech.edu Fri Dec  9 01:55:26 1994
Received: by staff.cs.su.oz.au with postie; Fri, 09 Dec 1994 01:55:26 +1000
Received: from burdell.cc.gatech.edu. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from arnold@cc.gatech.edu to dhog@cs.su.oz.au,
	matty@cs.su.oz.au);
	Thu, 08 Dec 1994 02:43:48 +1100
Received: from penfold.cc.gatech.edu (arnold@penfold.cc.gatech.edu [130.207.3.249]) by burdell.cc.gatech.edu (8.6.9/8.6.9) with ESMTP id JAA04360; Thu, 8 Dec 1994 09:55:19 -0500
Received: (from arnold@localhost) by penfold.cc.gatech.edu (8.6.9/8.6.9) id JAA04631; Thu, 8 Dec 1994 09:55:17 -0500
From: arnold@cc.gatech.edu (Arnold Robbins)
Message-Id: <199412081455.JAA04631@penfold.cc.gatech.edu>
Date: Thu, 8 Dec 1994 09:55:16 -0500
In-Reply-To: Glenn Barry's 42-line message on Dec  7,  5:37pm
X-Ultrix: Just Say NO!
X-Important-Saying: Premature Optimization Is The Root Of All Evil.
X-Mailer: Mail User's Shell (7.2.5 10/14/92)
To: glenn@mathcs.emory.edu (Glenn Barry)
Subject: Re: 9term testing
Cc: matty@cs.su.oz.au, dhog@cs.su.oz.au
Status: O

> ok, as it turns out the 9terms I have work ok *when* I sweep out the
> area with the 3rd button .. what was crashing was when I would click
> on the 3rd button to create the window when the crosshairs
> appear... is that not supposed to work or am i confusing that with sam
> or something?
> 
> anyway to to just click so it comes up with a basic 80xsomething window
> or to I have to sweep out everytime and hope I get 80cols?

You do have to sweep it every time.  In this respect, it is different
from sam, where the default behavior is to fill the whole space.
However, getting 9term to crash is not a good thing, so I've carboned
this to matty and david (authors of 9term and 9wm, respectively) so
that they can think about this.

Arnold

From dhog@plan9.cs.su.oz.au Fri Dec 16 03:12:23 1994
Received: by staff.cs.su.oz.au with postie; Fri, 16 Dec 1994 03:12:23 +1000
Received: from lore.plan9.cs.su.oz.au. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from dhog@plan9.cs.su.oz.au to matty@cs.usyd.edu.au);
	Fri, 16 Dec 1994 02:48:05 +1100
Date: Fri, 16 Dec 1994 03:09:35 EDT
From: David Hogan <dhog@plan9.cs.su.oz.au>
To: matty@cs.usyd.edu.au (James Matthew Farrow)
cc: arnold@cc.gatech.edu, micro@cooper.edu, john@physiol.su.oz.au
Subject: Re: 9term resize bug found!!!
X-Frobozz-Id: <19941216031225.0.in.frobozz@staff>
Status: O

>I digress, what do people think of a small patch bundled with 9term
>to patch this problem in libXg?

I'd recommend doing _all three_ of the following:

(1) Send a copy of the patch to the Labs
(2) Bundle the patch with 9term, with a note that it
    is to fix an old problem in libXg which should
    be fixed in newer versions
(3) move the call to frinit() to before bitblt(), to
    make it robust against lazy people who don't apply
    patches.

Don't just fix bugs, erradicate them!  :-)

From arnold@cc.gatech.edu Fri Dec 16 09:36:02 1994
Received: by staff.cs.su.oz.au with postie; Fri, 16 Dec 1994 09:36:02 +1000
Received: from burdell.cc.gatech.edu. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from arnold@cc.gatech.edu to matty@cs.su.oz.au);
	Fri, 16 Dec 1994 02:48:05 +1100
Received: from penfold.cc.gatech.edu (arnold@penfold.cc.gatech.edu [130.207.3.249]) by burdell.cc.gatech.edu (8.6.9/8.6.9) with ESMTP id RAA06937; Thu, 15 Dec 1994 17:35:54 -0500
Received: (from arnold@localhost) by penfold.cc.gatech.edu (8.6.9/8.6.9) id RAA11617; Thu, 15 Dec 1994 17:35:51 -0500
From: arnold@cc.gatech.edu (Arnold Robbins)
Message-Id: <199412152235.RAA11617@penfold.cc.gatech.edu>
Date: Thu, 15 Dec 1994 17:35:51 -0500
In-Reply-To: David Hogan's 36-line message on Dec 16,  1:15am
X-Ultrix: Just Say NO!
X-Important-Saying: Premature Optimization Is The Root Of All Evil.
X-Mailer: Mail User's Shell (7.2.5 10/14/92)
To: David Hogan <dhog@plan9.cs.su.oz.au>
Subject: Re: 9term resize bug found!!!
Cc: matty@cs.su.oz.au
Status: O

Well, at least I'm not seeing things.  Have you sent the bug report on
to bobf at the labs?  Would you like me to?

And, I agree with all your proposed steps about fixing the bug. It is
definitely worth distributing a patch, so that 9term behaves correctly.

Thanks, and Congratulations!

Arnold

From sam-fans-owner@hawkwind.utcs.toronto.edu Mon Dec 19 04:43:58 1994
Received: by staff.cs.su.oz.au with postie; Mon, 19 Dec 1994 04:43:58 +1000
Received: from hawkwind.utcs.utoronto.ca. (insecurely) by staff.cs.su.OZ.AU.
	(Mail from sam-fans-owner@hawkwind.utcs.toronto.edu to matty@cs.su.oz.au);
	Mon, 19 Dec 1994 02:39:49 +1100
Received: from relay3.UU.NET ([192.48.96.8]) by hawkwind.utcs.utoronto.ca with SMTP id <24149>; Sun, 18 Dec 1994 12:41:30 -0500
Received: from uucp1.UU.NET by relay3.UU.NET with SMTP 
	id QQxuvm09076; Sun, 18 Dec 1994 12:41:16 -0500
Received: from rexago8.UUCP by uucp1.UU.NET with UUCP/RMAIL
        ; Sun, 18 Dec 1994 12:41:11 -0500
Received: by summitis.com (smail2.5)
	id AA19757; 18 Dec 94 12:16:48 EST (Sun)
Received: from summitis.com by rserv1.summitis.com; Sun, 18 Dec 1994 12:15 EST
Received: from cheetah by rexsrvr2.summitis.com (AIX 3.2/UCB 5.64/4.03)
          id AA78676; Sun, 18 Dec 1994 12:14:51 -0500
Received: by cheetah (AIX 3.2/UCB 5.64/4.03)
          id AA16943; Sun, 18 Dec 1994 12:14:50 -0500
From:	hc05@summitis.com
Message-Id: <9412181714.AA16943@cheetah>
Subject: 9term & AIX
To:	sam-fans@hawkwind.utcs.toronto.edu (Sam mailing list)
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII
Content-Length: 1765
Date:	Sun, 18 Dec 1994 12:41:18 -0500
Status: O

I ported 9term to AIX 3.2.5.  This is the third time I have tried it and I 
think I have it working well.  I have a few questions, though, to see if it
is working the way it should be:

Should the suspend (^z), interrupt(DEL or ^c) and other interrupt keys
do the usual UNIX things?  I am seeing them passed through to the shell
without having the intended effects of job control or program
termination.  If I do an rlogin to another machine, though, they work
fine.

How do I set the modes resource?  I found that I have to make sure I set 
icanon, which only occurs if I start a 9term under xterm.  If I start it under
9wm I get my prompt redrawn whenever I start a command and newlines don't 
work right.  I'm setting this for now in my $ENV file in ksh, but I would
like to put it in my resource file.  I tried things like this but they didn't
work:

9Term*p9TtyModes: icanon
9Term*ttyModes: icanon

One final unrelated question:  what is es?  I know about 9wm, sam, rc, and 
9term but don't know what es is.

Thanks,
Beirne

-- 
-------------------------------------------------------------------------------
Beirne Konarski                 | Reading maketh a full man, conference a
beirnek@summitis.com            | ready man, and writing an exact man.
"Untouched by Scandal"          |       -- Francis Bacon
-------------------------------------------------------------------------------


-- 
-------------------------------------------------------------------------------
Beirne Konarski                 | Reading maketh a full man, conference a
beirnek@summitis.com            | ready man, and writing an exact man.
"Untouched by Scandal"          |       -- Francis Bacon
-------------------------------------------------------------------------------

From sam-fans-owner@hawkwind.utcs.toronto.edu Mon Dec 26 08:48:21 1994
Received: by staff.cs.su.oz.au with postie; Mon, 26 Dec 1994 08:48:21 +1000
Received: from hawkwind.utcs.utoronto.ca. by staff.cs.su.OZ.AU.; Mon, 26 Dec 1994 08:48:15 +1100
Received: from galapagos.cse.psu.edu ([130.203.2.12]) by hawkwind.utcs.utoronto.ca with SMTP id <24153>; Sun, 25 Dec 1994 16:47:41 -0500
Received: from localhost by galapagos.cse.psu.edu with SMTP id <12684>; Sun, 25 Dec 1994 16:47:17 -0500
To:	sam-fans@hawkwind.utcs.toronto.edu
Date:	Sun, 25 Dec 1994 16:47:13 -0500
From:	Scott Schwartz <schwartz@galapagos.cse.psu.edu>
Message-Id: <94Dec25.164717est.12684@galapagos.cse.psu.edu>
Status: O


Hi gang,
  I've made some changes to Matty's 9term v1.6.2 which I thought
I'd share.  The changes are:

	* Fix the Xrm stuff to not poke around inside the display structure,
	  so that it will work with X11R6.

	* Export the (correct) DISPLAY variable to the shell, like xterm does.

	* Under SUNOS, make utmp entries using ttyslot, like xterm and others do.

	* Don't put null host fields in utmp, even for local displays.

	* The tcdrain fix(?) that someone else posted.

-- Scott


*** 1.1	1994/12/13 04:33:24
--- display.c	1994/12/20 23:37:44
***************
*** 29,40 ****
  
  #include "9term.h"
  
- #ifdef __alpha
- #	define XRDB	(((_XPrivDisplay)_dpy)->db)
- #else
- #	define XRDB	(_dpy->db)
- #endif
- 
  extern	Display	*_dpy;
  extern	Widget	_toplevel;
  
--- 29,34 ----
***************
*** 136,142 ****
  
  	sprintf(str1, "%s.%s", resource, rname);
  	sprintf(str2, "%s.%s", class, cname);
! 	if (XrmGetResource(XRDB, str1, str2, &str_type, &value) == True) {
  		strncpy(result, value.addr, (int)value.size);
  		return result;
  	}
--- 130,138 ----
  
  	sprintf(str1, "%s.%s", resource, rname);
  	sprintf(str2, "%s.%s", class, cname);
! 	if (XrmGetResource(
! 			XrmGetDatabase(_dpy),
! 			str1, str2, &str_type, &value) == True) {
  		strncpy(result, value.addr, (int)value.size);
  		return result;
  	}
***************
*** 209,214 ****
--- 205,211 ----
  void
  init_display(int *argc, char **argv, char **shargv, char *resource)
  {
+ 	XrmDatabase	rdb;
  	XrmDatabase	cmd;
  	char		**cp;
  	char		id[512];
***************
*** 225,231 ****
  	xtbinit(0, resource, argc, argv, fallbacks);
  
  		/* we're still not done with the command line */
! 	XrmMergeDatabases(cmd, &XRDB);
  #ifdef DEBUG_X
  	XSynchronize(_dpy, True);
  	XSetErrorHandler(abort);
--- 222,229 ----
  	xtbinit(0, resource, argc, argv, fallbacks);
  
  		/* we're still not done with the command line */
! 	rdb = XrmGetDatabase(_dpy);
! 	XrmMergeDatabases(cmd, &rdb);
  #ifdef DEBUG_X
  	XSynchronize(_dpy, True);
  	XSetErrorHandler(abort);
***************
*** 233,238 ****
--- 231,238 ----
  		/* export window id to environment */
  	sprintf(id, "%d", XtWindow(_toplevel));
  	setenv("WINDOWID", id, 1);
+ 		/* make the display env var match the actual display */
+ 	setenv("DISPLAY", XDisplayString(_dpy), 1);
  
  		/* register mouse and keyboard events */
  	einit(Ekeyboard | Emouse);
*** 1.1	1994/12/13 20:51:08
--- pty.c	1994/12/25 21:31:13
***************
*** 409,414 ****
--- 409,415 ----
  				;
  #if !defined(PCKT) && !defined(REMOTE)
  		/* reinstate echo mode, if we disabled it above */
+ 	tcdrain (comm_fd);
  	if (echo) {
  		ttmode.c_lflag |= ECHO;
  		IOSETATTR(slave_fd, &ttmode);
***************
*** 573,583 ****
--- 574,586 ----
  	char *user, *display, *cp;
  	struct utmp utmp;
  	int fd;
+ 	int save_fd;
  
  	user = getuser();
  	fd = open("/etc/utmp", O_RDWR);
  	if (fd < 0)
  		return;
+ #ifndef SUNOS
  	/*
  	 * search for existing entry or add a new entry
  	 * to the end of the file if one is not found.
***************
*** 590,607 ****
--- 593,632 ----
  		}
  		slot++;
  	}
+ #else /* SUNOS */
+ 	/* XXX - ttyslot assumes that fd 0 is already attached to the 
+ 	   9term pty, so we jump thru some hoops to make it so, and
+ 	   then put it back.  Since we don't use stdin, we could probably
+ 	   leave off the last bit. */
+ #undef dup
+ 	save_fd = dup (0);
+ 	if (save_fd < 0)
+ 	    goto done;
+         dup2 (slave_fd, 0);
+ 	slot = ttyslot ();
+ 	dup2 (save_fd, 0);
+ 	close (save_fd);
+ 	if (slot <= 0)
+ 	    goto done;
+ 	
+ 	lseek (fd, slot*sizeof(utmp), SEEK_SET);	
+ #endif /* SUNOS */
+ 
  		/* build the entry and write it */
  	strncpy(utmp.ut_line, ttyname, sizeof(utmp.ut_line));
  	strncpy(utmp.ut_name, user, sizeof(utmp.ut_name));
  	display = getenv("DISPLAY");
  	if (display) {
+ /*
  		cp = strchr(display, ':');
  		if (cp)
  			*cp = 0;
+ */
  		strncpy(utmp.ut_host, display, sizeof(utmp.ut_host));
  	}
  	time(&utmp.ut_time);
  	write(fd, &utmp, sizeof(utmp));
+ done:
  	close(fd);
  }
  

From quanstro@sartre.minerva.bah.com Fri Feb  3 22:17:02 1995
Received: by staff.cs.su.oz.au with postie; Fri, 03 Feb 1995 22:17:02 +1000
Received: from sartre.minerva.bah.com by staff.cs.su.OZ.AU.; Fri, 03 Feb 1995 22:16:58 +1100
Received: from pigsnose by sartre.minerva.bah.com (NX5.67d/NX3.0M)
	id AA14085; Fri, 3 Feb 95 06:08:45 -0500
Date: Fri, 3 Feb 95 06:08:45 -0500
From: Erik Quanstrom <quanstro@sartre.minerva.bah.com>
Message-Id: <9502031108.AA14085@sartre.minerva.bah.com>
Subject: 9term funn∤y character problem
Apparently-To: <matty@staff.cs.su.oz.au>
Status: O

you're probablly right, that some odd tty flag is getting set. it seems that 
certian wonderful programs (ahem) that use readline like to mess with the tty
setting and not put things back where they found them.

btw. i modifyed gnu ls (bad hack, but it works) so that 
1) it doesn't print ? instead of the proper unicode character
2) if it sees an rc metacharacter, it quotes the whole word.
3) -I ? will exclude α
and i'm almost finished with modifying rc-1.4 ∍ unicode works througout.
(i've got those miserable here docs and backquoting to go.) much of the 
rc backquoting code is a lot less straightforward than needs be. i was able
to modify my shell for unicode support in ~15minutes. (well, then again,
it doesn't have here docs, for religious reasons.).

btw. also. how could i modify 9term so that it automatically chooses it's size
& doesn't have to be swept out under 9wm?

thanks,

erik quanström

From sam-fans-owner@hawkwind.utcs.toronto.edu Wed Feb  8 00:20:05 1995
Received: by staff.cs.su.oz.au with postie; Wed, 08 Feb 1995 00:20:05 +1000
Received: from hawkwind.utcs.utoronto.ca. by staff.cs.su.OZ.AU.; Wed, 08 Feb 1995 00:20:00 +1100
Received: from cegelecproj.co.uk ([159.245.72.6]) by hawkwind.utcs.utoronto.ca with SMTP id <24011>; Tue, 7 Feb 1995 08:14:44 -0500
Received: from vampire.cegelecproj.co.uk (cerberus.cegelecproj.co.uk) by cegelecproj.co.uk (4.1/SMI-4.1)
	id AA01143; Tue, 7 Feb 95 13:15:24 GMT
Received: from spirit.cegelecproj.co.uk (spirit.limbo.cegelecproj.co.uk) by vampire.cegelecproj.co.uk (5.0/SMI-SVR4)
	id AA27750; Tue, 7 Feb 1995 13:18:09 +0000
Received: by spirit.cegelecproj.co.uk (5.0/SMI-SVR4)
	id AA06143; Tue, 7 Feb 1995 12:59:20 +0000
Date:	Tue, 7 Feb 1995 07:59:20 -0500
From:	Steve_Kilbane@cegelecproj.co.uk (Steve_Kilbane)
Message-Id: <9502071259.AA06143@spirit.cegelecproj.co.uk>
X-Planation: X-Faces images can be viewed with the XFaces program
To:	sam-fans@hawkwind.utcs.toronto.edu
Subject: 9term/9wm hacks
Content-Length: 2274
X-Face: Iqsa(US9p?)Y^W+6Ff[Z]<t?\A!eaL'DG{20*#{C1;'Ct&}L}B^/1(aYI@hP)4!<}7D=2gm
	8!$T`8QNfK<te\20%A\`wm*wa2"^Up*Qs"X}KeV*3XeB2te&sKp*t`N;^BDh[6=K{ZBE=O>rM"uFE)
	lFDjag1e]\/#2
Status: O

I've been playing with some small hacks to 9term and 9wm which I
thought I'd mention to the list, since they might be of interest.
Basically, I was wondering how some of the characteristics of
8½ and Help could be implemented using the existing arrangement.
Basically I was after some level of programmability without having
to change the tools much (or do much work:-)).

In 9term, I've implemented command inputs via a pipe, similar to
the command pipe sam uses. Each 9term creates a named pipe with
the name /tmp/.9terms.$USER.$DISPLAY/$WINDOWID. Characters read
from this pipe get sent to the shell, and also appear on the
screen. The directory that the pipes are created in is mode 700,
as a nod towards security, but how safe this is, I don't know.

In 9wm, each time a window is made current the file
/tmp/.9wm-windows is re-written, containing a line for each
window. Each line contains <window label><space><windowid>.
The lines are written in the same order as the window focus
list, so the current window is the first line, the previous
current window is the second line, and so on.

>From here on in, it's just script writing. The most common
script determines which 9term was the most recently used,
and sends its arguments to that 9term's pipe. Another
script is similar, but uses xv_get_sel to determine text
that was last snarfed, and uses that in the command.

Scripts are normally run from 9menu popped up from the
main 9menu. One contains the commands used while producing
a document with latex, another has commands often used
while building an instance of the current program I'm
working on, and a third pops up the last 15 commands from
$history, for re-execution. Although I haven't done this,
9menus could be created which send commonly-used commands
to the current instance of sam (personally, I don't have
many sam commands I use a lot).

It's not a perfect system. Security is bound to be a problem,
the 9wm file should have a more unique name, and if you send
text to a 9term pipe it doesn't currently set dot first, so
the text appears in the wrong place. The command still works,
though. Finally, the hacks aren't to the most recent version
of 9term (they're to 1.3.2, and I know that matty's up to
at least 1.5).

Comments are welcome.

steve

From sam-fans-owner@hawkwind.utcs.toronto.edu Mon Feb 20 03:11:40 1995
Received: by staff.cs.su.oz.au with postie; Mon, 20 Feb 1995 03:11:40 +1000
Received: from hawkwind.utcs.utoronto.ca. by staff.cs.su.OZ.AU.; Mon, 20 Feb 1995 03:11:37 +1100
Received: from burdell.cc.gatech.edu ([130.207.3.207]) by hawkwind.utcs.utoronto.ca with SMTP id <24014>; Sun, 19 Feb 1995 11:04:37 -0500
Received: from penfold.cc.gatech.edu (arnold@penfold.cc.gatech.edu [130.207.3.249]) by burdell.cc.gatech.edu (8.6.9/8.6.9) with ESMTP id LAA16942 for <sam-fans@hawkwind.utcs.toronto.edu>; Sun, 19 Feb 1995 11:04:34 -0500
Received: (from arnold@localhost) by penfold.cc.gatech.edu (8.6.9/8.6.9) id LAA03834 for sam-fans@hawkwind.utcs.toronto.edu; Sun, 19 Feb 1995 11:04:32 -0500
Date:	Sun, 19 Feb 1995 11:04:32 -0500
From:	arnold@cc.gatech.edu (Arnold Robbins)
Message-Id: <199502191604.LAA03834@penfold.cc.gatech.edu>
To:	sam-fans@hawkwind.utcs.toronto.edu
Subject: article on Plan 9 interface for Unix
Status: O

Greetings.

I have placed the original ascii of a two part article I wrote on sam,
9term, 9wm, 9menu, rc and es up for ftp. This article is for Linux Journal.
The first part was just published, the second part will come out next month.

Most people on the list know all about what's in the article already, but it
may be useful to give to others whom you wish to proselytize, er, "help be
more productive." (:-)

It's available from ftp.cc.gatech.edu in /pub/people/arnold, in the
file plan9.interface.for.unix.

Enjoy,

Arnold

From dws@ssec.wisc.edu Thu Mar  9 09:37:22 1995
Received: by staff.cs.su.oz.au with postie; Thu, 09 Mar 1995 09:37:22 +1000
Received: from ssec.ssec.wisc.edu. by staff.cs.su.OZ.AU.; Thu, 09 Mar 1995 09:33:56 +1000
Received: from localhost by ssec.ssec.wisc.edu;
          id AA43712; AIX 3.2/UCB 5.64/42; Wed, 8 Mar 1995 17:33:43 -0600
Message-Id: <9503082333.AA43712@ssec.ssec.wisc.edu>
To: matty@cs.usyd.edu.au (James Matthew Farrow)
Subject: Re: 9term 1.6.3 on AIX 3.2.5 
In-Reply-To: Your message of "Wed, 08 Mar 1995 10:58:52 +1000."
             <19950308105851.27315.frobozz@staff.cs.su.oz.au> 
Date: Wed, 08 Mar 1995 17:33:38 -0600
From: "DaviD W. Sanderson" <dws@ssec.wisc.edu>
Status: O

# Yes, please.  I'd love to have a look at your patches.  Thanks.

Several things to note:

1) I didn't make sure that the utmp stuff worked on AIX since that needs
   root.

2) Please note the technique I used in pty.c in the new AIX _getpty()
   routine.  I think that you could probably use ttyname() in the
   RISCOS/OSF1 routine as well, meaning that for these three platforms
   anyway, you could have one routine with differences only in the
   name of the master device, and no #define for the name of the slave
   device.  It might even work on other platforms, too.

3) Please note that in pty.c I changed the body of the code to
   consistently use POSIX V* termio indices, instead of the mix of V*
   and V_* names that was there before.  For instance, it used to
   use the standard VKILL and the nonstandard V_START.  Now it uses
   the standard VSTART instead.

   I also introduced a new way to accomodate the possibility of
   different names for various indices that does not rely on
   per-platform #ifdefs.  Using this technique I was able to remove
   several platform-specific sections.  Please verify that it still
   compiles correctly on those platforms!  Note that it can easily be
   extended if necessary in order to allow for yet more names.

4) Note that the POSIX include file for termios is <termios.h>, not
   <sys/termios.h>.  Some platforms may have a <termios.h> that
   simply includes <sys/termios.h>, but others (like AIX) only have
   <termios.h>.  So <termios.h> is the one to include for POSIXPTYS.

5) I have included a pair of Make.aix files for you.  They are in the
   same sort of canonical form that you use, but without any of my
   private directories substituted in.

6) Please note that this is NOT extensively tested - I am not an
   experienced 9term user so it's quite possible there are things
   that are wrong that I can't identify!

DaviD W. Sanderson                                    dws@ssec.wisc.edu
Space Science and Engineering Center    University of Wisconsin-Madison
"The Noah Webster of smileys"    - The Wall Street Journal, 15 Sep 1992

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 03/08/1995 23:24 UTC by dws@ssec
# Source directory /home/dws/pub/src/wrk/9term1.6.3/!build
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   7416 -rw------- patch.dws
#   1395 -rw------- 9term/Make.aix
#    776 -rw------- libtext/Make.aix
#
# ============= patch.dws ==============
if test -f 'patch.dws' -a X"$1" != X"-c"; then
	echo 'x - skipping patch.dws (File already exists)'
else
echo 'x - extracting patch.dws (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'patch.dws' &&
*** 9term/9term.h0	Thu Dec 15 08:49:15 1994
--- 9term/9term.h	Mon Mar  6 16:47:23 1995
***************
*** 44,50 ****
X  extern void		sendrunes(Rune *, ulong);
X  extern void		setttyecho(int);
X  extern void		beep(void);
! extern void		catch_child(void);
X  extern void 		tty_set_size(int,int,int,int,int);
X  extern void 		init_command(char *,char **);
X  extern void		updateutmp(char*, int);
--- 44,50 ----
X  extern void		sendrunes(Rune *, ulong);
X  extern void		setttyecho(int);
X  extern void		beep(void);
! extern void		catch_child(int);
X  extern void 		tty_set_size(int,int,int,int,int);
X  extern void 		init_command(char *,char **);
X  extern void		updateutmp(char*, int);
***************
*** 62,67 ****
--- 62,71 ----
X  #define MIN(x, y)	(((x) < (y)) ? (x) : (y))
X  #ifndef NULL
X  #define NULL ((void *)0)
+ #endif
+ 
+ #ifdef	AIX
+ #define	POSIXPTYS
X  #endif
X  
X  #ifdef	SUNOS
*** 9term/command.c0	Sun Mar  6 19:50:51 1994
--- 9term/command.c	Mon Mar  6 16:46:20 1995
***************
*** 49,55 ****
X   *  handle SIGCHLD
X   */
X  void
! catch_child(void)
X  {
X  	if (wait((int *)0) == comm_pid)
X  		quit(0);
--- 49,55 ----
X   *  handle SIGCHLD
X   */
X  void
! catch_child(int sig)
X  {
X  	if (wait((int *)0) == comm_pid)
X  		quit(0);
***************
*** 58,64 ****
X   *  handle other signals
X   */
X  void
! catch_sig(void)
X  {
X  	quit(0);
X  }
--- 58,64 ----
X   *  handle other signals
X   */
X  void
! catch_sig(int sig)
X  {
X  	quit(0);
X  }
*** 9term/pty.c	Fri Jul 22 10:47:29 1994
--- !build/9term/pty.c	Wed Mar  8 17:17:06 1995
***************
*** 17,23 ****
X  #	include <sys/termio.h>
X  #	include <stropts.h>
X  	/* Isn't POSIX and portability so much fun? */
- #	define VRPRNT	VREPRINT
X  #endif
X  #if defined(IRIX)
X  #	include <termios.h>
--- 17,22 ----
***************
*** 32,75 ****
X  #	include <stropts.h>
X  #	define	HASPIXELSIZE
X  #endif
X  #ifdef PCKT
X  #	include <sys/stream.h>
X  #endif
X  #include "9term.h"
X  
- #ifdef  HPUX
- #	define 	VEOL2	_VEOL2
- #endif
- 
X  #ifdef	RISCOS
X  #	include <sys/stat.h>
X  #	include </usr/include/ctype.h>		/* to defeat posix version */
- #	define  VLNEXT V_LNEXT
- #	define 	VDSUSP V_DSUSP
- #	define	VRPRNT V_RPRNT
- #	define	VWERASE V_WERAS
X  #else
X  #	include <ctype.h>
X  #endif
X  
- #ifdef	OSF1
- #	define 	V_START VSTART
- #	define 	V_STOP VSTOP
- #	define 	V_SUSP VSUSP
- #	define 	V_DSUSP VDSUSP
- #	define	V_RPRNT VREPRINT
- #	define	V_WERAS VWERASE
- #	define	V_FLUSH VFLUSH
- #endif
- 
- #ifdef	HPUX
- #	define 	V_START VSTART
- #	define 	V_STOP VSTOP
- #	define 	V_SUSP VSUSP
- #endif
- 
X  #ifdef POSIXPTYS
! #	include <sys/termios.h>
X  #	define	termio termios
X  #else
X  #	include <sys/termio.h>
--- 31,57 ----
X  #	include <stropts.h>
X  #	define	HASPIXELSIZE
X  #endif
+ #if defined(AIX)
+ #	define _ALL_SOURCE
+ #	define _XOPEN_SOURCE
+ #	include	<sys/ioctl.h>
+ #	include <sys/stat.h>
+ #	define	HASPIXELSIZE
+ #endif
X  #ifdef PCKT
X  #	include <sys/stream.h>
X  #endif
X  #include "9term.h"
X  
X  #ifdef	RISCOS
X  #	include <sys/stat.h>
X  #	include </usr/include/ctype.h>		/* to defeat posix version */
X  #else
X  #	include <ctype.h>
X  #endif
X  
X  #ifdef POSIXPTYS
! #	include <termios.h>
X  #	define	termio termios
X  #else
X  #	include <sys/termio.h>
***************
*** 115,132 ****
X  	char udef, p9def;
X  };
X  
! #if defined(SUNOS) || defined(IRIX) || defined(SOLARIS)
! #	define V_START VSTART
! #	define V_STOP VSTOP
! #	define V_SUSP VSUSP
! #	define V_DSUSP VDSUSP
! #	ifdef SOLARIS
! #		define V_RPRNT VREPRINT
! #	else
! #		define V_RPRNT VRPRNT
! #	endif
! #	define V_WERAS VWERASE
! #	define V_FLUSH VDISCARD
X  #endif
X  
X  modenames ttymodelist[] = {
--- 97,145 ----
X  	char udef, p9def;
X  };
X  
! #ifndef VDISCARD
! # ifdef V_FLUSH
! #  define VDISCARD	V_FLUSH
! # endif
! #endif
! #ifndef VDISCARD
! # ifdef VDISCRD
! #  define VDISCARD	VDISCRD
! # endif
! #endif
! 
! #ifndef VWERASE
! # ifdef VWERSE
! #  define VWERASE	 VWERSE
! # endif
! #endif
! #ifndef VWERASE
! # ifdef V_WERAS
! #  define VWERASE	 V_WERAS
! # endif
! #endif
! 
! #ifndef VREPRINT
! # ifdef VRPRNT
! #  define VREPRINT	 VRPRNT
! # endif
! #endif
! #ifndef VREPRINT
! # ifdef V_RPRNT
! #  define VREPRINT	 V_RPRNT
! # endif
! #endif
! 
! #ifndef VLNEXT
! # ifdef V_LNEXT
! #  define VLNEXT	 V_LNEXT
! # endif
! #endif
! 
! #ifndef VEOL2
! # ifdef _EOL2
! #  define VEOL2		 _EOL2
! # endif
X  #endif
X  
X  modenames ttymodelist[] = {
***************
*** 136,162 ****
X  	{ "kill",	4, VKILL,	ctrl('u'),	ctrl('u') },
X  	{ "eof",	3, VEOF,	ctrl('d'),	ctrl('d') },
X  	{ "eol",	3, VEOL,	0,		0 },
! #ifndef _POSIX_SOURCE
X  	{ "eol2",	4, VEOL2,	0,		0 },
X  #endif
! #if	!defined(_OSF_SOURCE) && !defined(_POSIX_SOURCE)
! 	{ "swtch", 	5, VSWTCH,	0,		0 },
X  #endif
! 	{ "start",	5, V_START,	ctrl('q'),	ctrl('q') },
! 	{ "stop",	4, V_STOP,	ctrl('s'),	ctrl('s') },
! 	{ "susp",	4, V_SUSP,	ctrl('z'),	ctrl('z') },
! #ifndef HPUX
! #ifndef IRIX
! 	{ "dsusp",	5, V_DSUSP,	ctrl('y'),	ctrl('y') },
X  #endif
! 	{ "rprnt",	5, V_RPRNT,	ctrl('r'),	ctrl('r') },
! 	{ "weras",	5, V_WERAS,	ctrl('w'),	ctrl('w') },
X  	{ "lnext",	5, VLNEXT,	ctrl('v'),	ctrl('v') },
X  #endif
! #ifndef V_FLUSH
! 	{ "flush",	5, V_FLUSH,	ctrl('o'),	ctrl('o') },
X  #endif
! #ifdef	VQUOTE
X  	{ "quote",	5, VQUOTE,	'\\',		'\\' },
X  #endif
X  	{ 0,		0, 0 ,		0,		0 },
--- 149,183 ----
X  	{ "kill",	4, VKILL,	ctrl('u'),	ctrl('u') },
X  	{ "eof",	3, VEOF,	ctrl('d'),	ctrl('d') },
X  	{ "eol",	3, VEOL,	0,		0 },
! 	{ "start",	5, VSTART,	ctrl('q'),	ctrl('q') },
! 	{ "stop",	4, VSTOP,	ctrl('s'),	ctrl('s') },
! 	{ "susp",	4, VSUSP,	ctrl('z'),	ctrl('z') },
! #ifdef VWERASE
! 	{ "weras",	5, VWERASE,	ctrl('w'),	ctrl('w') },
! 	{ "werase",	6, VWERASE,	ctrl('w'),	ctrl('w') },
! 	{ "werse",	5, VWERASE,	ctrl('w'),	ctrl('w') },
! #endif
! #ifdef VEOL2
X  	{ "eol2",	4, VEOL2,	0,		0 },
X  #endif
! #ifdef VDSUSP
! 	{ "dsusp",	5, VDSUSP,	ctrl('y'),	ctrl('y') },
X  #endif
! #ifdef VREPRINT
! 	{ "rprnt",	5, VREPRINT,	ctrl('r'),	ctrl('r') },
! 	{ "reprint",	7, VREPRINT,	ctrl('r'),	ctrl('r') },
! #endif
! #ifdef VDISCARD
! 	{ "discard",	7, VDISCARD,	ctrl('o'),	ctrl('o') },
! 	{ "flush",	5, VDISCARD,	ctrl('o'),	ctrl('o') },
X  #endif
! #ifdef VLNEXT
X  	{ "lnext",	5, VLNEXT,	ctrl('v'),	ctrl('v') },
X  #endif
! #ifdef VSWTCH
! 	{ "swtch", 	5, VSWTCH,	0,		0 },
X  #endif
! #ifdef VQUOTE
X  	{ "quote",	5, VQUOTE,	'\\',		'\\' },
X  #endif
X  	{ 0,		0, 0 ,		0,		0 },
***************
*** 359,365 ****
--- 380,390 ----
X  		wordchar = ctrl('w');
X  #endif
X  		eofchar = ttmode.c_cc[VEOF];
+ #ifdef VEOL2
X  		eolchar = ttmode.c_cc[VEOL2];
+ #else
+ 		eolchar = 0;
+ #endif
X  	}
X  }
X  #undef ctrl
***************
*** 448,453 ****
--- 473,516 ----
X   *	bothered and each supplies a potentially incompatible method of
X   *	locating an available pseudo-tty.
X   */
+ 
+ #if defined(AIX)
+ 
+ #define MASTERCLONE	"/dev/ptc"
+ 
+ /*
+  *	open the master end of a pseudo-tty and return the name
+  *	of the slave end (AIX).
+  *	this uses ttyname() instead of TTYPREFIX and so may be
+  *	more portable...
+  */
+ char *
+ _getpty(int *fd, int mode, int perm, int flag)
+ {
+ 
+ 	struct stat stat;
+ 
+ 	static char slave[256];
+ 
+ 	char *pname;
+ 
+ 	*fd = open(MASTERCLONE, mode);
+ 	if (*fd < 0)
+ 		return 0;
+ 
+ 	if (fstat(*fd, &stat) < 0)
+ 		return 0;
+ 
+ 	pname = ttyname(*fd);	/* gives name of slave */
+ 	if(!pname)
+ 		return 0;
+ 
+ 	strcpy(slave, pname);
+ 	chmod(slave, perm);
+ 	return slave;
+ }
+ 
+ #endif	/* AIX */
X  
X  #if defined(RISCOS) || defined(OSF1)
X  
SHAR_EOF
chmod 0600 patch.dws ||
echo 'restore of patch.dws failed'
Wc_c="`wc -c < 'patch.dws'`"
test 7416 -eq "$Wc_c" ||
	echo 'patch.dws: original size 7416, current size' "$Wc_c"
fi
# ============= 9term/Make.aix ==============
if test ! -d '9term'; then
    echo 'x - creating directory 9term'
    mkdir '9term'
fi
if test -f '9term/Make.aix' -a X"$1" != X"-c"; then
	echo 'x - skipping 9term/Make.aix (File already exists)'
else
echo 'x - extracting 9term/Make.aix (Text)'
sed 's/^X//' << 'SHAR_EOF' > '9term/Make.aix' &&
#
#	Prototype Makefile for 9term
#
#	define operating system.  ONE of:
#		-DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX
#	
#	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
#	if your compiler supports posix-compatible compilation
#
#	Define RISCOS for Mips RISC/os
#	Define BSDPTYS for BSD-style pty support
#	Define POSIXPTYS for POSIX ptys
OS=-DAIX -D_POSIX_SOURCE
X
# where we'll install it
BINDIR=/usr/pgrad/matty/bin/$(cputype)
X
HEADERFILE=9term.h
TARGET=9term
INCLUDES= -I. -I../include
CFLAGS= $(OS) $(INCLUDES) -D_LIBXG_EXTENSION
LDFLAGS=
CC= xlc
X
# change this if your X11 libraries are in different places
# or if you need extra libraries to load with X11 applications
LIBS=../libtext/libtext.a ../libframe/libframe.a ../libXg/libXg.a
XXLIBS=-lXt -lX11
X
OBJECTS=9term.o command.o display.o pty.o
X
$(TARGET): $(OBJECTS)
X	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(XLIBS) -lm
X
wloc: wloc.o
X	$(CC) $(LDFLAGS) -o wloc wloc.o $(LIBS) $(XLIBS) -lm
X
label: wloc
X	ln wloc label
X
unicode: unicode.o
X	$(CC) $(LDFLAGS) -o unicode unicode.o $(LIBS) $(XLIBS) -lm
X
install: $(TARGET) wloc label
X	cp $(TARGET) $(BINDIR)
X	chown root $(BINDIR)/$(TARGET)
X	chmod 04755 $(BINDIR)/$(TARGET)
X	mv wloc $(BINDIR)
X	mv label $(BINDIR)
X	mv unicode $(BINDIR)
X
clean:
X	rm -f *.o core
X
nuke: clean
X	rm -f $(TARGET) wloc label unicode
X
$(OBJECTS): 9term.h
SHAR_EOF
chmod 0600 9term/Make.aix ||
echo 'restore of 9term/Make.aix failed'
Wc_c="`wc -c < '9term/Make.aix'`"
test 1395 -eq "$Wc_c" ||
	echo '9term/Make.aix: original size 1395, current size' "$Wc_c"
fi
# ============= libtext/Make.aix ==============
if test ! -d 'libtext'; then
    echo 'x - creating directory libtext'
    mkdir 'libtext'
fi
if test -f 'libtext/Make.aix' -a X"$1" != X"-c"; then
	echo 'x - skipping libtext/Make.aix (File already exists)'
else
echo 'x - extracting libtext/Make.aix (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'libtext/Make.aix' &&
#
#	Prototype Sun Makefile for libtext
#
#	Define operating system type: -DSUNOS
#	
#	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
#	if your compiler supports posix-compatible compilation
OS=-DAIX -D_POSIX_SOURCE
X
#	add -Iincludedir for any include directories that need to be searched
#	for posix header files
INCS=-I. -I../include
X
#	add name of library orderer - use ":" if none exists
RANLIB=:
X
#	add name of library
AR=ar
X
CFLAGS=-c $(OS) $(INCS) -D_LIBXG_EXTENSION
X
LIB=libtext.a
CC= xlc
X
OBJ=click.o scroll.o text.o
X
all:	$(LIB)
X
$(LIB):	$(OBJ)
X	$(AR) rv $(LIB) $(OBJ)
X	$(RANLIB) $(LIB)
X
clean:
X	rm -f *.o
X
nuke:	clean
X	rm -f $(LIB)
X
install:	$(LIB)
X
$(OBJ):	../include/u.h ../include/libc.h ../include/libg.h ../include/frame.h ../include/text.h
SHAR_EOF
chmod 0600 libtext/Make.aix ||
echo 'restore of libtext/Make.aix failed'
Wc_c="`wc -c < 'libtext/Make.aix'`"
test 776 -eq "$Wc_c" ||
	echo 'libtext/Make.aix: original size 776, current size' "$Wc_c"
fi
exit 0

From aeb@cwi.nl Sun Mar 12 05:18:53 1995
Received: by staff.cs.su.oz.au with postie; Sun, 12 Mar 1995 05:18:53 +1000
Received: from charon.cwi.nl. by staff.cs.su.OZ.AU.; Sun, 12 Mar 1995 05:18:46 +1000
Received: from zeus.cwi.nl by charon.cwi.nl with SMTP
	id <AA28154@cwi.nl>; Sat, 11 Mar 1995 20:18:38 +0100
Received: by zeus.cwi.nl 
	id AA12863 (5.65b/3.8/CWI-Amsterdam); Sat, 11 Mar 1995 20:18:38 +0100
Date: Sat, 11 Mar 1995 20:18:38 +0100
From: Andries.Brouwer@cwi.nl
Message-Id: <9503111918.AA12863=aeb@zeus.cwi.nl>
To: matty@cs.su.oz.au
Subject: 9term
Status: O

Dear Matty,
I ftp-ed the contents of ftp.cs.su.oz.au:/matty/unicode
and compiled it under Linux. I had to make the changes below
to get things to compile.
If I start 9term without arguments, I get something that
works as long as I stay away from unicode, but crashes as
soon as I cat a UTF-8 file ("libg error: bad combination of copy bitmaps:").
I have not yet investigated things further.

In order to save others the effort that I had to spend
(trying to compile 9term: u.h not found - now where do I find u.h? Etc.)
you might add a README or INSTALL saying things like:
========================
Installing these goodies:
	mkdir foo
	cd foo
	gunzip < ../sam.msg.gz | sh
	gunzip < ../9term.1.6.3.tar.gz | tar xf -
next adapt the Makefiles in foo/libXg foo/libtext foo/libframe foo/9term
and say make in each of these directories (last in 9term).
========================
(The subdirectory foo is probably necessary because sam spills junk
in the current directory; in particular, it would destroy a README.)

Maybe more things have to be changed - as I said, it does not yet really
work for me.
About the changes: they will be obvious. My include files have a killpg()
with a different prototype, that's the reason for my_killpg.

All the best - Andries - aeb@cwi.nl

diff -r -u unicode0/9term/9term.1 unicode/9term/9term.1
--- unicode0/9term/9term.1	Tue Sep 20 05:29:49 1994
+++ unicode/9term/9term.1	Sat Mar 11 19:31:56 1995
@@ -143,11 +143,11 @@
 .PP
 The
 .B \-ls
-option make the window a login window (prepends a `\-' to
+option makes the window a login window (prepends a `\-' to
 .IR cmd ).
 The option
 .B +ls
-attempt to do the opposite.
+attempts to do the opposite.
 The default is not to create a login window.
 .PP
 The
diff -r -u unicode0/9term/9term.c unicode/9term/9term.c
--- unicode0/9term/9term.c	Fri Jun  3 10:35:39 1994
+++ unicode/9term/9term.c	Sat Mar 11 18:42:43 1995
@@ -718,7 +718,7 @@
 	texthighlight(t, t->length, t->length, F&~D);
 #ifdef REMOTE
 	flushstream();
-	killpg(r == quitchar ? SIGQUIT : SIGINT);
+	my_killpg(r == quitchar ? SIGQUIT : SIGINT);
 #else
 	sendrunes(&r, 1);
 #endif
diff -r -u unicode0/9term/9term.h unicode/9term/9term.h
--- unicode0/9term/9term.h	Thu Dec 15 15:49:15 1994
+++ unicode/9term/9term.h	Sat Mar 11 19:23:13 1995
@@ -75,7 +75,7 @@
 #define BSDPTYS
 #endif
 
-#if	defined(RISCOS) || defined(POSIXPTYS)
+#if	defined(RISCOS) || defined(POSIXPTYS) || defined(BSDPTYS)
 char	*_getpty(int*, int, int, int);
 #endif
 
diff -r -u unicode0/9term/Makefile unicode/9term/Makefile
--- unicode0/9term/Makefile	Mon Mar 14 05:50:54 1994
+++ unicode/9term/Makefile	Sat Mar 11 19:20:20 1995
@@ -3,7 +3,7 @@
 #
 #	define operating system.  ONE of:
 #		-DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
-#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX
+#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX -DLINUX
 #	
 #	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
 #	if your compiler supports posix-compatible compilation
@@ -11,16 +11,16 @@
 #	Define RISCOS for Mips RISC/os
 #	Define BSDPTYS for BSD-style pty support
 #	Define POSIXPTYS for POSIX ptys
-OS=-DSOLARIS
+OS=-DLINUX -D_POSIX_SOURCE -DBSDPTYS
 
 # where we'll install it
-BINDIR=/usr/pgrad/matty/bin/$(cputype)
+BINDIR=/usr/bin
 
 HEADERFILE=9term.h
 TARGET=9term
 INCLUDES=-I. -I../include -I/usr/openwin/include
-CFLAGS=-g $(OS) $(INCLUDES) -fno-builtin -D_LIBXG_EXTENSION
-LDFLAGS=-g -R/usr/openwin/lib -L/usr/openwin/lib -R/usr/ucblib -L/usr/ucblib
+CFLAGS=$(OS) $(INCLUDES) -fno-builtin -D_LIBXG_EXTENSION
+LDFLAGS=-s
 CC=gcc
 
 # change this if your X11 libraries are in different places
@@ -31,7 +31,7 @@
 OBJECTS=9term.o command.o display.o pty.o
 
 $(TARGET): $(OBJECTS)
-	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(XLIBS) -lm -lucb
+	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(XLIBS) -lm
 
 wloc: wloc.o
 	$(CC) $(LDFLAGS) -o wloc wloc.o $(LIBS) $(XLIBS) -lm
Only in unicode/9term: Makefile.orig
diff -r -u unicode0/9term/command.c unicode/9term/command.c
--- unicode0/9term/command.c	Mon Mar  7 02:50:51 1994
+++ unicode/9term/command.c	Sat Mar 11 18:43:01 1995
@@ -200,11 +200,11 @@
 }
 
 /*
- *	killpg: send signal to everyone in process group
+ *	my_killpg: send signal to everyone in process group
  */
 
 void
-killpg(int sig)
+my_killpg(int sig)
 {
 	if (comm_pid)
 		kill(-comm_pid, sig);
diff -r -u unicode0/9term/display.c unicode/9term/display.c
--- unicode0/9term/display.c	Thu Dec 15 15:48:28 1994
+++ unicode/9term/display.c	Sat Mar 11 18:42:21 1995
@@ -114,7 +114,7 @@
 delwin(Widget w, XEvent *event, String *params, Cardinal *n)
 {
   if (w == _toplevel)
-	killpg(SIGHUP);
+	my_killpg(SIGHUP);
 }
 
 /*
diff -r -u unicode0/9term/pty.c unicode/9term/pty.c
--- unicode0/9term/pty.c	Fri Jul 22 17:47:29 1994
+++ unicode/9term/pty.c	Sat Mar 11 19:19:56 1995
@@ -115,12 +115,12 @@
 	char udef, p9def;
 };
 
-#if defined(SUNOS) || defined(IRIX) || defined(SOLARIS)
+#if defined(SUNOS) || defined(IRIX) || defined(SOLARIS) || defined(LINUX)
 #	define V_START VSTART
 #	define V_STOP VSTOP
 #	define V_SUSP VSUSP
 #	define V_DSUSP VDSUSP
-#	ifdef SOLARIS
+#	if defined(SOLARIS) || defined(LINUX)
 #		define V_RPRNT VREPRINT
 #	else
 #		define V_RPRNT VRPRNT
@@ -147,8 +147,10 @@
 	{ "susp",	4, V_SUSP,	ctrl('z'),	ctrl('z') },
 #ifndef HPUX
 #ifndef IRIX
+#ifndef LINUX
 	{ "dsusp",	5, V_DSUSP,	ctrl('y'),	ctrl('y') },
 #endif
+#endif
 	{ "rprnt",	5, V_RPRNT,	ctrl('r'),	ctrl('r') },
 	{ "weras",	5, V_WERAS,	ctrl('w'),	ctrl('w') },
 	{ "lnext",	5, VLNEXT,	ctrl('v'),	ctrl('v') },
@@ -636,7 +638,7 @@
 
 	/*
 	 * the utmp file is modeled as a magnetic tape; this
-	 * is preferrable to modeling it as a punched card.
+	 * is preferable to modeling it as a punched card.
 	 */
 	setutent();		/* rewind() */
 	utmp.ut_type = DEAD_PROCESS;
diff -r -u unicode0/libXg/Makefile unicode/libXg/Makefile
--- unicode0/libXg/Makefile	Sat Mar 11 19:44:35 1995
+++ unicode/libXg/Makefile	Sat Mar 11 19:14:23 1995
@@ -4,21 +4,21 @@
 #
 #	define operating system.  ONE of:
 #		-DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
-#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX
+#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX -DLINUX
 #	
 #	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
 #	if your compiler supports posix-compatible compilation
-OS=-DIRIX -ansiposix
+OS=-DLINUX -D_POSIX_SOURCE
 
 #	add -Iincludedir for any include directories that need to be searched
 INCS=-I../include
 
 #	set this if your X libraries are in different locations
 #	or if you need extra libraries to load with X11 applications
-XLIBS=/usr/local/X11R5/lib/libXt.a /usr/local/X11R5/lib/libX11.a
+XLIBS=/usr/lib/libXt.a /usr/lib/libX11.a
 
 #	add name of library orderer - use ":" if none
-RANLIB=:
+RANLIB=ranlib
 
 #	add name of librarian
 AR=ar
diff -r -u unicode0/libframe/Makefile unicode/libframe/Makefile
--- unicode0/libframe/Makefile	Sat Mar 11 19:44:35 1995
+++ unicode/libframe/Makefile	Sat Mar 11 19:12:20 1995
@@ -4,18 +4,18 @@
 #
 #	define operating system.  ONE of:
 #		-DIRIX -DSUNOS -DUMIPS -DSYSVR3 -DAIX -DOSF1
-#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX
+#		-DHPUX -DAPOLLO -DCONVEX -DDYNIX -DLINUX
 #	
 #	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
 #	if your compiler supports posix-compatible compilation
-OS=-DIRIX -ansiposix
+OS=-DLINUX -D_POSIX_SOURCE
 
 #	add -Iincludedir for any include directories that need to be searched
 #	for posix header files (for UMIPS, add -I/usr/include/posix)
 INCS=-I../include
 
 #	add name of library orderer - use ":" if none exists
-RANLIB=:
+RANLIB=ranlib
 
 #	add name of library
 AR=ar
diff -r -u unicode0/libtext/Makefile unicode/libtext/Makefile
--- unicode0/libtext/Makefile	Thu Jun  2 04:01:19 1994
+++ unicode/libtext/Makefile	Sat Mar 11 19:13:51 1995
@@ -1,18 +1,18 @@
 #
-#	Prototype Sun Makefile for libtext
+#	Prototype Linux Makefile for libtext
 #
-#	Define operating system type: -DSUNOS
+#	Define operating system type: -DLINUX
 #	
 #	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
 #	if your compiler supports posix-compatible compilation
-OS=-DSOLARIS
+OS=-DLINUX -D_POSIX_SOURCE
 
 #	add -Iincludedir for any include directories that need to be searched
 #	for posix header files
 INCS=-I. -I../include
 
 #	add name of library orderer - use ":" if none exists
-RANLIB=:
+RANLIB=ranlib
 
 #	add name of library
 AR=ar

From sam-fans-owner@hawkwind.utcs.toronto.edu Sat Apr 29 04:16:26 1995
Received: by staff.cs.su.oz.au with postie; Sat, 29 Apr 1995 04:16:26 +1000
Received: from hawkwind.utcs.utoronto.ca. by staff.cs.su.OZ.AU.; Sat, 29 Apr 1995 04:15:30 +1000
Received: from cegelecproj.co.uk ([159.245.72.6]) by hawkwind.utcs.utoronto.ca with SMTP id <24107>; Fri, 28 Apr 1995 14:02:29 -0400
Received: from vampire.cegelecproj.co.uk (cerberus.cegelecproj.co.uk) by cegelecproj.co.uk (4.1/SMI-4.1)
	id AA03451; Fri, 28 Apr 95 18:50:19 BST
Received: from spirit.cegelecproj.co.uk (spirit.limbo.cegelecproj.co.uk) by vampire.cegelecproj.co.uk (5.0/SMI-SVR4)
	id AA02331; Fri, 28 Apr 1995 18:50:02 +0000
Received: by spirit.cegelecproj.co.uk (5.0/SMI-SVR4)
	id AA01956; Fri, 28 Apr 1995 18:49:57 +0000
Date:	Fri, 28 Apr 1995 14:49:57 -0400
From:	Steve_Kilbane@cegelecproj.co.uk (Steve_Kilbane)
Message-Id: <9504281749.AA01956@spirit.cegelecproj.co.uk>
X-Planation: X-Faces images can be viewed with the XFaces program
To:	sam-fans@hawkwind.utcs.toronto.edu
Subject: 9wm/9term cmdpipes
Content-Length: 30278
X-Face: Iqsa(US9p?)Y^W+6Ff[Z]<t?\A!eaL'DG{20*#{C1;'Ct&}L}B^/1(aYI@hP)4!<}7D=2gm
	8!$T`8QNfK<te\20%A\`wm*wa2"^Up*Qs"X}KeV*3XeB2te&sKp*t`N;^BDh[6=K{ZBE=O>rM"uFE)
	lFDjag1e]\/#2
Status: RO

A while ago, I mentioned some hacks I'd done to 9term to add a
command pipe, like sam's. Rich $alz commented that 9wm could do
with something similar, and I couldn't resist. This is the
result, including patches for both 9term and 9wm. There are
probably bugs, but they work ok for me. :-) A README file
is included.

Steve

PS Rich: I've made some improvements since I sent you the
sample patches, so this lot is different.

#!/bin/sh
# to extract, remove the header and type "sh filename"
if `test ! -s ./9term.patch`
then
echo "writing ./9term.patch"
cat > ./9term.patch << '\Rogue\Monster\'
*** orig/9term/9term.c	Fri Jun  3 09:35:39 1994
--- hacked/9term/9term.c	Fri Apr 21 08:14:28 1995
***************
*** 16,36 ****
  
  #include "9term.h"
  
  int		flushing;
  int		suspended;
  Event		e;
  ulong		Erc;
  int		highwater = 50000;
  int		lowwater = 40000;
  int		waterquantum;
  int		beepmask;
  int		ninewm;
  
! static char	*items[] = { "cut", "paste", "snarf", "send", "scroll", 0 };
  static Menu	edit = {items};
  enum {	mCUT,
  	mPASTE,
  	mSNARF,
  	mSEND,
  	mSCROLL
  };
--- 16,48 ----
  
  #include "9term.h"
  
+ #define PIPEDIRENV		"NINETERMPIPE"
+ #define PIPEDIRDEF		"/tmp/.9terms."
+ 
  int		flushing;
  int		suspended;
  Event		e;
  ulong		Erc;
+ ulong		Epipe;
+ static char	*exname;
+ static int	exlen;
  int		highwater = 50000;
  int		lowwater = 40000;
  int		waterquantum;
  int		beepmask;
  int		ninewm;
+ static long	mark0, mark1;
+ static int	markset;
  
! void removeextern(void);
! static void pipeinput(Event *e);
! 
! static char	*items[] = { "cut", "paste", "snarf", "mark", "send", "scroll", 0 };
  static Menu	edit = {items};
  enum {	mCUT,
  	mPASTE,
  	mSNARF,
+ 	mMARK,
  	mSEND,
  	mSCROLL
  };
***************
*** 167,173 ****
--- 179,273 ----
  	run();

Status: RO

samterm...
+  */
+ 
+ static
+ void init_ninepipe(void)
+ {
+ #ifndef	NOFIFO
+ 	char	*ninepipedir;
+ 	char	*disp;
+ 	char	*user;
+ 	int	fd;
+ 	int	flags;
+ 	extern ulong windowid;
+ 
+ 	if ((ninepipedir = getenv(PIPEDIRENV)) == 0) {
+ 		/* user hasn't specified a directory - make up a name */
+ 		/* exname is PIPEDIR.user.display/wid or PIPEDIR.user/wid */
+ 		user = getuser();
+ 		disp = getenv("DISPLAY");
+ 	
+ 		if (disp) {
+ 			exlen = strlen(PIPEDIRDEF) + strlen(user) + 1 + strlen(disp);
+ 			if ((exname = (char *)malloc(exlen + 20)) == 0)
+ 				return;
+ 			sprintf(exname, "%s%s.%s", PIPEDIRDEF, user, disp);
+ 		} else {
+ 			exlen = strlen(PIPEDIRDEF) + strlen(user);
+ 			if ((exname = (char *)malloc(exlen + 20)) == 0)
+ 				return;
+ 			sprintf(exname, "%s%s", PIPEDIRDEF, user);
+ 		}
+ 	} else {
+ 		/* use user's specified directory */
+ 		exlen = strlen(ninepipedir);
+ 		if ((exname = (char *)malloc(exlen + 20)) == 0)
+ 			return;
+ 		strcpy(exname,ninepipedir);
+ 	}
+ 
+ 	/* Create a directory for the pipes to exist in, if necessary. */
+ 	(void)mkdir(exname,0700);
+ 
+ 	/* add the next level - the pid */
+ 	sprintf(exname+exlen,"/%d",windowid);
+ 
+ 	/* Make the named pipe */
+ 	if (mkfifo(exname, 0600) == -1) {
+ 		removeextern();
+ 		return;
+ 	}
+ 
+ 	fd = open(exname, O_RDONLY | O_NONBLOCK);
+ 	if (fd == -1) {
+ 		removeextern();
+ 		return;
+ 	}
+ 
+ 	/*
+ 	 * Turn off no-delay and provide ourselves as a lingering
+ 	 * writer so as not to get end of file on read.
+          */ 
+ 	flags = fcntl(fd, F_GETFL, 0);
+ 	if (flags == -1 || fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == -1
+ 			|| open(exname, O_WRONLY) == -1) {
+ 		(void)close(fd);
+ 		removeextern();
+ 		return;
+ 	}
+ 
+ 	Epipe = estart(0, fd, 8192);
+ 	atexit(removeextern);
+ 	return;
+ #endif
+ }
+ 
+ void
+ removeextern(void)
+ {
+ 	if (exname) {
+ 		(void)unlink(exname);
+ 		exname[exlen] = 0;
+ 		(void)rmdir(exname);
+ 	}
+ }
+ 
+ /*
   *	Register command output stream and handle events
   */
  #define MAXMSG		128
***************
*** 179,184 ****
--- 279,285 ----
  	ulong type;
  
  	Erc = estart(0, comm_fd, MAXMSG + MAXFDATA);
+ 	init_ninepipe();
  	for (;;) {
  		/* disable shell output when more than one buffer ahead */
  /*
***************
*** 204,210 ****
  			}
  #endif
  			shelloutput(Erc, &e);
! 		}
  	}
  }
  
--- 305,312 ----
  			}
  #endif
  			shelloutput(Erc, &e);
! 		} else if (type == Epipe)
! 			pipeinput(&e);
  	}
  }
  
***************
*** 234,239 ****
--- 336,371 ----
  }
  
  /*
+  *	Handle command pipe event
+  */
+ 
+ static void
+ pipeinput(Event *e)
+ {
+ 	Rune r;
+ 	char *c;
+ 	Text *t = text;
+ 
+ 	/* XXX - should do something like:
+ 		if (e->n)
+ 			t->p0 = t->p1 = t->end;
+ 	or whatever, to make sure we're inserting at the end. */
+ 
+ 	if (e->n)
+ 		t->p0 = t->p1 = t->length;
+ 	for (c = (char *)e->data; e->n--; c++) {
+ 		chartorune(&r, c);
+ 		/* ignore eof or eol */
+ 		if (r == eofchar || r == eolchar)
+ 			continue;
+ 		textinsert(t, &r, (&r)+1, t->p0);
+ 		textshow(t, t->p0, 1);
+ 		sendrunes(&r,1);
+ 	}
+ 	texthighlight(text,t->p0,t->p1, F & ~D);
+ }
+ 
+ /*
   *	Handle command output event
   */
  static void
***************
*** 398,403 ****
--- 530,536 ----
  	static Rune nl[] = { '\n', 0 };
  
  	specialchars(slave_fd);
+ 	edit.item[mMARK] = markset?"select":"mark";
  	edit.item[mSCROLL] = text->scrolling?"noscroll":"scroll";
  	switch (menuhit(2, m, &edit))
  	{
***************
*** 428,433 ****
--- 561,582 ----
  			inputrune(text, text->snarfed, text->snarflen);
  			if (text->snarfed[text->snarflen-1] != '\n')
  				inputrune(text, nl, 1);
+ 		}
+ 		break;
+ 	case mMARK:			/* save point, or select to point */
+ 		if (markset) {
+ 			ulong m0, m1;
+ 
+ 			m0 = (mark0 < text->p0)? mark0 : text->p0;
+ 			m1 = (mark1 > text->p1)? mark1 : text->p1;
+ 			markset = 0;
+ 			/* if (m0 < text->base || text->end < m0)
+ 				textset(text, _backnl(text, m0, 3)); */
+ 			texthighlight(text,m0,m1, F & ~D);
+ 		} else {
+ 			mark0 = text->p0;
+ 			mark1 = text->p1;
+ 			markset = 1;
  		}
  		break;
  	case mSCROLL:			/* toggle scroll state */
*** orig/9term/display.c	Thu Dec 15 14:48:28 1994
--- hacked/9term/display.c	Wed Mar 29 12:42:36 1995
***************
*** 52,57 ****
--- 52,58 ----
  static void	delwin(Widget, XEvent*, String*, Cardinal*);
  
  Text		*text;		/* the main and only text buffer */
+ ulong		windowid;
  
  	/* too many X options */
  static XrmOptionDescRec optable[] = {
***************
*** 229,235 ****
  	XSetErrorHandler(abort);
  #endif
  		/* export window id to environment */
! 	sprintf(id, "%d", XtWindow(_toplevel));
  	setenv("WINDOWID", id, 1);
  
  		/* register mouse and keyboard events */
--- 230,237 ----
  	XSetErrorHandler(abort);
  #endif
  		/* export window id to environment */
! 	windowid = XtWindow(_toplevel);
! 	sprintf(id, "%d", windowid);
  	setenv("WINDOWID", id, 1);
  
  		/* register mouse and keyboard events */
\Rogue\Monster\
else
  echo "will not over write ./9term.patch"
fi
if `test ! -s ./9wm.patch`
then
echo "writing ./9wm.patch"
cat > ./9wm.patch << '\Rogue\Monster\'
*** orig/9wm/9wm.c	Tue Mar 28 16:37:51 1995
--- hacked/9wm/9wm.c	Tue Apr 18 14:45:52 1995
***************
*** 14,20 ****
  
  char    *version[] = 
  {
!     "9wm version 1.1, Copyright (c) 1994 David Hogan", 0,
  };
  
  Display         *dpy;
--- 14,22 ----
  
  char    *version[] = 
  {
!     "9wm version 1.1, Copyright (c) 1994 David Hogan",
!     "cmdpipe extensions by Steve Kilbane",
!     0,
  };
  
  Display         *dpy;
***************
*** 51,57 ****
--- 53,61 ----
  Atom        _9wm_hold_mode;
  
  void    usage(), sighandler(), getevent();
+ static	int do_select();
  
+ 
  char    *fontlist[] = {
      "lucm.latin1.9",
      "blit",
***************
*** 221,226 ****
--- 225,232 ----
      nofocus();
      scanwins();
  
+     init_ninepipe();		/* smk */
+ 
      for (;;) {
          getevent(&ev);
  
***************
*** 443,448 ****
--- 449,455 ----
      e->value_mask |= CWBorderWidth;
  
      XConfigureWindow(dpy, e->window, e->value_mask, &wc);
+     wins_changed |= wm_configurereq;
  }
  
  void
***************
*** 479,484 ****
--- 486,492 ----
          unhidec(c, 1);
          break;
      }
+     wins_changed |= wm_mapreq;
  }
  
  void
***************
*** 506,511 ****
--- 514,520 ----
          }
          c->reparenting = 0;
      }
+     wins_changed |= wm_unmap;
  }
  
  void
***************
*** 532,537 ****
--- 541,547 ----
          c->dy = e->height;
          c->border = e->border_width;
      }
+     wins_changed |= wm_newwindow;
  }
  
  void
***************
*** 551,556 ****
--- 561,567 ----
      ignore_badwindow = 1;
      XSync(dpy, False);
      ignore_badwindow = 0;
+     wins_changed |= wm_destroy;
  }
  
  void
***************
*** 657,662 ****
--- 668,674 ----
          if (c == current)
              cmapfocus(c);
      }
+     wins_changed |= wm_property;
  }
  
  void
***************
*** 684,689 ****
--- 696,702 ----
          if (c != 0 && (c->parent == root || withdrawn(c))) 
              rmclient(c);
      }
+     wins_changed |= wm_reparent;
  }
  
  #ifdef  SHAPE
***************
*** 698,703 ****
--- 711,717 ----
          return;
  
      setshape(c);
+     wins_changed |= wm_shape;
  }
  #endif
  
***************
*** 728,755 ****
  XEvent *e;
  {
      int fd;
-     fd_set rfds;
-     struct timeval t;
  
      if (!signalled) {
!         if (QLength(dpy) > 0) {
!             XNextEvent(dpy, e);
              return;
          }
          fd = ConnectionNumber(dpy);
!         FD_ZERO(&rfds);
!         FD_SET(fd, &rfds);
!         t.tv_sec = t.tv_usec = 0;
!         if (select(fd+1, &rfds, NULL, NULL, &t) == 1) {
!             XNextEvent(dpy, e);
              return;
-         }
          XFlush(dpy);
!         FD_SET(fd, &rfds);
!         if (select(fd+1, &rfds, NULL, NULL, NULL) == 1) {
!             XNextEvent(dpy, e);
              return;
-         }
          if (errno != EINTR || !signalled) {
              perror("9wm: select failed");
              exit(1);
--- 742,761 ----
  XEvent *e;
  {
      int fd;
  
      if (!signalled) {
!         if (QLength(dpy) > 0) {		/* if there are X events, handle them */
!             XNextEvent(dpy, e);		/* may mean pipe never gets a look in */
              return;
          }
+         if (wins_changed)
+ 		update_windows_list();
          fd = ConnectionNumber(dpy);
!         if (do_select(fd,e,0))
              return;
          XFlush(dpy);
!         if (do_select(fd,e,1))
              return;
          if (errno != EINTR || !signalled) {
              perror("9wm: select failed");
              exit(1);
***************
*** 758,761 ****
--- 764,801 ----
      cleanup();
      fprintf(stderr, "9wm: exiting on signal\n");
      exit(1);
+ }
+ 
+ static int
+ do_select(fd, e, i)
+ int fd;
+ XEvent *e;
+ int i;
+ {
+     int nfds, r;
+     fd_set rfds;
+     struct timeval t;
+ 
+     for (;;) {			/* stay here until we get an X event */
+         FD_ZERO(&rfds);
+         FD_SET(fd, &rfds);
+         if (ninepipefd != -1) {
+             FD_SET(ninepipefd, &rfds);
+             nfds = ninepipefd > fd? ninepipefd : fd;
+         } else {
+             nfds = fd;
+         }
+         t.tv_sec = t.tv_usec = 0;
+         if ((r = select(nfds+1, &rfds, NULL, NULL, i? NULL : &t)) < 1) {
+             return 0;
+         }
+         if (ninepipefd != -1 && FD_ISSET(ninepipefd,&rfds)) {
+             pipecmd();
+             continue;
+         }
+         if (FD_ISSET(fd,&rfds)) {
+             XNextEvent(dpy, e);
+             return 1;
+         }
+     }
  }
*** orig/9wm/client.c	Tue Mar 28 16:37:53 1995
--- hacked/9wm/client.c	Tue Apr 18 14:45:52 1995
***************
*** 68,73 ****
--- 68,74 ----
  }
  #endif
  
+ 
  void
  active(c)
  Client *c;
***************
*** 94,99 ****
--- 95,101 ----
      if (debug)
          dump_revert();
  #endif
+     wins_changed |= wm_active;
  }
  
  void
***************
*** 123,128 ****
--- 125,131 ----
      }
      XSetInputFocus(dpy, w, RevertToPointerRoot, timestamp());
      cmapfocus(0);
+     wins_changed |= wm_nofocus;
  }
  
  Client *
*** orig/9wm/dat.h	Tue Mar 28 16:37:55 1995
--- hacked/9wm/dat.h	Tue Apr 18 15:00:54 1995
***************
*** 115,117 ****
--- 115,137 ----
  
  /* error.c */
  extern int          ignore_badwindow;
+ 
+ /* pipe.c - smk */
+ extern int          ninepipefd;
+ extern int          wins_changed;
+ 
+ #define wm_configurereq 0x1
+ #define wm_mapreq 0x2
+ #define wm_unmap 0x4
+ #define wm_newwindow 0x8
+ #define wm_destroy 0x10
+ #define wm_property 0x20
+ #define wm_reparent 0x40
+ #define wm_shape 0x80
+ #define wm_active 0x100
+ #define wm_nofocus 0x200
+ #define wm_hide 0x400
+ #define wm_unhide 0x800
+ #define wm_renamec 0x1000
+ #define wm_creshape 0x2000
+ #define wm_cmove 0x4000
*** orig/9wm/fns.h	Tue Mar 28 16:37:55 1995
--- hacked/9wm/fns.h	Tue Apr 18 14:15:42 1995
***************
*** 73,75 ****
--- 73,81 ----
  
  /* cursor.c */
  void    initcurs();
+ 
+ /* pipe.c - smk */
+ void	pipecmd();
+ void	init_ninepipe();
+ void	remove9pipe();
+ void    update_windows_list();
*** orig/9wm/manage.c	Tue Mar 28 16:37:52 1995
--- hacked/9wm/manage.c	Tue Apr 18 13:59:40 1995
***************
*** 88,94 ****
  
      /* Now do it!!! */
  
!     if (doreshape) {
          cmapfocus(0);
          if (!(fixsize ? drag(c) : sweep(c)) && c->is9term) {
              XDestroyWindow(dpy, c->window);
--- 88,94 ----
  
      /* Now do it!!! */
  
!     if (doreshape && (! dohide || ! fixsize)) {
          cmapfocus(0);
          if (!(fixsize ? drag(c) : sweep(c)) && c->is9term) {
              XDestroyWindow(dpy, c->window);
*** orig/9wm/menu.c	Tue Mar 28 16:37:52 1995
--- hacked/9wm/menu.c	Tue Apr 18 15:10:18 1995
***************
*** 108,114 ****
                  fprintf(stderr, "9wm: exec %s", shell);
                  perror(" failed");
              }
!             execlp("9term", "9term", "-9wm", 0);
              execlp("xterm", "xterm", "-ut", 0);
              perror("9wm: exec 9term/xterm failed");
              exit(1);
--- 108,114 ----
                  fprintf(stderr, "9wm: exec %s", shell);
                  perror(" failed");
              }
!             execlp("9term", "9term", "-unix", "-9wm", 0);
              execlp("xterm", "xterm", "-ut", 0);
              perror("9wm: exec 9term/xterm failed");
              exit(1);
***************
*** 186,191 ****
--- 186,192 ----
      b3items[B3FIXED+numhidden] = c->label;
      numhidden++;
      b3items[B3FIXED+numhidden] = 0;
+     wins_changed |= wm_hide;
  }
  
  void
***************
*** 220,225 ****
--- 221,227 ----
          b3items[B3FIXED+i] = b3items[B3FIXED+i+1];
      }
      b3items[B3FIXED+numhidden] = 0;
+     wins_changed |= wm_unhide;
  }
  
  void
***************
*** 248,253 ****
--- 250,256 ----
      if (name == 0)
          name = "???";
      c->label = name;
+     wins_changed |= wm_renamec;
      if (!hidden(c))
          return;
      for (i = 0; i < numhidden; i++)
\Rogue\Monster\
else
  echo "will not over write ./9wm.patch"
fi
if `test ! -s ./README`
then
echo "writing ./README"
cat > ./README << '\Rogue\Monster\'
This sharfile contains four files:
	README			(this file)
	9term.patch		(cmdpipe support for 9term)
	9wm.patch		(first part of cmdpipe support for 9wm)
	pipe.c			(second part)

The 9term patch is against 1.6.3, while the 9wm patch is against 1.1.

I've used these changes on Solaris 2.3 for quite a while now, and
they seem stable as far as daily use goes. Mind you, they don't
*much* use daily... incidentally, there's a bug in 9term 1.6.3
under solaris 2.3 - occasionally the cursor starts up in the
wrong place (between two shell prompts), and input results in
complaints about null characters. This is in the standard 9term
release, and I haven't been able to track it down.

9term changes
=============
Each 9term creates a pipe which can be used for input, in the
manner of sam's pipe. The name of the pipe is given by
$NINETERMPIPE, if set. If not, the pipes go into the directory
/tmp/.9terms.$USER.$DISPLAY, if $DISPLAY is set, or
/tmp/.9terms.$USER, if not. Within the directory, the pipe's
name is $WINDOWID. The directory is created if required, and
when 9term exits, the pipe is removed, and so is the directory,
if empty.

Text written to the pipe is inserted to 9term's window as though
it had been typed by the user - it is sent to the shell, too.
The cursor is moved to the end of the window first, if necessary.

This patch also includes the mark/select toggle on the second
menu: mark saves the current selection, and select selects all
text between the saved and current selections, inclusive.

Caveat:
	I don't bother to set $NINETERMPIPE, using the default
	pipe name. Therefore, I haven't actually got around to
	testing this bit of code. :-)
Bug:
	Text set to the pipe is always sent straight to the shell,
	too. This means that if you've, say, typed "echo hello "
	so far, and you squirt "world\n" into the pipe, you'll get
	"world: no such file or directory", and then when you press
	return, you get "hello world" appear. This doesn't bother me
	too much, since I normally only send text to the pipe while
	I'm between commands anyway.

9wm changes
===========
9wm creates a file which contains the current state of the windows
9wm knows about. The name of the file is $NINEWINDOWS, or
/tmp/.9wm-windows by default. Each line of the file contains
wid s x y dx dy l

where:
	wid	is $WINDOWID
	s	is the state of the window (n = normal, h = hidden)
	x y	are the coords of the window's position
	dx dy	are the window's dimensions
	l	is the window's label

The windows' details are added in the same order as the current
window stack. Thus, the current window will always be the first
line in the file, and so on. If a window's never been current,
it'll be one of the last lines in the file.

This file is updated whenever the details in it have changed. I've
tried to catch all the cases, and have probably been a little eager - 
it can get updated an awful lot when some X events are going on,
even though there's no visible change on the screen. However, 9wm
is still a lot faster than olwm...

9wm also creates a pipe, name from $NINEPIPE, or /tmp/.9wm-pipe
by default. This pipe is used for sending commands to 9wm itself.
Commands are:
	none
		Just used for testing.
	reshape wid x y dx dy
		change position and size of window wid
	resize wid dx dy
		change size of window wid
	move wid x d
		change position of window wid
	front wid
		move window wid to the front, and make current
	hide wid
		hides window wid
	delete wid
		deletes window wid
	label wid str
		sets label of window wid to str

This all seems to work on my system. I haven't tested the
label command *too* much, and I suspect that there may be
problems in the interaction between X's memory allocations and
mine. I haven't seen any evidence of this, it's just that I've
probably got it wrong somewhere. :-)

Caveats:
	Again, I use the default names, so I haven't tested the
	$NINEWINDOWS/$NINEPIPE code.
	The update code for the windows file is a little eager.
	Label memory handling could be dodgy.

What's the point?
=================
I've used these changes, along with 9menu, for adding a
few interesting things. Menu options for doing "front" and
"back" commands are trivial, and since I use the es shell,
other 9menus can repeat the last command or list my recent
command history for occasional selection.

The most extreme application is 9vwm, a virtual window
manager for 9wm written in es. It mostly works, but since
I don't have much of a tendency to have many windows anyway,
there's no inclination to finish it off. But it was fun.

Future directions
=================
Sooner or later David Hogan's going to release 9wm 1.2, which
has got some fairly extensive changes in it, so I'll have to
upgrade to that. :-(

I'm considering adding kill/unkill commands to 9wm, so that
9wm can be told of a list of daemons that are interested in
being told when the windows file has changed (via a kill()).
This might make it easier to write programs that follow manual
changes to the window structure.

It might be nice to have the windows file contain the arguments
to the window, too. That way saving workspaces would be a doddle.

It's probably a good idea for 9wm to have both "exit" and "exit!",
or something similar - the latter is the current behaviour, while
the former just complains to stderr if there are any windows currently
hidden. It would probably have to ignore 9menu, though....

Steve Kilbane
<Steve_Kilbane@cegelecproj.co.uk>
\Rogue\Monster\
else
  echo "will not over write ./README"
fi
if `test ! -s ./pipe.c`
then
echo "writing ./pipe.c"
cat > ./pipe.c << '\Rogue\Monster\'
/* Copyright (c) 1995 Steve Kilbane. See README for details */

#include <stdio.h>
#include <ctype.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <string.h>
#include <fcntl.h>
#include "dat.h"
#include "fns.h"
#include <malloc.h>
#include <stdlib.h>

#define		NINEWINDOWSDEF	"/tmp/.9wm-windows"
#define		NINEWINDOWSENV	"NINEWINDOWS"

#define PCMDMAX	80
#define PIPENAMEENV	"NINEPIPE"
#define PIPENAMEDEF	"/tmp/.9wm-pipe"

typedef enum {
	pNone, pReshape, pResize, pMove, pHide, pFront, pDelete, pLabel, pError
} PipeCmd;

#define XY	1
#define DXY	2
#define STR	4

static struct cmdinfo {
	PipeCmd cmd;
	char *name;
	char *fmt;
	int nconvs;
	unsigned short flags;
} names[] = {
	{ pNone, "none", "", 0, 0 },
	{ pReshape, "reshape", "%lu%d%d%d%d", 5, (XY|DXY) },
	{ pResize, "resize", "%lu%d%d", 3, DXY },
	{ pMove, "move", "%lu%d%d", 3, XY },
	{ pFront, "front", "%lu", 1, 0 },
	{ pHide, "hide", "%lu", 1, 0 },
	{ pDelete, "delete", "%lu", 1, 0 },
	{ pLabel, "label", "%lu%*[ \t]%n", 1, STR },
	{ pNone, 0, 0, 0, 0 }
};

static struct LabelStr {
	char *s;
	struct LabelStr *n;
	int f;
} *labelstrs = NULL;

static Client *findc();
static Client *setsize();
static PipeCmd parsepipecmd();
static PipeCmd parse();
static Client *freelabelstr();
static char *getlabelstr();
static void creshape();
static void cmove();

static char *pipename;
static pid_t serverpid;
int ninepipefd = -1;
int wins_changed = 0;

static struct {
	int i;
	char *s;
} reasons[] = {
	{ wm_configurereq, "configurereq" },
	{ wm_mapreq, "mapreq" },
	{ wm_unmap, "unmap" },
	{ wm_newwindow, "newwindow" },
	{ wm_destroy, "destroy" },
	{ wm_property, "property" },
	{ wm_reparent, "reparent" },
	{ wm_shape, "shape" },
	{ wm_active, "active" },
	{ wm_nofocus, "nofocus" },
	{ wm_hide, "hide" },
	{ wm_unhide, "unhide" },
	{ wm_renamec, "renamec" },
	{ wm_cmove, "cmove" },
	{ wm_creshape, "creshape" },
	{ 0, 0 }
};

static void
print_reason()
{
	int x;

	fprintf(stderr,"9wm: reason");
	for (x = 0; reasons[x].s ; x++)
		if (wins_changed & reasons[x].i)
			fprintf(stderr," %s",reasons[x].s);
	fprintf(stderr,"\n");
}


static int
write_window_line(c,fd)
Client *c;
int fd;
{
	static char *buffer;
	static int maxlen;
	int len;
	char state;

	if (c->label == 0)
		return 0;
	len = 45 + strlen(c->label);
	if (len >= maxlen) {
		maxlen = len + 1;
		buffer = buffer? realloc(buffer,maxlen) : malloc(maxlen);
		if (buffer == 0) {
			maxlen = 0;
			return 1;
		}
	}
	state = hidden(c)? 'h' : 'n';		/* ignore withdrawn */
	sprintf(buffer,"%lu %c %d %d %d %d %s\n",c->window,state,c->x,c->y,c->dx,c->dy,c->label);
	(void)write(fd,buffer,strlen(buffer));
	return 0;
}

void
update_windows_list(void)
{
	static char *ninewindows, *ninewindowstmp;
	Client *c, *cc;
	int fd;

/* print_reason(); */
	wins_changed = 0;
	if (ninewindowstmp == 0) {
		if ((ninewindows = getenv(NINEWINDOWSENV)) == 0)
			ninewindows = NINEWINDOWSDEF;
		if ((ninewindowstmp = malloc(strlen(ninewindows)+5)) == 0) {
			fprintf(stderr,"9wm: cannot alloc tmpfile name for %s\n",ninewindows);
			return;
		}
		sprintf(ninewindowstmp,"%s.tmp",ninewindows);
	}
	if ((fd = creat(ninewindowstmp, 0744)) < 0) {
		fprintf(stderr,"9wm: cannot create '%s'\n",ninewindowstmp);
		return;
	}
	/* write clients that have been selected first, in
	   active order */
	for (c = current; c; c = c->revert)
		if (write_window_line(c,fd)) {
			close(fd);
			(void)unlink(ninewindowstmp);
			return;
		}
	/* now do those that have never been selected, in any order */
	for (c = clients; c; c = c->next) {
		for (cc = current; cc; cc = cc->revert)
			if (cc == c)
				break;
		if (cc == 0)
			if (write_window_line(c,fd)) {
				close(fd);
				(void)unlink(ninewindowstmp);
				return;
			}
	}
	close(fd);
	(void)rename(ninewindowstmp,ninewindows);
	return;
}


void
pipecmd()
{
	static char data[PCMDMAX];
	int x, y, dx, dy;
	int len;
	Window winid;
	char *text;
	Client *c;
	char *ptr;

	if ((len = read(ninepipefd,data,PCMDMAX)) < 1)
		return;
	ptr = data;
	for (;;) {
		switch (parsepipecmd(&ptr,&len,&winid,&x,&y,&dx,&dy,&text)) {
			case pNone:
				return;
			case pReshape:
				creshape(setsize(findc(winid),x,y,dx,dy,1,1));
				break;
			case pResize:
				creshape(setsize(findc(winid),0,0,x,y,1,0));
				break;
			case pMove:
				cmove(setsize(findc(winid),x,y,0,0,0,1));
				break;
			case pHide:
				hide(findc(winid));
				break;
			case pFront:
				c = findc(winid);
				if (c == 0)
					break;
				if (hidden(c))
					unhidec(c,1);
				else {
					XMapRaised(dpy, c->parent);
					active(c);
				}
				break;
			case pDelete:
				delete(findc(winid),1);
				break;
			case pLabel:
				c = findc(winid);
				if (c == 0)
					break;
				renamec(freelabelstr(c),getlabelstr(text));
				break;
			default:
				fprintf(stderr,"9wm: unparsed command: %s\n",text);
				return;
		}
	XFlush(dpy);
	}
}

static Client *
findc(w)
Window w;
{
	Client *c;

	for (c = clients; c; c = c->next)
		if (c->window == w)
			return c;
	fprintf(stderr,"9wm: invalid window id %lu\n",w);
	return 0;
}

static Client *
setsize(c,x,y,dx,dy,resizing,moving)
Client *c;
int x, y, dx, dy, resizing, moving;
{
	if (c == 0)
		return 0;
	if (resizing) {
		if (dx < 0)
			dx = -dx;
		if (dy < 0)
			dy = -dy;
		/* following nicked from grab.c:sweepcalc() */
		dx -= 2*BORDER;
		dy -= 2*BORDER;
		if (!c->is9term) {
			if (dx < c->min_dx)
				dx = c->min_dx;
			if (dy < c->min_dy)
				dy = c->min_dy;
		}
		if (dx < 4)
			dx = 4;
		if (dy < 4)
			dy = 4;
	
		if (c->size.flags & PResizeInc) {
			dx = c->min_dx + (dx-c->min_dx)/c->size.width_inc*c->size.width_inc;
			dy = c->min_dy + (dy-c->min_dy)/c->size.height_inc*c->size.height_inc;
		}
	
		if (c->size.flags & PMaxSize) {
			if (dx > c->size.max_width)
				dx = c->size.max_width;
			if (dy > c->size.max_height)
				dy = c->size.max_height;
		}
		/* end of nicked code */
	c->dx = dx + 2*BORDER;
	c->dy = dy + 2*BORDER;
	}

	if (moving) {
		if (x < 0)
			x = 0;
		if (y < 0)
			y = 0;
		c->x = x;
		c->y = y;
	}
	return c;
}

/*
 * this function's fun. the event is pretty much going to be a character
 * at a time, but we don't know this. Therefore, we're called each time
 * with the new additions to the buffer, and we read until we get a
 * newline. At this point, we check the line length is ok, and then
 * start parsing. If we haven't got a newline yet, we return pNone once
 * we've saved the characters. If we find an error, we set *text to point
 * to the buffer, so that we can display it in the error message.
 */

static PipeCmd
parsepipecmd(data, n, w, x, y, dx, dy, text)
char **data;
int *n;
Window *w;
int *x, *y, *dx, *dy;
char **text;
{
	static char buff[PCMDMAX];
	static int len;
	char c;

	if (*n == 0)
		return pNone;
	*text = buff;
	while ((*n)--) {
		c = *(*data)++;
		if (c == '\n' || c == '\r') {
			if (len < PCMDMAX) {
				buff[len] = 0;
				len = 0;
				return parse(buff,w,x,y,dx,dy,text);
			} else {
				len = 0;
				return pError;
			}
		}
		buff[len++] = c;
	}
	return pNone;
}

static PipeCmd
parse(buff, w, x, y, dx, dy, text)
char *buff;
Window *w;
int *x, *y, *dx, *dy;
char **text;
{
	struct cmdinfo *p;
	char *str;
	unsigned int len;
	int r;

	for (p = names; p->name; p++) {
		len = strlen(p->name);
		if (strncmp(buff,p->name,len) == 0 && isspace(buff[len])) {
			break;
		} else {
		}
	}
	if (p->name == 0) {
		return pError;
	}
	str = buff + len + 1;
	if (p->flags & STR)
		r = sscanf(str,p->fmt,w,&len);
	else
		r = sscanf(str,p->fmt,w,x,y,dx,dy);
	if (r < p->nconvs)
		return pError;
	if (p->flags & STR)
		*text = str + len;
	return p->cmd;
}

/*
 * following is largely nicked from my hacks to 9term.c, which
 * in turn were swiped from samterm.
 */

void
init_ninepipe()
{
#ifndef NOFIFO
	int fd;
	int flags;
	extern char *getenv();

	serverpid = getpid();
	if ((pipename = getenv(PIPENAMEENV)) == 0)
		pipename = PIPENAMEDEF;
	if (mkfifo(pipename, 0600) == -1)
		return;
	if ((fd = open(pipename, O_RDONLY | O_NONBLOCK)) < 0) {
		remove9pipe();
		return;
	}
	flags = fcntl(fd, F_GETFL, 0);
	if (flags == -1 || fcntl(fd,F_SETFL, flags & ~O_NONBLOCK) == -1
		|| open(pipename, O_WRONLY) == -1) {
		(void)close(fd);
		remove9pipe();
		return;
	}
	ninepipefd = fd;
	atexit(remove9pipe);
	return;
#endif
}

void
remove9pipe()
{
	if (pipename && serverpid == getpid()) {
		(void)unlink(pipename);
		pipename = 0;
	}
	return;
}

static char *
getlabelstr(s)
char *s;
{
	struct LabelStr *l;

	if (s == 0)
		return s;
	if ((l = (struct LabelStr *)malloc(sizeof(*l))) == 0)
		return s;
	l->n = labelstrs;
	labelstrs = l;
	if ((l->s = strdup(s)) == 0)
		l->s = s;
	l->f = (l->s == s);
	return l->s;
}

static Client *
freelabelstr(c)
Client *c;
{
	char *s = c->label;
	struct LabelStr *l, **p = &labelstrs;

	while (*p && (*p)->s != s)
		p = &((*p)->n);
	if (*p) {
		l = *p;
		*p = l->n;
		if (l->f)
			(void)free(l->s);
		(void)free(l);
	}
	return c;
}

static void
cmove(c)
Client *c;
{
    if (c == 0)
        return;
    active(c);
    XRaiseWindow(dpy, c->parent);
    XMoveWindow(dpy, c->parent, c->x-BORDER, c->y-BORDER);
    sendconfig(c);
    wins_changed |= wm_cmove;
}

static void
creshape(c)
Client *c;
{
    if (c == 0)
        return;
    active(c);
    XRaiseWindow(dpy, c->parent);
    XMoveResizeWindow(dpy, c->parent, c->x-BORDER, c->y-BORDER,
                    c->dx+2*(BORDER-1), c->dy+2*(BORDER-1));
    XMoveResizeWindow(dpy, c->window, BORDER-1, BORDER-1, c->dx, c->dy);
    wins_changed |= wm_creshape;
}
\Rogue\Monster\
else
  echo "will not over write ./pipe.c"
fi
echo "Finished archive 1 of 1"
exit

From t-jont@microsoft.com Thu Sep 21 19:46:21 1995
Received: by staff.cs.su.oz.au with postie; Thu, 21 Sep 1995 19:46:21 +1000
Received: from netmail2.microsoft.com. by staff.cs.su.OZ.AU.; Thu, 21 Sep 1995 19:46:13 +1000
Received:  by netmail2.microsoft.com (5.65/25-eef)
	id AA07286; Thu, 21 Sep 95 03:42:56 -0700
Message-Id: <9509211042.AA07286@netmail2.microsoft.com>
Received: by netmail2 using fxenixd 1.0 Thu, 21 Sep 95 03:42:56 PDT
X-Received: from PRX-01-HUB by nax-01-hub with recvsmtp ; Thu, 21 Sep 1995 05:33:58 GMT
X-Received: from syd-02-msg by prx-01-hub with receive; Thu, 21 Sep 1995 05:33:56 GMT
X-Msmail-Message-Id:  1F41ECBD
X-Msmail-Conversation-Id:  1F41ECBD
From: Jonathon Tidswell <t-jont@microsoft.com>
To: matty@cs.su.oz.au
Date: Thu, 21 Sep 95 15:22:56 TZ
Subject: 9term and FreeBSD 2.05
X-Msxmtid: syd-02-msg950921042809MTP[01.00.00]00000115-5941
Status: RO


Im having a few problems.
I hope someone else has built 9term on a CSRG_BASED (BSD 4.4 lite) system.

your defintion of killpg() conflicts with the system one.
[ system killpg(0,sig) is equiv to your killpg(sig) ]

your implementation of setenv calls system putenv which calls setenv 
expecting the system setenv not your one.

Sytem defines runes (included from ctype.h) which seem to conflict with 
your/Plan9 definitions.

In pty.c

I use the OSF #defiens for VWERASE etc and define ONLRET to ONLCR
[ All the different names with and without '_' ... ]

Also VFLUSH has the following oddity in pty.c (I think the ifndef 
should be ifdef)

#ifndef VFLUSH
    ... use VFLUSH ...
#endif

However it still dies all the time for me.
Do you have any suggestions ?

Oh yeah, my OS line is
-DCSRG_BASED -DBSDPTYS -DPOSIXPTYS -Dulong =u_long

- JonT


