]> pd.if.org Git - zpackage/blobdiff - zpm-stat.c
fix compile process for elf programs
[zpackage] / zpm-stat.c
index 47e356d5f209dc66fce204500608e253ce9d9801..b8cb9d767cb906746aae7f4bc78626360f2dee18 100644 (file)
@@ -1,3 +1,5 @@
+#define _POSIX_C_SOURCE 200112L
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -80,6 +82,9 @@ void stat_one(char *fmt, char *timefmt, char *filename, struct stat *buf) {
                                timestr[1023] = 0;
                                printf("%s", timestr);
                                break;
+                       case 's':
+                               printf("%jd", (intmax_t)buf->st_size);
+                               break;
                        case 'a': /* octal mode */
                                printf("%o", (int)buf->st_mode & 07777);
                                break;
@@ -162,7 +167,7 @@ int main(int ac, char *av[]) {
                }
        }
        if (errflg) {
-               fprintf(stderr, "zpm-stat [-f <format>] [-t <timefmt>]");
+               fprintf(stderr, "zpm-stat [-f <format>] [-t <timefmt>]\n");
                exit(2);
        }
        for ( ; optind < ac; optind++) {