#include <inttypes.h>
#include <fcntl.h>
#include <locale.h>
-#include <libiberty.h>
#include <linux/lustre/lustre_user.h>
#ifdef HAVE_SELINUX
}
#endif /* HAVE_STATX */
+#define xstrdup(str) strdup(str)
+static inline
+char *xasprintf(const char *fmt, const char *old_fmt, const char *str)
+{
+ char *tmp = NULL;
+
+ if (asprintf(&tmp, fmt, old_fmt, str) < 0) {
+ fprintf(stderr, "asprintf allocation failed\n");
+ exit(1);
+ }
+
+ return tmp;
+}
+
+
/* coreutils/lib/intprops.h */
#define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED(__typeof__(t))
static char const fmt_terse_fs[] = "%n %i %l %t %s %S %b %f %a %c %d\n";
static char const fmt_terse_regular[] = "%n %s %b %f %u %g %D %i %h %t %T"
" %X %Y %Z %W %o\n";
+#ifdef HAVE_SELINUX
static char const fmt_terse_selinux[] = "%n %s %b %f %u %g %D %i %h %t %T"
" %X %Y %Z %W %o %C\n";
-
+#endif
static char *format;
/* Whether to follow symbolic links; True for --dereference (-L). */
"\t%%n file name\n"
"\t%%N quoted file name with dereference if symbolic link\n"
"\t%%o optimal I/O transfer size hint\n"
- "\t%%q Mask to show what's supported in stx_attributes\n"
+ "\t%%p Mask to show what's supported in stx_attributes\n"
"\t%%r Flags conveying information about the file: "
"stx_attributes\n"
"\t%%s total size, in bytes\n"
strcpy(pformat + prefix_len, "s");
printf(pformat, (scontext ? scontext : "?"));
+#ifdef HAVE_SELINUX
if (scontext)
freecon(scontext);
+#endif
return rc;
}
");
free(temp);
+#ifdef HAVE_SELINUX
if (is_selinux_enabled() > 0) {
temp = format;
/* TRANSLATORS: This string uses format
"Context: %C\n");
free(temp);
}
-
+#endif
temp = format;
/* TRANSLATORS: This string uses format specifiers from
* 'stat --help' without --file-system, and NOT from