/* -*-C-*-
-$Id: ntenv.c,v 1.5 1993/07/27 21:27:42 gjr Exp $
+$Id: ntenv.c,v 1.6 1993/08/21 03:21:19 gjr Exp $
Copyright (c) 1992-1993 Massachusetts Institute of Technology
DEFUN_VOID (OS_encoded_time)
{
time_t t;
- STD_UINT_SYSTEM_CALL (syscall_time, t, (DOS_time (0)));
+ STD_UINT_SYSTEM_CALL (syscall_time, t, (NT_time (0)));
return (t);
}
DEFUN (OS_decode_time, (t, buffer), time_t t AND struct time_structure * buffer)
{
struct tm * ts;
- STD_PTR_SYSTEM_CALL (syscall_localtime, ts, (DOS_localtime (&t)));
+ STD_PTR_SYSTEM_CALL (syscall_localtime, ts, (NT_localtime (&t)));
(buffer -> year) = ((ts -> tm_year) + 1900);
(buffer -> month) = ((ts -> tm_mon) + 1);
(buffer -> day) = (ts -> tm_mday);
int wday = (buffer -> day_of_week);
(ts -> tm_wday) = ((wday == 6) ? 0 : (wday + 1));
}
- STD_UINT_SYSTEM_CALL (syscall_mktime, t, (DOS_mktime (ts)));
+ STD_UINT_SYSTEM_CALL (syscall_mktime, t, (NT_mktime (ts)));
return (t);
}
return ((((double) (clock ())) * 1000.0) / ((double) CLOCKS_PER_SEC));
}
\f
-/* Timer adjustments */
-#define PC_TIMER_TICKS_PER_SECOND (18.2)
-/* This should work out to about 55 */
-#define PC_MILLISECONDS_PER_TIMER_TICK \
- ((long) ((1000.0/PC_TIMER_TICKS_PER_SECOND)+0.5))
-
-static unsigned long
-DEFUN (ms_to_ticks, (clocks), clock_t clocks)
-{ ldiv_t ticks;
- unsigned long result;
-
- ticks = ldiv((long) clocks, PC_MILLISECONDS_PER_TIMER_TICK);
-
- result = ((ticks.rem >= (PC_MILLISECONDS_PER_TIMER_TICK/2)) ?
- (ticks.quot + 1) : (ticks.quot));
- return (result == 0) ? 1 : result;
-}
-
void
DEFUN (OS_process_timer_set, (first, interval),
- clock_t first AND
- clock_t interval)
+ clock_t first AND clock_t interval)
{
- /* Convert granularity to 1/18.2 seconds */
-
return;
}
void
DEFUN (OS_real_timer_set, (first, interval),
- clock_t first AND
- clock_t interval)
+ clock_t first AND clock_t interval)
{
OS_process_timer_set (first, interval);
+ return;
}
void
OS_process_timer_clear();
return;
}
-
-void
-DEFUN_VOID (DOS_initialize_environment)
-{
- return;
-}
\f
static size_t current_dir_path_size = 0;
static char * current_dir_path = 0;
}
if (current_dir_path_size == 0)
{
- current_dir_path = (DOS_malloc (1024));
+ current_dir_path = (NT_malloc (1024));
if (current_dir_path == 0)
error_system_call (ENOMEM, syscall_malloc);
current_dir_path_size = 1024;
}
while (1)
{
- if ((DOS_getcwd (current_dir_path, current_dir_path_size)) != 0)
+ if ((NT_getcwd (current_dir_path, current_dir_path_size)) != 0)
{ strlwr(current_dir_path);
return (current_dir_path);
}
current_dir_path_size *= 2;
{
char * new_current_dir_path =
- (DOS_realloc (current_dir_path, current_dir_path_size));
+ (NT_realloc (current_dir_path, current_dir_path_size));
if (new_current_dir_path == 0)
/* ANSI C requires `path' to be unchanged -- we may have to
discard it for systems that don't behave thus. */
void
DEFUN (OS_set_working_dir_pathname, (name), char * name)
{
- /*SRA*/
- size_t name_size = strlen(name);
- char *filename = name;
+ size_t name_size = (strlen (name));
+ char * filename = name;
STD_BOOL_SYSTEM_CALL (syscall_chdir, (SetCurrentDirectory (filename)));
- while (1) {
- if (name_size < current_dir_path_size) {
+ while (1)
+ {
+ if (name_size < current_dir_path_size)
+ {
strcpy(current_dir_path, name);
return;
}
current_dir_path_size *= 2;
{
char * new_current_dir_path =
- (DOS_realloc (current_dir_path, current_dir_path_size));
+ (NT_realloc (current_dir_path, current_dir_path_size));
if (new_current_dir_path == 0)
error_system_call (ENOMEM, syscall_realloc);
current_dir_path = new_current_dir_path;
/* -*-C-*-
-$Id: ntfs.c,v 1.5 1993/07/30 06:23:56 gjr Exp $
+$Id: ntfs.c,v 1.6 1993/08/21 03:21:47 gjr Exp $
Copyright (c) 1992-1993 Massachusetts Institute of Technology
#include "outf.h"
\f
int
-DEFUN (DOS_read_file_status, (name, s),
+DEFUN (NT_read_file_status, (name, s),
CONST char * name AND
struct stat * s)
{ char filename[128];
- dos_pathname_as_filename(name, filename);
+ nt_pathname_as_filename (name, filename);
while ((stat (filename, s)) < 0)
{
struct stat s;
char filename[128];
- dos_pathname_as_filename(name, filename);
+ nt_pathname_as_filename(name, filename);
return
- (((DOS_stat (filename, (&s))) < 0)
+ (((NT_stat (filename, (&s))) < 0)
? file_doesnt_exist : file_does_exist);
}
{
char filename[128];
- dos_pathname_as_filename(name, filename);
- return ((DOS_access (filename, mode)) == 0);
+ nt_pathname_as_filename (name, filename);
+ return ((NT_access (filename, mode)) == 0);
}
int
struct stat s;
char filename[128];
- dos_pathname_as_filename(name, filename);
- return (((DOS_stat (filename, (&s))) == 0) &&
+ nt_pathname_as_filename(name, filename);
+ return (((NT_stat (filename, (&s))) == 0) &&
(((s . st_mode) & S_IFMT) == S_IFDIR));
}
void
DEFUN (OS_file_remove, (name), CONST char * name)
{
- STD_VOID_SYSTEM_CALL (syscall_unlink, (DOS_unlink (name)));
+ STD_VOID_SYSTEM_CALL (syscall_unlink, (NT_unlink (name)));
}
void
DEFUN (OS_file_remove_link, (name), CONST char * name)
{
struct stat s;
- if ( (DOS_stat (name, (&s)) == 0) &&
+ if ( (NT_stat (name, (&s)) == 0) &&
(((s . st_mode) & S_IFMT) == S_IFREG) )
- DOS_unlink (name);
+ NT_unlink (name);
return;
}
CONST char * from_name AND
CONST char * to_name)
{
- if ((rename (from_name, to_name)) != 0)
+ if ((NT_rename (from_name, to_name)) != 0)
error_system_call (errno, syscall_rename);
}
void
DEFUN (OS_directory_make, (name), CONST char * name)
{
- STD_VOID_SYSTEM_CALL (syscall_mkdir, (DOS_mkdir (name)));
+ STD_VOID_SYSTEM_CALL (syscall_mkdir, (NT_mkdir (name)));
}
void
DEFUN (OS_directory_delete, (name), CONST char * name)
{
- STD_VOID_SYSTEM_CALL (syscall_rmdir, (RemoveDirectory (name)));
+ STD_VOID_SYSTEM_CALL (syscall_rmdir, (NT_rmdir (name)));
}
\f
#define DIR_UNALLOCATED (-1L)
static unsigned int n_directory_pointers;
void
-DEFUN_VOID (DOS_initialize_directory_reader)
+DEFUN_VOID (NT_initialize_directory_reader)
{
directory_pointers = 0;
n_directory_pointers = 0;
{
if (n_directory_pointers == 0)
{
- DIR ** pointers = ((DIR **) (DOS_malloc ((sizeof (DIR *)) * 4)));
+ DIR ** pointers = ((DIR **) (NT_malloc ((sizeof (DIR *)) * 4)));
if (pointers == 0)
error_system_call (ENOMEM, syscall_malloc);
directory_pointers = pointers;
unsigned int n_pointers = (2 * n_directory_pointers);
DIR ** pointers =
((DIR **)
- (DOS_realloc (((PTR) directory_pointers),
+ (NT_realloc (((PTR) directory_pointers),
((sizeof (DIR *)) * n_pointers))));
if (pointers == 0)
error_system_call (ENOMEM, syscall_realloc);
if (dir == 0)
error_system_call (ENOMEM, syscall_malloc);
- if (dos_pathname_as_filename (name, filename))
+ if (nt_pathname_as_filename (name, filename))
sprintf (searchname, "%s*.*", filename);
else
sprintf (searchname, "%s\\*.*", filename);