Commit graph

1874 commits

Author SHA1 Message Date
Ben Huntsman
d356d2a8b2 9term: Skip unnecessary ioctl call on AIX. 2021-08-30 19:40:49 -04:00
Russ Cox
88a87fadae all: update for new MIT license
On March 23, 2021, Nokia transferred the copyrights in the Plan 9 software
to the Plan 9 Foundation, which relicensed them under the MIT license.

This commit updates the Plan 9 from User Space license to reflect the
new base license. The vast majority of the contributions beyond the
base Plan 9 set were by me, many of them explicitly under an MIT license.
Those are all under the new MIT license now as well.

The port of mk to Unix was taken from Inferno via Vita Nuova and had
been made available under GPL, but Vita Nuova has relicensed Inferno
under the MIT license as well, to match the new Plan 9 license.

Michael Teichgraber contributed src/lib9/zoneinfo.c explicitly under
the Lucent Public License but has agreed to change the contribution
to the MIT license now used in the rest of the distribution.

There remain a few exceptions, most notably fonts.
See the root LICENSE file for full details.

The only mention of the Lucent Public License in the whole tree now
is in the LICENSE file, explaining the history.
2021-03-23 20:59:23 -04:00
Russ Cox
a8bd9e9d8c mk: fix for Unix build 2021-03-23 20:54:29 -04:00
Russ Cox
73661401ea acme: fix double-free in acmeerrorproc
The receiver of cerr takes ownership of s.
2021-03-23 17:03:56 -04:00
Connor Taffe
f62d4c4143 9pfuse: support MacFUSE >=4
MacFUSE 4 removes support for passing device fd to the mount command. Adds
support for the receiving the fd over a socket instead, and updates command paths
and filesystem name.
2021-01-31 20:52:49 -05:00
David Arroyo
a72478870a 9p: parse lines in rdwr command
Use bio(3) to read at most one line of input per iteration, even
if there is more than one line available in the input buffer. This
makes it easier to interact with line-oriented ctl files like that of
factotum(4) from shell scripts, without the need to control when
and how much data is flushed to a pipe.
2021-01-31 11:52:08 -05:00
Xiao-Yong Jin
0144f87dc6 htmlroff: fix array bounds 2021-01-29 06:32:41 -05:00
Xiao-Yong Jin
4e6bb208eb eqn: enlarge errbuf to account for large tokens 2021-01-29 06:32:41 -05:00
Xiao-Yong Jin
20c14efad6 xd: fix swizz8 loop counting 2021-01-29 06:32:41 -05:00
Russ Cox
3ccd61629b sam: avoid out-of-bounds read in rterm
Usually r->nused < r->nalloc and the read is in bounds.
But it could in theory be right on the line and reading
past the end of the allocation.

Make it safe but preserve as much of the old semantics
as possible. This use of rterm appears to be only for
optimization purposes so the result does not matter
for correctness.
2021-01-14 10:05:50 -05:00
Russ Cox
6a80119eb5 sam: remove backward ?:
The exit code here is ignored anyway.
2021-01-14 10:01:25 -05:00
Russ Cox
c3ae85a004 rc: do not exit on EINTR from read
This happens if lldb attaches to rc.
2021-01-14 09:59:54 -05:00
Russ Cox
fdcf3d70c2 auxstats: do not postnote 0 2021-01-14 09:58:44 -05:00
Russ Cox
1c845e0bd5 acme, sam, samterm: remove weird switch usage
For whatever reason all three of these programs
contain switches like:

	switch(x) {
	case 1:
		if(cond)
	case 2:
			f();
	}

Like Duff's device, this is legal C but more obscure
than it really needs to be.

