Install sccs headers and copyright notices.
[unix-history] / usr / src / usr.bin / tn3270 / api / apilib.c
index 550067b..f27fc20 100644 (file)
@@ -1,4 +1,29 @@
-#include "../api/api.h"
+/*
+ *     Copyright (c) 1984-1987 by the Regents of the
+ *     University of California and by Gregory Glenn Minshall.
+ *
+ *     Permission to use, copy, modify, and distribute these
+ *     programs and their documentation for any purpose and
+ *     without fee is hereby granted, provided that this
+ *     copyright and permission appear on all copies and
+ *     supporting documentation, the name of the Regents of
+ *     the University of California not be used in advertising
+ *     or publicity pertaining to distribution of the programs
+ *     without specific prior permission, and notice be given in
+ *     supporting documentation that copying and distribution is
+ *     by permission of the Regents of the University of California
+ *     and by Gregory Glenn Minshall.  Neither the Regents of the
+ *     University of California nor Gregory Glenn Minshall make
+ *     representations about the suitability of this software
+ *     for any purpose.  It is provided "as is" without
+ *     express or implied warranty.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)apilib.c   1.10 (Berkeley) %G%";
+#endif /* not lint */
+
+#include "../ctlr/api.h"
 
 #include "apilib.h"
 
 
 #include "apilib.h"
 
@@ -20,10 +45,11 @@ static int
  * Only certain routines need this (supervisor services come to mind).
  */
 
  * Only certain routines need this (supervisor services come to mind).
  */
 
-int
-api_issue_regs(ah, al, bh, bl, cx, dx, parms, regs, sregs)
+static int
+api_issue_regs(ah, al, bh, bl, cx, dx, parms, length, regs, sregs)
 int            ah, al, bh, bl, cx, dx;
 char           *parms;
 int            ah, al, bh, bl, cx, dx;
 char           *parms;
