summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-05-10 23:37:32 +0000
committerUlrich Drepper <drepper@redhat.com>1997-05-10 23:37:32 +0000
commit43b0e40f85770cd1f362c3abbad41e09bd9f0b17 (patch)
tree799af104f1ab7419ac37f0d9a8d5d34a73bba54b
parent8b13cb56b3433bed5233840af66127a745c27718 (diff)
downloadglibc-43b0e40f85770cd1f362c3abbad41e09bd9f0b17.tar.gz
glibc-43b0e40f85770cd1f362c3abbad41e09bd9f0b17.tar.xz
glibc-43b0e40f85770cd1f362c3abbad41e09bd9f0b17.zip
1997-05-10 11:46  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/rpcsvc/nis_callback.x: New, from tirpcsrc-2.3.

	* nis/nis_call.c (__nis_docall): Rewritten for navigation in NIS+
	namespace hierachy.
	* nis/nis_intern.h: Add new __nis_docall function prototypes.
	* nis/nis_add.c: Change __nis_docall/__nis_docall2 parameters for new
	rewritten functions.
	* nis/nis_checkpoint.c: Likewise.
	* nis/nis_lookup.c: Likewise.
	* nis/nis_mkdir.c: Likewise.
	* nis/nis_modify.c: Likewise.
	* nis/nis_ping.c: Likewise.
	* nis/nis_remove.c: Likewise.
	* nis/nis_rmdir.c: Likewise.
	* nis/nis_server.c: Likewise.
	* nis/nis_table.c: Likewise.

1997-05-09 16:09  Miles Bader  <miles@gnu.ai.mit.edu>

	* argp/argp-eexst.c: Include <sysexits.h>.
	(argp_err_exit_status): Initialize to EX_USAGE.
	* argp/argp.h, argp/argp-help.c: Doc fixes.

1997-05-08 17:15  Miles Bader  <miles@gnu.ai.mit.edu>

	* argp/argp.h [!__error_t_defined] (__error_t_defined): Define.
	* argp/argp-help.c (canon_doc_option): Correct ctype tests.
-rw-r--r--ChangeLog30
-rw-r--r--argp/argp-eexst.c7
-rw-r--r--argp/argp-help.c6
-rw-r--r--argp/argp.h4
-rwxr-xr-xconfig.guess2
-rw-r--r--hurd/hurdfault.c2
-rw-r--r--hurd/hurdsig.c2
-rw-r--r--nis/TODO6
-rw-r--r--nis/nis_add.c3
-rw-r--r--nis/nis_call.c211
-rw-r--r--nis/nis_checkpoint.c2
-rw-r--r--nis/nis_intern.h9
-rw-r--r--nis/nis_lookup.c4
-rw-r--r--nis/nis_mkdir.c10
-rw-r--r--nis/nis_modify.c2
-rw-r--r--nis/nis_ping.c9
-rw-r--r--nis/nis_remove.c2
-rw-r--r--nis/nis_rmdir.c10
-rw-r--r--nis/nis_server.c16
-rw-r--r--nis/nis_table.c22
-rw-r--r--nis/rpcsvc/nis_callback.x65
-rw-r--r--sys/ttydefaults.h1
-rw-r--r--sysdeps/generic/sys/ttydefaults.h (renamed from termios/sys/ttydefaults.h)12
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h104
-rw-r--r--sysdeps/unix/sysv/linux/poll.c3
-rw-r--r--sysdeps/unix/sysv/linux/sys/ttydefaults.h104
26 files changed, 558 insertions, 90 deletions
diff --git a/ChangeLog b/ChangeLog
index cfc98c31cb..794d891b44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+1997-05-10 11:46  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+	* nis/rpcsvc/nis_callback.x: New, from tirpcsrc-2.3.
+
+	* nis/nis_call.c (__nis_docall): Rewritten for navigation in NIS+
+	namespace hierachy.
+	* nis/nis_intern.h: Add new __nis_docall function prototypes.
+	* nis/nis_add.c: Change __nis_docall/__nis_docall2 parameters for new
+	rewritten functions.
+	* nis/nis_checkpoint.c: Likewise.
+	* nis/nis_lookup.c: Likewise.
+	* nis/nis_mkdir.c: Likewise.
+	* nis/nis_modify.c: Likewise.
+	* nis/nis_ping.c: Likewise.
+	* nis/nis_remove.c: Likewise.
+	* nis/nis_rmdir.c: Likewise.
+	* nis/nis_server.c: Likewise.
+	* nis/nis_table.c: Likewise.
+
+1997-05-09 16:09  Miles Bader  <miles@gnu.ai.mit.edu>
+
+	* argp/argp-eexst.c: Include <sysexits.h>.
+	(argp_err_exit_status): Initialize to EX_USAGE.
+	* argp/argp.h, argp/argp-help.c: Doc fixes.
+
+1997-05-08 17:15  Miles Bader  <miles@gnu.ai.mit.edu>
+
+	* argp/argp.h [!__error_t_defined] (__error_t_defined): Define.
+	* argp/argp-help.c (canon_doc_option): Correct ctype tests.
+
 1997-05-08 07:53  H.J. Lu  <hjl@gnu.ai.mit.edu>
 
 	* sysdeps/unix/sysv/linux/poll.c: Save errno.
diff --git a/argp/argp-eexst.c b/argp/argp-eexst.c
index 676d1ec517..9040058e4a 100644
--- a/argp/argp-eexst.c
+++ b/argp/argp-eexst.c
@@ -22,8 +22,11 @@
 #include <config.h>
 #endif
 
+#include <sysexits.h>
+
 #include "argp.h"
 
 /* The exit status that argp will use when exiting due to a parsing error.
-   If not defined or set by the user program, this defaults to 1.  */
-error_t argp_err_exit_status = 1;
+   If not defined or set by the user program, this defaults to EX_USAGE from
+   <sysexits.h>.  */
+error_t argp_err_exit_status = EX_USAGE;
diff --git a/argp/argp-help.c b/argp/argp-help.c
index ed934e0e3a..b17c56d3a5 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -658,12 +658,12 @@ canon_doc_option (const char **name)
 {
   int non_opt;
   /* Skip initial whitespace.  */
-  while (isspace (*name))
+  while (isspace (**name))
     (*name)++;
   /* Decide whether this looks like an option (leading `-') or not.  */
   non_opt = (**name != '-');
   /* Skip until part of name used for sorting.  */
-  while (**name && !isalnum (*name))
+  while (**name && !isalnum (**name))
     (*name)++;
   return non_opt;
 }
