static void mode_string (unsigned short mode, char *str) { str[0] = ftypelet (mode); rwx ((unsigned short) ((mode & 0700) << 0), &str[1]); rwx ((unsigned short) ((mode & 0070) << 3), &str[4]); rwx ((unsigned short) ((mode & 0007) << 6), &str[7]); setst (mode, str); }
void mode_string(MODE_T m, char *str) { unsigned mode = (unsigned) m; str[0] = ftypelet(mode); set_rwx((mode & 0700) >> 6, &str[1]); set_rwx((mode & 0070) >> 3, &str[4]); set_rwx((mode & 0007) >> 0, &str[7]); set_st(mode, str); }
/* %M */ static int print_sd_mode (FILE * stream, const struct printf_info *info, const void *const *args) { int len = 0; mode_t mode; mode = *(mode_t *)args[0]; len = fprintf (stream, "%c", ftypelet (mode)); len += rwx (stream, (mode & 0700) << 0); len += rwx (stream, (mode & 0070) << 3); len += rwx (stream, (mode & 0007) << 6); return len; }
void mode_string (unsigned long mode, char *str) { str[0] = ftypelet ((unsigned long) mode); str[1] = (mode & S_IRUSR) != 0 ? 'r' : '-'; str[2] = (mode & S_IWUSR) != 0 ? 'w' : '-'; str[3] = (mode & S_IXUSR) != 0 ? 'x' : '-'; str[4] = (mode & S_IRGRP) != 0 ? 'r' : '-'; str[5] = (mode & S_IWGRP) != 0 ? 'w' : '-'; str[6] = (mode & S_IXGRP) != 0 ? 'x' : '-'; str[7] = (mode & S_IROTH) != 0 ? 'r' : '-'; str[8] = (mode & S_IWOTH) != 0 ? 'w' : '-'; str[9] = (mode & S_IXOTH) != 0 ? 'x' : '-'; setst ((unsigned long) mode, str); }
void mode_string (mode_t mode, char *str) { str[0] = ftypelet (mode); str[1] = mode & S_IRUSR ? 'r' : '-'; str[2] = mode & S_IWUSR ? 'w' : '-'; str[3] = mode & S_IXUSR ? 'x' : '-'; str[4] = mode & S_IRGRP ? 'r' : '-'; str[5] = mode & S_IWGRP ? 'w' : '-'; str[6] = mode & S_IXGRP ? 'x' : '-'; str[7] = mode & S_IROTH ? 'r' : '-'; str[8] = mode & S_IWOTH ? 'w' : '-'; str[9] = mode & S_IXOTH ? 'x' : '-'; setst (mode, str); }
void strmode( mode_t mode, char *str ) { str[0] = ftypelet( mode ); str[1] = ( mode & 256 ) == 0 ? '-' : 'r'; str[2] = ( mode & 128 ) == 0 ? '-' : 'w'; str[3] = ( mode & 2048 ) == 0 ? ( mode & 64 ) == 0 ? '-' : 'x' : ( mode & 64 ) == 0 ? 'S' : 's'; str[4] = ( mode & 32 ) == 0 ? '-' : 'r'; str[5] = ( mode & 16 ) == 0 ? '-' : 'w'; str[6] = ( mode & 1024 ) == 0 ? ( mode & 8 ) == 0 ? '-' : 'x' : ( mode & 8 ) == 0 ? 'S' : 's'; str[7] = ( mode & 4 ) == 0 ? '-' : 'r'; str[8] = ( mode & 2 ) == 0 ? '-' : 'w'; str[9] = ( mode & 512 ) == 0 ? ( mode & 1 ) == 0 ? '-' : 'x' : ( mode & 1 ) == 0 ? 'T' : 't'; str[10] = ' '; str[11] = 0; return; }
char * udf_mode_string (mode_t i_mode, char *psz_str) { psz_str[ 0] = ftypelet (i_mode); psz_str[ 1] = i_mode & S_IRUSR ? 'r' : '-'; psz_str[ 2] = i_mode & S_IWUSR ? 'w' : '-'; psz_str[ 3] = i_mode & S_IXUSR ? 'x' : '-'; psz_str[ 4] = i_mode & S_IRGRP ? 'r' : '-'; psz_str[ 5] = i_mode & S_IWGRP ? 'w' : '-'; psz_str[ 6] = i_mode & S_IXGRP ? 'x' : '-'; psz_str[ 7] = i_mode & S_IROTH ? 'r' : '-'; psz_str[ 8] = i_mode & S_IWOTH ? 'w' : '-'; psz_str[ 9] = i_mode & S_IXOTH ? 'x' : '-'; psz_str[10] = '\0'; setst (i_mode, psz_str); return psz_str; }
void strmode (mode_t mode, char *str) { str[0] = ftypelet (mode); str[1] = mode & S_IRUSR ? 'r' : '-'; str[2] = mode & S_IWUSR ? 'w' : '-'; str[3] = (mode & S_ISUID ? (mode & S_IXUSR ? 's' : 'S') : (mode & S_IXUSR ? 'x' : '-')); str[4] = mode & S_IRGRP ? 'r' : '-'; str[5] = mode & S_IWGRP ? 'w' : '-'; str[6] = (mode & S_ISGID ? (mode & S_IXGRP ? 's' : 'S') : (mode & S_IXGRP ? 'x' : '-')); str[7] = mode & S_IROTH ? 'r' : '-'; str[8] = mode & S_IWOTH ? 'w' : '-'; str[9] = (mode & S_ISVTX ? (mode & S_IXOTH ? 't' : 'T') : (mode & S_IXOTH ? 'x' : '-')); str[10] = ' '; str[11] = '\0'; }