?????????????д???????show()?????????????????????????
????show??????????£?
1 void show(char name[][CNT]?? int cnt)
2 {
3     int index;
4     char mode[10];
5     char *str;
6     struct stat buf;
7     for(index = 0; index < cnt; index ++)
8     {
9         memset(&buf?? 0?? sizeof(buf));
10         if(stat(name[index]?? &buf) == -1)
11         {
12             printf("stat error!! ");
13             exit(1);
14         }
15         mode_to_char(buf.st_mode?? mode);
16         str = ctime(&buf.st_atime);
17         str = time_change(str);
18         int i;
19         for(i = strlen(name[index]) - 1; name[index][i] != '/'; i --);
20         i++;
21         printf("%10s.%2d %5s %5s%5d%13s %s "?? mode?? buf.st_nlink?? getpwuid(buf.st_uid)->pw_name?? getgrgid(buf.st_gid)->gr_name?? buf.st_size?? str?? name[index] + i);
22     }
23 }
??????????????:
????getpwuid()?????????????????????????????????y????е????????——pw_name???????getgrid()??????????????
???????????????:
1 #include "head.h"
2 int main(int argc?? char *argv[])
3 {
4     DIR *fp;
5     char name[CNT][CNT];
6     int cnt;
7     fp = opendir(argv[1]);
8     if(fp == NULL)
9     {
10         printf("opendir error!! ");
11         exit(1);
12     }
13     cnt = file_name(fp?? argv[1]?? name);
14     str_sort(name?? cnt);
15     show(name?? cnt);
16     return 0;
17 }