summaryrefslogtreecommitdiff
path: root/utils/format/Nt.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 21:39:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 21:39:35 +0000
commit74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a (patch)
treec6e220ba61db3a6ea4052e6841296d829654e664 /utils/format/Nt.c
parent46439007cf417cbd9ac8049bb4122c890097a0fa (diff)
20060303
Diffstat (limited to 'utils/format/Nt.c')
-rw-r--r--utils/format/Nt.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/utils/format/Nt.c b/utils/format/Nt.c
new file mode 100644
index 00000000..f2239f3c
--- /dev/null
+++ b/utils/format/Nt.c
@@ -0,0 +1,47 @@
+#include <lib9.h>
+
+int
+initfflag()
+{
+ return 1;
+}
+
+Tm *
+getlocaltime()
+{
+ static Tm tmstruct;
+
+ time_t t = time((time_t *)0);
+ struct tm *ts = localtime(&t);
+ Tm *tt = &tmstruct;
+
+ tt->hour = ts->tm_hour;
+ tt->min = ts->tm_min;
+ tt->sec = ts->tm_sec;
+ tt->year = ts->tm_year;
+ tt->mon = ts->tm_mon;
+ tt->mday = ts->tm_mday;
+ tt->wday = ts->tm_wday;
+ tt->yday = ts->tm_yday;
+ return tt;
+}
+
+int
+openfloppy(char *dev)
+{
+ char buf[16];
+
+ /* if dev is of the form "x:" use "\\.\x:" instead */
+ if (strlen(dev) == 2 && dev[1] == ':') {
+ if (dev[0] == 'a' || dev[0] == 'A') {
+ strcpy(buf, "\\\\.\\");
+ strcat(buf, dev);
+ return open(buf, ORDWR);
+ }
+ else {
+ print("can only open A: drive\n");
+ return -1;
+ }
+ }
+ return open(dev, ORDWR);
+}