diff options
| author | Mark Whitley <markw@lineo.com> | 2001-01-23 22:30:04 +0000 |
|---|---|---|
| committer | Mark Whitley <markw@lineo.com> | 2001-01-23 22:30:04 +0000 |
| commit | 59ab025363d884deb2013dcaae6c968585a6ec72 (patch) | |
| tree | 852d97bdc34c44dbcf29cc8b5cd9257a8c90f7b3 /ls.c | |
| parent | 2b8d07c590249991fae975652aae86f5fca91f81 (diff) | |
| download | busybox-w32-59ab025363d884deb2013dcaae6c968585a6ec72.tar.gz busybox-w32-59ab025363d884deb2013dcaae6c968585a6ec72.tar.bz2 busybox-w32-59ab025363d884deb2013dcaae6c968585a6ec72.zip | |
#define -> static const int. Also got rid of some big static buffers.
Diffstat (limited to 'ls.c')
| -rw-r--r-- | ls.c | 75 |
1 files changed, 40 insertions, 35 deletions
| @@ -41,9 +41,9 @@ | |||
| 41 | * 1. requires lstat (BSD) - how do you do it without? | 41 | * 1. requires lstat (BSD) - how do you do it without? |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | #define TERMINAL_WIDTH 80 /* use 79 if your terminal has linefold bug */ | 44 | static const int TERMINAL_WIDTH = 80; /* use 79 if your terminal has linefold bug */ |
| 45 | #define COLUMN_WIDTH 14 /* default if AUTOWIDTH not defined */ | 45 | static const int COLUMN_WIDTH = 14; /* default if AUTOWIDTH not defined */ |
| 46 | #define COLUMN_GAP 2 /* includes the file type char, if present */ | 46 | static const int COLUMN_GAP = 2; /* includes the file type char, if present */ |
| 47 | 47 | ||
| 48 | /************************************************************************/ | 48 | /************************************************************************/ |
| 49 | 49 | ||
| @@ -66,10 +66,12 @@ | |||
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | /* what is the overall style of the listing */ | 68 | /* what is the overall style of the listing */ |
| 69 | #define STYLE_AUTO 0 | 69 | enum { |
| 70 | #define STYLE_LONG 1 /* one record per line, extended info */ | 70 | STYLE_AUTO = 0, |
| 71 | #define STYLE_SINGLE 2 /* one record per line */ | 71 | STYLE_LONG = 1, /* one record per line, extended info */ |
| 72 | #define STYLE_COLUMNS 3 /* fill columns */ | 72 | STYLE_SINGLE = 2, /* one record per line */ |
| 73 | STYLE_COLUMNS = 3 /* fill columns */ | ||
| 74 | }; | ||
| 73 | 75 | ||
| 74 | /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ | 76 | /* 51306 lrwxrwxrwx 1 root root 2 May 11 01:43 /bin/view -> vi* */ |
| 75 | /* what file information will be listed */ | 77 | /* what file information will be listed */ |
| @@ -99,23 +101,23 @@ | |||
| 99 | 101 | ||
| 100 | #ifdef BB_FEATURE_LS_SORTFILES | 102 | #ifdef BB_FEATURE_LS_SORTFILES |
| 101 | /* how will the files be sorted */ | 103 | /* how will the files be sorted */ |
| 102 | #define SORT_FORWARD 0 /* sort in reverse order */ | 104 | static const int SORT_FORWARD = 0; /* sort in reverse order */ |
| 103 | #define SORT_REVERSE 1 /* sort in reverse order */ | 105 | static const int SORT_REVERSE = 1; /* sort in reverse order */ |
| 104 | #define SORT_NAME 2 /* sort by file name */ | 106 | static const int SORT_NAME = 2; /* sort by file name */ |
| 105 | #define SORT_SIZE 3 /* sort by file size */ | 107 | static const int SORT_SIZE = 3; /* sort by file size */ |
| 106 | #define SORT_ATIME 4 /* sort by last access time */ | 108 | static const int SORT_ATIME = 4; /* sort by last access time */ |
| 107 | #define SORT_CTIME 5 /* sort by last change time */ | 109 | static const int SORT_CTIME = 5; /* sort by last change time */ |
| 108 | #define SORT_MTIME 6 /* sort by last modification time */ | 110 | static const int SORT_MTIME = 6; /* sort by last modification time */ |
| 109 | #define SORT_VERSION 7 /* sort by version */ | 111 | static const int SORT_VERSION = 7; /* sort by version */ |
| 110 | #define SORT_EXT 8 /* sort by file name extension */ | 112 | static const int SORT_EXT = 8; /* sort by file name extension */ |
| 111 | #define SORT_DIR 9 /* sort by file or directory */ | 113 | static const int SORT_DIR = 9; /* sort by file or directory */ |
| 112 | #endif | 114 | #endif |
| 113 | 115 | ||
| 114 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 116 | #ifdef BB_FEATURE_LS_TIMESTAMPS |
| 115 | /* which of the three times will be used */ | 117 | /* which of the three times will be used */ |
| 116 | #define TIME_MOD 0 | 118 | static const int TIME_MOD = 0; |
| 117 | #define TIME_CHANGE 1 | 119 | static const int TIME_CHANGE = 1; |
| 118 | #define TIME_ACCESS 2 | 120 | static const int TIME_ACCESS = 2; |
| 119 | #endif | 121 | #endif |
| 120 | 122 | ||
| 121 | #define LIST_SHORT (LIST_FILENAME) | 123 | #define LIST_SHORT (LIST_FILENAME) |
| @@ -125,9 +127,9 @@ | |||
| 125 | LIST_SYMLINK) | 127 | LIST_SYMLINK) |
| 126 | #define LIST_ILONG (LIST_INO | LIST_LONG) | 128 | #define LIST_ILONG (LIST_INO | LIST_LONG) |
| 127 | 129 | ||
| 128 | #define SPLIT_DIR 0 | 130 | static const int SPLIT_DIR = 0; |
| 129 | #define SPLIT_FILE 1 | 131 | static const int SPLIT_FILE = 1; |
| 130 | #define SPLIT_SUBDIR 2 | 132 | static const int SPLIT_SUBDIR = 2; |
| 131 | 133 | ||
| 132 | #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) | 134 | #define TYPEINDEX(mode) (((mode) >> 12) & 0x0f) |
| 133 | #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) | 135 | #define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)]) |
| @@ -150,15 +152,15 @@ struct dnode **list_dir(char *); | |||
| 150 | struct dnode **dnalloc(int); | 152 | struct dnode **dnalloc(int); |
| 151 | int list_single(struct dnode *); | 153 | int list_single(struct dnode *); |
| 152 | 154 | ||
| 153 | static unsigned int disp_opts= DISP_NORMAL; | 155 | static unsigned int disp_opts; |
| 154 | static unsigned int style_fmt= STYLE_AUTO ; | 156 | static unsigned int style_fmt; |
| 155 | static unsigned int list_fmt= LIST_SHORT ; | 157 | static unsigned int list_fmt; |
| 156 | #ifdef BB_FEATURE_LS_SORTFILES | 158 | #ifdef BB_FEATURE_LS_SORTFILES |
| 157 | static unsigned int sort_opts= SORT_FORWARD; | 159 | static unsigned int sort_opts; |
| 158 | static unsigned int sort_order= SORT_FORWARD; | 160 | static unsigned int sort_order; |
| 159 | #endif | 161 | #endif |
| 160 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 162 | #ifdef BB_FEATURE_LS_TIMESTAMPS |
| 161 | static unsigned int time_fmt= TIME_MOD; | 163 | static unsigned int time_fmt; |
| 162 | #endif | 164 | #endif |
| 163 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 165 | #ifdef BB_FEATURE_LS_FOLLOWLINKS |
| 164 | static unsigned int follow_links=FALSE; | 166 | static unsigned int follow_links=FALSE; |
| @@ -166,12 +168,9 @@ static unsigned int follow_links=FALSE; | |||
| 166 | 168 | ||
| 167 | static unsigned short column = 0; | 169 | static unsigned short column = 0; |
| 168 | #ifdef BB_FEATURE_AUTOWIDTH | 170 | #ifdef BB_FEATURE_AUTOWIDTH |
| 169 | static unsigned short terminal_width = TERMINAL_WIDTH; | 171 | static unsigned short terminal_width; |
| 170 | static unsigned short column_width = COLUMN_WIDTH; | 172 | static unsigned short column_width; |
| 171 | static unsigned short tabstops = 8; | 173 | static unsigned short tabstops; |
| 172 | #else | ||
| 173 | #define terminal_width TERMINAL_WIDTH | ||
| 174 | #define column_width COLUMN_WIDTH | ||
| 175 | #endif | 174 | #endif |
| 176 | 175 | ||
| 177 | static int status = EXIT_SUCCESS; | 176 | static int status = EXIT_SUCCESS; |
| @@ -710,10 +709,16 @@ extern int ls_main(int argc, char **argv) | |||
| 710 | list_fmt= LIST_SHORT; | 709 | list_fmt= LIST_SHORT; |
| 711 | #ifdef BB_FEATURE_LS_SORTFILES | 710 | #ifdef BB_FEATURE_LS_SORTFILES |
| 712 | sort_opts= SORT_NAME; | 711 | sort_opts= SORT_NAME; |
| 712 | sort_order= SORT_FORWARD; | ||
| 713 | #endif | 713 | #endif |
| 714 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 714 | #ifdef BB_FEATURE_LS_TIMESTAMPS |
| 715 | time_fmt= TIME_MOD; | 715 | time_fmt= TIME_MOD; |
| 716 | #endif | 716 | #endif |
| 717 | #ifdef BB_FEATURE_AUTOWIDTH | ||
| 718 | terminal_width = TERMINAL_WIDTH; | ||
| 719 | column_width = COLUMN_WIDTH; | ||
| 720 | tabstops = 8; | ||
| 721 | #endif | ||
| 717 | nfiles=0; | 722 | nfiles=0; |
| 718 | 723 | ||
| 719 | /* process options */ | 724 | /* process options */ |
