Exemple #1
0
void show_file_info(char *filename, struct stat *info_p) /* 打印文件的相关信息 */
{
	char modestr[11];

	mode_str(info_p->st_mode, modestr);

	if((strcmp(arr1,"-a") == 0) ||(strcmp(arr2,"-a") == 0))
	{
		printf("%s", modestr);
		printf("%3d ", (int)info_p->st_nlink);
		printf("%-8s", uid_str(info_p->st_uid));
		printf("%-8s", gid_str(info_p->st_gid));
		printf("%4ld ", (long)info_p->st_size);
		printf("%.12s ", 4 + ctime(&info_p->st_mtime));
		printf("%s\n", filename);
	}else if(filename[0] != '.')	//文件名第一个字符不为.就显示
	{
		printf("%s", modestr);
		printf("%3d ", (int)info_p->st_nlink);
		printf("%-8s", uid_str(info_p->st_uid));
		printf("%-8s", gid_str(info_p->st_gid));
		printf("%4ld ", (long)info_p->st_size);
		printf("%.12s ", 4 + ctime(&info_p->st_mtime));
		printf("%s\n", filename);
	}
}
Exemple #2
0
void show_file_info(char *filename, struct stat *info_p) 
{
       char modestr[11];

        mode_str(info_p->st_mode, modestr);
        printf("%s", modestr);
        printf("%3d ", (int)info_p->st_nlink);
        printf("%-8s", uid_str(info_p->st_uid));
        printf("%-8s", gid_str(info_p->st_gid));
        printf("%4ld ", (long)info_p->st_size);
        printf("%.12s ", 4 + ctime(&info_p->st_mtime));
        printf("%s\n", filename);
}