aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-06-08 06:55:30 +0000
committermerakor <cem@ckyln.com>2020-06-08 06:55:30 +0000
commit22d2433a2f29379bbe6a4827dfbf438bfacb07a4 (patch)
treea4de6cea0870f1d3f5eda312692132b7acfb9e16 /bin
parenta93b30f9e7d8958f8a3cba2f9f17ea6fb891d8b3 (diff)
downloadcpt-22d2433a2f29379bbe6a4827dfbf438bfacb07a4.tar.gz
bin: C89 standard compatibility fixes
FossilOrigin-Name: 0f850280cc94a62782bf1fc83fa3b719678bf529f7101387c017d265fdd6a2f1
Diffstat (limited to 'bin')
-rw-r--r--bin/kiss-readlink.c9
-rw-r--r--bin/kiss-stat.c22
2 files changed, 17 insertions, 14 deletions
diff --git a/bin/kiss-readlink.c b/bin/kiss-readlink.c
index a87da0e..8dc0c0f 100644
--- a/bin/kiss-readlink.c
+++ b/bin/kiss-readlink.c
@@ -1,7 +1,8 @@
-// kiss-readlink --- a utility replacement for readlink
-// See LICENSE for copyright information
-
-// This is basically a 'readlink -f' command.
+/* kiss-readlink --- a utility replacement for readlink
+ * See LICENSE for copyright information
+ *
+ * This is basically a 'readlink -f' command.
+ */
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>
diff --git a/bin/kiss-stat.c b/bin/kiss-stat.c
index 1e2de4e..ebb6f52 100644
--- a/bin/kiss-stat.c
+++ b/bin/kiss-stat.c
@@ -1,7 +1,7 @@
-// kiss-stat --- a utility for getting the user name of file owner
-// See LICENSE for copyright information
-
-/* The reason this simple tool exists is because 'stat' is not
+/* kiss-stat --- a utility for getting the user name of file owner
+ * See LICENSE for copyright information
+ *
+ * The reason this simple tool exists is because 'stat' is not
* portable and ls is not exactly stable enough for scripting.
* This program is for outputting the owner name, and that's it.
*/
@@ -11,28 +11,30 @@
#include <stdio.h>
#include <string.h>
+struct passwd *pw;
+struct stat sb;
+
int main (int argc, char *argv[]) {
- struct stat sb;
- // Exit if no or multiple arguments are given.
+ /* 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.
+ /* 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.
+ /* Exit if name of the owner cannot be retrieved. */
if (!getpwuid(sb.st_uid)) {
return(1);
}
- // Print the user name of file owner.
- struct passwd *pw = getpwuid(sb.st_uid);
+ /* Print the user name of file owner. */
+ pw = getpwuid(sb.st_uid);
printf("%s\n", pw->pw_name);
return(0);
}