Commit Graph

687 Commits

Author SHA1 Message Date
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
junior rantila
1071e4cf78 watch: Remove unnecessary call to StringBuilder::appendff 2021-10-23 11:41:18 +02:00
junior rantila
658eac5c46 Utilities: Change watch utility to use eastconst style 2021-10-23 11:41:18 +02:00
Ben Wiederhake
dad47a3dd1 man.serenityos.org: Use pandoc for listings and landing page
This makes all pages look and feel the same, because they all use the
default CSS generated by pandoc. Also, it inserts the banner everywhere
at the top, not only into the top-level index.html.

Credit to @xSlendiX for suggesting that `-B` works here.
2021-10-22 19:49:28 +03:00
Andrew Kaster
259ef76504 Utilities: Add fdtdump for dumping OpenFirmware Device Trees
Use the new LibDeviceTree to dump the contents of the device tree blob
(Flattened Device Tree) file passed on the command line.
2021-10-21 19:20:03 -07:00
Karol Kosek
6337d742bb logout: Add this utility to REQUIRED_TARGETS
The Shutdown Dialog needs it.

Related: a36d13e36c
2021-10-21 23:10:25 +02:00
Ben Wiederhake
3371a27018 adjtime: Drop unnecessary privileges unconditionally
Furthermore, this simplifies the control flow.
2021-10-21 15:41:22 +01:00
Valtteri Koskivuori
a3b3800cd4 Userland: Teach the file utility more about ELF files
It now shows some useful at-a-glance information about ELF files, like
it does on other *nix systems.
2021-10-21 01:14:09 +02:00
Valtteri Koskivuori
d1adf5bc5e LibELF+Userland: Move a few functions to Elf::Image
These were originally in `readelf`, but they became useful in
`file` as well, so they are now available in Elf::Image with a slightly
revised API.
2021-10-21 01:14:09 +02:00
Idan Horowitz
40eb3a39d4 LibJS: Rename define_native_function => define_old_native_function
This method will eventually be removed once all native functions are
converted to ThrowCompletionOr
2021-10-20 12:27:19 +01:00
Idan Horowitz
20163c0584 LibJS: Add ThrowCompletionOr versions of the JS native function macros
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and
JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all
native functions were converted to the new format.
2021-10-20 12:27:19 +01:00
Timothy Flynn
4739982c66 LibCore: Change Account::set_password to take a SecretString
This matches the API of Account::authenticate. The only caller to this
API is the passwd utility, which already has the new password stored as
a SecretString.
2021-10-19 18:19:33 +02:00