This commit assumes those are intended as written
and simply writes them more clearly. I did consider
that maybe they are mistakes, but in the case of sam/regexp.c,
my rewrite in this commit matches the acme/regx.c that
has been in plan9port since I added acme in 2003.
(I didn't bother to dig up the old Plan 9 releases.)

Assuming acme/regx.c has been correct for the past
two decades, this commit should be correct too.
2021-01-05 23:38:09 -05:00
Russ Cox
0a513e6560 sam: rm dregs 2021-01-05 23:37:04 -05:00
Russ Cox
7f6458b045 stats: add threadmaybackground 2021-01-05 23:37:04 -05:00
Russ Cox
ac487c754e acme: allow @ in file names
For upspin and other tools that put email addresses in names.
2020-12-30 14:44:01 -05:00
Russ Cox
dbc153f51e 9term: add threadmaybackground 2020-12-30 10:40:25 -05:00
Russ Cox
74577741c8 tcolors: add threadmaybackground 2020-12-30 08:12:04 -05:00
Nicola Girardi
0a7fe60681 9term: use openpty on NetBSD
Fixes #376.
2020-12-30 07:53:28 -05:00
Russ Cox
8b9aaf2e3f devdraw: add /usr/X11R7 for NetBSD
Fixes #362.
2020-12-30 07:53:28 -05:00
Russ Cox
b3a20a96eb libthread: add threadmaybackground
Programs that want to background themselves now need
to define threadmaybackground returning 1.
This avoids a confusing (to people and debuggers)
extra parent process for all the threaded programs
that will never want to background themselves.
2020-12-30 00:12:14 -05:00
Russ Cox
a012d17433 time: print 1s of milliseconds 2020-12-15 00:06:03 -05:00
Russ Cox
1f098efb73 all: a few more #define tricks for AIX
This should make the AIX build finally work.

Fixes #400.
2020-08-15 20:46:23 -04:00
Russ Cox
9843fc0d82 fontsrv: fix handling of colored glyphs (emoji)
Drawing as white on black to produce a mask only works if
the white on black is the inversion of black on white.
Emoji that force use of specific colors don't respect that.
Draw black on white and invert to mask separately.
2020-08-15 09:10:54 -04:00
James Cook
a1c4307800 touch: fix for OpenBSD.
This fixes https://github.com/9fans/plan9port/issues/436

This doesn't necessarily address the underlying issue: calling p9create with
mode = OREAD should probably be allowed, but currently doesn't work on
OpenBSD.
2020-08-08 12:11:37 -04:00
Igor Böhm
afa34a73a9
devdraw, libdraw: fix memory leaks by freeing getns() malloced string (#431) 2020-07-22 14:59:58 -04:00
Russ Cox
057d8a76a9 acme: add font control message 2020-07-18 21:54:06 -04:00
Russ Cox
95ab1308b4 src/cmd: rm dformat
Unclear why it is here (wkj added it long ago).
It has never been installed into $PLAN9/bin,
so it's doubtful that anyone has ever used it.

Arnold Robbins has an alternate version at
https://github.com/arnoldrobbins/dformat.

Fixes #421.
2020-06-22 11:22:27 -04:00
Gregor Best
c3d31baca0
fontsrv: fix compilation on X11 (#420) 2020-06-04 13:55:26 -04:00
sean
95220bf887 ed: handle Unicode beyond the BMP correctly in list mode.
List mode was constrained to the BMP. This change introduces
the following new list mode convention, using Go string literal syntax:

Non-printing ASCII characters display as \xhh.
Non-ASCII characters in the BMP display as \uhhhh.
Characters beyond the BMP display as \Uhhhhhhhh.
2020-05-29 21:42:23 -04:00
Russ Cox
3850e6e177 devdraw: accept 5- and 6-byte Unicode hex values
Alt X 1234 for U+1234
Alt X X 12345 for U+12345
Alt X X X 103456 for U+103456.
2020-05-29 21:28:59 -04:00
dzklaim
2c70acc3ab
fontsrv: scale f->originy to match f->height on x11
Co-authored-by: dzklaim <smmoth.rp@gmail.com>
2020-05-29 21:02:10 -04:00
Russ Cox
5f0fa185d0 fontsrv: handle non-BMP runes on X11
Have to adjust algorithms to deal with
much larger number of subfont files as well.
2020-05-29 20:58:37 -04:00
Russ Cox
d25d0ca1a3 devdraw, libdraw: handle keyboard runes > U+FFFF
Runes in Plan 9 were limited to the 16-bit BMP when I drew up
the RPC protocol between graphical programs and devdraw
a long time ago. Now that they can be 32-bit, use a 32-bit wire
encoding too. A new message number to avoid problems with
other clients (like 9fans.net/go).

Add keyboard shortcut alt : , for U+1F602, face with tears of joy,
to test that it all works.
2020-05-18 23:45:03 -04:00
Russ Cox
20c841bac1 rc: avoid problematic internal names "var", "thread"
For AIX.
2020-05-18 22:35:17 -04:00
Russ Cox
dea4dbdba6 acme: avoid global named "class"
For AIX.
2020-05-18 22:35:17 -04:00
Russ Cox
d4a4b66a40 diff: rename class to fix AIX
math.h defines a function named class on AIX.
2020-05-18 21:41:35 -04:00
Gabriel Diaz
84167be4ad devdraw: use indirect impl interface in x11 2020-05-18 17:07:25 -04:00
Russ Cox
587933c161 devdraw: use global drawlk instead of per-client
Setting up for a real window system.
2020-05-17 23:24:29 -04:00
Russ Cox
94d381ec9d devdraw: use indirect impl interface
Setting up for a real window system.
2020-05-17 23:19:24 -04:00
Russ Cox
154140a22b mk: replace overlapping strcpy with memmove
Found by ASAN.
2020-05-17 20:15:41 -04:00
Ben Huntsman
5802b09e9d all: fix #includes for AIX, add a few AIX "implementation" files 2020-05-07 20:36:03 -04:00
Ben Huntsman
f84d54a033 mk: support Big Archive Format under AIX 2020-05-07 20:36:03 -04:00
Ben Huntsman
4982d4ebc3 all: update build scripts to fix AIX XL/C compatibility 2020-05-07 20:36:03 -04:00
Russ Cox
601e07b636 rc: clean up parser levels, disallow free carats on lists 2020-05-05 08:30:14 -04:00
Russ Cox
ff74f7cdda rc: allow unquoted = in command arguments
dd fans rejoice!

Also helps with commands like go test -run=x.
2020-05-04 23:41:15 -04:00
Russ Cox
7d6a248f2c rc: move free carat handling into parser
This fixes at least one shell script (printfont) that expected

	'x'`{y}'z'

to mean

	'x'^`{y}^'z'

as it now does. Before it meant:

	'x'^`{y} 'z'

One surprise is that adjacent lists get a free carat:

	(x y z)(1 2 3)

is

	(x1 y2 z3)

This doesn't affect any rc script in Plan 9 or plan9port.
2020-05-04 23:41:15 -04:00
Russ Cox
3caf5c238a rc: move newline handling into parser 2020-05-04 23:41:15 -04:00
Russ Cox
47d4646eeb rc: add recursive descent parser
The old yacc-based parser is available with the -Y flag,
which will probably be removed at some point.

The new -D flag dumps a parse tree of the input,
without executing it. This allows comparing the output
of rc -D and rc -DY on different scripts to see that the
two parsers behave the same.

The rc paper ends by saying:

	It is remarkable that in the four most recent editions of the UNIX
	system programmer’s manual the Bourne shell grammar described in the
	manual page does not admit the command who|wc. This is surely an
	oversight, but it suggests something darker: nobody really knows what
	the Bourne shell’s grammar is. Even examination of the source code is
	little help. The parser is implemented by recursive descent, but the
	routines corresponding to the syntactic categories all have a flag
	argument that subtly changes their operation depending on the context.
	Rc’s parser is implemented using yacc, so I can say precisely what the
	grammar is.

The new recursive descent parser here has no such flags.
It is a straightforward translation of the yacc.

The new parser will make it easier to handle free carats
in more generality as well as potentially allow the use of
unquoted = as a word character.

Going through this exercise has highlighted a few
dark corners here as well. For example, I was surprised to
find that

	x >f | y
	>f x | y

are different commands (the latter redirects y's output).

It is similarly surprising that

	a=b x | y

sets a during the execution of y.

It is also a bit counter-intuitive

	x | y | z
	x | if(c) y | z

are not both 3-phase pipelines.

These are certainly not things we should change, but they
are not entirely obvious from the man page description,
undercutting the quoted claim a bit.

On the other hand, who | wc is clearly accepted by the grammar
in the manual page, and the new parser still handles that test case.
2020-05-04 23:41:15 -04:00