diff options
| author | Eric Andersen <andersen@codepoet.org> | 1999-10-19 20:03:34 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 1999-10-19 20:03:34 +0000 |
| commit | e77ae3a2c0328590b43447550bdb1284650b8236 (patch) | |
| tree | 1e46d5cf36870771a4f3cedfe84f6161c3871131 /ls.c | |
| parent | a3f09076ef5e9a2c26b4d0728cd066bba6c474e4 (diff) | |
| download | busybox-w32-e77ae3a2c0328590b43447550bdb1284650b8236.tar.gz busybox-w32-e77ae3a2c0328590b43447550bdb1284650b8236.tar.bz2 busybox-w32-e77ae3a2c0328590b43447550bdb1284650b8236.zip | |
Added sfdisk. Ststic-ified a bunch of stuff.
Diffstat (limited to 'ls.c')
| -rw-r--r-- | ls.c | 19 |
1 files changed, 9 insertions, 10 deletions
| @@ -132,7 +132,6 @@ int ls_main(int argc, char **argv) | |||
| 132 | #else | 132 | #else |
| 133 | 133 | ||
| 134 | 134 | ||
| 135 | #include "internal.h" | ||
| 136 | /* | 135 | /* |
| 137 | * tiny-ls.c version 0.1.0: A minimalist 'ls' | 136 | * tiny-ls.c version 0.1.0: A minimalist 'ls' |
| 138 | * Copyright (C) 1996 Brian Candler <B.Candler@pobox.com> | 137 | * Copyright (C) 1996 Brian Candler <B.Candler@pobox.com> |
| @@ -175,7 +174,7 @@ int ls_main(int argc, char **argv) | |||
| 175 | * 1. requires lstat (BSD) - how do you do it without? | 174 | * 1. requires lstat (BSD) - how do you do it without? |
| 176 | */ | 175 | */ |
| 177 | 176 | ||
| 178 | #define FEATURE_USERNAME /* show username/groupnames (libc6 uses NSS) */ | 177 | //#define FEATURE_USERNAME /* show username/groupnames (libc6 uses NSS) */ |
| 179 | #define FEATURE_TIMESTAMPS /* show file timestamps */ | 178 | #define FEATURE_TIMESTAMPS /* show file timestamps */ |
| 180 | #define FEATURE_AUTOWIDTH /* calculate terminal & column widths */ | 179 | #define FEATURE_AUTOWIDTH /* calculate terminal & column widths */ |
| 181 | #define FEATURE_FILETYPECHAR /* enable -p and -F */ | 180 | #define FEATURE_FILETYPECHAR /* enable -p and -F */ |
| @@ -187,8 +186,8 @@ int ls_main(int argc, char **argv) | |||
| 187 | 186 | ||
| 188 | /************************************************************************/ | 187 | /************************************************************************/ |
| 189 | 188 | ||
| 190 | 189 | #include "internal.h" | |
| 191 | #if 1 /* FIXME libc 6 */ | 190 | #if !defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) |
| 192 | # include <linux/types.h> | 191 | # include <linux/types.h> |
| 193 | #else | 192 | #else |
| 194 | # include <sys/types.h> | 193 | # include <sys/types.h> |
| @@ -225,7 +224,7 @@ int ls_main(int argc, char **argv) | |||
| 225 | 224 | ||
| 226 | /* The 9 mode bits to test */ | 225 | /* The 9 mode bits to test */ |
| 227 | 226 | ||
| 228 | static const umode_t MBIT[] = { | 227 | static const mode_t MBIT[] = { |
| 229 | S_IRUSR, S_IWUSR, S_IXUSR, | 228 | S_IRUSR, S_IWUSR, S_IXUSR, |
| 230 | S_IRGRP, S_IWGRP, S_IXGRP, | 229 | S_IRGRP, S_IWGRP, S_IXGRP, |
| 231 | S_IROTH, S_IWOTH, S_IXOTH | 230 | S_IROTH, S_IWOTH, S_IXOTH |
| @@ -233,7 +232,7 @@ static const umode_t MBIT[] = { | |||
| 233 | 232 | ||
| 234 | /* The special bits. If set, display SMODE0/1 instead of MODE0/1 */ | 233 | /* The special bits. If set, display SMODE0/1 instead of MODE0/1 */ |
| 235 | 234 | ||
| 236 | static const umode_t SBIT[] = { | 235 | static const mode_t SBIT[] = { |
| 237 | 0, 0, S_ISUID, | 236 | 0, 0, S_ISUID, |
| 238 | 0, 0, S_ISGID, | 237 | 0, 0, S_ISGID, |
| 239 | 0, 0, S_ISVTX | 238 | 0, 0, S_ISVTX |
| @@ -278,7 +277,7 @@ static unsigned char time_fmt = TIME_MOD; | |||
| 278 | 277 | ||
| 279 | static void writenum(long val, short minwidth) | 278 | static void writenum(long val, short minwidth) |
| 280 | { | 279 | { |
| 281 | char scratch[20]; | 280 | char scratch[128]; |
| 282 | 281 | ||
| 283 | char *p = scratch + sizeof(scratch); | 282 | char *p = scratch + sizeof(scratch); |
| 284 | short len = 0; | 283 | short len = 0; |
| @@ -324,7 +323,7 @@ static void tab(short col) | |||
| 324 | } | 323 | } |
| 325 | 324 | ||
| 326 | #ifdef FEATURE_FILETYPECHAR | 325 | #ifdef FEATURE_FILETYPECHAR |
| 327 | static char append_char(umode_t mode) | 326 | static char append_char(mode_t mode) |
| 328 | { | 327 | { |
| 329 | if (!(opts & DISP_FTYPE)) | 328 | if (!(opts & DISP_FTYPE)) |
| 330 | return '\0'; | 329 | return '\0'; |
| @@ -343,14 +342,14 @@ static char append_char(umode_t mode) | |||
| 343 | 342 | ||
| 344 | static void list_single(const char *name, struct stat *info) | 343 | static void list_single(const char *name, struct stat *info) |
| 345 | { | 344 | { |
| 346 | char scratch[20]; | 345 | char scratch[PATH_MAX]; |
| 347 | short len = strlen(name); | 346 | short len = strlen(name); |
| 348 | #ifdef FEATURE_FILETYPECHAR | 347 | #ifdef FEATURE_FILETYPECHAR |
| 349 | char append = append_char(info->st_mode); | 348 | char append = append_char(info->st_mode); |
| 350 | #endif | 349 | #endif |
| 351 | 350 | ||
| 352 | if (display_fmt == FMT_LONG) { | 351 | if (display_fmt == FMT_LONG) { |
| 353 | umode_t mode = info->st_mode; | 352 | mode_t mode = info->st_mode; |
| 354 | int i; | 353 | int i; |
| 355 | 354 | ||
| 356 | scratch[0] = TYPECHAR(mode); | 355 | scratch[0] = TYPECHAR(mode); |
