]> git.saurik.com Git - apple/file_cmds.git/blobdiff - stat/stat.c
file_cmds-321.100.10.0.1.tar.gz
[apple/file_cmds.git] / stat / stat.c
index 8869f728f2a23ec9b69aae3debfd23ce2b1dd78c..610eff94d732e87e01652a40196fa77cd51c5d2f 100644 (file)
@@ -549,7 +549,7 @@ format1(const struct stat *st,
        struct passwd *pw;
        struct group *gr;
        const struct timespec *tsp;
-       struct timespec ts;
+       struct timespec ts = {0,0};
        struct tm *tm;
        int l, small, formats;
 
@@ -731,7 +731,14 @@ format1(const struct stat *st,
                small = (sizeof(st->st_flags) == 4);
                data = st->st_flags;
                sdata = NULL;
-               formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX;
+               formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
+                       FMTF_STRING;
+               if (ofmt == FMTF_STRING) {
+                       small = 0;
+                       data = 0;
+                       snprintf(path, sizeof(path), "%s", fflagstostr(st->st_flags));
+                       sdata = path;
+               }
                if (ofmt == 0)
                        ofmt = FMTF_UNSIGNED;
                break;