Commit Graph

698 Commits

Author SHA1 Message Date
Tim Schumacher
7ce693840b Utilities/tr: Implement squeezing repeated characters 2021-11-12 21:23:29 +00:00
Ali Mohammad Pur
070d2eaa51 LibJS+LibTest+js: Convert BC::Interpreter::run to ThrowCompletionOr<>
Note that this is just a shallow API change.
2021-11-12 13:01:59 +00:00
Tim Schumacher
ba29798039 Utilities: cut: Implement field-based cutting 2021-11-11 09:47:41 +01:00
Tim Schumacher
96ea4f71bd Utilities: cut: Split up into file and line processing 2021-11-11 09:47:41 +01:00
Tim Schumacher
4d18b21fb5 Utilities: cut: Work exclusively with ranges 2021-11-11 09:47:41 +01:00
Tim Schumacher
ed3a5f6b9d Utilities: cut: Move string splitting into expand_list 2021-11-11 09:47:41 +01:00
Tim Schumacher
2358f6cbda Utilities: cut: Migrate to ArgsParser 2021-11-11 09:47:41 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Andreas Kling
a15ed8743d AK: Make ByteBuffer::try_* functions return ErrorOr<void>
Same as Vector, ByteBuffer now also signals allocation failure by
returning an ENOMEM Error instead of a bool, allowing us to use the
TRY() and MUST() patterns.
2021-11-10 21:58:58 +01:00
Tim Schumacher
bd6c48f6ea Utilities: tar: Always create parent directory when extracting 2021-11-10 14:48:20 +01:00
Ben Wiederhake
4512e89159 strace: Interpret errno codes for pointer-like return codes 2021-11-10 14:47:31 +01:00
Ben Wiederhake
81b6be4bf4 strace: Switch to new flag handler, support more flags
In particular, strace now supports all O_*, MSG_*, MAP_*, and PROT_*
flags, as well as a more context-dependent default value (e.g.
"PROT_NONE").
2021-11-10 14:47:31 +01:00
Ben Wiederhake
491ed375fc strace: Better support for bitflags, show unrecognized flags 2021-11-10 14:47:31 +01:00
faxe1008
100e25d1d3 pape: Add set-random option 2021-11-08 16:36:02 -08:00
Andreas Kling
e76b21a66f LibCore: Use ErrorOr<T> for Core::get_password() 2021-11-08 00:35:27 +01:00
Andreas Kling
a7f1f1c34b LibCore: Use ErrorOr<T> for Core::File::open() 2021-11-08 00:35:27 +01:00
Andreas Kling
4a2b718ba2 LibCore: Use ErrorOr<T> for Core::File::copy_file() 2021-11-08 00:35:27 +01:00
Andreas Kling
c7e62d448c LibCore: Use ErrorOr<T> for Core::File::remove()
This function returns a subclass of Error, which is now possible.
2021-11-08 00:35:27 +01:00
Andreas Kling
0f5477c721 AK: Use ErrorOr<T> for MappedFile factories
Replace Result<T, E> with ErrorOr<T> and propagate the error to callers.
2021-11-08 00:35:27 +01:00
Andreas Kling
235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Andreas Kling
a54be656ae LibRegex: Don't push LibRegex's "Error" into the global namespace 2021-11-08 00:35:27 +01:00
Ben Wiederhake
99b8750154 syscall: Translate errno to something human-readable 2021-11-08 00:34:58 +01:00
Ben Wiederhake
c706b2c142 hexdump: Improve error handling
In particular, hexdump can now handle read errors and reads that
completely fill up the buffer.
2021-11-08 00:34:58 +01:00
Ben Wiederhake
1d777073fd grep: Add ability to output line numbers 2021-11-06 08:57:05 -07:00
Ben Wiederhake
b9a270e5e7 grep: Simplify lambda signature for readability
Those 'optional' arguments are always supplied anyway. Making them
compulsory means there's one thing fewer to keep track of.
2021-11-06 08:57:05 -07:00
Aziz Berkay Yesilyurt
7f8794f902 shot: Fix hanging due to zero sized Rect
shot was refactored to retrive crop_region,
but it is empty when -r is not used.
2021-11-05 00:10:23 +01:00
Ben Wiederhake
4e55d649d7 Services: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through
ClassName::construct(), to avoid handling ref-counted objects with
refcount zero. Fixing the visibility means that misuses like this are
more difficult.
2021-11-02 22:56:53 +01:00
Idan Horowitz
390a04a985 LibJS: Convert the GetValue AO to ThrowCompletionOr 2021-11-02 19:48:35 +01:00
Ben Wiederhake
17d95bc1db Utilities: Remove misbehaving-application
This used to be a target to demonstrate a bug in Inspector (#3159).
However, now that the inspection direction has inverted, this no longer
makes any sense.
2021-11-02 11:07:07 +01:00
Ben Wiederhake
28195032a3 profile: Don't treat '--help' as an error
profile seems to be the only program treating '--help' as an error.
Let's change that.
2021-11-01 21:12:58 +01:00
Ben Wiederhake
4e1318fb0e less: Fix condition to read more data
While mathematically equivalent, the presence of a size_t forces the
comparison to work with size_t's. This means that '-1 < 0' is false,
contrary to the 'mathematically pure' interpretation of the inequality.
2021-11-01 10:55:10 +01:00
Ben Wiederhake
5096f9cff5 hexdump: Avoid using read_all
I like using hexdump to 'have a look' at binary files, for example
/dev/random or /dev/hda. Obviously, this usecase requires that hexdump
tries not to buffer the 'entire' device.
2021-11-01 10:55:10 +01:00
Ben Wiederhake
a5dda0b0c5 hexdump: Make non-ASCII output easier to read
Enclose the ASCII-interpretation in pipes, show non-ASCII bytes as a
dot, and fix the length of the last line.

Note that this makes it more similar to the behavior of many other
implementations.
2021-11-01 10:55:10 +01:00
Rodrigo Tobar
866c9cc1a5 echo: Obey -n when text is empty 2021-11-01 10:47:13 +01:00
Andreas Kling
248ff8e971 strace: Teach mmap() pretty-printer about more MAP_FOO flags 2021-10-31 21:07:29 +01:00
Andreas Kling
472401a51e Revert "wc: Count last line even if it doesn't end in newline"
This reverts commit f356c4ab91.

According to Dr. POSIX, `wc -l` should print the number of *newlines*
in the input.
2021-10-31 21:07:29 +01:00
Kyle Ambroff-Kao
0329a37271 Userland: Handle terminal window resizing in less(1)
Before this patch less would query the terminal geometry only at
startup and use this information to render the file when
appropriate. If the terminal is resized then the output is broken in
several different ways because of this.

This patch adds a SIGWINCH signal handler receive notification any
time the terminal is resized. This signal handler just sets a flag to
notify the main loop that a resize has occurred.

The main loop of the program just calls get_key_sequence() to get
input from the user, interpreting keystrokes as commands like scroll
up or down. The get_key_sequence() function has been changed to return
Optional<String>, so it either returns a keystroke from the user or it
returns nothing as an empty Optional.

While the user is not pressing any keys on the keyboard, the program
is blocking on a read() system call in get_key_sequence(). When
SIGWINCH is received, this read() will return with -1 and errno is set
to EINTR since the system call was interrupted by the signal. When
this happens we just return an empty Optional.

The mainloop now checks to see if a resize has been requested by
checking the flag, and if it has it performs a resize.

init() now just calls resize() since the required logic is the same.

Setters for m_filename and m_prompt are removed because these are now
just initialized by the constructor, as they never change for the life
of the program.
2021-10-31 12:34:37 +01:00
Marco Cutecchia
0086466b61 Utilities: Add option to suppress errors to grep 2021-10-31 14:18:29 +03:30
Marco Cutecchia
647f89f15e Utilities: Add 'quiet' mode to grep 2021-10-31 14:18:29 +03:30
Timothy Flynn
0f91b22795 js: Convert JavaScript REPL to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Rodrigo Tobar
f356c4ab91 wc: Count last line even if it doesn't end in newline 2021-10-29 22:37:34 +03:00
Filiph Sandström
d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Liav A
8554952690 Kernel + WindowServer: Re-define the interface to framebuffer devices
We create a base class called GenericFramebufferDevice, which defines
all the virtual functions that must be implemented by a
FramebufferDevice. Then, we make the VirtIO FramebufferDevice and other
FramebufferDevice implementations inherit from it.
The most important consequence of rearranging the classes is that we now
have one IOCTL method, so all drivers should be committed to not
override the IOCTL method or make their own IOCTLs of FramebufferDevice.
All graphical IOCTLs are known to all FramebufferDevices, and it's up to
the specific implementation whether to support them or discard them (so
we require extensive usage of KResult and KResultOr, together with
virtual characteristic functions).
As a result, the interface is much cleaner and understandable to read.
2021-10-27 07:57:44 +03:00
Andreas Kling
f75d78f56a LibJS: Include executable name in bytecode dumps 2021-10-24 17:18:06 +02:00
Andreas Kling
c95dde971b LibJS: Move global "should dump bytecode" flag into LibJS
This will allow us to trigger bytecode executable dumps when generating
bytecode inside LibJS as well, not just in clients like js and test-js.
2021-10-24 17:18:06 +02:00
Ben Wiederhake
cb868cfa41 AK+Everywhere: Make Base64 decoding fallible 2021-10-23 19:16:40 +01:00
Jean-Baptiste Boric
eaeed259b0 Utilities: Add -f option to ln 2021-10-23 15:06:33 +02:00
Jean-Baptiste Boric
8bbf43318f Utilities: Add ignored -f option to touch 2021-10-23 15:06:33 +02:00
junior rantila
cf3c125e77 watch: Add ability to run command on file change 2021-10-23 11:41:18 +02:00
junior rantila
769091fc1a watch: VERIFY that command vector ends with nullptr 2021-10-23 11:41:18 +02:00