about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTDOS.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTDOS.c')
-rw-r--r--WWW/Library/Implementation/HTDOS.c114
1 files changed, 55 insertions, 59 deletions
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index 0e4e5614..8edb0e7c 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -13,24 +13,25 @@
  * Make a copy of the source argument in the result, allowing some extra
  * space so we can append directly onto the result without reallocating.
  */
-static char * copy_plus (char **  result, const char *  source)
+static char *copy_plus(char **result, const char *source)
 {
     int length = strlen(source);
-    HTSprintf0(result, "%-*s", length+10, source);
+
+    HTSprintf0(result, "%-*s", length + 10, source);
     (*result)[length] = 0;
     return (*result);
 }
 
 /* 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 (const char *  dosname)
+ *		CONVERTS DOS Name into WWW Name
+ * ON ENTRY:
+ *	dosname		DOS file specification (NO NODE)
+ *
+ * ON EXIT:
+ *	returns		WWW file specification
+ *
+ */
+char *HTDOS_wwwName(const char *dosname)
 {
     static char *wwwname = NULL;
     char *cp_url = copy_plus(&wwwname, dosname);
@@ -42,7 +43,7 @@ char * HTDOS_wwwName (const char *  dosname)
     while ((ch = *dosname) != '\0') {
 	switch (ch) {
 	case '\\':
-	/* convert dos backslash to unix-style */
+	    /* convert dos backslash to unix-style */
 	    *cp_url++ = '/';
 	    break;
 	case ' ':
@@ -50,40 +51,39 @@ char * HTDOS_wwwName (const char *  dosname)
 	    *cp_url++ = '2';
 	    *cp_url++ = '0';
 	    break;
-      default:
+	default:
 	    *cp_url++ = ch;
 	    break;
-      }
-      dosname++;
+	}
+	dosname++;
     }
     *cp_url = '\0';
 #else
-    for ( ; *cp_url != '\0' ; cp_url++)
-	if(*cp_url == '\\')
-	    *cp_url = '/';   /* convert dos backslash to unix-style */
+    for (; *cp_url != '\0'; cp_url++)
+	if (*cp_url == '\\')
+	    *cp_url = '/';	/* convert dos backslash to unix-style */
 #endif
 
     wwwname_len = strlen(wwwname);
     if (wwwname_len > 1)
-	cp_url--;	/* point last char */
+	cp_url--;		/* point last char */
 
     if (wwwname_len > 3 && *cp_url == '/') {
 	cp_url++;
 	*cp_url = '\0';
     }
-    return(wwwname);
+    return (wwwname);
 }
 
-
 /*
  * Convert slashes from Unix to DOS
  */
