diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:52:39 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:52:39 +0200 |
commit | a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch) | |
tree | b88cc7a8457658d67e0321718556ac807f6bccf3 /src/qmail-getpw.c | |
parent | 00be7622c428f279872f84569f098ce16150f8a8 (diff) |
format files
Diffstat (limited to 'src/qmail-getpw.c')
-rw-r--r-- | src/qmail-getpw.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/qmail-getpw.c b/src/qmail-getpw.c index f801c3c..9de7ec6 100644 --- a/src/qmail-getpw.c +++ b/src/qmail-getpw.c @@ -1,16 +1,18 @@ -#include <sys/types.h> -#include <sys/stat.h> #include <pwd.h> +#include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> -#include "error.h" + #include "buffer.h" -#include "exit.h" #include "byte.h" -#include "str.h" #include "case.h" +#include "error.h" +#include "exit.h" #include "fmt.h" -#include "auto_usera.h" +#include "str.h" + #include "auto_break.h" +#include "auto_usera.h" #include "qlx.h" #define GETPW_USERLEN 32 @@ -29,7 +31,7 @@ int userext() for (;;) { if (extension - local < sizeof(username)) if (!*extension || (*extension == *auto_break)) { - byte_copy(username,extension - local,local); + byte_copy(username, extension - local, local); username[extension - local] = 0; case_lowers(username); errno = 0; @@ -37,24 +39,27 @@ int userext() if (errno == ETXTBSY) _exit(QLX_SYS); if (pw) if (pw->pw_uid) - if (stat(pw->pw_dir,&st) == 0) { + if (stat(pw->pw_dir, &st) == 0) { if (st.st_uid == pw->pw_uid) { dash = ""; - if (*extension) { ++extension; dash = "-"; } + if (*extension) { + ++extension; + dash = "-"; + } return 1; } } else { if (errno) _exit(QLX_NFS); } } - if (extension == local) return 0; + if (extension == local) return 0; --extension; } } char num[FMT_ULONG]; -int main(int argc,char **argv) +int main(int argc, char **argv) { local = argv[1]; if (!local) _exit(100); @@ -67,18 +72,18 @@ int main(int argc,char **argv) if (!pw) _exit(QLX_NOALIAS); - buffer_puts(buffer_1small,pw->pw_name); - buffer_put(buffer_1small,"",1); - buffer_put(buffer_1small,num,fmt_ulong(num,(long) pw->pw_uid)); - buffer_put(buffer_1small,"",1); - buffer_put(buffer_1small,num,fmt_ulong(num,(long) pw->pw_gid)); - buffer_put(buffer_1small,"",1); - buffer_puts(buffer_1small,pw->pw_dir); - buffer_put(buffer_1small,"",1); - buffer_puts(buffer_1small,dash); - buffer_put(buffer_1small,"",1); - buffer_puts(buffer_1small,extension); - buffer_put(buffer_1small,"",1); + buffer_puts(buffer_1small, pw->pw_name); + buffer_put(buffer_1small, "", 1); + buffer_put(buffer_1small, num, fmt_ulong(num, (long)pw->pw_uid)); + buffer_put(buffer_1small, "", 1); + buffer_put(buffer_1small, num, fmt_ulong(num, (long)pw->pw_gid)); + buffer_put(buffer_1small, "", 1); + buffer_puts(buffer_1small, pw->pw_dir); + buffer_put(buffer_1small, "", 1); + buffer_puts(buffer_1small, dash); + buffer_put(buffer_1small, "", 1); + buffer_puts(buffer_1small, extension); + buffer_put(buffer_1small, "", 1); buffer_flush(buffer_1small); _exit(0); |