aboutsummaryrefslogtreecommitdiff
path: root/e2fsprogs/lsattr.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-07-09 08:58:10 +0100
committerRon Yorston <rmy@pobox.com>2020-07-09 09:07:55 +0100
commit0e3456e0c4a8623fe2d8bc28c51f16c8274b8098 (patch)
treee8fc4feb3f700a1101c082d8f815d426d515ce95 /e2fsprogs/lsattr.c
parent86eb680bbfd096ab1a2664e36f80f4bea55e18cf (diff)
downloadbusybox-w32-0e3456e0c4a8623fe2d8bc28c51f16c8274b8098.tar.gz
busybox-w32-0e3456e0c4a8623fe2d8bc28c51f16c8274b8098.tar.bz2
busybox-w32-0e3456e0c4a8623fe2d8bc28c51f16c8274b8098.zip
chattr, lsattr: enable in the default configuration
The chattr and lsattr utilities allow file attributes to be changed and displayed. Modify them to support Windows file attributes using the same names as Cygwin. Only allow a limited subset of attributes to be changed: just most of those supported by SetFileAttributes(). Since it isn't possible to set all attributes the '=' operator isn't allowed.
Diffstat (limited to 'e2fsprogs/lsattr.c')
-rw-r--r--e2fsprogs/lsattr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c
index be1488b79..b36dd47a5 100644
--- a/e2fsprogs/lsattr.c
+++ b/e2fsprogs/lsattr.c
@@ -22,14 +22,21 @@
22//kbuild:lib-$(CONFIG_LSATTR) += lsattr.o e2fs_lib.o 22//kbuild:lib-$(CONFIG_LSATTR) += lsattr.o e2fs_lib.o
23 23
24//usage:#define lsattr_trivial_usage 24//usage:#define lsattr_trivial_usage
25//usage: IF_NOT_PLATFORM_MINGW32(
25//usage: "[-Radlv] [FILE]..." 26//usage: "[-Radlv] [FILE]..."
27//usage: )
28//usage: IF_PLATFORM_MINGW32(
29//usage: "[-Radl] [FILE]..."
30//usage: )
26//usage:#define lsattr_full_usage "\n\n" 31//usage:#define lsattr_full_usage "\n\n"
27//usage: "List ext2 file attributes\n" 32//usage: "List ext2 file attributes\n"
28//usage: "\n -R Recurse" 33//usage: "\n -R Recurse"
29//usage: "\n -a Don't hide entries starting with ." 34//usage: "\n -a Don't hide entries starting with ."
30//usage: "\n -d List directory entries instead of contents" 35//usage: "\n -d List directory entries instead of contents"
31//usage: "\n -l List long flag names" 36//usage: "\n -l List long flag names"
37//usage: IF_NOT_PLATFORM_MINGW32(
32//usage: "\n -v List version/generation number" 38//usage: "\n -v List version/generation number"
39//usage: )
33 40
34#include "libbb.h" 41#include "libbb.h"
35#include "e2fs_lib.h" 42#include "e2fs_lib.h"
@@ -45,16 +52,20 @@ enum {
45static void list_attributes(const char *name) 52static void list_attributes(const char *name)
46{ 53{
47 unsigned long fsflags; 54 unsigned long fsflags;
55#if !ENABLE_PLATFORM_MINGW32
48 unsigned long generation; 56 unsigned long generation;
57#endif
49 58
50 if (fgetflags(name, &fsflags) != 0) 59 if (fgetflags(name, &fsflags) != 0)
51 goto read_err; 60 goto read_err;
52 61
62#if !ENABLE_PLATFORM_MINGW32
53 if (option_mask32 & OPT_GENERATION) { 63 if (option_mask32 & OPT_GENERATION) {
54 if (fgetversion(name, &generation) != 0) 64 if (fgetversion(name, &generation) != 0)
55 goto read_err; 65 goto read_err;
56 printf("%5lu ", generation); 66 printf("%5lu ", generation);
57 } 67 }
68#endif
58 69
59 if (option_mask32 & OPT_PF_LONG) { 70 if (option_mask32 & OPT_PF_LONG) {
60 printf("%-28s ", name); 71 printf("%-28s ", name);
@@ -112,7 +123,11 @@ static void lsattr_args(const char *name)
112int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 123int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
113int lsattr_main(int argc UNUSED_PARAM, char **argv) 124int lsattr_main(int argc UNUSED_PARAM, char **argv)
114{ 125{
126#if ENABLE_PLATFORM_MINGW32
127 getopt32(argv, "Radl");
128#else
115 getopt32(argv, "Radlv"); 129 getopt32(argv, "Radlv");
130#endif
116 argv += optind; 131 argv += optind;
117 132
118 if (!*argv) 133 if (!*argv)