Commit graph

159 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
dbc153f51e 9term: add threadmaybackground 2020-12-30 10:40:25 -05:00
Nicola Girardi
0a7fe60681 9term: use openpty on NetBSD
Fixes #376.
2020-12-30 07:53:28 -05:00
Ben Huntsman
5802b09e9d all: fix #includes for AIX, add a few AIX "implementation" files 2020-05-07 20:36:03 -04:00
Dan Cross
7bf2db4c2a malloc: remove locking
The issue manifests in fork: POSIX fork mandates that a
fork'd process is created with a single thread.  If a
multithreaded program forks, and some thread was in
malloc() when the fork() happened, then in the child
the lock will be held but there will be no thread to
release it.

We assume the system malloc() must already know how to
deal with this and is thread-safe, but it won't know about
our custom spinlock.  Judging that this is no longer
necessary (the lock code was added 15 years ago) we remove
it.

Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-16 16:54:19 +00:00
Dan Cross
fa325e9b42 Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.

Signed-off-by: Dan Cross <cross@gajendra.net>
2020-01-10 14:54:30 +00:00
Fazlul Shahriar
a4e59b3702 9term: add a "look" menu item (#299)
Add a menu item which functions similar to acme's `Look` command.

This is copied from 9front. See:
https://code.9front.org/hg/plan9front/rev/1f1596dbca51
https://code.9front.org/hg/plan9front/rev/d2de1d2f7b48
2020-01-07 15:02:01 -05:00
Russ Cox
d3f21b709e 9term: make 9term -l invoke $SHELL with -l 2018-11-14 00:13:01 -05:00
Xiao-Yong
014fd65a5c 9term: fix getpts on FreeBSD 11.2 (#199)
Opening /dev/ptyXX files fails on recent
FreeBSD versions.

Following the same fix being applied to
Linux, OpenBSD, and Darwin, we use openpty
to open a pseudoterminal in openpts.
2018-11-13 23:09:10 -05:00
Martin Kühl
cfa9a6dfa1 9term: Set TERM_PROGRAM to termprog
TERM_PROGRAM is the customary way to identify which kind of terminal
emulator program one uses on macOS.
This change sets TERM_PROGRAM to termprog since both variables are used
for the same purpose.
2018-03-23 10:41:43 +01:00
Russ Cox
2023d484f2 9term: re-enable sys: child note for child processes
Fixes #6.

Change-Id: Id9950f59c7970575866a7c22a69bfbf3a271f2bb
2017-11-27 11:10:27 +01:00
David du Colombier
7321ed031c 9term: fix getpts on macOS 10.13
Since macOS 10.13, opening the /dev/ptyXX files
always return ENOENT.

Consequently, we changed getpts to use openpty to
open a pseudoterminal, like on Linux and OpenBSD.

Fixes #90.
Fixes #110.
2017-10-13 10:26:51 +02:00
Ray Lai
669713d43f 9term: Add missing parentheses, preventing buffer overflow.
(el-sr) is the string length and (sizeof wdir - strlen(name) - 20)
is the buffer size. When the string length is greater than the
buffer size, the beginning of the string is supposed to be trimmed
to fit in the buffer size. Unfortunately a pair of parentheses were
missing, pointing sr outside the buffer, and the for loop below
then reads outside the buffer. For certain binary data printed in
a window, it causes a segfault.

Change-Id: Iffeaa348260ee2a5a36d9577308fb8d1c1688d05
Reviewed-on: https://plan9port-review.googlesource.com/1540
Reviewed-by: Gleydson Soares <gsoares@gmail.com>
2017-04-08 00:04:32 +00:00
Russ Cox
c819ee640c 9term: c nits
Change-Id: Ia18ebb28f24bc69f404004896f9ce54ddb53faf9
Reviewed-on: https://plan9port-review.googlesource.com/2782
Reviewed-by: Russ Cox <rsc@swtch.com>
2017-01-09 15:44:30 +00:00
Dave Presotto
be7485e1da cmd/9term: A hack because I'm constantly getting confused about ^C vs fn+delete
Since Google (and a lot of the outside) is so engrained with using
^C as interrupt, I'd like to be able to use it in 9term if I've
stty'd my intr to ^C. Without this, hitting ^C still works but if
the program behind the window isn't reading from /dev/cons, it won't
take effect till after I hit a newline which is often very confusing.

I know this is a hack since it only works if I stty intr ^C but that
seems the only other character that gets used anyways.

Change-Id: I0597e63b2d7628f5668c648e6dba6f281e4b27fd
Reviewed-on: https://plan9port-review.googlesource.com/2742
Reviewed-by: Russ Cox <rsc@swtch.com>
2017-01-09 15:42:59 +00:00
Russ Cox
9e0d3750c5 9term, win: work around bsd linker nonsense
Change-Id: Ifcef0636ee1e1fd0f9b06a8d1a99d58fae831318
Reviewed-on: https://plan9port-review.googlesource.com/2780
Reviewed-by: Russ Cox <rsc@swtch.com>
2017-01-06 20:20:33 +00:00
Russ Cox
d296c18e37 9term, mc: conspire to handle hidpi displays
9term now uses the low bit of ws.ws_ypixel to signal
whether this is a hidpi display, and mc adjusts the font
it uses for columnation accordingly.

Makes 'lc' work right on hidpi displays.

Change-Id: I52928871ffb7f4c6fd6722f3d59f1836379148c6
Reviewed-on: https://plan9port-review.googlesource.com/2760
Reviewed-by: Russ Cox <rsc@swtch.com>
2017-01-06 15:36:59 +00:00
Russ Cox
8db40354c5 win: local \r cancellation
Change-Id: I4becec052af58c5a52b777004867eb23023b9403
Reviewed-on: https://plan9port-review.googlesource.com/1391
Reviewed-by: Russ Cox <rsc@google.com>
2015-11-10 15:34:42 +00:00
Russ Cox
0d2dfbc84f 9term, win: better \r handling (thanks, git)
Change-Id: I75563b911b54d8957d2d004b9c27d0a2f8f043b3
Reviewed-on: https://plan9port-review.googlesource.com/1390
Reviewed-by: Russ Cox <rsc@google.com>
2015-11-10 15:34:06 +00:00
Shenghou Ma
20035ed43c all: DragonFly port.
Fix compilation problems, libdraw still doesn't work right yet.

LGTM=rsc
R=rsc
https://codereview.appspot.com/67820046
2014-02-27 23:17:47 -05:00
Russ Cox
bf63f986ff 9term: set TERM=dumb instead of TERM=9term
Everyone seems to assume that TERM != dumb implies
ANSI escape codes are okay. In fact, many people assume
that unconditionally, but it is easier to argue back about
TERM=dumb than TERM=9term.

This applies to acme win too, because they share the code.

Set termprog=9term or termprog=win for clients who
need to know.

R=rsc
CC=r
https://codereview.appspot.com/12532043
2013-08-06 09:42:10 -04:00
Russ Cox
a8a0a6422c 9term: adjust to dpi changes
R=rsc
http://codereview.appspot.com/6847105
2012-11-26 00:13:18 -05:00
Russ Cox
f1825251e7 9term: fix hold mode delay 2011-10-13 09:38:24 -04:00
Russ Cox
210d461c87 merge 2011-10-12 13:19:04 -04:00
Russ Cox
0e881c054a 9term: hold mode back door
R=rsc
http://codereview.appspot.com/5248056
2011-10-11 09:34:25 -04:00
David Swasey
53000799be 9term: fix insert
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/4952066
2011-09-12 12:36:30 -04:00
Mathieu Lonjaret
13666ca73e win: hide not just passwords but also passphrases
R=rsc, nicolesimons1986
CC=plan9port.codebot
http://codereview.appspot.com/4957042
2011-08-26 16:40:04 -04:00
Russ Cox
65a5e5fe46 9term: home/end like acme
R=rsc
http://codereview.appspot.com/4830052
2011-08-02 07:55:20 -04:00
Russ Cox
ba31ab3044 9term, acme: autoscroll
Ignore scroll/noscroll window setting.
Instead, scroll when the write begins in
or immediately after the displayed window content.

In the new scrolling discipline, executing
"Noscroll" is replaced by typing Page Up or
using the mouse to scroll higher in the buffer,
and executing "Scroll" is replaced by typing End
or using the mouse to scroll to the bottom of
the buffer.

R=r, r2
http://codereview.appspot.com/4433060
2011-04-27 13:18:07 -04:00
Russ Cox
c8471ac58c win: another attempt at input modes
R=rsc
http://codereview.appspot.com/2476042
2010-10-13 10:50:46 -04:00
Russ Cox
875351f44f win: add cook/nocook
R=rsc
http://codereview.appspot.com/2162042
2010-09-10 09:31:56 -04:00
Russ Cox
ef5c6a6eda 9term, win: better echo cancellation
Also just drop \r from output.
It's a losing battle to keep turning it off.

R=rsc
http://codereview.appspot.com/2128042
2010-09-03 10:21:16 -04:00
Anthony Martin
c988c8adf1 9term: fix getpts on linux
Openpty uses grantpt internally and its behavior is
unspecified when a handler is set to catch SIGCHLD.

Fixes issue 37. http://code.swtch.com/plan9port/issues/37

R=rsc
CC=codebot
http://codereview.appspot.com/1209049
2010-06-28 14:32:29 -07:00
David Swasey
670f730113 9term: add -c to force cooked mode
R=rsc
CC=codebot
http://codereview.appspot.com/1044043
2010-05-19 18:27:05 -07:00
David Swasey
7b08cf334b 9term: cut, snarf, and paste with keyboard on Mac
R=rsc
CC=codebot
http://codereview.appspot.com/854042
2010-04-13 13:16:36 -07:00
Eoghan Sherry
bea7c49aad win: scroll
R=rsc
CC=codebot
http://codereview.appspot.com/643041
2010-03-19 13:10:14 -07:00
Fazlul Shahriar
6a6c2663bf win fixes
- don't exit from a "child" note unless rc exited (code copied from 9term.c)
- ignore writes to the tag; specifically " Send Noscroll" at startup.

R=rsc
CC=codebot
http://codereview.appspot.com/181115
2010-01-05 14:31:27 -08:00
Russ Cox
0cadb4301d convert to 4-byte UTF-8 and 32-bit Rune
http://codereview.appspot.com/116075
2009-09-11 17:03:06 -04:00
Tony Lainson
3b7ca01f98 9term: allow scroll wheel in main window
http://codereview.appspot.com/105082
2009-08-11 11:11:58 -04:00
Russ Cox
77ac358321 merge 2009-06-09 09:26:13 -07:00
Russ Cox
65a34c7fac win: better SIGPIPE handling 2009-01-06 14:42:41 -08:00
Russ Cox
95cb0f633d win: another attempt at DEL 2008-11-13 18:21:10 -08:00
Russ Cox
d66973d28e win: handle DEL internally so that it always works 2008-11-13 15:49:48 -08:00
Russ Cox
e1118cf27c win: implement Scroll and Noscroll 2008-11-13 15:39:56 -08:00
Russ Cox
482299b83c 9term: convert to new libframe 2008-07-21 12:32:45 -04:00
rsc
adcb656c84 correct dump string (Fazlul Shahriar) 2007-04-17 05:43:22 +00:00
rsc
93921c4817 better cleanup 2006-06-28 17:39:52 +00:00
rsc
98df7c80d8 check initdraw return 2006-06-25 23:50:32 +00:00
rsc
96e0eb83dd more matching (eq) 2006-04-01 21:28:43 +00:00
rsc
cbeb0b26e4 Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. 2006-04-01 19:24:03 +00:00