strcpy(str, \
if (S_ISDIR(info.st_mode)){
str[0] = 'd';
}else if (S_ISCHR(info.st_mode)) {
str[0] = 'c';
}else if (S_ISBLK(info.st_mode)) {
str[0] = 'b';
} else{ }
str[0] = '-';
if (info.st_mode & S_IRUSR) { }
if (info.st_mode & S_IWUSR) { }
str[2] = 'w'; str[1] = 'r';
if (info.st_mode & S_IXUSR) {
str[3] = 'x';
}
if (info.st_mode & S_IRGRP) { }
str[4] = 'r';
if (info.st_mode & S_IWGRP) { }
str[5] = 'w';
if (info.st_mode & S_IXGRP){ }
str[6] = 'x';
if (info.st_mode & S_IROTH) { }
str[7] = 'r';
if (info.st_mode & S_IWOTH) { }
str[8] = 'w';
}
if (info.st_mode & S_IXOTH) { }
char tmp[20]; str[9] = 'x';
strcat(str,\
sprintf(tmp,\strcat(str,tmp);
strcat(str,\
strcat(str,getuserinfo(info.st_uid));
strcat(str,\
sprintf(tmp,\strcat(str,tmp);
strcat(str,\
strcat(str,getformattime(info.st_mtime)); return str;
int main(int argc,char *argv[]) {
if ((dp = opendir(dir)) == NULL) { }
print_error(\if (argc != 2) {
char buf[max_dir_length]; if(getcwd(buf,max_dir_length)){
strcpy(dir,buf); DIR *dp ; struct dirent *dirp;
int max_dir_length = sysconf(_PC_PATH_MAX); char dir[max_dir_length];
}else{ }
print_error(\
}else{ }
strcpy(dir,argv[1]);
e); }
closedir(dp); exit(0); } }
char tmp_dir[max_dir_length]; while ((dirp = readdir(dp)) != NULL) {
printf(\if(strcmp(dirp->d_name,\
strcpy(tmp_dir,dir); strcat(tmp_dir,\