+int            length;
 union REGS     *regs;
 struct SREGS   *sregs;
 {
 union REGS     *regs;
 struct SREGS   *sregs;
 {
@@ -42,7 +68,7 @@ struct SREGS  *sregs;
     int86x(API_INTERRUPT_NUMBER, regs, regs, sregs);
 #endif /* defined(MSDOS) */
 #if    defined(unix)
     int86x(API_INTERRUPT_NUMBER, regs, regs, sregs);
 #endif /* defined(MSDOS) */
 #if    defined(unix)
-    api_exch_api(regs, sregs);
+    api_exch_api(regs, sregs, parms, length);
 #endif /* defined(unix) */
 
     if (regs->h.cl != 0) {
 #endif /* defined(unix) */
 
     if (regs->h.cl != 0) {
@@ -59,8 +85,8 @@ struct SREGS  *sregs;
  * registers.  Most routines use this.
  */
 
  * registers.  Most routines use this.
  */
 
-int
-api_issue(ah, al, bh, bl, cx, dx, parms)
+static int
+api_issue(ah, al, bh, bl, cx, dx, parms, length)
 int
     ah,
     al,
 int
     ah,
     al,
@@ -69,11 +95,12 @@ int
     cx,
     dx;
 char *parms;
     cx,
     dx;
 char *parms;
+int length;                            /* Length of parms */
 {
     union REGS regs;
     struct SREGS sregs;
 
 {
     union REGS regs;
     struct SREGS sregs;
 
-    return api_issue_regs(ah, al, bh, bl, cx, dx, parms, &regs, &sregs);
+    return api_issue_regs(ah, al, bh, bl, cx, dx, parms, length, &regs, &sregs);
 }
 \f
 /*
 }
 \f
 /*
@@ -97,13 +124,33 @@ char *name;
        }
     }
 
        }
     }
 
-    if (api_issue_regs(NAME_RESOLUTION, 0, 0, 0, 0, 0, &parms, &regs, &sregs)
+    if (api_issue_regs(NAME_RESOLUTION, 0, 0, 0, 0, 0, &parms, sizeof parms, &regs, &sregs)
                    == -1) {
        return -1;
     } else {
        return regs.x.dx;
     }
 }
                    == -1) {
        return -1;
     } else {
        return regs.x.dx;
     }
 }
+
+#if    defined(unix)
+/*
+ * Block until the oia or ps is modified.
+ */
+
+int
+api_ps_or_oia_modified()
+{
+    union REGS regs;
+    struct SREGS sregs;
+
+    if (api_issue_regs(PS_OR_OIA_MODIFIED, 0, 0, 0, 0, 0, 0, 0, &regs, &sregs)
+                   == -1) {
+       return -1;
+    } else {
+       return 0;
+    }
+}
+#endif /* defined(unix) */
 \f
 /*
  * Session Information Services
 \f
 /*
  * Session Information Services
@@ -113,7 +160,7 @@ api_query_session_id(parms)
 QuerySessionIdParms *parms;
 {
     if (api_issue(0x09, QUERY_SESSION_ID, 0x80, 0x20, 0,
 QuerySessionIdParms *parms;
 {
     if (api_issue(0x09, QUERY_SESSION_ID, 0x80, 0x20, 0,
-                                       gate_sessmgr, (char *)parms) == -1) {
+                                       gate_sessmgr, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -131,7 +178,7 @@ api_query_session_parameters(parms)
 QuerySessionParametersParms *parms;
 {
     if (api_issue(0x09, QUERY_SESSION_PARAMETERS, 0x80, 0x20, 0,
 QuerySessionParametersParms *parms;
 {
     if (api_issue(0x09, QUERY_SESSION_PARAMETERS, 0x80, 0x20, 0,
-                                       gate_sessmgr, (char *)parms) == -1) {
+                           gate_sessmgr, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -148,7 +195,7 @@ api_query_session_cursor(parms)
 QuerySessionCursorParms *parms;
 {
     if (api_issue(0x09, QUERY_SESSION_CURSOR, 0x80, 0x20, 0xff,
 QuerySessionCursorParms *parms;
 {
     if (api_issue(0x09, QUERY_SESSION_CURSOR, 0x80, 0x20, 0xff,
-                                       gate_sessmgr, (char *)parms) == -1) {
+                       gate_sessmgr, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -169,7 +216,7 @@ api_connect_to_keyboard(parms)
 ConnectToKeyboardParms *parms;
 {
     if (api_issue(0x09, CONNECT_TO_KEYBOARD, 0x80, 0x20, 0,
 ConnectToKeyboardParms *parms;
 {
     if (api_issue(0x09, CONNECT_TO_KEYBOARD, 0x80, 0x20, 0,
-                                       gate_keyboard, (char *)parms) == -1) {
+                       gate_keyboard, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -187,7 +234,7 @@ api_disconnect_from_keyboard(parms)
 DisconnectFromKeyboardParms *parms;
 {
     if (api_issue(0x09, DISCONNECT_FROM_KEYBOARD, 0x80, 0x20, 0,
 DisconnectFromKeyboardParms *parms;
 {
     if (api_issue(0x09, DISCONNECT_FROM_KEYBOARD, 0x80, 0x20, 0,
-                                       gate_keyboard, (char *)parms) == -1) {
+                       gate_keyboard, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -205,7 +252,7 @@ api_write_keystroke(parms)
 WriteKeystrokeParms *parms;
 {
     if (api_issue(0x09, WRITE_KEYSTROKE, 0x80, 0x20, 0,
 WriteKeystrokeParms *parms;
 {
     if (api_issue(0x09, WRITE_KEYSTROKE, 0x80, 0x20, 0,
-                                       gate_keyboard, (char *)parms) == -1) {
+                       gate_keyboard, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -223,7 +270,7 @@ api_disable_input(parms)
 DisableInputParms *parms;
 {
     if (api_issue(0x09, DISABLE_INPUT, 0x80, 0x20, 0,
 DisableInputParms *parms;
 {
     if (api_issue(0x09, DISABLE_INPUT, 0x80, 0x20, 0,
-                                       gate_keyboard, (char *)parms) == -1) {
+                       gate_keyboard, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -240,7 +287,7 @@ api_enable_input(parms)
 EnableInputParms *parms;
 {
     if (api_issue(0x09, ENABLE_INPUT, 0x80, 0x20, 0,
 EnableInputParms *parms;
 {
     if (api_issue(0x09, ENABLE_INPUT, 0x80, 0x20, 0,
-                                       gate_keyboard, (char *)parms) == -1) {
+                       gate_keyboard, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -261,7 +308,7 @@ api_copy_string(parms)
 CopyStringParms *parms;
 {
     if (api_issue(0x09, COPY_STRING, 0x80, 0x20, 0xff,
 CopyStringParms *parms;
 {
     if (api_issue(0x09, COPY_STRING, 0x80, 0x20, 0xff,
-                                           gate_copy, (char *)parms) == -1) {
+                           gate_copy, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -282,7 +329,7 @@ api_read_oia_group(parms)
 ReadOiaGroupParms *parms;
 {
     if (api_issue(0x09, READ_OIA_GROUP, 0x80, 0x20, 0xff,
 ReadOiaGroupParms *parms;
 {
     if (api_issue(0x09, READ_OIA_GROUP, 0x80, 0x20, 0xff,
-                                           gate_oiam, (char *)parms) == -1) {
+                           gate_oiam, (char *)parms, sizeof *parms) == -1) {
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
        api_fcn_errno = 0;
        api_fcn_fcn_id = 0;
        return -1;
@@ -328,7 +375,7 @@ api_init()
     if ((regs.x.bx == 0) && (sregs.es == 0)) {
        return 0;               /* Interrupt not being handled */
     }
     if ((regs.x.bx == 0) && (sregs.es == 0)) {
        return 0;               /* Interrupt not being handled */
     }
-#endif defined(MSDOS)
+#endif /* defined(MSDOS) */
 #if    defined(unix)
     if (api_open_api(0) == -1) {
        return 0;
 #if    defined(unix)
     if (api_open_api(0) == -1) {
        return 0;