1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:07:45 +00:00

Userland: Run clang-format on everything.

This commit is contained in:
Andreas Kling 2019-06-07 11:49:31 +02:00
parent f7ede145b4
commit b07bbf383d
48 changed files with 271 additions and 268 deletions

View file

@ -1,18 +1,18 @@
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <time.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <AK/AKString.h>
#include <AK/Vector.h>
#include <LibCore/CDirIterator.h>
#include <pwd.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
static int do_file_system_object_long(const char* path);
static int do_file_system_object_short(const char* path);
@ -51,7 +51,7 @@ int main(int argc, char** argv)
}
}
auto do_file_system_object = [&] (const char* path) {
auto do_file_system_object = [&](const char* path) {
if (flag_long)
return do_file_system_object_long(path);
return do_file_system_object_short(path);
@ -60,7 +60,7 @@ int main(int argc, char** argv)
int status;
if (optind >= argc) {
status = do_file_system_object(".");
} else if (optind+1 >= argc) {
} else if (optind + 1 >= argc) {
status = do_file_system_object(argv[optind]);
} else {
for (; optind < argc; ++optind) {
@ -119,7 +119,8 @@ int print_name(struct stat& st, const char* name, const char* path_for_link_reso
return nprinted;
}
bool print_filesystem_object(const char* path, const char* name) {
bool print_filesystem_object(const char* path, const char* name)
{
struct stat st;
int rc = lstat(path, &st);
if (rc == -1) {
@ -155,8 +156,7 @@ bool print_filesystem_object(const char* path, const char* name) {
st.st_mode & S_IWGRP ? 'w' : '-',
st.st_mode & S_ISGID ? 's' : (st.st_mode & S_IXGRP ? 'x' : '-'),
st.st_mode & S_IROTH ? 'r' : '-',
st.st_mode & S_IWOTH ? 'w' : '-'
);
st.st_mode & S_IWOTH ? 'w' : '-');
if (st.st_mode & S_ISVTX)
printf("t");
@ -166,14 +166,14 @@ bool print_filesystem_object(const char* path, const char* name) {
passwd* pwd = getpwuid(st.st_uid);
group* grp = getgrgid(st.st_gid);
if (!flag_print_numeric && pwd) {
printf(" %5s", pwd->pw_name);
printf(" %5s", pwd->pw_name);
} else {
printf(" %5u", st.st_uid);
printf(" %5u", st.st_uid);
}
if (!flag_print_numeric && grp) {
printf(" %5s", grp->gr_name);
printf(" %5s", grp->gr_name);
} else {
printf(" %5u", st.st_gid);
printf(" %5u", st.st_gid);
}
if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))
@ -221,8 +221,8 @@ int do_file_system_object_long(const char* path)
return 0;
}
bool print_filesystem_object_short(const char *path, const char *name, int *nprinted) {
bool print_filesystem_object_short(const char* path, const char* name, int* nprinted)
{
struct stat st;
int rc = lstat(path, &st);
if (rc == -1) {