Age | Commit message (Collapse) | Author |
|
In other words, if the user presses EOF (normally Ctrl+D), we now print
out "<EOF>" and exit the shell without error.
Fixes #701.
|
|
Previously, we did not properly restore termios settings
after running built-in commands. This has been fixed
by ensuring that we only change the termios settings
when we are forking a child process.
|
|
Shell.cpp uses its own line discipline which handles
echoing and line editing. Because of this we disable
ICANON and ECHO so that we don't get duplicate characters
or weird line editing errors.
We also revert these settings just before running a command.
This is so that commands may run with proper line editing
and echoing.
|
|
We had two ways to get the data inside a ByteBuffer. That was silly.
|
|
|
|
|
|
This patch adds a function to LineEditor that takes the current shell
buffer, searches PATH for the first program that starts with that
buffer and then compares that to any other programs starting with the
buffer to remove any mismatching characters off the end. The result is
appended to the buffer.
This may be faster with a data structure but that seems overkill.
|
|
Fixed a few issues with both `pushd` and `popd`. There was a few
typos etcetera causing it to behave errantly in certain situations.
|
|
Added a few builtin functions to the shell to make navigating a bit
easier in the terminal.
`pushd` allows a user to "push" the current directory to the directory
stack, and then `cd` to the new directory.
`popd` allows the used to take the directory on the top of the stack
off before `cd`'ing to it.
`dirs` gives the state of the current directory stack.
This is only a partial implementation of the `bash` version
(gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html)
, and doesn't include any of the +N or -N commands as of yet.
|
|
This patch allows passing a script as an argument to the Shell program.
We will read the specified line by line and pass them through the Shell
command interpreter.
This is not very powerful, but it's a start :^)
|
|
POSIX.1-2017, Shells & Utilities, section 2.2
|
|
|
|
...and allow switching back to it with `cd -`
Partially addresses #397
|
|
|
|
program executed
|
|
|
|
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.
Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
|
|
It's not safe to return a CFile by-value. CFile is a CObjects and they
are honestly not very good at being values..
|
|
|
|
When we only want to read the file, we should open it for reading.
|
|
By pressing ctr-e/a the cursor goes to the end/beginning of the current line.
|
|
|
|
|
|
It was kinda unpleasant to always see "So-and-so exited with status 123."
|
|
This looks a little nicer than 'execvp(cmd): No such file or directory'
|
|
Make LineEditor::get_line() responsible for printing the prompt. That way
we can re-prompt after clearing the screen on ^L.
This makes the Serenity Terminal feel a little bit more like home :^)
|
|
This makes waitpid() return when a child process is stopped via a signal.
Use this in Shell to catch stopped children and return control to the
command line. :^)
Fixes #298.
|
|
|
|
When resizing the terminal, we now clear the entire current line and reset
the shell's LineEditor input state. This makes it look and feel kinda the
same as xterm.
Fixes #286.
|
|
This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
|
|
|
|
commands into history buffer
|
|
A glob has to be resolved against the directory corresponding to
the part of the path it is found in, not the current directory.
For example, in /usr/i*/AK/, the glob has to be resolved inside
/usr. Moreover, an argument can contain more than one glob, such
as /u*/*/?, in which case they have to be resolved recursively.
In case a glob matches nothing, the argument should be used as is.
|
|
|
|
|
|
After reading a bunch of POSIX specs, I've learned that a file descriptor
is the number that refers to a file description, not the description itself.
So this patch renames FileDescriptor to FileDescription, and Process now has
FileDescription* file_description(int fd).
|
|
|
|
|
|
This was unnecessarily confusing. When we build up a chain of commands
connected by pipes, we now store the file descriptors of each end of
these pipes as rewirings in a vector. The rewirings are then put into
effect by calls to dup2().
|
|
The syscall used is actually stat(), so let's be correct about that.
|
|
|
|
If I'm understanding the standard C library correctly, setenv() copies while
putenv() does not. That's really confusing and putenv() basically sucks.
To know which environment variables to free on replacement and which ones to
leave alone, we keep track of the ones malloced by setenv in a side table.
This patch also moves Shell to using setenv() instead of putenv().
Fixes #29.
|
|
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
|
|
Should also presumably allow for escaping and such, but this is a start.
Fixes #112.
|
|
|
|
Previously we were only printing the signal number (except for SIGINT.)
|
|
Fixes #93.
|
|
|
|
environ values.
This is in keeping with how putenv should function. It does mean that
the shell's export command now leaks, but that's not a difficult fix.
Contributes to #29.
|
|
Hook this up in Terminal so that the '\a' character generates a beep.
Finally emit an '\a' character in the shell line editing code when
backspacing at the start of the line.
|