commit 50363b7aca8bb24e3bda644224eefc062fec528a
parent 2d17fffa6c3ef3504dc40f169e132290ff52861d
Author: Cem Keylan <cem@ckyln.com>
Date: Thu, 23 Jul 2020 11:25:15 +0300
kiss-stat: style changes
Diffstat:
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/bin/kiss-stat.c b/bin/kiss-stat.c
@@ -14,27 +14,28 @@
struct passwd *pw;
struct stat sb;
-int main (int argc, char *argv[]) {
+int
+main (int argc, char *argv[])
+{
+ /* Exit if no or multiple arguments are given. */
+ if (argc != 2 || strcmp(argv[1], "--help") == 0) {
+ fprintf(stderr, "Usage: %s [pathname]\n", argv[0]);
+ return 1;
+ }
- /* Exit if no or multiple arguments are given. */
- if (argc != 2 || strcmp(argv[1], "--help") == 0) {
- fprintf(stderr, "Usage: %s [pathname]\n", argv[0]);
- return(1);
- }
+ /* Exit if file stat cannot be obtained. */
+ if (lstat(argv[1], &sb) == -1) {
+ perror(argv[0]);
+ return 1;
+ }
- /* Exit if file stat cannot be obtained. */
- if (lstat(argv[1], &sb) == -1) {
- perror(argv[0]);
- return(1);
- }
+ /* Exit if name of the owner cannot be retrieved. */
+ if (!getpwuid(sb.st_uid)) {
+ return 1;
+ }
- /* Exit if name of the owner cannot be retrieved. */
- if (!getpwuid(sb.st_uid)) {
- return(1);
- }
-
- /* Print the user name of file owner. */
- pw = getpwuid(sb.st_uid);
- printf("%s\n", pw->pw_name);
- return(0);
-}
+ /* Print the user name of file owner. */
+ pw = getpwuid(sb.st_uid);
+ printf("%s\n", pw->pw_name);
+ return 0;
+}