forked from aquynh/unidos
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglobal.c
47 lines (39 loc) · 843 Bytes
/
global.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "global.h"
#include <time.h>
#include "fdtable.h"
#include "mount.h"
uint8_t cur_drive = 2;
struct dospath cur_path[26];
time_t time_offset = 0;
bool verify_switch = false;
bool ctrl_break_check = false;
bool ext_ctrl_break_check = false;
uint8_t exit_code = 0;
char switch_character = '/';
uint16_t current_proc_seg = 0;
const time_t time_fix()
{
return time(NULL) + time_offset;
}
void ptime_fix(struct timeval* val)
{
gettimeofday(val, NULL);
val->tv_sec += time_offset;
}
void global_init()
{
fdtable_init();
mount_add(DRIVE_A, "dos/v11object/");
mount_add(DRIVE_C, "root/");
}
void print_uc_err(uc_err err)
{
printf("Unicorn error returned %u: %s\n",
err, uc_strerror(err));
}
uint8_t fix_drive(uint8_t drive)
{
if (drive == 0)
return cur_drive;
return drive - 1;
}