mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
ls: Port to LibMain :^)
This commit is contained in:
parent
1640445cb2
commit
0de575ec11
2 changed files with 6 additions and 6 deletions
|
@ -85,6 +85,7 @@ target_link_libraries(id LibMain)
|
||||||
target_link_libraries(js LibJS LibLine LibMain)
|
target_link_libraries(js LibJS LibLine LibMain)
|
||||||
target_link_libraries(keymap LibKeyboard LibMain)
|
target_link_libraries(keymap LibKeyboard LibMain)
|
||||||
target_link_libraries(logout LibMain)
|
target_link_libraries(logout LibMain)
|
||||||
|
target_link_libraries(ls LibMain)
|
||||||
target_link_libraries(lspci LibPCIDB LibMain)
|
target_link_libraries(lspci LibPCIDB LibMain)
|
||||||
target_link_libraries(lsusb LibUSBDB LibMain)
|
target_link_libraries(lsusb LibUSBDB LibMain)
|
||||||
target_link_libraries(man LibMarkdown LibMain)
|
target_link_libraries(man LibMarkdown LibMain)
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <LibCore/DateTime.h>
|
#include <LibCore/DateTime.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
|
#include <LibMain/Main.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -71,12 +73,9 @@ static HashMap<gid_t, String> groups;
|
||||||
|
|
||||||
static bool is_a_tty = false;
|
static bool is_a_tty = false;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
{
|
{
|
||||||
if (pledge("stdio rpath tty", nullptr) < 0) {
|
TRY(Core::System::pledge("stdio rpath tty"));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
int rc = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
|
int rc = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
|
||||||
|
@ -118,7 +117,7 @@ int main(int argc, char** argv)
|
||||||
args_parser.add_option(flag_disable_hyperlinks, "Disable hyperlinks", "no-hyperlinks", 'K');
|
args_parser.add_option(flag_disable_hyperlinks, "Disable hyperlinks", "no-hyperlinks", 'K');
|
||||||
args_parser.add_option(flag_recursive, "List subdirectories recursively", "recursive", 'R');
|
args_parser.add_option(flag_recursive, "List subdirectories recursively", "recursive", 'R');
|
||||||
args_parser.add_positional_argument(paths, "Directory to list", "path", Core::ArgsParser::Required::No);
|
args_parser.add_positional_argument(paths, "Directory to list", "path", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
if (flag_show_almost_all_dotfiles)
|
if (flag_show_almost_all_dotfiles)
|
||||||
flag_show_dotfiles = true;
|
flag_show_dotfiles = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue