about summary refs log tree commit diff stats
path: root/WWW
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>1998-09-17 12:13:52 -0400
committerThomas E. Dickey <dickey@invisible-island.net>1998-09-17 12:13:52 -0400
commit03b222bbbdbc58cbe5a4eb93e500d490800dee9c (patch)
tree317783cc00147ee45e2cadfa578b6e468581343c /WWW
parent02f2851492143446abaaa33cc9536fade7b51124 (diff)
downloadlynx-snapshots-03b222bbbdbc58cbe5a4eb93e500d490800dee9c.tar.gz
snapshot of project "lynx", label v2-8-1dev_28
Diffstat (limited to 'WWW')
-rw-r--r--WWW/Library/Implementation/CommonMakefile6
-rw-r--r--WWW/Library/Implementation/HTAccess.c14
-rw-r--r--WWW/Library/Implementation/HTDOS.c1
-rw-r--r--WWW/Library/Implementation/HTFile.c82
-rw-r--r--WWW/Library/Implementation/HTFile.h5
-rw-r--r--WWW/Library/Implementation/HTGopher.c2
-rw-r--r--WWW/Library/Implementation/HTMIME.c11
-rw-r--r--WWW/Library/Implementation/HTParse.c2
-rw-r--r--WWW/Library/Implementation/HTTP.c12
-rw-r--r--WWW/Library/Implementation/HTTelnet.c6
-rw-r--r--WWW/Library/Implementation/UCDefs.h28
-rw-r--r--WWW/Library/Implementation/UCMap.h3
-rw-r--r--WWW/Library/Implementation/tcp.h39
13 files changed, 93 insertions, 118 deletions
diff --git a/WWW/Library/Implementation/CommonMakefile b/WWW/Library/Implementation/CommonMakefile
index 818cb036..53091228 100644
--- a/WWW/Library/Implementation/CommonMakefile
+++ b/WWW/Library/Implementation/CommonMakefile
@@ -85,7 +85,8 @@ COMMON = $(LOB)/HTParse.o $(LOB)/HTAccess.o $(LOB)/HTTP.o \
 	$(LOB)/HTAAUtil.o $(LOB)/HTAAServ.o $(LOB)/HTAABrow.o \
 	$(LOB)/HTAAFile.o $(LOB)/HTPasswd.o $(LOB)/HTGroup.o  \
 	$(LOB)/HTACL.o    $(LOB)/HTAuth.o   $(LOB)/HTAAProt.o \
-	$(LOB)/HTAssoc.o  $(LOB)/HTLex.o    $(LOB)/HTUU.o
+	$(LOB)/HTAssoc.o  $(LOB)/HTLex.o    $(LOB)/HTUU.o \
+	$(LOB)/HTDOS.o
 
 CFILES = $(CMN)HTParse.c $(CMN)HTAccess.c $(CMN)HTTP.c $(CMN)HTFile.c \
         $(CMN)HTBTree.c \
@@ -374,3 +375,6 @@ $(LOB)/HTAccess.o : $(OE)  $(CMN)HTAccess.c $(CMN)HTUtils.h
 $(LOB)/HTParse.o : $(OE) $(CMN)HTParse.c $(CMN)HTUtils.h
 	$(COMPILE) $(CMN)HTParse.c
 
+$(LOB)/HTDOS.o : $(OE) $(CMN)HTDOS.c $(CMN)HTUtils.h
+	$(COMPILE) $(CMN)HTDOS.c
+
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index f98a14bf..9bf69d38 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -60,6 +60,8 @@
 #include <UCMap.h>
 #include <GridText.h>
 
+#include <GridText.h>
+#include <LYGlobalDefs.h>
 #include <LYexit.h>
 #include <LYLeaks.h>
 
@@ -620,8 +622,6 @@ PUBLIC HTStream *HTSaveStream ARGS1(
     return (*p->saveStream)(anchor);
 }
 
