summaryrefslogtreecommitdiff
path: root/Userland/cat.cpp
AgeCommit message (Collapse)Author
2020-09-25Meta+Userland: Make clang-format-10 cleanBen Wiederhake
2020-06-17Meta: Scale back overly informal user-facing stringsAndreas Kling
We were getting a little overly memey in some places, so let's scale things back to business-casual. Informal language is fine in comments, commits and debug logs, but let's keep the runtime nice and presentable. :^)
2020-06-17Userland: Improve cat(1)Sergey Bugaev
* Port it to Core::ArgsParser - even though it doesn't support any options at the moment, it's nice to handle --help and reject other options; * Accept "-" to mean stdin; * Make sure to write out all data that we read, looping if needed; * Detect Useless Uses of Cat and print a cute warning :^)
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-11cat: Use pledge()Andreas Kling
2019-11-03cat: Use a 32 KB I/O buffer here to improve "cat a > b" scenarioAndreas Kling
This is roughly twice as fast as the old 4 KB buffer size. We still don't go nearly as fast as "cp", since we don't ftruncate() up front like "cp" does.
2019-10-31Userland: cat no longer tries to open "cat"balatt
I made the mistake of starting the initial for loop at i=0 when it should have started at 1. argv[0] is the program name, argv[1] is an argument.
2019-10-29cat: Updated to handle multiple input files (#694)balatt
Now concatenates multiple files at once with a for loop iterating through a vector of file arguments.
2019-06-07Userland: Run clang-format on everything.Andreas Kling
2019-06-06cat: Fix some oversights in error handling.Andreas Kling
Error messages should go to stderr so they don't get mixed in with the program's output. Also added a check for the return value of write().
2019-04-25cat: Just use fd 0 when no arguments are passed.Andreas Kling
I'm not sure why it seemed necessary at some point to open /dev/stdin rather than simply using the already-open fd 0.
2019-02-03Add /dev/{stdin,stdout,stderr} as symlinks to /proc/self/fd/{0,1,2}Andreas Kling
Also change /bin/cat to open /dev/stdin if no arguments are provided.
2018-11-17Various stubs while trying to get an old coreutils to build.Andreas Kling
2018-11-08Add some simple write buffering to LibC's stdio.Andreas Kling
Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write() the whole chunks we get from read() directly to stdout.
2018-11-06Add some basic signal support.Andreas Kling
It only works for sending a signal to a process that's in userspace code. We implement reception by synthesizing a PUSHA+PUSHF in the receiving process (operating on values in the TSS.) The TSS CS:EIP is then rerouted to the signal handler and a tiny return trampoline is constructed in a dedicated region in the receiving process. Also hacked up /bin/kill to be able to send arbitrary signals (kill -N PID)
2018-11-03Fix some bugs in execve() and make sh use it for process launching.Andreas Kling
Interrupting children of sh now always works with ^C :^)
2018-11-02Basic ^C interrupt implementation.Andreas Kling
For testing, I made cat put itself into a new process group. This should eventually be done by sh between fork() and exec().
2018-10-28Add basic symlink support.Andreas Kling
- sys$readlink + readlink() - Add a /proc/PID/exe symlink to the process's executable. - Print symlink contents in ls output. - Some work on plumbing options into VFS::open().
2018-10-27Greatly improve /proc/PID/stack by tracing the ebp frame chain.Andreas Kling
I also added a generator cache to FileHandle. This way, multiple reads to a generated file (i.e in a synthfs) can transparently handle multiple calls to read() without the contents changing between calls. The cache is discarded at EOF (or when the FileHandle is destroyed.)
2018-10-26Add a very hackish /proc/PID/stack.Andreas Kling
It walks the stack and identifies anything that looks like a kernel symbol. This could be a lot more sophisticated.
2018-10-26Implement argc/argv support for spawned tasks.Andreas Kling
Celebrate the new functionality with a simple /bin/cat implementation. :^)