1324 Commits

Author SHA1 Message Date
Alexander Naumov
8d19c07b28 man page: copyright update 2022-01-04 01:30:47 +02:00
Michael Witten
21f04b22e0 [PATCH 2/2] trivial: docs: Add missing ')'.
A cross-reference was intended to be placed inside parentheses,
but the closing parenthesis was forgotten; this commit inserts
that missing closing parenthesis.
2020-12-17 11:48:09 +01:00
Michael Witten
8592675371 [PATCH 1/2] trivial: docs: Fix typo (s/paramter/parameter)
In the description of the 'stuff' command, there
was the typo "paramter"; this commit makes that
word "parameter".
2020-12-17 11:30:00 +01:00
Taj Morton
58aa0f9f1c bugfix: option -X ignores specified user in multiuser env
bug #37437

Thanks to Taj Morton
2020-10-20 15:45:07 +02:00
f0d6154b95 TERMCAP_BUF is used in place of TERMCAP_BUFSIZE 2020-04-27 18:24:37 +02:00
Václav Doležal
b14e76eb5d Expand d_xtermosc array in struct Display
Commit 7059bff expands index range of "typ2" by one without expanding
affected arrays. d_xtermosc in struct display is one of these.

Related: 7059bff20a
  (ansi: add support for xterm OSC 11)
Related: eb2be1adf9
  (Fix out of bounds access when setting w_xtermosc after OSC 49)

Signed-off-by: Václav Doležal <vdolezal@redhat.com>
2020-02-22 22:30:40 +01:00
Amadeusz Sławiński
bfb05c34ba Increase permitted length of OSC
hyperlink feature used by some terminals requires lots of characters
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#length-limits
mentions around 2083 characters, set it to a bit more.

Bug: 57718

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2020-02-05 21:07:56 +01:00
Amadeusz Sławiński
eb2be1adf9 Fix out of bounds access when setting w_xtermosc after OSC 49
echo -e "\e]49\e;                                    \n\ec"
crashes screen.

This happens because 49 is divided by 10 and used as table index
resulting in access to w_xtermosc[4], which is out of bounds with table
itself being size 4. Increase size of table by 1 to 5, which is enough
for all current uses.

As this overwrites memory based on user input it is potential security
issue.

Reported-by: pippin@gimp.org
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2020-02-05 21:00:42 +01:00
ed@s5h.net
eb38c84a67 Add escape to show number of currently open windows in hardstatus
String escape format of %C for number of windows with - prefix for
group window count.

Bug: 14484

Signed-off-by: Ed Neville <ed@s5h.net>
2020-02-03 23:42:14 +01:00
Amadeusz Sławiński
c2d797a379 Fix 100% cpu use on one core with poll
If there is no event timeout set just wait for 1 second instead of
setting poll timeout to 0.

Bug: 57697

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2020-02-03 23:40:11 +01:00
François Revol
e25dd483da Haiku port: Check for some libraries
* libnetwork for sockets,
* libbsd for openpty.
2020-02-03 23:07:38 +01:00
François Revol
f251537616 fix mismatched types in prototype
not everyone defines pid_t as int...
2020-02-03 22:43:29 +01:00
François Revol
469be1421b remove hardcoded -lutil
AC_SEARCH_LIBS prepends the found library already.
2020-02-03 22:40:20 +01:00
François Revol
f91a705879 add dirent.h test back to configure
Haiku doesn't have sys/dir.h which is deprecated anyway,
so it's better to actually use dirent.h if found.
2020-02-03 22:38:45 +01:00
Chris Meyering
9bf0a785ca build: acls.c: mark unused parameters
* src/acls.c (DoSu): avoid four unused-variable warnings
2020-02-02 00:39:44 +01:00
Chris Meyering
b2fb626a38 build: tests/test-winmsgbuf.c: avoid GCC 10 alloca warning
* src/tests/test-winmsgbuf.c (main): Replace alloca with malloc/free
to prevent the following warning: tests/test-winmsgbuf.c:298:19:\
  warning: implicit declaration of function ‘alloca’; did you mean \
  ‘calloc’?