-extern char LYinternal_flag;		       /* from LYMainLoop.c */
-
 /*	Load a document - with logging etc		HTLoadDocument()
 **	----------------------------------
 **
@@ -640,16 +640,6 @@ extern char LYinternal_flag;		       /* from LYMainLoop.c */
 **		     NO      Failure
 */
 
-extern char LYforce_no_cache;				 /* from GridText.c */
-extern char LYoverride_no_cache;		       /* from LYMainLoop.c */
-extern char * HTLoadedDocumentURL NOPARAMS;		   /* in GridText.c */
-extern BOOL HText_hasNoCacheSet PARAMS((HText *text));	   /* in GridText.c */
-extern BOOL reloading;
-extern BOOL permanent_redirection;
-#ifdef DIRED_SUPPORT
-extern BOOLEAN lynx_edit_mode;
-#endif
-
 PRIVATE BOOL HTLoadDocument ARGS4(
 	CONST char *,		full_address,
 	HTParentAnchor *,	anchor,
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index c946d0c4..9f0bf60a 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -3,6 +3,7 @@
  */
 
 #include <HTUtils.h>
+#include <HTDOS.h>
 
 /* PUBLIC							HTDOS_wwwName()
 **		CONVERTS DOS Name into WWW Name
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 3ede11c9..4cb68047 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -52,8 +52,6 @@
 #define INFINITY 512		/* file name length @@ FIXME */
 #define MULTI_SUFFIX ".multi"	/* Extension for scanning formats */
 
-#define HT_EM_SPACE ((char)2)
-
 #ifdef VMS
 #include <HTVMSUtils.h>
 #endif /* VMS */
@@ -127,7 +125,6 @@ PUBLIC int HTDirReadme = HT_DIR_README_NONE;
 PUBLIC int HTDirReadme = HT_DIR_README_TOP;
 #endif /* DIRED_SUPPORT */
 
-extern BOOLEAN LYRawMode;
 extern BOOL HTPassEightBitRaw;
 extern HTCJKlang HTCJK;
 
@@ -564,69 +561,60 @@ PRIVATE int HTCreatePath ARGS1(CONST char *,path)
 **  On exit:
 **	Returns a malloc'ed string which must be freed by the caller.
 */
-PUBLIC char * HTLocalName ARGS1(
-	CONST char *,	name)
+PUBLIC char * HTnameOfFile_WWW ARGS3(
+	CONST char *,	name,
+	BOOL,		WWW_prefix,
+	BOOL,		expand_all)
 {
     char * acc_method = HTParse(name, "", PARSE_ACCESS);
     char * host = HTParse(name, "", PARSE_HOST);
     char * path = HTParse(name, "", PARSE_PATH+PARSE_PUNCTUATION);
+    char * home;
+    char * result = NULL;
 
-    HTUnEscape(path);	/* Interpret % signs */
+    if (expand_all)
+    	HTUnEscape(path);		/* Interpret all % signs */
+    else
+	HTUnEscapeSome(path, "/");	/* Interpret % signs for path delims */
 
     if (0 == strcmp(acc_method, "file")) { /* local file */
-	FREE(acc_method);
 	if ((0 == strcasecomp(host, HTHostName())) ||
 	    (0 == strcasecomp(host, "localhost")) || !*host) {
-	    FREE(host);
 	    CTRACE(tfp, "Node `%s' means path `%s'\n", name, path);
 #ifdef DOSPATH
-	    {
-		char *ret_path = NULL;
-		StrAllocCopy(ret_path, HTDOS_name(path));
-		CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n",
-			    path, ret_path);
-		FREE(path);
-		return(ret_path);
-	    }
+	    StrAllocCopy(result, HTDOS_name(path));
+	    CTRACE(tfp, "HTDOS_name changed `%s' to `%s'\n", path, result);
 #else
 #ifdef __EMX__
-	    {
-		char *ret_path = NULL;
-		if (path[0] == '/') /* pesky leading slash */
-		    StrAllocCopy(ret_path, path+1);
-		else
-		    StrAllocCopy(ret_path, path);
-		CTRACE(tfp, "EMX hack changed `%s' to `%s'\n",
-			    path, ret_path);
-		FREE(path);
-		return(ret_path);
-	    }
+	    if (path[0] == '/'
+	     && isalpha(path[1])
+	     && path[2] == ':') /* pesky leading slash */
+		StrAllocCopy(result, path+1);
+	    else
+		StrAllocCopy(result, path);
+	    CTRACE(tfp, "EMX hack changed `%s' to `%s'\n", path, result);
 #else
-	    return(path);
+	    StrAllocCopy(result, path);
 #endif /* __EMX__ */
 #endif /* DOSPATH */
-	} else {
-	    char * result = (char *)malloc(
+	} else if (WWW_prefix) {
+	    result = (char *)malloc(
 				strlen("/Net/")+strlen(host)+strlen(path)+1);
-	      if (result == NULL)
-		  outofmem(__FILE__, "HTLocalName");
+	    if (result == NULL)
+		outofmem(__FILE__, "HTLocalName");
 	    sprintf(result, "%s%s%s", "/Net/", host, path);
-	    FREE(host);
-	    FREE(path);
 	    CTRACE(tfp, "Node `%s' means file `%s'\n", name, result);
-	    return result;
+	} else {
+	    StrAllocCopy(result, path);
 	}
-    } else {  /* other access */
-	char * result;
+    } else if (WWW_prefix) {  /* other access */
 #ifdef VMS
-	char * home =  getenv("HOME");
-	if (!home)
+	if ((home = getenv("HOME")) == 0)
 	    home = HTCacheRoot;
 	else
 	    home = HTVMS_wwwName(home);
 #else
-	CONST char * home =  (CONST char*)getenv("HOME");
-	if (!home)
+	if ((home = getenv("HOME")) == 0)
 	    home = "/tmp";
 #endif /* VMS */
 	result = (char *)malloc(
@@ -634,11 +622,15 @@ PUBLIC char * HTLocalName ARGS1(
 	if (result == NULL)
 	    outofmem(__FILE__, "HTLocalName");
 	sprintf(result, "%s/WWW/%s/%s%s", home, acc_method, host, path);
-	FREE(path);
-	FREE(acc_method);
-	FREE(host);
-	return result;
+    } else {
+	StrAllocCopy(result, path);
     }
+
+    FREE(host);
+    FREE(path);
+    FREE(acc_method);
+
+    return result;
 }
 
 /*	Make a WWW name from a full local path name.
diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h
index 867e00d7..9c7686f1 100644
--- a/WWW/Library/Implementation/HTFile.h
+++ b/WWW/Library/Implementation/HTFile.h
@@ -42,7 +42,10 @@ extern int HTDirReadme;         /* Include readme files in listing? */
 /*
 **  Convert filenames between local and WWW formats
 */
-extern char * HTLocalName PARAMS((CONST char * name));
+extern char * HTnameOfFile_WWW PARAMS((CONST char * name, BOOL WWW_prefix, BOOL expand_all));
+#define HTLocalName(name)      HTnameOfFile_WWW(name,TRUE,TRUE)
+#define HTfullURL_toFile(name) HTnameOfFile_WWW(name,FALSE,TRUE)
+#define HTpartURL_toFile(name) HTnameOfFile_WWW(name,FALSE,FALSE)
 
 /*
 **  Make a WWW name from a full local path name
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 9bfac99c..8c7855ca 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -26,8 +26,6 @@
 */
 #include <HTGopher.h>
 
-#define HT_EM_SPACE ((char)2)		/* For now */
-
 #define GOPHER_PORT 70		/* See protocol spec */
 #define CSO_PORT 105		/* See protocol spec */
 #define BIG 1024		/* Bug */
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index d7b11a15..c518cba7 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -19,22 +19,15 @@
 #include <UCDefs.h>
 #include <UCAux.h>
 
+#include <LYCookie.h>
 #include <LYCharSets.h>
 #include <LYStrings.h>
+#include <LYUtils.h>
 #include <LYLeaks.h>
 
-extern CONST char *LYchar_set_names[];
-extern BOOLEAN LYRawMode;
 extern BOOL HTPassEightBitRaw;
 extern HTCJKlang HTCJK;
 
-extern void LYSetCookie PARAMS((
-	CONST char *	SetCookie,
-	CONST char *	SetCookie2,
-	CONST char *	address));
-extern time_t LYmktime PARAMS((char *string, BOOL absolute));
-
-
 /*		MIME Object
 **		-----------
 */
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index d25157b3..7362a59a 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -245,7 +245,7 @@ PUBLIC char * HTParse ARGS3(
     **	this is back to inheriting for identical
     **	schemes whether or not they are "file".
     **	If you want to try it again yourself,
-    **	uncomment the strncasecomp() below. - FM
+    **	uncomment the strcasecomp() below. - FM
     */
     if ((given.access && related.access) &&
 	(/* strcasecomp(given.access, "file") || */
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 026d6c31..5d2a9642 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -30,6 +30,7 @@
 #include <HTInit.h>
 #include <HTAABrow.h>
 
+#include <LYCookie.h>
 #include <LYGlobalDefs.h>
 #include <GridText.h>
 #include <LYStrings.h>
@@ -63,17 +64,6 @@ extern char *http_error_file;	 /* Store HTTP status code in this file */
 extern BOOL traversal;		 /* TRUE if we are doing a traversal */
 extern BOOL dump_output_immediately;  /* TRUE if no interactive user */
 
-extern char * HTLoadedDocumentURL NOPARAMS;
-extern void LYSetCookie PARAMS((
-	CONST char *	SetCookie,
-	CONST char *	SetCookie2,
-	CONST char *	address));
-extern char * LYCookie PARAMS((
-	CONST char *	hostname,
-	CONST char *	path,
-	int		port,
-	BOOL		secure));
-
 #define HTTP_NETREAD(a, b, c, d)   NETREAD(a, b, c)
 #define HTTP_NETWRITE(a, b, c, d)  NETWRITE(a, b, c)
 #define HTTP_NETCLOSE(a, b)  (void)NETCLOSE(a)
diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c
index f37a632a..5de48da1 100644
--- a/WWW/Library/Implementation/HTTelnet.c
+++ b/WWW/Library/Implementation/HTTelnet.c
@@ -32,6 +32,7 @@
 
 #include <userdefs.h>  /* for TELNET_COMMAND and RLOGIN_COMMAND */
 
+#include <LYStrings.h>
 #include <LYLeaks.h>
 
 #define HT_NO_DATA -9999
@@ -303,7 +304,6 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	    system(command);
 	}
 	else {
-	    extern int LYgetch NOPARAMS;
 	    extern BOOLEAN HadVMSInterrupt;
 
 	    printf(
@@ -421,7 +421,6 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	    system(command);
 	}
 	else {
-	    extern int LYgetch NOPARAMS;
 	    extern BOOLEAN HadVMSInterrupt;
 
 	    printf(
@@ -443,7 +442,6 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	    system(command);
 	}
 	else {
-	    extern int LYgetch NOPARAMS;
 	    extern BOOLEAN HadVMSInterrupt;
 
 	    printf(
@@ -484,8 +482,6 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
 	    printf("\nlogging in with username %s", user);
 	printf(".\n");
 	{
-	    extern int LYgetch NOPARAMS;
-
 	    printf("\nPress <return> to return to Lynx.");
 	    fflush(stdout);
 	    LYgetch();
diff --git a/WWW/Library/Implementation/UCDefs.h b/WWW/Library/Implementation/UCDefs.h
index 8c370338..0da30713 100644
--- a/WWW/Library/Implementation/UCDefs.h
+++ b/WWW/Library/Implementation/UCDefs.h
@@ -9,17 +9,23 @@ typedef struct _LYUCcharset {
     int UChndl;
     CONST char * MIMEname;
     int enc;
-    int repertoire;
-    int codepoints;
-    int cpranges;	/* which ranges have valid displayable chars
-			   (including nbsp and shy) */
-    int like8859;	/* for which ranges is it like 8859-1 */
+
+    /* parameters below are not used by chartrans mechanism, */
+    /* they describe some relationships against built-in Latin1 charset...*/
+    int repertoire;	/* unused */
+    int codepoints;	/* subset/superset of Latin1 ? */
+    int cpranges;	/* unused, obsolete by LYlowest_eightbit;
+			  "which ranges have valid displayable chars
+			   (including nbsp and shy)" */
+    int like8859;	/* currently used for nbsp and shy only
+			   (but UCT_R_8859SPECL assumed for any UCT_R_8BIT...);
+			  "for which ranges is it like 8859-1" */
 } LYUCcharset;
 
 #define UCT_ENC_7BIT 0
 #define UCT_ENC_8BIT 1
-#define UCT_ENC_8859 2
-#define UCT_ENC_8BIT_C0 3      /* 8-bit some chars in C0 control area */
+#define UCT_ENC_8859 2         /* no displayable chars in 0x80-0x9F */
+#define UCT_ENC_8BIT_C0 3      /* 8-bit + some chars in C0 control area */
 #define UCT_ENC_MAYBE2022 4
 #define UCT_ENC_CJK 5
 #define UCT_ENC_16BIT 6
@@ -47,13 +53,13 @@ typedef struct _LYUCcharset {
  *  More specific bitflags for practically important code point ranges:
  */
 #define UCT_R_LOWCTRL 0x08	/* 0x00-0x1F, for completeness */
-#define UCT_R_7BITINV 0x10	/* invariant, displayable 7bit chars */
-#define UCT_R_7BITNAT 0x20	/* displayable 7bit, national */
-#define UCT_R_HIGHCTRL 0x40
+#define UCT_R_7BITINV 0x10	/* invariant???, displayable 7bit chars */
+#define UCT_R_7BITNAT 0x20	/* displayable 7bit, national??? */
+#define UCT_R_HIGHCTRL 0x40	/* chars in 0x80-0x9F range */
 #define UCT_R_8859SPECL 0x80	/* special chars in 8859-x sets: nbsp and shy*/
 #define UCT_R_HIGH8BIT 0x100	/* rest of 0xA0-0xFF range */
 
-#define UCT_R_ASCII UCT_R_7BITINV | UCT_R_7BITNAT /*displayable US-ASCII*/
+#define UCT_R_ASCII UCT_R_7BITINV | UCT_R_7BITNAT /* displayable US-ASCII */
 #define UCT_R_LAT1 UCT_R_ASCII | UCT_R_8859SPECL | UCT_R_HIGH8BIT
 #define UCT_R_8BIT UCT_R_LAT1 | UCT_R_HIGHCTRL /* full 8bit range */
 
diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h
index 23d88515..15df5f02 100644
--- a/WWW/Library/Implementation/UCMap.h
+++ b/WWW/Library/Implementation/UCMap.h
@@ -37,7 +37,7 @@ extern int UCGetRawUniMode_byLYhndl PARAMS((
 extern int UCGetLYhndl_byMIME PARAMS((
 	CONST char *	p)); /* returns -1 if name not recognized */
 extern int safeUCGetLYhndl_byMIME PARAMS((
-	CONST char *	p)); /* returns LATIN1 if MIME name not recognized */
+	CONST char *	p)); /* returns LATIN1 if name not recognized */
 
 extern int UCLYhndl_for_unspec;
 extern int UCLYhndl_for_unrec;
@@ -46,6 +46,7 @@ extern int UCLYhndl_HTFile_for_unrec;
 
 /* easy to type: */
 #define LATIN1   UCGetLYhndl_byMIME("iso-8859-1")
+#define US_ASCII UCGetLYhndl_byMIME("us-ascii")
 
 /*
 In general, Lynx translates letters from document charset to display charset.
diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h
index 608b3bda..4afefa59 100644
--- a/WWW/Library/Implementation/tcp.h
+++ b/WWW/Library/Implementation/tcp.h
@@ -1,20 +1,20 @@
 /*                System dependencies in the W3 library
                                    SYSTEM DEPENDENCIES
-                                             
+
    System-system differences for TCP include files and macros. This
    file includes for each system the files necessary for network and
    file I/O.  It should be used in conjunction with HTUtils.h to help
    ensure portability across as many platforms and flavors of platforms
    as possible.
-   
+
   AUTHORS
-  
+
   TBL                Tim Berners-Lee, W3 project, CERN, <timbl@info.cern.ch>
   EvA                     Eelco van Asperen <evas@cs.few.eur.nl>
   MA                      Marc Andreessen NCSA
   AT                      Aleksandar Totic <atotic@ncsa.uiuc.edu>
   SCW                     Susan C. Weber <sweber@kyle.eitech.com>
-                         
+
   HISTORY:
   22 Feb 91               Written (TBL) as part of the WWW library.
   16 Jan 92               PC code from EvA
@@ -35,7 +35,7 @@ Default values
 
    These values may be reset and altered by system-specific sections
    later on.  there are also a bunch of defaults at the end .
-   
+
  */
 /* Default values of those: */
 #define NETCLOSE close      /* Routine to close a TCP-IP socket         */
@@ -171,23 +171,23 @@ VAX/VMS
 
    Under VMS, there are many versions of TCP-IP. Define one if you do
    not use Digital's UCX product:
-   
+
   UCX                     DEC's "Ultrix connection" (default)
   CMU_TCP                 Available via FTP from sacusr.mp.usbr.gov
   SOCKETSHR		  Eckhart Meyer's interface to NETLIB
   WIN_TCP                 From Wollongong, now GEC software.
   MULTINET                From SRI, became TGV, then Cisco.
   DECNET                  Cern's TCP socket emulation over DECnet
-                           
+
    The last three do not interfere with the
    unix i/o library, and so they need special calls to read, write and
    close sockets. In these cases the socket number is a VMS channel
    number, so we make the @@@ HORRIBLE @@@ assumption that a channel
    number will be greater than 10 but a unix file descriptor less than
    10.  It works.
-   
+
  */
-#ifdef VMS 
+#ifdef VMS
 
 #ifdef UCX
 #undef IOCTL
@@ -434,7 +434,7 @@ struct timeval {
    On VMS machines, the linker needs to be told to put global data sections into
  a data
    segment using these storage classes. (MarkDonszelmann)
-  
+
  */
 #if defined(VAXC) && !defined(__DECC)
 #define GLOBALDEF globaldef
@@ -472,6 +472,7 @@ struct timeval {
 #define NETREAD read_s
 #undef NETCLOSE
 #define NETCLOSE close_s
+#define getsockname getsockname_s
 #endif
 
 #ifdef HAVE_UNISTD_H
@@ -513,15 +514,6 @@ Regular BSD unix versions
 #include <sys/param.h>
 #include <sys/file.h>       /* For open() etc */
 
-#if defined(NeXT) || defined(sony_news)
-#ifndef mode_t
-typedef unsigned short mode_t;
-#endif /* !mode_t */
-
-#ifndef pid_t
-typedef int pid_t;
-#endif /* !pid_t */
-
 #ifndef S_ISLNK
 #define S_ISLNK(m)	(((m) & S_IFMT) == S_IFLNK)
 #endif /* S_ISLNK */
@@ -586,6 +578,15 @@ typedef int pid_t;
 #define S_IXOTH 00001
 #endif
 
+#if defined(NeXT) || defined(sony_news)
+#ifndef mode_t
+typedef unsigned short mode_t;
+#endif /* !mode_t */
+
+#ifndef pid_t
+typedef int pid_t;
+#endif /* !pid_t */
+
 #ifndef WEXITSTATUS
 #ifdef sony_news
 #define WEXITSTATUS(s) WIFEXITED(s)