| | 1 | #ifdef RCSID |
| | 2 | static char RCSid[] = |
| | 3 | "$Header$"; |
| | 4 | #endif |
| | 5 | |
| | 6 | /* |
| | 7 | * Copyright (c) 1999, 2002 Michael J. Roberts. All Rights Reserved. |
| | 8 | * |
| | 9 | * Please see the accompanying license file, LICENSE.TXT, for information |
| | 10 | * on using and copying this software. |
| | 11 | */ |
| | 12 | /* |
| | 13 | Name |
| | 14 | vmhostsi.cpp - stdio-based VM host application environment |
| | 15 | Function |
| | 16 | |
| | 17 | Notes |
| | 18 | |
| | 19 | Modified |
| | 20 | 08/06/99 MJRoberts - Creation |
| | 21 | */ |
| | 22 | |
| | 23 | #include "t3std.h" |
| | 24 | #include "os.h" |
| | 25 | #include "resload.h" |
| | 26 | #include "vmhost.h" |
| | 27 | #include "vmhostsi.h" |
| | 28 | |
| | 29 | /* |
| | 30 | * initialize |
| | 31 | */ |
| | 32 | CVmHostIfcStdio::CVmHostIfcStdio(const char *argv0) |
| | 33 | { |
| | 34 | char buf[OSFNMAX]; |
| | 35 | |
| | 36 | /* remember the program's argv[0], in case we need it later */ |
| | 37 | argv0_ = lib_copy_str(argv0); |
| | 38 | |
| | 39 | /* |
| | 40 | * Create the resource loader for character mapping files in the |
| | 41 | * same directory as the executable. |
| | 42 | */ |
| | 43 | os_get_special_path(buf, sizeof(buf), argv0, OS_GSP_T3_RES); |
| | 44 | cmap_loader_ = new CResLoader(buf); |
| | 45 | |
| | 46 | /* set the executable filename in the loader, if available */ |
| | 47 | if (os_get_exe_filename(buf, sizeof(buf), argv0)) |
| | 48 | cmap_loader_->set_exe_filename(buf); |
| | 49 | |
| | 50 | /* |
| | 51 | * the default safety level allows reading and writing to the current |
| | 52 | * directory only |
| | 53 | */ |
| | 54 | io_safety_ = VM_IO_SAFETY_READWRITE_CUR; |
| | 55 | } |
| | 56 | |
| | 57 | /* |
| | 58 | * delete |
| | 59 | */ |
| | 60 | CVmHostIfcStdio::~CVmHostIfcStdio() |
| | 61 | { |
| | 62 | /* delete our character map resource loader */ |
| | 63 | delete cmap_loader_; |
| | 64 | |
| | 65 | /* delete our saved argv[0] */ |
| | 66 | lib_free_str(argv0_); |
| | 67 | } |