diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-10-06 22:55:12 +0200 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-10-10 15:18:55 -0700 |
commit | 8ff942b5a45957554e339ad0fad3888af75f33d5 (patch) | |
tree | db34fb5b2b89f6b8b5a35d4763996cd50d3b5b6c | |
parent | 3a9f289dc60f98d98f3f08591a78b8b060512569 (diff) | |
download | serenity-8ff942b5a45957554e339ad0fad3888af75f33d5.zip |
Manpages+markdown-checker: Permit only specific missing files
I can't write these manpages ad-hoc, and in most cases I don't want to
remove the link because it is justified. The hope is that with this
FIXME in place, there is more motivation to write these manpages for
someone who knows enough about them. Or at least we will introduce fewer
dead links in the future, making Help more useful.
-rw-r--r-- | Base/usr/share/man/man1/ps.md | 26 | ||||
-rw-r--r-- | Base/usr/share/man/man1/tar.md | 2 | ||||
-rw-r--r-- | Userland/Utilities/markdown-check.cpp | 27 |
3 files changed, 52 insertions, 3 deletions
diff --git a/Base/usr/share/man/man1/ps.md b/Base/usr/share/man/man1/ps.md new file mode 100644 index 0000000000..57c9fdbc9f --- /dev/null +++ b/Base/usr/share/man/man1/ps.md @@ -0,0 +1,26 @@ +## Name + +ps - list currently running processes + +## Synopsis + +```**sh +$ ps [--version] [-e] [-f] [-q pid-list] +``` + +## Description + +Print a list of currently running processes in the current TTY. +For each process, print its PID (process ID), to which TTY it belongs, and invoking commandline (CMD). + +## Options + +* `-e`: Consider all processes, not just those in the current TTY. +* `-f`: Also print for each process: UID (as resolved username), PPID (parent PID), and STATE (Runnable, Sleeping, Selecting, Reading, etc.) +* `-q pid-list`: Only consider the given PIDs, if they exist. + +## Examples + +```sh +$ ps -ef +``` diff --git a/Base/usr/share/man/man1/tar.md b/Base/usr/share/man/man1/tar.md index 036d2c712e..47683a3ea3 100644 --- a/Base/usr/share/man/man1/tar.md +++ b/Base/usr/share/man/man1/tar.md @@ -39,6 +39,4 @@ $ tar -x -f archive.tar ## See also -* [`gunzip`(1)](gunzip.md) * [`unzip`(1)](unzip.md) - diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index 1fdfa3435d..3746e9e090 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -22,6 +22,31 @@ #include <LibMarkdown/Document.h> #include <LibMarkdown/Visitor.h> +static bool is_missing_file_acceptable(String const& filename) +{ + const StringView acceptable_missing_files[] = { + // FIXME: Please write these manpages! + "/usr/share/man/man2/accept.md", + "/usr/share/man/man2/exec.md", + "/usr/share/man/man2/fcntl.md", + "/usr/share/man/man2/fork.md", + "/usr/share/man/man2/ioctl.md", + "/usr/share/man/man2/listen.md", + "/usr/share/man/man2/mmap.md", + "/usr/share/man/man2/mprotect.md", + "/usr/share/man/man2/open.md", + "/usr/share/man/man2/ptrace.md", + "/usr/share/man/man5/perfcore.md", + // This one is okay: + "/home/anon/js-tests/test-common.js", + }; + for (auto const& suffix : acceptable_missing_files) { + if (filename.ends_with(suffix)) + return true; + } + return false; +} + struct FileLink { String file_path; // May be empty, but not null String anchor; // May be null ("foo.md", "bar.png"), may be empty ("baz.md#") @@ -195,7 +220,7 @@ int main(int argc, char** argv) } else { pointee_file = LexicalPath::absolute_path(file_dir, file_link.file_path); } - if (!Core::File::exists(pointee_file)) { + if (!Core::File::exists(pointee_file) && !is_missing_file_acceptable(pointee_file)) { outln("File '{}' points to '{}' (label '{}'), but '{}' does not exist!", file_item.key, file_link.file_path, file_link.label, pointee_file); any_problems = true; |