Commit Graph

57 Commits

Author SHA1 Message Date
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
Sergey Bugaev
cf04de188e Userland: Print which path we failed to ls 2020-01-17 21:49:58 +01:00
joshua stein
d7e8431cdb Userland/ls: escape non-printable characters
Fixes #1044
2020-01-15 23:13:15 +01:00
Brian Gianforcaro
a77da7f245 ls: Use pledge() 2020-01-13 11:04:35 +01:00
Andreas Kling
73788d7305 ls: Cache the user and group names instead of looking up every time 2020-01-11 13:30:17 +01:00
Andreas Kling
41d5f5c3b5 ls: Widen the user and group fields a little bit
I didn't like looking at /tmp/portal now that lookup:lookup owns one
of the sockets there :^)
2020-01-09 21:43:21 +01:00
Andreas Kling
c9507e8cbe ls: Display SUID files with red background color 2020-01-05 12:49:25 +01:00
Andreas Kling
755938c650 ls: Show directories with the sticky bit in a special color
This makes /tmp show up with a green background in "ls" output.
2020-01-04 11:38:02 +01:00
Andreas Kling
6f4c380d95 AK: Use size_t for the length of strings
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
2019-12-09 17:51:21 +01:00
Andreas Kling
7b0f3b19df ls: Fix alignment of device files in long mode (ls -l) 2019-10-19 20:54:47 +02:00
Andreas Kling
8a3fabffb3 ls: Add -t and -r flags
-t: Sort by modification time (default is to sort by name)
-r: Reverse sort order

Note that these only apply when used together with -l (long mode.)
2019-10-19 20:54:47 +02:00
Andreas Kling
825fa3463c ls: Add -h (human readable) output switch
Fixes #543.
2019-09-11 18:59:13 +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
9731bff44c ls: Sort the output alphabetically
Also use StringBuilder to construct the full relative paths, to get rid
of an unnecessary and suspicious-looking buffer.
2019-08-20 21:39:01 +02:00
Andreas Kling
029786e6b5 ls: Don't layout or colorize output if stdout is not a TTY 2019-08-20 21:06:44 +02:00
marprok
d4b7b92492 Userland: ls division by zero.
When the terminal app window became smaller than the longest filename,
a division by zero occured while calculating the offset.
2019-08-20 20:17:10 +02:00
Marios Prokopakis
91c79440a1 Userland: Improved the printing of the ls command. (#468)
The ls command takes into consideration the length of the largest
filename when it prints a line.

Fixes #432.
2019-08-19 16:37:21 +02:00
Andreas Kling
3965fcc484 ls: Don't print an empty line if there were no files to show.
Fixes #352.
2019-07-21 09:26:47 +02:00
Andreas Kling
3b01d7fdff Userland: Fix more compiler warnings. 2019-06-22 16:13:47 +02:00
Andreas Kling
b07bbf383d Userland: Run clang-format on everything. 2019-06-07 11:49:31 +02:00
Mustafa
a4726b846c ls: Show user name and group name if available. (#151)
Fixes #150
2019-06-01 13:23:35 +02:00
Robin Burchell
9d2b08e06e LibCore: Add CDirIterator, and use it in everything rather than readdir 2019-05-27 15:27:23 +02:00
Andreas Kling
f352a5094d ls: Fix build and tidy up coding style. 2019-05-27 15:04:23 +02:00
faissaloo
f28cc2e2e0 Ls: Cleanup 2019-05-27 14:53:16 +02:00
faissaloo
4c410f3de6 Ls: Support multiple files 2019-05-27 14:53:16 +02:00
faissaloo
776a359a17 Ls: Support single files in long mode 2019-05-27 14:53:16 +02:00
faissaloo
fee686e2cd Ls: Refactor long directory listings 2019-05-27 14:53:16 +02:00
faissaloo
07c356ce64 Ls: Add single file support in short mode 2019-05-27 14:53:16 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00
Andreas Kling
02bfbb712a Userland: /bin/ls should show major,minor for block devices. 2019-02-27 21:32:21 +01:00
Andreas Kling
9624b54703 More moving towards using signed types.
I'm still feeling this out, but I am starting to like the general idea.
2019-02-25 22:06:55 +01:00
Andreas Kling
b0d1969ca5 Userland: Fix two compiler warnings. 2019-02-22 10:50:59 +01:00
Andreas Kling
920e8e58ed Kernel+Userland: Implement setuid() and setgid() and add /bin/su
Also show setuid and setgid bits in "ls -l" output. :^)
2019-02-21 23:38:10 +01:00
Andreas Kling
ce74db4e2a Userland: /bin/ls should display socket files nicely. 2019-02-14 17:30:58 +01:00
Andreas Kling
736e852525 LibC: Implement enough missing stuff to get bash-5.0 running. :^) 2019-02-08 02:38:21 +01:00
Andreas Kling
0c9a2b1430 Kernel: Oops, I mixed up st_dev and st_rdev in struct stat. 2019-02-03 06:23:10 +01:00
Andreas Kling
10fde0d707 Userland: Pretty-print modification times in /bin/ls. 2019-02-03 02:14:41 +01:00
Andreas Kling
9153666e72 Userland: /bin/ls shouldn't display inode numbers by default.
Added the -i option to ls which turns on inode number display.
2019-01-31 17:34:24 +01:00
Andreas Kling
c4fce9b3f9 Make stat() work on device files again.
FileDescriptor will now keep a pointer to the original inode even after
opening it resolves to a character device.

Fixed up /bin/ls to display major and minor device numbers instead of size
for device files.
2019-01-31 05:05:57 +01:00
Andreas Kling
038d8641f9 Implement utime() along with a naive /bin/touch.
This synchronous approach to inodes is silly, obviously. I need to rework
it so that the in-memory CoreInode object is the canonical inode, and then
we just need a sync() that flushes pending changes to disk.
2018-12-19 21:14:55 +01:00
Andreas Kling
829bf94de1 Fix /bin/ls usage string. 2018-12-07 01:19:39 +01:00
Andreas Kling
ca6847b5bb Import a simple text editor I started working on. 2018-12-04 00:27:16 +01:00
Andreas Kling
ac7a60225e Add TIOCGWINSZ ioctl so userland can determine terminal geometry.
(Don't) use this to implement short-form output in ls.
I'm too tired to make a nice column formatting algorithm.
I just wanted something concise when I type "ls".
2018-11-29 03:45:23 +01:00
Andreas Kling
e440c3fa87 Support "ls <path>" rather than just "ls" :^) 2018-11-17 01:04:00 +01:00
Andreas Kling
3e0a0dd7ed Fix all current build warnings in the userland. 2018-11-09 10:19:33 +01:00
Andreas Kling
71c9b09e8c Fix ls build. 2018-10-31 15:52:24 +01:00
Andreas Kling
97726862dd Add basic symlink support.
- 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-28 14:11:51 +01:00