Commit graph

365 commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen
87db1f52a4 Add halt(8), poweroff(8), and reboot(8). 2022-02-08 18:48:34 +01:00
Jonas 'Sortie' Termansen
4ed2bb1c50 Fix unused variable warning in pstree(1). 2021-12-12 22:13:05 +01:00
Jonas 'Sortie' Termansen
cd8dcdec55 Add -gp options to pstree(1). 2021-12-12 19:47:38 +01:00
Juhani Krekelä
2e193b6014 Fix possible overflow when resizing buffers and remove unncessary casts.
A line longer than 2G might overflow the size_t containing the buffer
length on 32-bit platform. Fix is to use reallocarray with second
parameter twice the size of the element to double the buffer size, since
it will error out if there was an overflow.
2021-11-02 02:11:18 +02:00
Juhani Krekelä
cb4a631524 Fix indentation in switch-statement in utils/tail.c.
Sortix coding style does not indent the cases of a switch statement.
2021-10-31 00:46:13 +03:00
Juhani Krekelä
d605911ddc Make command-not-found(1) data-driven.
Previously command-not-found(1) encoded all its suggestions in code.
This changes it to use a data table to make it easier to understand and
to modify with new suggestions.
2021-10-06 23:37:08 +03:00
Juhani Krekelä
79799b0084 Support historical syntax in head(1) and tail(1). 2021-08-17 00:03:32 +03:00
Juhani Krekelä
198c54ed25 Rewrite tail(1). 2021-08-15 16:16:19 +03:00
Juhani Krekelä
42c94ee36b Mark install(1) dependant on utils/cp.c and head(1) on utils/tail.c 2021-07-29 00:40:49 +03:00
Jonas 'Sortie' Termansen
63ce55e7e9 Fix reading directories not failing with EISDIR. 2021-07-28 22:21:41 +02:00
Jonas 'Sortie' Termansen
23ddc536bc Add -bdfgikhMnt options to sort(1). 2021-06-13 12:51:18 +02:00
Jonas 'Sortie' Termansen
280ba8d64d Rewrite find(1). 2021-05-29 01:04:53 +02:00
Juhani Krekelä
73e42780f4 Add more keybinds for scrolling in pager(1)
b commonly corresponds to Page Up, and f is added to match.

j and k for lines, ^F and ^B for pages, and g and G for home/end are from vi.

C-n and C-p for lines and C-v and M-v for pages are from Emacs.

< and > for home/end allow using Emacs M-< and M->, tho they are from less(1).
2021-05-04 22:14:47 +00:00
Jonas 'Sortie' Termansen
b52bfa5978 Add nl(1). 2021-04-21 22:30:21 +02:00
Jonas 'Sortie' Termansen
a8f8b4cfd6 Add format support to date(1). 2021-04-06 23:22:22 +02:00
Jonas 'Sortie' Termansen
7139de4a53 Add stty(1). 2020-11-25 20:47:19 +01:00
Jonas 'Sortie' Termansen
eb70062331 Fix utils/chown not being gitignored. 2020-10-28 12:47:35 +01:00
Jonas 'Sortie' Termansen
8337947058 Add chown(1). 2020-10-18 00:31:06 +02:00
Jonas 'Sortie' Termansen
6774df5756 Modernize chmod(1). 2020-10-18 00:31:06 +02:00
Jonas 'Sortie' Termansen
11ababec90 Add -h option to ln(1). 2020-04-13 15:00:25 +02:00
Jonas 'Sortie' Termansen
90180a614f Fix ln(1) behavior on empty paths and indentation. 2020-04-12 21:08:57 +02:00
Jonas 'Sortie' Termansen
ff1a90c331 Rewrite ln(1) to be standards compliant. 2020-04-12 00:04:16 +02:00
Jonas 'Sortie' Termansen
8467102662 Fix ls(1) not checking stat_record()'s error correctly. 2018-08-06 23:59:34 +02:00
Jonas 'Sortie' Termansen
db90720c01 Fix code relying on <stdio.h> including <stdarg.h>. 2018-08-06 23:59:34 +02:00
Jonas 'Sortie' Termansen
29555d72bb Fix <fcntl.h> including <sys/stat.h> namespace pollution.
POSIX allows <fcntl.h> to include <sys/stat.h>, but doesn't require it.
There's little reason to do that, since they are separate headers, and
<fcntl.h> just needs the mode_t constants. Fix the code accidentally
relying on <fcntl.h> including <sys/stat.h>. The mode_t constants are now
provided in their own kernel header <sortix/mode.h>.

Additionally fix <sys/stat.h> pulling in all of <sys/types.h>, which is not
allowed by POSIX, which only requires a few types to be declared. Fix the
code accidentally relying on <sys/stat.h> including <sys/types.h>.

Finally fix <dirent.h> pulling in <stdint.h> through <sortix/dirent.h>.

The <sortix/__/dt.h> and <sortix/__/stat.h> headers are no longer required
and their contents have been merged into <sortix/__/dirent.h>.
2018-08-06 23:59:34 +02:00
64f4f5701c Fix typos in sort(1). 2018-04-15 18:06:49 +02:00
Jonas 'Sortie' Termansen
3654b370f1 Add -R option to sort(1). 2018-04-08 20:56:46 +02:00
Jonas 'Sortie' Termansen
a209c89233 Fix POSIX comformance issues in sort(1).
Fix -C disabling checking rather than checking quietly.