2020-02-02 00:39:39 +01:00
Chris Meyering
2703529ade build: test-winmsgbuf.c: add const to avoid GCC 10 warning
* src/tests/test-winmsgbuf.c:45: make char * const
This avoids the following warning:
tests/test-winmsgbuf.c:45:17: warning: initialization of\
‘char *[...]'from incompatible pointer type ‘const char *[...]'
2020-02-02 00:39:34 +01:00
Chris Meyering
33d9a92d04 cleanup: acls.c: move unused variables into #if-0 block
* src/acls.c (DoSu): avoid two unused-variable warnings
2020-02-02 00:39:29 +01:00
Chris Meyering
23f450eef0 build: cast NULL to (char *) to prevent GCC 10 warning
* src/acls.c (GrowBitfield): replace NULL by (char *)NULL.
This avoids the following warning:
acls.h:44:35: warning: dereferencing ‘void *’ pointer
2020-02-02 00:39:24 +01:00
Amadeusz Sławiński
e73df890cb Refactor condition handling to use offset instead of pointer
If wmc_else() is called after wmb_expand() it can overwrite pointer to
old value. To avoid this issue refactor condition code to use offset
into parsed string instead.

Reported-by: pippin@gimp.org
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2020-01-31 23:35:14 +01:00
Alexander Naumov
a98fd8538a Copyright update for 2020 2020-01-10 21:28:01 +01:00
Alexander Naumov
4a48bb2798 Fix return code of '--version' and '-v'
Bug #57571
2020-01-10 20:27:58 +01:00
Amadeusz Sławiński
d7bd327fdf Fix code formatting
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-31 12:03:10 +01:00
Amadeusz Sławiński
9fd08507cc Fix variable type
ParseAttrColor returns uint64_t and ApplyAttrColor takes uint64_t as
argument, int was used instead, which may cause vertical bar to not have
color applied on split.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-28 23:40:18 +01:00
David Dorfman
4dd664149c Disable exclusive mode on TTY device when closing
When opening a TTY we enable exclusive mode to prevent other tools
messing with our connection. When we are done using the TTY the
exclusive mode must be disabled so the TTY can be reconnected to
later. We remember to do this when a break is sent to the device,
but not on window close.

This change ensures we disable exclusive mode on the TTY device
whenever the window is closed.

bug #52248
2019-12-28 20:24:59 +01:00
Scott Shambarger
11a1fc82fb Create TERMCAP entries limited to 1023 bytes by default.
TERMCAP_BUF defaults to 1023 to create TERMCAP entries that work on
most systems.  To save space, TERMCAP is unwrapped, and vt220 extra
keys are skipped (unless TERMCAP_BUF > 1023); navigation keys are
still included.  Entries larger than TERMCAP_BUF are now truncated,
and no longer Panic screen.

Termcap entries are still wrapped when saved to a file.

Signed-off-by: Scott Shambarger <devel@shambarger.net>
2019-12-28 13:45:48 +01:00
Christoph Moench-Tegeder
fa4f88614d Fix coredump on xterm and rxvt
Here's the rub: with TERM=xterm (or rxvt, for that matter), Km
("key_mouse", "Mouse event has occured") is not set (and therefore
NULL), but InitTermcap() (termcap.c:230) happily tries to strdup() that,
which gets us that segfault.

As a band-aid, catch that NULL and don't strdup().

Signed-off-by: Marcin Cieślak <saper@saper.info>
2019-12-28 13:43:22 +01:00
Amadeusz Sławiński
bde659b6bf Count timeout in milliseconds instead of using struct timeval
poll() accepts timeout in milliseconds, so there is no need to keep
timeout in struct timeval.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-28 13:41:59 +01:00
Amadeusz Sławiński
8becc4d29a Convert select() to poll() in sched.c
select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.

As can be seen in case of scheduler it requires quite some changes, care
must be taken to count poll() events properly.

Bug: 55697

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-28 13:41:53 +01:00
Amadeusz Sławiński
88add631de Convert select() to poll() in screen.c
select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.

Bug: 55697

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-28 13:41:48 +01:00
Amadeusz Sławiński
f253ff920c Convert select() to poll() in display.c
select() limits number of file descriptors that can be used by screen.
Migrate to poll() to avoid this limitation.

Bug: 55697

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-28 13:41:42 +01:00
Amadeusz Sławiński
3e37405972 Make closeallfiles() faster
Optimize startup time, making closeallfiles() faster, by doing less
system calls. Instead of calling close for each possible file, use
poll() to check if file exist at all. On linux with open file limit set
to 1048576, it should do 1024 poll() calls instead of 1048576 close().

Bug: 55618

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-12-28 13:41:04 +01:00
Alexander Naumov
f66377f992 Using 'https' instead of 'http' 2019-11-09 14:40:37 +01:00
Amadeusz Sławiński
39c9aea173 Update ambiguous and wide characters tables to Unicode 12.1.0
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-10-02 00:07:08 +02:00
Amadeusz Sławiński
0c49b92adb Get rid of externs in telnet.c
Just include correct headers.
We need to expose af properly in screen.h for this to work.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-09-19 23:13:07 +02:00
Amadeusz Sławiński
abc87e4879 Fix broken mouse after ncurses 6.1
ncurses 6.1 changed kmous capability from "\e[M" to "\e[<". It seems to
be done to signal that terminal supports sgr mouse mode. screen assumed
that if kmous is set to "\e[M" it is on xterm compatible terminal
anyway, so just dynamically detect which one is used and override
relevant kmapdef.

