Commit graph

1695 commits

Author SHA1 Message Date
Mathis Wiehl
98ee2fcd1b man: Skip shellrc when invoking pager using sh
man invokes the pager command via `sh` which, since
beaae6b420 launches `Shell` in posix mode.
As the referenced commits message indicates, launching `Shell` in posix
mode while interactive, makes it choke on the default `.shellrc`. This
made `man` spew out some shell syntax errors to stderr every time it
invoked the pager.

To fix that, invoke `sh` with `--skip-shellrc` for now as suggested by
the aforementioned commit.
2023-03-07 00:42:32 +01:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Andreas Kling
689ca370d4 Everywhere: Remove NonnullRefPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Sam Atkins
104be6c8ac less: Stop adding extra blank lines
Each time we wrapped a line, we were appending an extra blank span which
wasn't needed. This was leading to an extra blank line after every
single line.
2023-03-06 21:44:28 +01:00
Sam Atkins
774f328783 LibCore+Everywhere: Return an Error from DirIterator::error()
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
2023-03-05 20:23:42 +01:00
Liav A
11a7e21c2a Kernel+Userland: Add support for using the PCSpeaker with various tones 2023-03-05 08:38:29 +00:00
Nico Weber
85507b34d7 icc: Introduce --name flag to load a built-in profile by name
...instead of from a file.

For now, `--name=sRGB` is the only valid value, but more will
probably follow in the future.

Just `icc --name=sRGB` prints the built-in sRGB profile.

`icc --name=sRGB --reencode-to=file.icc` writes it to file.icc.
2023-03-04 21:38:47 +00:00
Dan Klishch
4536b80a62 AK+readelf: Issue error when using ARCH(arch) with nonexistent arch
This disallows erroneous `#if ARCH(x86_64)` (note lowercase x).
2023-03-03 21:53:41 +01:00
Ali Mohammad Pur
23c514cda3 LibCore+Userland: Remove ArgsParser::add*(Vector<char const*>&)
This finally makes ArgsParser's value API free of silly char*'s!
2023-03-01 10:47:19 +01:00
Ali Mohammad Pur
500044906d LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
2023-03-01 10:47:19 +01:00
Ali Mohammad Pur
db886fe18b Userland+AK: Stop using getopt() for ArgsParser
This commit moves the implementation of getopt into AK, and converts its
API to understand and use StringView instead of char*.
Everything else is caught in the crossfire of making
Option::accept_value() take a StringView instead of a char const*.

With this, we must now pass a Span<StringView> to ArgsParser::parse(),
applications using LibMain are unaffected, but anything not using that
or taking its own argc/argv has to construct a Vector<StringView> for
this method.
2023-02-28 15:52:24 +03:30
Andreas Kling
7e76a51cb0 LibWeb: Rename Layout::InitialContainingBlock to Layout::Viewport
The name "initial containing block" was wrong for this, as it doesn't
correspond to the HTML element, and that's specifically what it's
supposed to do! :^)
2023-02-28 12:21:56 +01:00
Nico Weber
a81e1a8c4f file: Use StringView instead of DeprecatedString for paths 2023-02-27 15:18:55 +01:00
Nico Weber
4193e53f62 file: Use StringView instead of DeprecatedString for description 2023-02-27 15:18:55 +01:00
Nico Weber
f989d2bb1f file: Use StringView instead of DeprecatedString for mime types 2023-02-27 15:18:55 +01:00
Nico Weber
9f5343e29e file: Remove unnecessary DeprecatedString ctor call
path is already a DeprecatedString.
2023-02-27 15:18:55 +01:00
Nico Weber
5d5f9f52a0 Utilities: Make file print more information for animated images 2023-02-27 13:29:57 +01:00
Ali Mohammad Pur
6b50f23242 LibWasm+LibWeb: Sneak a JS::Completion into Wasm::Result
Imported functions in Wasm may throw JS exceptions, and we need to
preserve these exceptions so we can pass them to the calling JS code.

This also adds a `assert_wasm_result()` API to Result for cases where
only Wasm traps or values are expected (e.g. internal uses) to avoid
making LibWasm (pointlessly) handle JS exceptions that will never show
up in reality.
2023-02-26 10:54:23 +03:30
Andrew Kaster
72a48ee1ee LibCore+Utilities: Replace uses of strpbrk with find_any_of()
We don't need to use scary C string POSIX APIs when we have nicer ones
on String/DeprecatedString.
2023-02-25 22:31:17 +01:00
Linus Groh
09d40bfbb2 Everywhere: Use _{short_,}string to create Strings from literals 2023-02-25 20:51:49 +01:00
Liav A
8f3c343b88 Kernel+Userland: Unify declarations for KCOV in Kernel/API/kcov.h 2023-02-24 20:35:45 +01:00
Nico Weber
f5063fe7ec file: Add a description for the image/webp mime type 2023-02-24 19:44:20 +01:00
Hediadyoin1
fd8c54d720 AK: Add take_first to HashTable and rename pop to take_last
This naming scheme matches Vector.

This also changes `take_last` to move the value it takes, and delete by
known pointer, avoiding a full lookup and potential copies.
2023-02-21 22:13:06 +01:00
Andrew Kaster
f40094d014 LibWeb+LibJS: Format Console arguments with JS::Print
Instead of just calling JS::Value::to_string_without_side_effects() when
printing values to the console, have all the console clients use
the same JS::Print that the REPL does to print values.

