libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / bin / autologin.cpp
blob76c69c1f5f3863fa2ceb62f2e19bc4d46b3c2ab4
1 /*
2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <pwd.h>
8 #include <stdio.h>
9 #include <stdlib.h>
11 #include <LaunchRoster.h>
14 int
15 main()
17 if (getuid() != 0)
18 return EXIT_FAILURE;
20 // TODO: This will obviously be done differently in a multi-user
21 // environment; we'll probably want to merge this with the standard
22 // login application then.
23 struct passwd* passwd = getpwuid(0);
24 if (passwd == NULL)
25 return EXIT_FAILURE;
27 status_t status = BLaunchRoster().StartSession(passwd->pw_name);
28 if (status != B_OK)
29 return EXIT_FAILURE;
31 return EXIT_SUCCESS;