1
0

show_file_info.c 755 B

123456789101112131415161718192021222324
  1. #include <stdio.h>
  2. #include <sys/stat.h>
  3. #include "show_file_info.h"
  4. void show_file_info( char *filename, struct stat *info_p )
  5. /*
  6. * display the info about 'filename'. The info is stored in struct at *info_p
  7. */
  8. {
  9. char *uid_to_name(), *ctime(), *gid_to_name(), *filemode();
  10. void mode_to_letters();
  11. char modestr[11];
  12. mode_to_letters( info_p->st_mode, modestr );
  13. printf( "%s" , modestr );
  14. printf( "%4d " , (int) info_p->st_nlink);
  15. printf( "%-8s " , uid_to_name(info_p->st_uid) );
  16. printf( "%-8s " , gid_to_name(info_p->st_gid) );
  17. printf( "%8ld " , (long)info_p->st_size);
  18. printf( "%.12s ", 4+ctime(&info_p->st_mtime));
  19. printf( "%s\n" , filename );
  20. }