summaryrefslogtreecommitdiff
path: root/Userland/cp.cpp
AgeCommit message (Collapse)Author
2020-01-28Userland+Terminal: Port to new CArgsParser APISergey Bugaev
While at it, also add some niceties and fix some things.
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-13cp: Use pledge()Andreas Kling
2019-11-02cp: Fail immediately if there's not enough space for the destinationAndreas Kling
Instead of writing until we run out of space, just fail immediately.
2019-11-02cp: Read/write 32 KB at a time to go faster :^)Andreas Kling
This is a huge speed-up (3x) when copying large files. Ideally this would be optimized by the kernel somehow, but we're not there yet.
2019-11-02cp: Try to pre-size the destination file to the final size up frontAndreas Kling
Since we usually know how many bytes we're going to write, we can be nice to the kernel and ftruncate() the destination to the expected size up front, reducing the amount of FS churn.
2019-09-07cp: Implement directory copyingAaron Malpas
Recursive copying is only allowed if cp is called with the -r switch, ala POSIX.
2019-09-07cp: Refactor copying into copy_file functionAaron Malpas
2019-09-07cp: Use LibCore/CArgsParser for command-line arg parsingAaron Malpas
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2019-06-07Userland: Run clang-format on everything.Andreas Kling
2019-03-27Kernel: Add Inode::truncate(size).Andreas Kling
- Use this to implement the O_TRUNC open flag. - Fix creat() to pass O_CREAT | O_TRUNC | O_WRONLY. - Make sure we truncate wherever appropriate.
2019-03-07Userland: Fix broken permissions for files created by /bin/cp.Andreas Kling
When passing O_CREAT to open(), it will grab a third "mode" argument from the stack. Let's not forget to actually pass this! Also use the process umask for the created files.
2019-03-06Userland: /bin/cp needs to handle open(dst) failing with EISDIR.Andreas Kling
2019-03-06Userland: Support "cp foo somedirectory"Andreas Kling
Don't overwrite the literal directory inode contents when copying a file to a directory, duh. :^)
2019-03-01Kernel+Userland: Implement fchmod() syscall and use it to improve /bin/cp.Andreas Kling
/bin/cp will now copy the permission bits from source to destination. :^)
2019-01-27/bin/cp: Handle partial write() case.Andreas Kling
2019-01-27Userland: Make a simple /bin/cp for copying files.Andreas Kling