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

Userland: Replace most printf-style APIs with AK::Format APIs :^)

This commit is contained in:
Linus Groh 2021-05-31 15:43:25 +01:00
parent 4f1889c2cb
commit f5c35fccca
75 changed files with 642 additions and 644 deletions

View file

@ -54,25 +54,25 @@ int main(int argc, char** argv)
// Let's run a quick sanity check on username
if (strpbrk(username, "\\/!@#$%^&*()~+=`:\n")) {
fprintf(stderr, "invalid character in username, %s\n", username);
warnln("invalid character in username, {}", username);
return 1;
}
// Disallow names starting with _ and -
if (username[0] == '_' || username[0] == '-' || !isalpha(username[0])) {
fprintf(stderr, "invalid username, %s\n", username);
warnln("invalid username, {}", username);
return 1;
}
if (uid < 0) {
fprintf(stderr, "invalid uid %d!\n", uid);
warnln("invalid uid {}!", uid);
return 3;
}
// First, let's sort out the uid for the user
if (uid > 0) {
if (getpwuid(static_cast<uid_t>(uid))) {
fprintf(stderr, "uid %u already exists!\n", uid);
warnln("uid {} already exists!", uid);
return 4;
}
@ -82,7 +82,7 @@ int main(int argc, char** argv)
}
if (gid < 0) {
fprintf(stderr, "invalid gid %d\n", gid);
warnln("invalid gid {}", gid);
return 3;
}