-char * HTDOS_slashes (char *  path)
+char *HTDOS_slashes(char *path)
 {
     char *s;
 
-    for (s = path; *s != '\0'; ++s)	{
-	if (*s == '/')	{
+    for (s = path; *s != '\0'; ++s) {
+	if (*s == '/') {
 	    *s = '\\';
 	}
     }
@@ -91,16 +91,16 @@ char * HTDOS_slashes (char *  path)
 }
 
 /* PUBLIC							HTDOS_name()
-**		CONVERTS WWW name into a DOS name
-** ON ENTRY:
-**	wwwname		WWW file name
-**
-** ON EXIT:
-**	returns		DOS file specification
-*/
-char * HTDOS_name (char *  wwwname)
+ *		CONVERTS WWW name into a DOS name
+ * ON ENTRY:
+ *	wwwname		WWW file name
+ *
+ * ON EXIT:
+ *	returns		DOS file specification
+ */
+char *HTDOS_name(char *wwwname)
 {
-#ifdef _WINDOWS	/* 1998/04/02 (Thu) 08:47:20 */
+#ifdef _WINDOWS			/* 1998/04/02 (Thu) 08:47:20 */
     extern char windows_drive[];
     char temp_buff[LY_MAXPATH];
 #endif
@@ -110,12 +110,12 @@ char * HTDOS_name (char *  wwwname)
     copy_plus(&result, wwwname);
 #ifdef __DJGPP__
     if (result[0] == '/'
-     && result[1] == 'd'
-     && result[2] == 'e'
-     && result[3] == 'v'
-     && result[4] == '/'
-     && isalpha(result[5])) {
-	return(result);
+	&& result[1] == 'd'
+	&& result[2] == 'e'
+	&& result[3] == 'v'
+	&& result[4] == '/'
+	&& isalpha(result[5])) {
+	return (result);
     }
 #endif /* __DJGPP__ */
 
@@ -123,16 +123,14 @@ char * HTDOS_name (char *  wwwname)
 
     /* pesky leading slash, rudiment from file://localhost/  */
     /* the rest of path may be with or without drive letter  */
-    if((result[1] != '\\') && (result[0]  == '\\')) {
-	for (joe = 0; (result[joe] = result[joe+1]) != 0; joe++)
-	    ;
+    if ((result[1] != '\\') && (result[0] == '\\')) {
+	for (joe = 0; (result[joe] = result[joe + 1]) != 0; joe++) ;
     }
-
-#ifdef _WINDOWS	/* 1998/04/02 (Thu) 08:59:48 */
+#ifdef _WINDOWS			/* 1998/04/02 (Thu) 08:59:48 */
     if (LYLastPathSep(result) != NULL
-     && !LYIsDosDrive(result)) {
+	&& !LYIsDosDrive(result)) {
 	sprintf(temp_buff, "%.3s\\%.*s", windows_drive,
-		(int)(sizeof(temp_buff) - 5), result);
+		(int) (sizeof(temp_buff) - 5), result);
 	StrAllocCopy(result, temp_buff);
     }
 #endif
@@ -141,7 +139,7 @@ char * HTDOS_name (char *  wwwname)
      * refers to the current directory on the given device.
      */
     if (LYLastPathSep(result) == NULL
-     && LYIsDosDrive(result))
+	&& LYIsDosDrive(result))
 	LYAddPathSep0(result);
 
     CTRACE((tfp, "HTDOS_name changed `%s' to `%s'\n", wwwname, result));
@@ -169,13 +167,13 @@ char *HTDOS_short_name(char *path)
 
 #if defined(DJGPP) && defined(DJGPP_KEYHANDLER)
 /* PUBLIC       getxkey()
-**              Replaces libc's getxkey() with polling of tcp/ip
-**              library (WatTcp or Watt-32). This is required to
-**              be able to finish off dead sockets, answer pings etc.
-**
-** ON EXIT:
-**      returns extended keypress.
-*/
+ *              Replaces libc's getxkey() with polling of tcp/ip
+ *              library (WatTcp or Watt-32). This is required to
+ *              be able to finish off dead sockets, answer pings etc.
+ *
+ * ON EXIT:
+ *      returns extended keypress.
+ */
 
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <pc.h>
@@ -183,16 +181,15 @@ char *HTDOS_short_name(char *path)
 #include <libc/farptrgs.h>
 #include <go32.h>
 
-int getxkey (void)
+int getxkey(void)
 {
     __dpmi_regs r;
 
     /* poll tcp/ip lib and yield to DPMI-host while nothing in
      * keyboard buffer (head = tail) (simpler than kbhit).
      */
-    while (_farpeekw(_dos_ds, 0x41a) == _farpeekw(_dos_ds, 0x41c))
-    {
-	tcp_tick (NULL);
+    while (_farpeekw(_dos_ds, 0x41a) == _farpeekw(_dos_ds, 0x41c)) {
+	tcp_tick(NULL);
 	__dpmi_yield();
     }
 
@@ -206,4 +203,3 @@ int getxkey (void)
     return r.h.al;
 }
 #endif /* DJGPP && DJGPP_KEYHANDLER */
-