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
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/* DOS specific routines
*/
#include <HTUtils.h>
#include <HTDOS.h>
/* PUBLIC HTDOS_wwwName()
** CONVERTS DOS Name into WWW Name
** ON ENTRY:
** dosname DOS file specification (NO NODE)
**
** ON EXIT:
** returns WWW file specification
**
*/
char * HTDOS_wwwName (char *dosname)
{
static char wwwname[1024];
char *cp_url = wwwname;
strcpy(wwwname,dosname);
for ( ; *cp_url != '\0' ; cp_url++)
if(*cp_url == '\\') *cp_url = '/'; /* convert dos backslash to unix-style */
if(strlen(wwwname) > 3 && *cp_url == '/')
*cp_url = '\0';
if(*cp_url == ':')
{
cp_url++;
*cp_url = '/';
}
/*
if((strlen(wwwname)>2)&&(wwwname[1]==':')) wwwname[1]='|';
printf("\n\nwww: %s\n\ndos: %s\n\n",wwwname,dosname);
sleep(5);
*/
return(wwwname);
}
/* PUBLIC HTDOS_name()
** CONVERTS WWW name into a DOS name
** ON ENTRY:
** wwwname WWW file name
**
** ON EXIT:
** returns DOS file specification
**
** Bug(?): Returns pointer to input string, which is modified
*/
char * HTDOS_name(char *wwwname)
{
static char cp_url[1024];
int joe;
memset(cp_url, 0, 1023);
sprintf(cp_url, "%s",wwwname);
for(joe = 0; cp_url[joe] != '\0'; joe++) {
if(cp_url[joe] == '/') {
cp_url[joe] = '\\';
}
}
/* Needed to surf the root of a local drive. */
if(strlen(cp_url) < 4) cp_url[2] = ':';
if(strlen(cp_url) == 3) cp_url[3] = '\\';
if(strlen(cp_url) == 4) cp_url[4] = '.';
if((strlen(cp_url) > 2) && (cp_url[1] == '|'))
cp_url[1] = ':';
if((cp_url[1] == '\\') || (cp_url[0] != '\\'))
{
#if 0
printf("\n\n%s = i%\n\n",cp_url,strlen(cp_url));
sleep(5);
#endif
CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n",
wwwname, cp_url);
strcpy(wwwname, cp_url);
return(wwwname); /* return(cp_url); */
} else {
#if 0
printf("\n\n%s = %i\n\n",cp_url+1,strlen(cp_url));
sleep(5);
#endif
CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n",
wwwname, cp_url+1);
strcpy(wwwname, cp_url+1);
return(wwwname); /* return(cp_url+1); */
}
}
|