comparison src/dired.c @ 94371:436ee104782b

(Ffile_attributes) [WINDOWSNT]: Undo change from 2008-03-31, it's not needed anymore with `struct stat' definition on nt/inc/sys/stat.h. Undo changes from 2007-01-12 and 2007-01-13 for the same reasons.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 26 Apr 2008 08:22:21 +0000
parents e65203929930
children 9d03d6298e0f
comparison
equal deleted inserted replaced
94370:28e6262d77ad 94371:436ee104782b
940 struct stat sdir; 940 struct stat sdir;
941 #endif 941 #endif
942 char modes[10]; 942 char modes[10];
943 Lisp_Object handler; 943 Lisp_Object handler;
944 struct gcpro gcpro1; 944 struct gcpro gcpro1;
945 EMACS_INT uid, gid, ino; 945 EMACS_INT ino;
946 946
947 filename = Fexpand_file_name (filename, Qnil); 947 filename = Fexpand_file_name (filename, Qnil);
948 948
949 /* If the file name has special constructs in it, 949 /* If the file name has special constructs in it,
950 call the corresponding file handler. */ 950 call the corresponding file handler. */
975 case S_IFLNK: 975 case S_IFLNK:
976 values[0] = Ffile_symlink_p (filename); break; 976 values[0] = Ffile_symlink_p (filename); break;
977 #endif 977 #endif
978 } 978 }
979 values[1] = make_number (s.st_nlink); 979 values[1] = make_number (s.st_nlink);
980 /* When make_fixnum_or_float is called below with types that are
981 shorter than an int (e.g., `short'), GCC whines about comparison
982 being always false due to limited range of data type. Fix by
983 copying s.st_uid and s.st_gid into int variables. */
984 #ifdef WINDOWSNT
985 /* Windows uses signed short for the uid and gid in the stat structure,
986 but we use an int for getuid (limited to the range 0-60000).
987 So users with uid > 32767 need their uid patched back here. */
988 uid = (unsigned short) s.st_uid;
989 gid = (unsigned short) s.st_gid;
990 #else
991 uid = s.st_uid;
992 gid = s.st_gid;
993 #endif
994 if (NILP (id_format) || EQ (id_format, Qinteger)) 980 if (NILP (id_format) || EQ (id_format, Qinteger))
995 { 981 {
996 values[2] = make_fixnum_or_float (uid); 982 values[2] = make_fixnum_or_float (s.st_uid);
997 values[3] = make_fixnum_or_float (gid); 983 values[3] = make_fixnum_or_float (s.st_gid);
998 } 984 }
999 else 985 else
1000 { 986 {
1001 BLOCK_INPUT; 987 BLOCK_INPUT;
1002 pw = (struct passwd *) getpwuid (uid); 988 pw = (struct passwd *) getpwuid (s.st_uid);
1003 values[2] = (pw ? build_string (pw->pw_name) 989 values[2] = (pw ? build_string (pw->pw_name)
1004 : make_fixnum_or_float (uid)); 990 : make_fixnum_or_float (s.st_uid));
1005 gr = (struct group *) getgrgid (gid); 991 gr = (struct group *) getgrgid (s.st_gid);
1006 values[3] = (gr ? build_string (gr->gr_name) 992 values[3] = (gr ? build_string (gr->gr_name)
1007 : make_fixnum_or_float (gid)); 993 : make_fixnum_or_float (s.st_gid));
1008 UNBLOCK_INPUT; 994 UNBLOCK_INPUT;
1009 } 995 }
1010 values[4] = make_time (s.st_atime); 996 values[4] = make_time (s.st_atime);
1011 values[5] = make_time (s.st_mtime); 997 values[5] = make_time (s.st_mtime);
1012 values[6] = make_time (s.st_ctime); 998 values[6] = make_time (s.st_ctime);
1024 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ 1010 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */
1025 dirname = Ffile_name_directory (filename); 1011 dirname = Ffile_name_directory (filename);
1026 if (! NILP (dirname)) 1012 if (! NILP (dirname))
1027 encoded = ENCODE_FILE (dirname); 1013 encoded = ENCODE_FILE (dirname);
1028 if (! NILP (dirname) && stat (SDATA (encoded), &sdir) == 0) 1014 if (! NILP (dirname) && stat (SDATA (encoded), &sdir) == 0)
1029 values[9] = (sdir.st_gid != gid) ? Qt : Qnil; 1015 values[9] = (sdir.st_gid != s.st_gid) ? Qt : Qnil;
1030 else /* if we can't tell, assume worst */ 1016 else /* if we can't tell, assume worst */
1031 values[9] = Qt; 1017 values[9] = Qt;
1032 #else /* file gid will be egid */ 1018 #else /* file gid will be egid */
1033 values[9] = (gid != getegid ()) ? Qt : Qnil; 1019 values[9] = (s.st_gid != getegid ()) ? Qt : Qnil;
1034 #endif /* BSD4_2 (or BSD4_3) */ 1020 #endif /* BSD4_2 (or BSD4_3) */
1035 /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */ 1021 /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */
1036 if (sizeof (s.st_ino) > sizeof (ino)) 1022 if (sizeof (s.st_ino) > sizeof (ino))
1037 ino = (EMACS_INT)(s.st_ino & 0xffffffff); 1023 ino = (EMACS_INT)(s.st_ino & 0xffffffff);
1038 else 1024 else