Commit Graph

21 Commits

Author SHA1 Message Date
Shannon Booth
57f1c919df LibCore: Remove all remaining C prefix references
LibCore's GZip is also moved into the Core namespace with this change.
2020-03-07 01:33:53 +01:00
Andreas Kling
d17e23bd27 LibCore: Remove leading C from filenames 2020-02-06 15:04:03 +01:00
Andreas Kling
2d39da5405 LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
2020-02-02 15:15:30 +01:00
Sergey Bugaev
f983dfe319 Userland+Terminal: Port to new CArgsParser API
While at it, also add some niceties and fix some things.
2020-01-28 13:50:18 +01:00
Andreas Kling
94ca55cefd Meta: Add license header to source files
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-18 09:45:54 +01:00
Andreas Kling
8ccc2b25c2 cp: Use pledge() 2020-01-13 14:51:18 +01:00
Andreas Kling
be19606501 cp: Fail immediately if there's not enough space for the destination
Instead of writing until we run out of space, just fail immediately.
2019-11-02 23:47:22 +01:00
Andreas Kling
73b2cb9ed8 cp: Read/write 32 KB at a time to go faster :^)
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-02 16:39:26 +01:00
Andreas Kling
f9d679ae37 cp: Try to pre-size the destination file to the final size up front
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-11-02 10:00:18 +01:00
Aaron Malpas
fe1ab7989f cp: Implement directory copying
Recursive copying is only allowed if cp is called with the -r switch, ala POSIX.
2019-09-07 16:54:49 +02:00
Aaron Malpas
86415acd6a cp: Refactor copying into copy_file function 2019-09-07 16:54:49 +02:00
Aaron Malpas
4bc6c20091 cp: Use LibCore/CArgsParser for command-line arg parsing 2019-09-07 16:54:49 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
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-09-06 15:36:54 +02:00
Andreas Kling
b07bbf383d Userland: Run clang-format on everything. 2019-06-07 11:49:31 +02:00
Andreas Kling
0058da734e Kernel: Add Inode::truncate(size).
- 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-27 16:42:30 +01:00
Andreas Kling
28a6ba498a Userland: Fix broken permissions for files created by /bin/cp.
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-07 23:23:07 +01:00
Andreas Kling
3079ef01ce Userland: /bin/cp needs to handle open(dst) failing with EISDIR. 2019-03-06 20:28:00 +01:00
Andreas Kling
7d46375690 Userland: Support "cp foo somedirectory"
Don't overwrite the literal directory inode contents when copying a file
to a directory, duh. :^)
2019-03-06 20:22:23 +01:00
Andreas Kling
1b16a29044 Kernel+Userland: Implement fchmod() syscall and use it to improve /bin/cp.
/bin/cp will now copy the permission bits from source to destination. :^)
2019-03-01 10:39:19 +01:00
Andreas Kling
c4c475b49d /bin/cp: Handle partial write() case. 2019-01-27 10:04:53 +01:00
Andreas Kling
15fad649ea Userland: Make a simple /bin/cp for copying files. 2019-01-27 07:18:26 +01:00