Fix sort(1) exiting 1 on certain errors, as POSIX requires sort(1) to only
exit if the input wasn't sorted when -c.

Fix -o opening the output file for truncation before all the input has been
read, as POSIX requires allowing -o to be an input file.

POSIX requires sort(1) to handle input errors by either erroring with no
output, or by erroring and sorting the input read so far. Change the current
behavior of continuing to the next file to simply failing hard on the first
input error.

Don't increment the last line number on the end of the standard input.

Report -c/-C as incompatible with -o.

Exit unsuccessfully on any output errors.

Update to current coding conventions and add documentation while here.
2018-04-08 20:56:46 +02:00
Jonas 'Sortie' Termansen
d1c3433353 Add rw(1). 2018-03-31 00:55:33 +02:00
Jonas 'Sortie' Termansen
0bb865a7d3 Add install(1) -d support. 2017-12-04 23:56:47 +01:00
Jonas 'Sortie' Termansen
724c035c99 Fix failed fix to pstree(1) vertical line drawing character.
The commit 0def94568a switched to the box
drawing light vertical (U+2502) character, but did not fix the now wrong
assumption that the line drawing character encoded to a single byte.
2017-08-20 12:44:34 +02:00
Jonas 'Sortie' Termansen
326e43f3e9 Fix logname(1) not reseting errno before logname(3).
Thanks to ybden for spotting this bug.
2017-07-02 22:09:53 +02:00
Jonas 'Sortie' Termansen
723f8e964c Fix date format in manual pages. 2017-07-02 22:07:39 +02:00
Jonas 'Sortie' Termansen
0def94568a Fix pstree(1) vertical line drawing character. 2017-04-18 23:32:00 +02:00
Jonas 'Sortie' Termansen
10453f0269 Fix uname(1) referencing section 4 and not section 5. 2017-04-12 23:22:09 +02:00
Jonas 'Sortie' Termansen
9613d47496 Fix comma punctuation bugs in manual lists. 2017-03-19 17:34:19 +01:00
Nicholas De Nova
d217621649 Correct manpage spacing per roff(7) convention.
roff(7) dictates that "Each sentence should terminate at the end of an
input line." Instead of doing this, Sortix manpages (incorrectly) used
double-spaces to separate sentences.

Additionally, fix a few small typos.
2017-02-16 14:42:28 -06:00
Nicholas De Nova
eddc4f7407 Document chvideomode(1). 2017-02-13 13:57:16 -06:00
Jonas 'Sortie' Termansen
7de1942803 Only the tty1 login session powers off. 2017-02-12 13:26:26 +01:00
Jonas 'Sortie' Termansen
b86a227f7b Fix unterminated list in pager(1). 2017-02-12 13:11:07 +01:00
Nicholas De Nova
912a5448c5 Document uname(1). 2017-02-05 13:41:07 -06:00
Jonas 'Sortie' Termansen
0bb608b09e Support 8-bit/24-bit color and more escape codes in the graphical console.
The console has gained these escape codes:
 - Set color to any of 256 entries in the palette.
 - Set color to any 24-bit RGB value.
 - Inverse mode.
 - Bold mode.
 - Underline mode.
 - Move cursor to line N.
 - \a is now ignored.

The effectively unused ATTR_CHAR has been removed. Parsing of escape codes
has been improved. The graphical palette has been changed to the tango
colors, which makes Sortix look a bit differently. Some user-space programs
have been changed to use different colors that look better under the new
palette.

Remove const from methods that weren't really const and remove mutable
keyword workaround.
2016-11-27 11:19:03 +01:00
Jonas 'Sortie' Termansen
dc44993465 Add tty(1). 2016-11-23 22:31:41 +01:00
Jonas 'Sortie' Termansen
6ef5a5cee3 Detect whether the terminal has a display and a keyboard layout.
A new ioctl TIOCGDISPLAYS allow detecting which displays the terminal
has associated. The ability to set a keyboard layout can be detected
with tcgetblob kblayout.

Improve the user-space multi-monitor support while here.

The kernel now sets TERM rather than init(8).

This is a compatible ABI change riding on the previous commit's bump.
2016-11-23 22:31:04 +01:00
Jonas 'Sortie' Termansen
db7182ddc3 Add support for sessions.
This change refactors the process group implementation and adds support
for sessions. The setsid(2) and getsid(2) system calls were added.

psctl(2) now has PSCTL_TTYNAME, which lets you get the name of a process's
terminal, and ps(1) now uses it.

The initial terminal is now called /dev/tty1.

/dev/tty is now a factory for the current terminal.

A global lock now protects the process hierarchy which makes it safe to
access other processes. This refactor removes potential vulnerabilities
and increases system robustness.

A number of terminal ioctls have been added.

This is a compatible ABI change.
2016-11-23 22:30:47 +01:00
Jonas 'Sortie' Termansen
3182471881 Switch pager(1) to termios. 2016-11-22 21:36:43 +01:00
Jonas 'Sortie' Termansen
3cfbdb29b5 Fix ls -Ra recursing on dot and dotdot. 2016-11-14 20:47:07 +01:00
Jonas 'Sortie' Termansen
e808ddb62e Fix ps and pstree extra operand not using errx. 2016-11-03 22:10:45 +01:00
Jonas 'Sortie' Termansen
77defc5e24 Add suggestion to use nano(1) if installed. 2016-11-03 22:02:53 +01:00
Jonas 'Sortie' Termansen
df0a99a2d2 Add suggestion to use ed(1) if installed. 2016-10-30 19:56:34 +01:00