diff options
| author | Bill Wohler | 2012-11-24 19:43:02 -0800 |
|---|---|---|
| committer | Bill Wohler | 2012-11-24 19:43:02 -0800 |
| commit | 5244bc019bf7376caff3bb198ff674e0ad9fb0e6 (patch) | |
| tree | 02ee1615e904771f692ec2957c79a08ae029a13d /lib-src/ntlib.c | |
| parent | 9f7e719509474e92f85955e22e57ffeebd4e96f3 (diff) | |
| parent | c07a6ded1df2f4156badc9add2953579622c3722 (diff) | |
| download | emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.tar.gz emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.zip | |
Merge from trunk.
Diffstat (limited to 'lib-src/ntlib.c')
| -rw-r--r-- | lib-src/ntlib.c | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 83f653f3ea3..4e125eb6d73 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | /* Utility and Unix shadow routines for GNU Emacs support programs on NT. | 1 | /* Utility and Unix shadow routines for GNU Emacs support programs on NT. |
| 2 | Copyright (C) 1994, 2001-2011 Free Software Foundation, Inc. | 2 | |
| 3 | Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | Author: Geoff Voelker (voelker@cs.washington.edu) | ||
| 6 | Created: 10-8-94 | ||
| 3 | 7 | ||
| 4 | This file is part of GNU Emacs. | 8 | This file is part of GNU Emacs. |
| 5 | 9 | ||
| @@ -14,11 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| 14 | GNU General Public License for more details. | 18 | GNU General Public License for more details. |
| 15 | 19 | ||
| 16 | You should have received a copy of the GNU General Public License | 20 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 21 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | |||
| 19 | |||
| 20 | Geoff Voelker (voelker@cs.washington.edu) 10-8-94 | ||
| 21 | */ | ||
| 22 | 22 | ||
| 23 | #include <windows.h> | 23 | #include <windows.h> |
| 24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| @@ -29,9 +29,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |||
| 29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| 30 | #include <errno.h> | 30 | #include <errno.h> |
| 31 | #include <ctype.h> | 31 | #include <ctype.h> |
| 32 | #include <sys/timeb.h> | ||
| 33 | #include <mbstring.h> | ||
| 32 | 34 | ||
| 33 | #include "ntlib.h" | 35 | #include "ntlib.h" |
| 34 | 36 | ||
| 37 | struct timezone | ||
| 38 | { | ||
| 39 | int tz_minuteswest; /* minutes west of Greenwich */ | ||
| 40 | int tz_dsttime; /* type of dst correction */ | ||
| 41 | }; | ||
| 42 | |||
| 35 | #define MAXPATHLEN _MAX_PATH | 43 | #define MAXPATHLEN _MAX_PATH |
| 36 | 44 | ||
| 37 | /* Emulate sleep...we could have done this with a define, but that | 45 | /* Emulate sleep...we could have done this with a define, but that |
| @@ -202,6 +210,29 @@ getpass (const char * prompt) | |||
| 202 | return NULL; | 210 | return NULL; |
| 203 | } | 211 | } |
| 204 | 212 | ||
| 213 | /* This is needed because lib/gettime.c calls gettimeofday, which MSVC | ||
| 214 | doesn't have. Copied from w32.c. */ | ||
| 215 | void | ||
| 216 | gettimeofday (struct timeval *tv, struct timezone *tz) | ||
| 217 | { | ||
| 218 | struct _timeb tb; | ||
| 219 | _ftime (&tb); | ||
| 220 | |||
| 221 | tv->tv_sec = tb.time; | ||
| 222 | tv->tv_usec = tb.millitm * 1000L; | ||
| 223 | /* Implementation note: _ftime sometimes doesn't update the dstflag | ||
| 224 | according to the new timezone when the system timezone is | ||
| 225 | changed. We could fix that by using GetSystemTime and | ||
| 226 | GetTimeZoneInformation, but that doesn't seem necessary, since | ||
| 227 | Emacs always calls gettimeofday with the 2nd argument NULL (see | ||
| 228 | current_emacs_time). */ | ||
| 229 | if (tz) | ||
| 230 | { | ||
| 231 | tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */ | ||
| 232 | tz->tz_dsttime = tb.dstflag; /* type of dst correction */ | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 205 | int | 236 | int |
| 206 | fchown (int fd, unsigned uid, unsigned gid) | 237 | fchown (int fd, unsigned uid, unsigned gid) |
| 207 | { | 238 | { |
| @@ -260,6 +291,7 @@ is_exec (const char * name) | |||
| 260 | stricmp (p, ".cmd") == 0)); | 291 | stricmp (p, ".cmd") == 0)); |
| 261 | } | 292 | } |
| 262 | 293 | ||
| 294 | /* FIXME? This is in config.nt now - is this still needed? */ | ||
| 263 | #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\') | 295 | #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\') |
| 264 | 296 | ||
| 265 | /* We need this because nt/inc/sys/stat.h defines struct stat that is | 297 | /* We need this because nt/inc/sys/stat.h defines struct stat that is |
| @@ -374,3 +406,9 @@ stat (const char * path, struct stat * buf) | |||
| 374 | return 0; | 406 | return 0; |
| 375 | } | 407 | } |
| 376 | 408 | ||
| 409 | int | ||
| 410 | lstat (const char * path, struct stat * buf) | ||
| 411 | { | ||
| 412 | return stat (path, buf); | ||
| 413 | } | ||
| 414 | |||