@@ -1612,7 +1612,7 @@ weak_alias (__argp_state_help, argp_state_help)
 
 /* If appropriate, print the printf string FMT and following args, preceded
    by the program name and `:', to stderr, and followed by a `Try ... --help'
-   message, then exit (ARGP_ERR_EXIT_STATUS).  */
+   message, then exit (1).  */
 void
 __argp_error (const struct argp_state *state, const char *fmt, ...)
 {
diff --git a/argp/argp.h b/argp/argp.h
index d418253692..6f430d4c23 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -34,6 +34,7 @@
 
 #ifndef __error_t_defined
 typedef int error_t;
+#define __error_t_defined
 #endif
 
 #ifndef __P
@@ -397,7 +398,8 @@ extern void (*argp_program_version_hook) __P ((FILE *__stream,
 __const extern char *argp_program_bug_address;
 
 /* The exit status that argp will use when exiting due to a parsing error.
-   If not defined or set by the user program, this defaults to 1.  */
+   If not defined or set by the user program, this defaults to EX_USAGE from
+   <sysexits.h>.  */
 extern error_t argp_err_exit_status;
 
 /* Flags for argp_help.  */
diff --git a/config.guess b/config.guess
index bfd352355e..ea44a2a9ca 100755
--- a/config.guess
+++ b/config.guess
@@ -430,7 +430,7 @@ EOF
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
     *:GNU:*:*)
-	echo `echo ${UNAME_MACHINE}|sed -e 's,-.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
     *:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c
index 671f8cb21a..6c1134a663 100644
--- a/hurd/hurdfault.c
+++ b/hurd/hurdfault.c
@@ -29,7 +29,7 @@
 #include <assert.h>
 
 jmp_buf _hurdsig_fault_env;
-struct hurd_signal_preemptor _hurdsig_fault_preemptor;
+struct hurd_signal_preemptor _hurdsig_fault_preemptor = {0};
 
 /* XXX temporary to deal with spelling fix */
 weak_alias (_hurdsig_fault_preemptor, _hurdsig_fault_preempter)
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 6ebd7bed14..592dc12e66 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -426,7 +426,7 @@ abort_all_rpcs (int signo, struct machine_thread_all_state *state, int live)
       }
 }
 
-struct hurd_signal_preemptor *_hurdsig_preemptors;
+struct hurd_signal_preemptor *_hurdsig_preemptors = 0;
 sigset_t _hurdsig_preempted_set;
 
 /* XXX temporary to deal with spelling fix */
diff --git a/nis/TODO b/nis/TODO
index 33072fa730..f87b02a407 100644
--- a/nis/TODO
+++ b/nis/TODO
@@ -1,12 +1,6 @@
 
  * nss_nisplus: When using parser form nss_files, rewrite parser
 
- * nss_nisplus: Search the data in the complete NIS+ namespace
-		specified by NIS_PATH
- 
- * What does nis_list give back, if rpc.nisd is not running or
-   if /var/nis/NIS_START_FILE does not exist ?
-
  * nis_table.c: nis_list(): 
 	Missing flags: FOLLOW_PATH, ALL_RESULTS
 	callback: Don't simulate it, use server callback thread
diff --git a/nis/nis_add.c b/nis/nis_add.c
index 0eb838efed..6e11f17ff6 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -55,7 +55,8 @@ nis_add (const_nis_name name, const nis_object *obj)
   req.ns_object.ns_object_val[0].zo_domain =
     nis_domain_of_r (name, buf4, sizeof (buf4));
 
-  if ((status = __do_niscall (NULL, 0, NIS_ADD, (xdrproc_t) xdr_ns_request,
+  if ((status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
+			      NIS_ADD, (xdrproc_t) xdr_ns_request,
 			      (caddr_t) &req, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, MASTER_ONLY)) != RPC_SUCCESS)
     res->status = status;
diff --git a/nis/nis_call.c b/nis/nis_call.c
index a92f1445f4..17f67abbde 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -160,36 +160,19 @@ __nis_dobind (const nis_server *server, u_long flags)
 }
 
 nis_error
-__do_niscall (const nis_server *serv, int serv_len, u_long prog,
-	      xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp,
-	      u_long flags)
+__do_niscall2 (const nis_server *server, u_int server_len, u_long prog,
+	       xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp,
+	       u_long flags)
 {
   CLIENT *clnt;
-  directory_obj *dir = NULL;
-  const nis_server *server;
   int try, result;
-  unsigned int server_len;
 
-  if (serv == NULL || serv_len == 0)
-    {
-      dir = readColdStartFile ();
-      if (dir == NULL) /* No /var/nis/NIS_COLD_START -> no NIS+ installed */
-	return NIS_UNAVAIL;
-      server = dir->do_servers.do_servers_val;
-      server_len = dir->do_servers.do_servers_len;
-    }
-  else
-    {
-      server = serv;
-      server_len = serv_len;
-    }
+  try = 0;
+  result = NIS_NAMEUNREACHABLE;
 
   if (((flags & MASTER_ONLY) == MASTER_ONLY) && server_len > 1)
     server_len = 1; /* The first entry is the master */
 
-  try = 0;
-  result = NIS_NAMEUNREACHABLE;
-
   while (try < MAXTRIES && result != RPC_SUCCESS)
     {
       unsigned int i;
@@ -215,7 +198,191 @@ __do_niscall (const nis_server *serv, int serv_len, u_long prog,
 	}
     }
 
+  return result;
+}
+
+static directory_obj *
+dir_lookup (const_nis_name name, nis_server *serv, u_long flags)
+{
+  CLIENT *clnt;
+  int try, result;
+  nis_result *res;
+  struct ns_request req;
+  directory_obj *dir;
+
+  res = calloc (1, sizeof (nis_result));
+  req.ns_name = (char *)name;
+  req.ns_object.ns_object_len = 0;
+  req.ns_object.ns_object_val = NULL;
+  try = 0;
+  result = NIS_NAMEUNREACHABLE;
+
+  while (try < MAXTRIES && result != RPC_SUCCESS)
+    {
+      if ((clnt = __nis_dobind (serv, flags)) == NULL)
+	continue;
+
+      result = clnt_call (clnt, NIS_LOOKUP, (xdrproc_t) xdr_ns_request,
+			  (caddr_t) &req, (xdrproc_t) xdr_nis_result,
+			  (caddr_t) res, TIMEOUT);
+
+      if (result != RPC_SUCCESS)
+	{
+	  clnt_perror (clnt, "do_niscall: clnt_call");
+	  clnt_destroy (clnt);
+	  result = NIS_RPCERROR;
+	}
+      else
+	clnt_destroy (clnt);
+    }
+  if (result != RPC_SUCCESS || res->status != NIS_SUCCESS)
+    return NULL;
+
+  dir = nis_clone_directory (&res->objects.objects_val->DI_data, NULL);
+  nis_freeresult (res);
+
+  return dir;
+}
+
+static directory_obj *
+rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags)
+{
+  char domain [strlen (name) + 3];
+
+  nis_domain_of_r (name, domain, sizeof (domain));
+  if (strncmp (domain, "org_dir.", 8) == 0)
+    {
+      char tmp[strlen (name) + 3];
+
+      nis_domain_of_r (domain, tmp, sizeof (tmp));
+      strcpy (domain, tmp);
+    }
+  else
+    if (strncmp (domain, "groups_dir.", 11) == 0)
+      {
+	char tmp[strlen (name) + 3];
+
+	nis_domain_of_r (domain, tmp, sizeof (tmp));
+	strcpy (domain, tmp);
+      }
+    else
+      {
+	/* We have no grous_dir or org_dir, so try the complete name */
+	strcpy (domain, name);
+      }
+
+  switch (nis_dir_cmp (domain, dir->do_name))
+    {
+    case SAME_NAME:
+      return dir;
+    case NOT_SEQUENTIAL:
+      /* NOT_SEQUENTIAL means, go one up and try it there ! */
+    case HIGHER_NAME:
+      { /* We need data from a parent domain */
+	directory_obj *obj;
+	char ndomain [strlen (name) + 3];
+
+	nis_domain_of_r (dir->do_name, ndomain, sizeof (ndomain));
+
+	/* The root server of our domain is a replica of the parent
+	   domain ! (Now I understand why a root server must be a
+	   replica of the parent domain) */
+	obj = dir_lookup (ndomain, dir->do_servers.do_servers_val,
+			  flags);
+	if (obj != NULL)
+	  {
+	    /* We have found a NIS+ server serving ndomain, now
+	       let us search for "name" */
+	    nis_free_directory (dir);
+	    return rec_dirsearch (name, obj, flags);
+	  }
+	else
+	  {
+	    /* Ups, very bad. Are we already the root server ? */
+	    nis_free_directory (dir);
+	    return NULL;
+	  }
+      }
+      break;
+    case LOWER_NAME:
+      {
+	directory_obj *obj;
+	char leaf [strlen (name) + 3];
+	char ndomain [strlen (name) + 3];
+	u_int i;
+
+	do
+	  {
+	    if (strlen (domain) == 0)
+	      {
+		nis_free_directory (dir);
+		return NULL;
+	      }
+	    nis_leaf_of_r (domain, leaf, sizeof (leaf));
+	    nis_domain_of_r (domain, ndomain, sizeof (ndomain));
+	    strcpy (domain, ndomain);
+	  }
+	while (nis_dir_cmp (domain, dir->do_name) != SAME_NAME);
+	strcat (leaf, ".");
+	strcat (leaf, domain);
+
+	for (i = 0; i < dir->do_servers.do_servers_len; ++i)
+	  {
+	    obj = dir_lookup (leaf, &dir->do_servers.do_servers_val[i],
+			      flags);
+	    if (obj != NULL)
+	      {
+		/* We have found a NIS+ server serving ndomain, now
+		   let us search for "name" */
+		nis_free_directory (dir);
+		return rec_dirsearch (name, obj, flags);
+	      }
+	  }
+      }
+      break;
+    case BAD_NAME:
+      nis_free_directory (dir);
+      return NULL;
+    }
+  nis_free_directory (dir);
+  return NULL;
+}
+
+nis_error
+__do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
+	      caddr_t req, xdrproc_t xres, caddr_t resp, u_long flags)
+{
+  nis_error result;
+  directory_obj *dir = NULL;
+  const nis_server *server;
+  u_int server_len;
+
+
+  dir = readColdStartFile ();
+  if (dir == NULL) /* No /var/nis/NIS_COLD_START -> no NIS+ installed */
+    return NIS_UNAVAIL;
+
+  if (name != NULL)
+    {
+      dir = rec_dirsearch (name, dir, flags);
+      if (dir == NULL)
+	{
+	  if (nis_dir_cmp (nis_local_directory(), name) == NOT_SEQUENTIAL)
+	    return NIS_NAMEUNREACHABLE;
+	  else
+	    return NIS_NOTFOUND;
+	}
+    }
+  server = dir->do_servers.do_servers_val;
+  server_len = dir->do_servers.do_servers_len;
+
+  if (((flags & MASTER_ONLY) == MASTER_ONLY) && server_len > 1)
+    server_len = 1; /* The first entry is the master */
+
+  result = __do_niscall2 (server, server_len, prog, xargs, req, xres,
+			  resp, flags);
   if (dir != NULL)
     nis_free_directory (dir);
+
   return result;
 }
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 56e98b2ac5..ff0a9b37a7 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -50,7 +50,7 @@ nis_checkpoint(const_nis_name dirname)
 	   i < res2->objects.objects_val[0].DI_data.do_servers.do_servers_len;
 	   ++i)
 	{
-	  if (__do_niscall (&res2->objects.objects_val[0].DI_data.do_servers.do_servers_val[i],
+	  if (__do_niscall2 (&res2->objects.objects_val[0].DI_data.do_servers.do_servers_val[i],
 			    1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
 			    (caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
 			    (caddr_t) &cpres, 0) != RPC_SUCCESS)
diff --git a/nis/nis_intern.h b/nis/nis_intern.h
index 855a7cab51..25c88a2b22 100644
--- a/nis/nis_intern.h
+++ b/nis/nis_intern.h
@@ -24,9 +24,12 @@
 
 __BEGIN_DECLS
 
-extern nis_error __do_niscall (__const nis_server *server, int server_len,
-			       u_long prog, xdrproc_t xargs, caddr_t req,
-			       xdrproc_t xres, caddr_t resp, u_long flags);
+extern nis_error __do_niscall2 (const nis_server *server, u_int server_len,
+				u_long prog, xdrproc_t xargs, caddr_t req,
+				xdrproc_t xres, caddr_t resp, u_long flags);
+extern nis_error __do_niscall (const_nis_name name, u_long prog,
+			       xdrproc_t xargs, caddr_t req, xdrproc_t xres,
+			       caddr_t resp, u_long flags);
 #if defined (HAVE_SECURE_RPC)
 extern AUTH *authdes_pk_create (const char *, const netobj *, u_int,
 				struct sockaddr *, des_block *);
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index 9173437bfa..6f5b12b285 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -56,7 +56,7 @@ nis_lookup (const_nis_name name, const u_long flags)
 	      req.ns_object.ns_object_val = NULL;
 	      memset (res, '\0', sizeof (nis_result));
 
-	      if ((status = __do_niscall (NULL, 0, NIS_LOOKUP,
+	      if ((status = __do_niscall (req.ns_name, NIS_LOOKUP,
 					  (xdrproc_t) xdr_ns_request,
 					  (caddr_t) & req,
 					  (xdrproc_t) xdr_nis_result,
@@ -113,7 +113,7 @@ nis_lookup (const_nis_name name, const u_long flags)
 	  req.ns_object.ns_object_val = NULL;
 	  memset (res, '\0', sizeof (nis_result));
 
-	  if ((status = __do_niscall (NULL, 0, NIS_LOOKUP,
+	  if ((status = __do_niscall (req.ns_name, NIS_LOOKUP,
 				      (xdrproc_t) xdr_ns_request,
 				      (caddr_t) &req,
 				      (xdrproc_t) xdr_nis_result,
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index a781c041ba..685dae64aa 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -28,17 +28,17 @@ nis_mkdir (const_nis_name dir, const nis_server *server)
 
   if (server == NULL)
     {
-      if (__do_niscall (NULL, 0, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
+      if (__do_niscall (dir, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
 			(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
 			(caddr_t) &res, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
   else
     {
-      if (__do_niscall (server, 1, NIS_MKDIR,
-			(xdrproc_t) xdr_nis_name,
-			(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
-			(caddr_t) &res, 0) != RPC_SUCCESS)
+      if (__do_niscall2 (server, 1, NIS_MKDIR,
+			 (xdrproc_t) xdr_nis_name,
+			 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
+			 (caddr_t) &res, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
 
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index 9c371c03bc..9c5aad7913 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -36,7 +36,7 @@ nis_modify (const_nis_name name, const nis_object *obj)
   req.ns_object.ns_object_len = 1;
   req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
 
-  if ((status = __do_niscall (NULL, 0, NIS_MODIFY, (xdrproc_t) xdr_ns_request,
+  if ((status = __do_niscall (name, NIS_MODIFY, (xdrproc_t) xdr_ns_request,
 			      (caddr_t) & req, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, MASTER_ONLY)) != RPC_SUCCESS)
     res->status = status;
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index 0aa56ed37e..610cf03ea5 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -53,11 +53,10 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
   args.stamp = utime;
 
   for (i = 0; i < obj->DI_data.do_servers.do_servers_len; ++i)
-    __do_niscall (&obj->DI_data.do_servers.do_servers_val[i], 1,
-		  NIS_PING, (xdrproc_t) xdr_ping_args,
-		  (caddr_t) &args, (xdrproc_t) xdr_void,
-		  (caddr_t) NULL, 0);
-
+    __do_niscall2 (&obj->DI_data.do_servers.do_servers_val[i], 1,
+		   NIS_PING, (xdrproc_t) xdr_ping_args,
+		   (caddr_t) &args, (xdrproc_t) xdr_void,
+		   (caddr_t) NULL, 0);
   if (res)
     nis_freeresult (res);
 }
diff --git a/nis/nis_remove.c b/nis/nis_remove.c
index 0415dca731..3ffd66dfe0 100644
--- a/nis/nis_remove.c
+++ b/nis/nis_remove.c
@@ -44,7 +44,7 @@ nis_remove (const_nis_name name, const nis_object *obj)
       req.ns_object.ns_object_val = NULL;
     }
 
-  if ((status = __do_niscall (NULL, 0, NIS_REMOVE, (xdrproc_t) xdr_ns_request,
+  if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) xdr_ns_request,
 			      (caddr_t) & req, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, MASTER_ONLY)) != RPC_SUCCESS)
     res->status = status;
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index 5b6f1d181b..a8c239ec70 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -28,17 +28,17 @@ nis_rmdir (const_nis_name dir, const nis_server *server)
 
   if (server == NULL)
     {
-      if (__do_niscall (NULL, 0, NIS_RMDIR, (xdrproc_t) xdr_nis_name,
+      if (__do_niscall (dir, NIS_RMDIR, (xdrproc_t) xdr_nis_name,
 			(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
 			(caddr_t) &res, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
   else
     {
-      if (__do_niscall (server, 1, NIS_RMDIR,
-			(xdrproc_t) xdr_nis_name,
-			(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
-			(caddr_t) &res, 0) != RPC_SUCCESS)
+      if (__do_niscall2 (server, 1, NIS_RMDIR,
+			 (xdrproc_t) xdr_nis_name,
+			 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
+			 (caddr_t) &res, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
 
diff --git a/nis/nis_server.c b/nis/nis_server.c
index 393f6c6eb4..4d6b1c1100 100644
--- a/nis/nis_server.c
+++ b/nis/nis_server.c
@@ -37,16 +37,16 @@ nis_servstate (const nis_server *serv, const nis_tag *tags,
 
   if (serv == NULL)
     {
-      if (__do_niscall (NULL, 0, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
+      if (__do_niscall (NULL, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
 			(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
 			(caddr_t) &tagres, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
   else
     {
-      if (__do_niscall (serv, 1, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
-			(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
-			(caddr_t) &tagres, 0) != RPC_SUCCESS)
+      if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
+			 (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
+			 (caddr_t) &tagres, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
   if (tagres.tags.tags_len > 0)
@@ -84,16 +84,16 @@ nis_stats (const nis_server *serv, const nis_tag *tags,
 
   if (serv == NULL)
     {
-      if (__do_niscall (NULL, 0, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
+      if (__do_niscall (NULL, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
 			(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
 			(caddr_t) &tagres, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
   else
     {
-      if (__do_niscall (serv, 1, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
-			(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
-			(caddr_t) &tagres, 0) != RPC_SUCCESS)
+      if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
+			 (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
+			 (caddr_t) &tagres, 0) != RPC_SUCCESS)
 	return NIS_RPCERROR;
     }
   if (tagres.tags.tags_len > 0)
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 268ea2f76c..5fa3c89e0b 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -197,9 +197,9 @@ nis_list (const_nis_name name, u_long flags,
     {
       memset (res, '\0', sizeof (nis_result));
 
-      if ((result = __do_niscall (NULL, 0, NIS_IBLIST,
+      if ((result = __do_niscall (ibreq.ibr_name, NIS_IBLIST,
 				  (xdrproc_t) xdr_ib_request,
-			      (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+				  (caddr_t) &ibreq, (xdrproc_t) xdr_nis_result,
 				  (caddr_t) res, flags)) != RPC_SUCCESS)
 	{
 	  res->status = result;
@@ -276,9 +276,9 @@ nis_add_entry (const_nis_name name, const nis_object *obj,
   ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
   ibreq.ibr_obj.ibr_obj_len = 1;
 
-  if ((status = __do_niscall (NULL, 0, NIS_IBADD,
+  if ((status = __do_niscall (ibreq.ibr_name, NIS_IBADD,
 			      (xdrproc_t) xdr_ib_request,
-			      (caddr_t) & ibreq,
+			      (caddr_t) &ibreq,
 			      (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, 0)) != RPC_SUCCESS)
     res->status = status;
@@ -308,7 +308,7 @@ nis_modify_entry (const_nis_name name, const nis_object *obj,
   ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
   ibreq.ibr_obj.ibr_obj_len = 1;
 
-  if ((status = __do_niscall (NULL, 0, NIS_IBMODIFY,
+  if ((status = __do_niscall (ibreq.ibr_name, NIS_IBMODIFY,
 			      (xdrproc_t) xdr_ib_request,
 			      (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, 0)) != RPC_SUCCESS)
@@ -342,7 +342,7 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
       ibreq.ibr_obj.ibr_obj_len = 1;
     }
 
-  if ((status = __do_niscall (NULL, 0, NIS_IBREMOVE,
+  if ((status = __do_niscall (ibreq.ibr_name, NIS_IBREMOVE,
 			      (xdrproc_t) xdr_ib_request,
 			      (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, 0)) != RPC_SUCCESS)
@@ -368,8 +368,9 @@ nis_first_entry (const_nis_name name)
       return res;
     }
 
-  if ((status = __do_niscall (NULL, 0, NIS_IBFIRST, (xdrproc_t) xdr_ib_request,
-			      (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+  if ((status = __do_niscall (ibreq.ibr_name, NIS_IBFIRST,
+			      (xdrproc_t) xdr_ib_request,
+			      (caddr_t) &ibreq, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, 0)) != RPC_SUCCESS)
     res->status = status;
 
@@ -406,8 +407,9 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
       ibreq.ibr_cookie.n_len = cookie->n_len;
     }
 
-  if ((status = __do_niscall (NULL, 0, NIS_IBNEXT, (xdrproc_t) xdr_ib_request,
-			      (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+  if ((status = __do_niscall (ibreq.ibr_name, NIS_IBNEXT,
+			      (xdrproc_t) xdr_ib_request,
+			      (caddr_t) &ibreq, (xdrproc_t) xdr_nis_result,
 			      (caddr_t) res, 0)) != RPC_SUCCESS)
     res->status = status;
 
diff --git a/nis/rpcsvc/nis_callback.x b/nis/rpcsvc/nis_callback.x
new file mode 100644
index 0000000000..48178655cf
--- /dev/null
+++ b/nis/rpcsvc/nis_callback.x
@@ -0,0 +1,65 @@
+%/*
+% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+% * unrestricted use provided that this legend is included on all tape
+% * media and as a part of the software program in whole or part.  Users
+% * may copy or modify Sun RPC without charge, but are not authorized
+% * to license or distribute it to anyone else except as part of a product or
+% * program developed by the user or with the express written consent of
+% * Sun Microsystems, Inc.
+% *
+% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+% *
+% * Sun RPC is provided with no support and without any obligation on the
+% * part of Sun Microsystems, Inc. to assist in its use, correction,
+% * modification or enhancement.
+% *
+% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+% * OR ANY PART THEREOF.
+% *
+% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+% * or profits or other special, indirect and consequential damages, even if
+% * Sun has been advised of the possibility of such damages.
+% *
+% * Sun Microsystems, Inc.
+% * 2550 Garcia Avenue
+% * Mountain View, California  94043
+% */
+
+/*
+ *	nis_callback.x
+ *
+ *	Copyright (c) 1988-1992 Sun Microsystems Inc
+ *	All Rights Reserved.
+ */
+
+%#pragma ident	"@(#)nis_callback.x	1.7	94/05/03 SMI"
+
+/*
+ * "@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro" 
+ *
+ * RPCL description of the Callback Service.
+ */
+
+#ifdef RPC_HDR
+%#include <rpcsvc/nis.h>
+#endif
+#ifdef RPC_XDR
+%#include "nis_clnt.h"
+#endif
+
+typedef nis_object	*obj_p;
+
+struct cback_data {
+	obj_p		entries<>;	/* List of objects */
+};
+
+program CB_PROG {
+	version CB_VERS {
+		bool	CBPROC_RECEIVE(cback_data) = 1;
+		void	CBPROC_FINISH(void) = 2;
+		void	CBPROC_ERROR(nis_error) = 3;
+	} = 1;
+} = 100302;
diff --git a/sys/ttydefaults.h b/sys/ttydefaults.h
deleted file mode 100644
index 9cf7f1b6b9..0000000000
--- a/sys/ttydefaults.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <termios/sys/ttydefaults.h>
diff --git a/termios/sys/ttydefaults.h b/sysdeps/generic/sys/ttydefaults.h
index 14903923da..ab9a1f6934 100644
--- a/termios/sys/ttydefaults.h
+++ b/sysdeps/generic/sys/ttydefaults.h
@@ -39,7 +39,7 @@
  */
 
 /*
- * System wide defaults for terminal state.
+ * System wide defaults for terminal state.  4.4 BSD/generic GNU version.
  */
 #ifndef _SYS_TTYDEFAULTS_H_
 #define	_SYS_TTYDEFAULTS_H_
@@ -48,15 +48,7 @@
  * Defaults on "first" open.
  */
 #define	TTYDEF_IFLAG	(BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
-#ifdef OXTABS
-# define TTYDEF_OFLAG	(OPOST | ONLCR | OXTABS)
-#else
-# if defined TAB3
-#  define TTYDEF_OFLAG	(OPOST | ONLCR | TAB3)
-# else
-#  define TTYDEF_OFLAG	(OPOST | ONLCR)
-# endif
-#endif
+#define TTYDEF_OFLAG	(OPOST | ONLCR | OXTABS)
 #define TTYDEF_LFLAG	(ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
 #define TTYDEF_CFLAG	(CREAD | CS7 | PARENB | HUPCL)
 #define TTYDEF_SPEED	(B9600)
diff --git a/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h b/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h
new file mode 100644
index 0000000000..d4ee4ac451
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state.  SunOS 4 version.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define	_SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define	TTYDEF_IFLAG	(BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG	(OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG	(ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG	(CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED	(B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x)	(x&037)
+#define	CEOF		CTRL('d')
+#ifdef _POSIX_VDISABLE
+# define CEOL		_POSIX_VDISABLE
+#else
+# define CEOL		((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
+#endif
+#define	CERASE		0177
+#define	CINTR		CTRL('c')
+#ifdef _POSIX_VDISABLE
+# define CSTATUS	_POSIX_VDISABLE
+#else
+# define CSTATUS	((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
+#endif
+#define	CKILL		CTRL('u')
+#define	CMIN		1
+#define	CQUIT		034		/* FS, ^\ */
+#define	CSUSP		CTRL('z')
+#define	CTIME		0
+#define	CDSUSP		CTRL('y')
+#define	CSTART		CTRL('q')
+#define	CSTOP		CTRL('s')
+#define	CLNEXT		CTRL('v')
+#define	CDISCARD 	CTRL('o')
+#define	CWERASE 	CTRL('w')
+#define	CREPRINT 	CTRL('r')
+#define	CEOT		CEOF
+/* compat */
+#define	CBRK		CEOL
+#define CRPRNT		CREPRINT
+#define	CFLUSH		CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef TTYDEFCHARS
+cc_t	ttydefchars[NCCS] = {
+	CEOF,	CEOL,	CEOL,	CERASE, CWERASE, CKILL, CREPRINT,
+	_POSIX_VDISABLE, CINTR,	CQUIT,	CSUSP,	CDSUSP,	CSTART,	CSTOP,	CLNEXT,
+	CDISCARD, CMIN,	CTIME,  CSTATUS, _POSIX_VDISABLE
+};
+#undef TTYDEFCHARS
+#endif
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 875c3b48f8..b92139aab4 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -41,10 +41,13 @@ poll (fds, nfds, timeout)
     {
       if (syscall)
 	{
+	  int errno_saved = errno;
 	  int retval = __syscall_poll (fds, nfds, timeout);
 
 	  if (retval >= 0 || errno != ENOSYS)
 	    return retval;
+
+	  __set_errno (errno_saved);
 	}
 
       must_emulate = 1;
diff --git a/sysdeps/unix/sysv/linux/sys/ttydefaults.h b/sysdeps/unix/sysv/linux/sys/ttydefaults.h
new file mode 100644
index 0000000000..28512ebebb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/ttydefaults.h
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state.  Linux version.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define	_SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define	TTYDEF_IFLAG	(BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG	(OPOST | ONLCR | XTABS)
+#define TTYDEF_LFLAG	(ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG	(CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED	(B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x)	(x&037)
+#define	CEOF		CTRL('d')
+#ifdef _POSIX_VDISABLE
+# define CEOL		_POSIX_VDISABLE
+#else
+# define CEOL		((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
+#endif
+#define	CERASE		0177
+#define	CINTR		CTRL('c')
+#ifdef _POSIX_VDISABLE
+# define CSTATUS	_POSIX_VDISABLE
+#else
+# define CSTATUS	((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
+#endif
+#define	CKILL		CTRL('u')
+#define	CMIN		1
+#define	CQUIT		034		/* FS, ^\ */
+#define	CSUSP		CTRL('z')
+#define	CTIME		0
+#define	CDSUSP		CTRL('y')
+#define	CSTART		CTRL('q')
+#define	CSTOP		CTRL('s')
+#define	CLNEXT		CTRL('v')
+#define	CDISCARD 	CTRL('o')
+#define	CWERASE 	CTRL('w')
+#define	CREPRINT 	CTRL('r')
+#define	CEOT		CEOF
+/* compat */
+#define	CBRK		CEOL
+#define CRPRNT		CREPRINT
+#define	CFLUSH		CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef TTYDEFCHARS
+cc_t	ttydefchars[NCCS] = {
+	CEOF,	CEOL,	CEOL,	CERASE, CWERASE, CKILL, CREPRINT,
+	_POSIX_VDISABLE, CINTR,	CQUIT,	CSUSP,	CDSUSP,	CSTART,	CSTOP,	CLNEXT,
+	CDISCARD, CMIN,	CTIME,  CSTATUS, _POSIX_VDISABLE
+};
+#undef TTYDEFCHARS
+#endif