aboutsummaryrefslogtreecommitdiffstats
path: root/src/filemode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/filemode.c')
-rw-r--r--src/filemode.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/filemode.c b/src/filemode.c
index 4a11d2a3115..c3a5a924a93 100644
--- a/src/filemode.c
+++ b/src/filemode.c
@@ -90,10 +90,10 @@
90#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) 90#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
91#endif 91#endif
92 92
93void mode_string (); 93void mode_string (short unsigned int mode, char *str);
94static char ftypelet (); 94static char ftypelet (long int bits);
95static void rwx (); 95static void rwx (short unsigned int bits, char *chars);
96static void setst (); 96static void setst (short unsigned int bits, char *chars);
97 97
98/* filemodestring - fill in string STR with an ls-style ASCII 98/* filemodestring - fill in string STR with an ls-style ASCII
99 representation of the st_mode field of file stats block STATP. 99 representation of the st_mode field of file stats block STATP.
@@ -132,9 +132,7 @@ static void setst ();
132 'T' if the file is sticky but not executable. */ 132 'T' if the file is sticky but not executable. */
133 133
134void 134void
135filemodestring (statp, str) 135filemodestring (struct stat *statp, char *str)
136 struct stat *statp;
137 char *str;
138{ 136{
139 mode_string (statp->st_mode, str); 137 mode_string (statp->st_mode, str);
140} 138}
@@ -143,9 +141,7 @@ filemodestring (statp, str)
143 is given as an argument. */ 141 is given as an argument. */
144 142
145void 143void
146mode_string (mode, str) 144mode_string (short unsigned int mode, char *str)
147 unsigned short mode;
148 char *str;
149{ 145{
150 str[0] = ftypelet ((long) mode); 146 str[0] = ftypelet ((long) mode);
151 rwx ((mode & 0700) << 0, &str[1]); 147 rwx ((mode & 0700) << 0, &str[1]);
@@ -167,8 +163,7 @@ mode_string (mode, str)
167 '?' for any other file type. */ 163 '?' for any other file type. */
168 164
169static char 165static char
170ftypelet (bits) 166ftypelet (long int bits)
171 long bits;
172{ 167{
173#ifdef S_ISBLK 168#ifdef S_ISBLK
174 if (S_ISBLK (bits)) 169 if (S_ISBLK (bits))
@@ -207,9 +202,7 @@ ftypelet (bits)
207 flags in CHARS accordingly. */ 202 flags in CHARS accordingly. */
208 203
209static void 204static void
210rwx (bits, chars) 205rwx (short unsigned int bits, char *chars)
211 unsigned short bits;
212 char *chars;
213{ 206{
214 chars[0] = (bits & S_IRUSR) ? 'r' : '-'; 207 chars[0] = (bits & S_IRUSR) ? 'r' : '-';
215 chars[1] = (bits & S_IWUSR) ? 'w' : '-'; 208 chars[1] = (bits & S_IWUSR) ? 'w' : '-';
@@ -220,9 +213,7 @@ rwx (bits, chars)
220 according to the file mode BITS. */ 213 according to the file mode BITS. */
221 214
222static void 215static void
223setst (bits, chars) 216setst (short unsigned int bits, char *chars)
224 unsigned short bits;
225 char *chars;
226{ 217{
227#ifdef S_ISUID 218#ifdef S_ISUID
228 if (bits & S_ISUID) 219 if (bits & S_ISUID)