Esempio n. 1
0
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);
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
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);
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
File: file.c Progetto: Gingar/port
void stat_mode(unsigned char **p, int *l, struct stat *stp)
{
	unsigned char c = '?';
	if (stp) {
		if (0) ;
#ifdef S_ISBLK
		else if (S_ISBLK(stp->st_mode)) c = 'b';
#endif
#ifdef S_ISCHR
		else if (S_ISCHR(stp->st_mode)) c = 'c';
#endif
		else if (S_ISDIR(stp->st_mode)) c = 'd';
		else if (S_ISREG(stp->st_mode)) c = '-';
#ifdef S_ISFIFO
		else if (S_ISFIFO(stp->st_mode)) c = 'p';
#endif
#ifdef S_ISLNK
		else if (S_ISLNK(stp->st_mode)) c = 'l';
#endif
#ifdef S_ISSOCK
		else if (S_ISSOCK(stp->st_mode)) c = 's';
#endif
#ifdef S_ISNWK
		else if (S_ISNWK(stp->st_mode)) c = 'n';
#endif
	}
	add_chr_to_str(p, l, c);
#ifdef FS_UNIX_RIGHTS
	{
		unsigned char rwx[10] = "---------";
		if (stp) {
			int mode = stp->st_mode;
			setrwx(mode << 0, &rwx[0]);
			setrwx(mode << 3, &rwx[3]);
			setrwx(mode << 6, &rwx[6]);
			setst(mode, rwx);
		}
		add_to_str(p, l, rwx);
	}
#endif
	add_chr_to_str(p, l, ' ');
}