This method leaves some things to be desired as far as OOM hardening
goes, however. We should be able to create a String in a way that
doesn't OOM on failure so hard.
2023-02-21 10:57:44 +01:00
Nico Weber
04d519f1f1 LibGfx: Use ICC::Profile::try_for_each_tag in icc main loop
I didn't use it in out_curve(), out_parametric_curve() since it
wouldn't be necessary if I printed the indent with a loop instead
of String::repeated() there.
2023-02-19 23:46:36 +01:00
Sam Atkins
2db168acc1 LibTextCodec+Everywhere: Port Decoders to new Strings 2023-02-19 17:15:47 +01:00
Sam Atkins
f2a9426885 LibTextCodec+Everywhere: Return Optional<Decoder&> from decoder_for() 2023-02-19 17:15:47 +01:00
Andrew Kaster
613cfb31b1 LibDeviceTree: Add a slow, allocation-free property fetch API
Using the walk_device_tree helper, we can walk the device tree from the
beginning looking for a specific property node. It's still missing the
ability to get property lists, string lists, and property-specific data.
2023-02-19 13:49:07 +01:00
Andrew Kaster
895f54f487 LibDeviceTree: Refactor dump() to return ErrorOr, and use ReadonlyBytes
ReadonlyBytes is much nicer to use than a u8 const* + size_t.
2023-02-19 13:49:07 +01:00
Evan Smal
76891ae45d js: Save REPL history when exiting interpreter with exit()
Previously, we only saved the REPL history when the interpreter was
shutdown with a signal. This change ensures that we save the history
when a user uses `exit()`.
2023-02-19 01:21:24 +01:00
Lucas CHOLLET
856d0202f2 LibGfx: Rename JPGLoader to JPEGLoader
The patch also contains modifications on several classes, functions or
files that are related to the `JPGLoader`.

Renaming include:
 - JPGLoader{.h, .cpp}
 - JPGImageDecoderPlugin
 - JPGLoadingContext
 - JPG_DEBUG
 - decode_jpg
 - FuzzJPGLoader.cpp
 - Few string literals or texts
2023-02-18 23:56:24 +01:00
Nico Weber
7880e11690 icc: Add flags for writing and dumping profiles
This adds three flags to icc:

* --reencode-to=<file> re-serializes a profile to a given file,
  using Gfx::ICC::encode(). This is mainly useful for testing that
  code.

* --dump-to=<file> dumps the raw ICC profile bytes read from the
  input to disk. This is useful for extracting ICC profiles from
  images, and for comparing the raw profile bytes to the profile
  bytes written by --reencode-to=.

If either of these flags is passed, icc by default no longer dumps
the icc data to stdout. To force priting of the data even if either
of these flags is present, this also adds:

* --print, which forces printing ICC contents, even if either or
  both of the icc-data writing flags are present.
2023-02-17 20:05:50 -07:00
Timothy Flynn
88814acbd3 LibJS+Everywhere: Convert JS::Error to String
This includes an Error::create overload to create an Error from a UTF-8
StringView. If creating a String from that view fails, the factory will
return an OOM InternalError instead. VM::throw_completion can also make
use of this overload via its perfect forwarding.
2023-02-17 09:14:23 -05:00
Karol Baraniecki
3c04d22e38 su: Only check for an interactive tty if a password is actually needed 2023-02-16 12:52:11 +00:00
Karol Baraniecki
a8a5707467 su: Allow to specify a command to be executed by -c
su -c 'echo yeah'
2023-02-16 12:52:11 +00:00
Sam Atkins
d6075ef5b5 LibTextCodec+Everywhere: Make TextCodec::decoder_for() take a StringView
We don't need a full String/DeprecatedString inside this function, so we
might as well not force users to create one.
2023-02-15 12:48:26 -05:00
Tim Schumacher
43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher
874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher
606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Nico Weber
6f39c44160 icc: Dump embedded non-parametric curves in lutAToBType and lutAToBType 2023-02-13 00:15:02 +00:00
Nico Weber
7929f8fef9 icc: Dump embedded parametric curves in lutAToBType and lutAToBType 2023-02-13 00:15:02 +00:00
Nico Weber
ed8bd3a792 icc: Dump more information about curves in lutAToBType and lutAToBType 2023-02-13 00:15:02 +00:00
Liav A
4b1e501bdf Utilities/arp: Don't unveil /tmp/portal/lookup for numerical output
It's not needed in such case, and in the near-future when we would want
to use this utility in an initramfs environment where there's no service
such as LookupServer being running, it's still useful to have the option
to invoke this utility with the mentioned limited output functionality.
2023-02-12 20:54:20 +00:00
Ollrogge
0ce1c52577 LibArchive: Add support for modification time and date 2023-02-12 13:13:15 -07:00
Nico Weber
b15a889ca4 icc: Dump some of lutAToBType and lutBToAType curve data 2023-02-12 20:07:45 +00:00
Liav A
38ce053296 Utilities/netstat: Don't unveil /tmp/portal/lookup for numerical output
It's not needed in such case, and in the near-future when we would want
to use this utility in an initramfs environment where there's no service
such as LookupServer being running, it's still useful to have the option
to invoke this utility with the mentioned limited output functionality.
2023-02-12 19:38:40 +00:00
Timothy Flynn
3b4879d29b LibJS+Userland: Port the JS Console object and direct callers to String 2023-02-10 17:26:20 +00:00