InitKeytab() is moved, so kmapdef[] can be overriden before
initialization, as InitTermcap() needs to run first, as far as I can
tell this should have no consequences.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-09-07 17:58:50 +02:00
Amadeusz Sławiński
0328c657b5 Fix some gcc-9 warning in utmp
Shouldn't have really used strncpy, for something that is effectively
binary data.

Also cleanup structs when defining instead of adding memsets everywhere.
2019-05-18 18:13:34 +02:00
Amadeusz Sławiński
854c3673bb Revert "Remove unnecessary condition check"
This reverts commit ceb9b1f6ec.

I need to look at this again, there is a report that commit in question
may cause problems and apparently logic may have failed me when I
removed this code, as it probably should stay and everything after it is
unreacheable.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-05-13 18:05:46 +02:00
Amadeusz Sławiński
50a8496eb3 Clean whole buffer if we don't want to parse it
Fixes problem when pressing arrows in some prompts causes arrows to stop
in other places.

For example pressing up arrow in 'kill --confirm' prompt stops up arrow
from working on 'windowlist'

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-04-17 20:41:22 +02:00
Amadeusz Sławiński
ceb9b1f6ec Remove unnecessary condition check
According to parent "if" condition this is never the case

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-04-14 14:25:37 +02:00
Amadeusz Sławiński
6cc0088057 Close file descriptor after query command
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-04-14 00:43:27 +02:00
Amadeusz Sławiński
4e545ba086 Fix -L option when passed to backend via Msg
Breaks backward compatibility

This fixes a problem when user runs screen with "-L" option in already
existing screen. We need to pass information about theflag to backend.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-04-13 16:08:36 +02:00
Amadeusz Sławiński
5bbf4eddfd Define data pointer in Event as void
We don't know format of data we pass around, so we may as well define
pointer as void *. Gets rid of -Wcast-align warning with clang.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-03-31 01:07:44 +01:00
Amadeusz Sławiński
8f688079be Fix D_processinputdata type
Define d_processinputdata as struct pwdata instead of doing casts back
and forth. Removes clang warning with -Wcast-align.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-03-31 01:07:44 +01:00
Alexander Naumov
8b52d122cb Copyright update for 2019 2019-03-29 20:26:32 +01:00
Alexander Naumov
e42a8cff79 Typo in man page
bug #56027
2019-03-29 20:22:12 +01:00
Stefan Assmann
7fc842ddc6 fix UTF-8 characters with more than 2 bytes
Characters are stored as uint32 nowadays. Looking at the lower bytes
only seems to be an oversight from the fontx clean up.

Fixes: f18f5d0da1 get rid of fontx
2019-03-17 14:31:45 +01:00
Amadeusz Sławiński
d2d33f6641 drop unnecessary BEL from bracketed paste mode sequence
there is no BEL in enable/disable bracketed paste mode sequence, so we
shouldn't unnecessarily print it

Bug: #55709

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-02-14 20:30:23 +01:00
Nicolas Schodet
9b0243f7ee Fix extra characters when sending a command in one go
This closes bug #52372: Giberish printed to screen window in certain
situations.

When sending "^An", most of the time, screen first receives "^A", then
it receives the "n".  This means that in the ProcessInput2 function,
ilen == 1 after the escape character has been seen, ilen is decremented
and the ProcessInput2 function returns.

When "^An" is sent in one go, for example when pasting or when using a
special shortcut, ilen is not 1 when the escape character is seen.  In
this case, the s variable was incremented, but ilen was not decremented.
This leads the function to read an extra character which does not
exists.

This regression was introduced in 2fab4d6f73, as reported in the bug
report.

This can be tested by having a command in the selection:

echo -ne '\x01n' | xclip -i

And pasting it (in this case, you might see the closing bracketed paste
sequence, but that is another problem).

Bug: #52372
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-02-11 21:59:43 +01:00
Amadeusz Sławiński
724297c2c2 make build date reproducible
Based on https://reproducible-builds.org/docs/source-date-epoch/
They suggest "BUILD_DATE ?=", but it seems to be evaluated for each file
separately, so us "BUILD_DATE :=" to set it once.

Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
2019-02-02 22:35:07 +01:00