Fossil SCM

Report the effective file mode bits also.

mistachkin 2017-02-14 00:40 UTC symlinks
Commit 7972e19f77094b66381a83dd14995ce1e60c4da6
1 file changed +18 -1
+18 -1
--- src/file.c
+++ src/file.c
@@ -162,10 +162,26 @@
162162
** Same as file_mtime(), but takes into account symlinks.
163163
*/
164164
i64 file_wd_mtime(const char *zFilename){
165165
return getStat(zFilename, 1) ? -1 : fileStat.st_mtime;
166166
}
167
+
168
+/*
169
+** Return the mode bits for a file. Return -1 if the file does not
170
+** exist. If zFilename is NULL return the size of the most recently
171
+** stat-ed file.
172
+*/
173
+int file_mode(const char *zFilename){
174
+ return getStat(zFilename, 0) ? -1 : fileStat.st_mode;
175
+}
176
+
177
+/*
178
+** Same as file_mode(), but takes into account symlinks.
179
+*/
180
+int file_wd_mode(const char *zFilename){
181
+ return getStat(zFilename, 1) ? -1 : fileStat.st_mode;
182
+}
167183
168184
/*
169185
** Return TRUE if the named file is an ordinary file or symlink
170186
** and symlinks are allowed.
171187
** Return false for directories, devices, fifos, etc.
@@ -976,12 +992,13 @@
976992
}else{
977993
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zPath));
978994
fossil_print(" file_size = %s\n", zBuf);
979995
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zPath));
980996
fossil_print(" file_mtime = %s\n", zBuf);
997
+ fossil_print(" file_mode = %d\n", file_wd_mode(zPath));
981998
fossil_print(" file_isfile = %d\n", file_wd_isfile(zPath));
982
- fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zPath));
999
+ fossil_print(" file_isfile_or_link = %d\n", file_wd_isfile_or_link(zPath));
9831000
fossil_print(" file_islink = %d\n", file_wd_islink(zPath));
9841001
fossil_print(" file_isexe = %d\n", file_wd_isexe(zPath));
9851002
fossil_print(" file_isdir = %d\n", file_wd_isdir(zPath));
9861003
}
9871004
}
9881005
--- src/file.c
+++ src/file.c
@@ -162,10 +162,26 @@
162 ** Same as file_mtime(), but takes into account symlinks.
163 */
164 i64 file_wd_mtime(const char *zFilename){
165 return getStat(zFilename, 1) ? -1 : fileStat.st_mtime;
166 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
168 /*
169 ** Return TRUE if the named file is an ordinary file or symlink
170 ** and symlinks are allowed.
171 ** Return false for directories, devices, fifos, etc.
@@ -976,12 +992,13 @@
976 }else{
977 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zPath));
978 fossil_print(" file_size = %s\n", zBuf);
979 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zPath));
980 fossil_print(" file_mtime = %s\n", zBuf);
 
981 fossil_print(" file_isfile = %d\n", file_wd_isfile(zPath));
982 fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zPath));
983 fossil_print(" file_islink = %d\n", file_wd_islink(zPath));
984 fossil_print(" file_isexe = %d\n", file_wd_isexe(zPath));
985 fossil_print(" file_isdir = %d\n", file_wd_isdir(zPath));
986 }
987 }
988
--- src/file.c
+++ src/file.c
@@ -162,10 +162,26 @@
162 ** Same as file_mtime(), but takes into account symlinks.
163 */
164 i64 file_wd_mtime(const char *zFilename){
165 return getStat(zFilename, 1) ? -1 : fileStat.st_mtime;
166 }
167
168 /*
169 ** Return the mode bits for a file. Return -1 if the file does not
170 ** exist. If zFilename is NULL return the size of the most recently
171 ** stat-ed file.
172 */
173 int file_mode(const char *zFilename){
174 return getStat(zFilename, 0) ? -1 : fileStat.st_mode;
175 }
176
177 /*
178 ** Same as file_mode(), but takes into account symlinks.
179 */
180 int file_wd_mode(const char *zFilename){
181 return getStat(zFilename, 1) ? -1 : fileStat.st_mode;
182 }
183
184 /*
185 ** Return TRUE if the named file is an ordinary file or symlink
186 ** and symlinks are allowed.
187 ** Return false for directories, devices, fifos, etc.
@@ -976,12 +992,13 @@
992 }else{
993 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zPath));
994 fossil_print(" file_size = %s\n", zBuf);
995 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zPath));
996 fossil_print(" file_mtime = %s\n", zBuf);
997 fossil_print(" file_mode = %d\n", file_wd_mode(zPath));
998 fossil_print(" file_isfile = %d\n", file_wd_isfile(zPath));
999 fossil_print(" file_isfile_or_link = %d\n", file_wd_isfile_or_link(zPath));
1000 fossil_print(" file_islink = %d\n", file_wd_islink(zPath));
1001 fossil_print(" file_isexe = %d\n", file_wd_isexe(zPath));
1002 fossil_print(" file_isdir = %d\n", file_wd_isdir(zPath));
1003 }
1004 }
1005

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button