blob: ec3e0a6407f965e7f92adc0891aa024a517501d6 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#include "monitor.h"
#ifndef SINGLEFS
int fs_type = 0;
open_file(fname)
char * fname;
{
#ifdef DEBUG
fprintf(stderr, "Open file %s\n", fname);
#endif
if( fs_type ) close_file();
/* If we can't read the boot sector there is a _real_ problem */
if (read_sector(0) == 0) return -1;
if( tar_open_file(fname) >= 0 ) { fs_type = 1; return 0; }
if( min_open_file(fname) >= 0 ) { fs_type = 2; return 0; }
if( dos_open_file(fname) >= 0 ) { fs_type = 3; return 0; }
return -1;
}
rewind_file()
{
#ifdef DEBUG
fprintf(stderr, "Rewind file (%d)\n", fs_type);
#endif
switch(fs_type)
{
case 1: return tar_rewind_file();
case 2: return min_rewind_file();
case 3: return dos_rewind_file();
}
return -1;
}
close_file()
{
int rv = -1;
#ifdef DEBUG
fprintf(stderr, "Close file (%d)\n", fs_type);
#endif
switch(fs_type)
{
case 1: rv = tar_close_file(); break;
case 2: rv = min_close_file(); break;
case 3: rv = dos_close_file(); break;
}
fs_type = 0;
return rv;
}
long
file_length()
{
#ifdef DEBUG
fprintf(stderr, "File length (%d)\n", fs_type);
#endif
switch(fs_type)
{
case 1: return tar_file_length();
case 2: return min_file_length();
case 3: return dos_file_length();
}
return -1;
}
read_block(buffer)
char * buffer;
{
#ifdef DEBUG
fprintf(stderr, "read block into (%d) (%d)\n", buffer, fs_type);
#endif
switch(fs_type)
{
case 1: return tar_read_block(buffer);
case 2: return min_read_block(buffer);
case 3: return dos_read_block(buffer);
}
return -1;
}
#endif
|