diff options
author | Mauri de Souza Nunes <mauri870@gmail.com> | 2019-12-24 09:37:41 -0300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-24 20:23:37 +0100 |
commit | cb4e51a7a58d1c536d51484f83239d8cd9009616 (patch) | |
tree | 8cea8ad73324727017d27562487fc479a9a619e3 /Userland/syscall.cpp | |
parent | b6eba388e33af245f9a456b17bdf64679989d4ec (diff) | |
download | serenity-cb4e51a7a58d1c536d51484f83239d8cd9009616.zip |
Userland: Add syscall -l option and man page
Diffstat (limited to 'Userland/syscall.cpp')
-rw-r--r-- | Userland/syscall.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Userland/syscall.cpp b/Userland/syscall.cpp index d6ef41af40..d848745be9 100644 --- a/Userland/syscall.cpp +++ b/Userland/syscall.cpp @@ -29,16 +29,21 @@ int main(int argc, char** argv) { int oflag; int opt; - while ((opt = getopt(argc, argv, "oh")) != -1) { + while ((opt = getopt(argc, argv, "olh")) != -1) { switch (opt) { case 'o': oflag = 1; break; + case 'l': + for (auto sc : syscall_table) { + fprintf(stdout, "%s ", Syscall::to_string(sc)); + } + return EXIT_SUCCESS; case 'h': - fprintf(stderr, "usage: \tsyscall [-o] entry [args; buf==BUFSIZ buffer]\n"); + fprintf(stderr, "usage: \tsyscall [-o] [-l] [-h] <syscall-name> <args...> [buf==BUFSIZ buffer]\n"); fprintf(stderr, "\tsyscall write 1 hello 5\n"); fprintf(stderr, "\tsyscall -o read 0 buf 5\n"); - fprintf(stderr, "\tsyscall -o getcwd buf 100\n"); + fprintf(stderr, "\tsyscall sleep 3\n"); break; default: exit(EXIT_FAILURE); @@ -61,7 +66,7 @@ int main(int argc, char** argv) perror("syscall"); } else { if (oflag) - printf("%s", buf); + fwrite(buf, 1, sizeof(buf), stdout); } fprintf(stderr, "Syscall return: %d\n", rc); |