--- slb.c	Wed May  3 16:15:58 2000
+++ ../slb.c	Wed May  3 22:37:56 2000
@@ -10,7 +10,7 @@
  */
 
 /*
- * slb.c dated 00/05/02
+ * slb.c dated 99/08/18
  *
  * Author:
  * Thomas Binder
@@ -20,8 +20,6 @@
  * Routines for MagiC-style "shared libraries". EXPERIMENTAL! USE WITH CAUTION!
  *
  * History:
- * 00/05/02: - Removed proc_self and pbaseaddr, as slb_util.spp no longer needs
- *             them (Gryf)
  * 99/08/18: - open() and close() of a shared library now get the address of
  *             the basepage of the calling process, instead of its PID (Gryf)
  *           - Added string and long constant needed by changes in slb_util.spp
@@ -33,10 +31,6 @@
 
 # include "slb.h"
 
-# include "libkern/libkern.h"
-# include "mint/basepage.h"
-# include "mint/signal.h"
-
 # include "kmemory.h"
 # include "memory.h"
 # include "mprot.h"
@@ -45,13 +39,17 @@
 # include "dossig.h"
 # include "rendez.h"
 # include "slb_util.h"
+# include "string.h"
 # include "signal.h"
 # include "util.h"
 
-# include <osbind.h>
+const char slbpath[]="SLBPATH=";	/* used by slb_util.spp */
 
+/* Name of curproc, needed in slb_util.spp */
+const char proc_self[] = "U:\\proc\\.-1";
 
-const char slbpath[]="SLBPATH=";	/* used by slb_util.spp */
+/* The value of the PBASEADDR opcode, needed in slb_util.spp */
+const short pbaseaddr = PBASEADDR;
 
 /* The linked list of used SLBs */
 SHARED_LIB *slb_list = NULL;
@@ -123,7 +121,7 @@
  * pid: The PID of the process to be (un)marked
  * setflag: Mark (1) or unmark (0) the process as user
  */
-INLINE void
+FASTFN void
 mark_users (SHARED_LIB *sl, int pid, int setflag)
 {
 	if (setflag)
@@ -145,7 +143,7 @@
  * 0: Process is not user of the SLB
  * 1: Process is user of the SLB
  */
-INLINE int
+FASTFN int
 is_user (SHARED_LIB *sl, int pid)
 {
 	if (sl->slb_users [pid/8] & (1 << (pid % 8)))
@@ -165,7 +163,7 @@
  * pid: The PID of the process to be (un)marked
  * setflag: Mark (1) or unmark (0) the process as having opened the SLB
  */
-INLINE void
+FASTFN void
 mark_opened (SHARED_LIB *sl, int pid, int setflag)
 {
 	if (setflag)
@@ -188,7 +186,7 @@
  * 0: Process has not open()ed the SLB
  * 1: Process has open()ed the SLB
  */
-INLINE int
+FASTFN int
 has_opened (SHARED_LIB *sl, int pid)
 {
 	if (sl->slb_opened [pid/8] & (1 << (pid % 8)))
@@ -243,10 +241,12 @@
 		DEBUG(("Slbopen: Couldn't kmalloc() full pathname"));
 		return(ENOMEM);
 	}
-	strcpy(fullpath, path);
+	strcpy(fullpath + 1, path);	/* leave 1 byte for commandline length */
 	strcat(fullpath, "\\");
 	strcat(fullpath, name);
 
+	fullpath[0] = 0x70;		/* say this much... (must be below $7f) */
+
 	/* Create the new shared library structure */
 	mr = get_region(alt, sizeof(SHARED_LIB) + strlen(name), PROT_PR);
 	if (mr == 0L)
@@ -262,11 +262,11 @@
 	}
 	mark_proc_region(curproc, mr, PROT_G);
 	*sl = (SHARED_LIB *)mr->loc;
-	bzero(*sl, sizeof(SHARED_LIB));
+	zero((char *)*sl, sizeof(SHARED_LIB));
 	(*sl)->slb_region = mr;
 
 	/* Load, but don't run the SLB */
-	r = p_exec(3, fullpath, fullpath, 0L);
+	r = p_exec(3, fullpath + 1, fullpath, 0L);
 	kfree(fullpath);
 	if (r <= 0L)
 	{
@@ -293,7 +293,7 @@
 		return(r);
 	}
 
-	/* Test for the new programm-format */
+	/* Test for the new program format */
 	exec_longs = (long *) b->p_tbase;
 	if (exec_longs[0] == 0x283a001a && exec_longs[1] == 0x4efb48fa)
 	{
