--- /dev/null
+# hints/vmesa.sh
+#
+# VM/ESA hints by Neale Ferguson (neale@mailbox.tabnsw.com.au)
+
+case "$archname" in
+'') archname="$osname" ;;
+esac
+bin='/usr/local/bin'
+binexp='/usr/local/bin'
+byacc='byacc'
+c='\c'
+cc='c89'
+ccflags="-D_OE_SOCKETS -DOLD_PTHREADS_API -DYYDYNAMIC -DDEBUGGING -I.." \
+ "-I/usr/local/include -W c,hwopts\\\(string\\\),langlvl\\\(ansi\\\)"
+clocktype='clock_t'
+cryptlib="n"
+d_Gconvert='gcvt((x),(n),(b))'
+d_access='define'
+d_alarm='define'
+d_archlib='define'
+# randbits='15'
+archobjs="ebcdic.o vmesa.o"
+d_attribut='undef'
+d_bcmp='define'
+d_bcopy='define'
+d_bsd='undef'
+d_bsdgetpgrp='undef'
+d_bsdsetpgrp='undef'
+d_bzero='define'
+d_casti32='define'
+d_castneg='define'
+d_charvspr='undef'
+d_chown='define'
+d_chroot='undef'
+d_chsize='undef'
+d_closedir='define'
+d_const='define'
+d_crypt='undef'
+d_csh='undef'
+d_cuserid='define'
+d_dbl_dig='define'
+d_difftime='define'
+d_dirnamlen='undef'
+d_dlerror='define'
+d_dlopen='define'
+d_dlsymun='define'
+d_dosuid='undef'
+d_dup2='define'
+d_endgrent='undef'
+d_endpwent='undef'
+d_eofnblk='define'
+d_eunice='undef'
+d_fchmod='define'
+d_fchown='define'
+d_fcntl='define'
+d_fd_macros='define'
+d_fd_set='define'
+d_fds_bits='define'
+d_fgetpos='define'
+d_flexfnam='define'
+d_flock='undef'
+d_fork='undef'
+d_fpathconf='define'
+d_fsetpos='define'
+d_ftime='undef'
+d_getgrent='undef'
+d_gethent='define'
+d_gethname='undef'
+d_getlogin='define'
+d_getpgid='undef'
+d_getpgrp='define'
+d_getpgrp2='undef'
+d_getppid='define'
+d_getprior='undef'
+d_getpwent='undef'
+d_gettimeod='define'
+d_gnulibc='undef'
+d_htonl='define'
+d_index='define'
+d_inetaton='undef'
+d_isascii='define'
+d_killpg='define'
+d_link='define'
+d_locconv='define'
+d_lockf='define'
+d_longdbl='undef'
+d_longllong='undef'
+d_lstat='define'
+d_mblen='define'
+d_mbstowcs='define'
+d_mbtowc='define'
+d_memcmp='define'
+d_memcpy='define'
+d_memmove='define'
+d_memset='define'
+d_mkdir='define'
+d_mkfifo='define'
+d_mktime='define'
+d_msg='define'
+d_msgctl='define'
+d_msgget='define'
+d_msgrcv='define'
+d_msgsnd='define'
+d_mymalloc='undef'
+d_nice='undef'
+d_oldsock='undef'
+d_open3='define'
+d_pathconf='define'
+d_pause='define'
+d_phostname='undef'
+d_pipe='define'
+d_poll='undef'
+d_portable='define'
+d_pwage='undef'
+d_pwchange='undef'
+d_pwclass='undef'
+d_pwcomment='undef'
+d_pwexpire='undef'
+d_pwquota='undef'
+d_readdir='define'
+d_readlink='define'
+d_rename='define'
+d_rewinddir='define'
+d_rmdir='define'
+d_safebcpy='define'
+d_safemcpy='undef'
+d_sanemcmp='define'
+d_sched_yield='undef'
+d_seekdir='undef'
+d_select='define'
+d_sem='define'
+d_semctl='define'
+d_semctl_semid_ds='define'
+d_semget='define'
+d_semop='define'
+d_setegid='define'
+d_seteuid='define'
+d_setgrent='undef'
+d_setgrps='undef'
+d_setlinebuf='undef'
+d_setlocale='define'
+d_setpgid='define'
+d_setpgrp='define'
+d_setpgrp2='undef'
+d_setprior='undef'
+d_setpwent='undef'
+d_setregid='undef'
+d_setresgid='undef'
+d_setresuid='undef'
+d_setreuid='undef'
+d_setrgid='undef'
+d_setruid='undef'
+d_setsid='define'
+d_sfio='undef'
+d_shm='define'
+d_shmat='define'
+d_shmatprototype='define'
+d_shmctl='define'
+d_shmdt='define'
+d_shmget='define'
+d_sigaction='define'
+d_sigsetjmp='define'
+d_socket='define'
+d_sockpair='undef'
+d_statblks='undef'
+d_stdio_cnt_lval='undef'
+d_stdio_ptr_lval='undef'
+d_stdiobase='undef'
+d_stdstdio='undef'
+d_strchr='define'
+d_strcoll='define'
+d_strctcpy='undef'
+d_strerrm='strerror(e)'
+d_strerror='define'
+d_strtod='define'
+d_strtol='define'
+d_strtoul='define'
+d_strxfrm='define'
+d_suidsafe='undef'
+d_symlink='define'
+d_syscall='undef'
+d_sysconf='define'
+d_sysernlst="n"
+d_syserrlst='undef'
+d_system='define'
+d_tcgetpgrp='define'
+d_tcsetpgrp='define'
+d_telldir='undef'
+d_time='define'
+d_times='define'
+d_truncate='define'
+d_tzname='define'
+d_umask='define'
+d_uname='define'
+d_union_semun='undef'
+d_vfork='define'
+d_void_closedir='undef'
+d_voidsig='define'
+d_voidtty="n"
+d_volatile='define'
+d_vprintf='define'
+d_waitpid='define'
+d_wait4='undef'
+d_wcstombs='define'
+d_wctomb='define'
+d_xenix='undef'
+db_hashtype='u_int32_t'
+db_prefixtype='size_t'
+direntrytype='struct dirent'
+dlext='none'
+dlsrc='dl_vmesa.xs'
+dynamic_ext=''
+eagain='EAGAIN'
+ebcdic='define'
+exe_ext=''
+extensions='Fcntl GDBM_File IO NDBM_File Opcode POSIX Socket IPC/SysV Errno Thread attrs re Data/dumper'
+fpostype='fpos_t'
+freetype='void'
+groupstype='gid_t'
+h_fcntl='false'
+h_sysfile='true'
+hint='recommended'
+i_arpainet="define"
+i_bsdioctl="n"
+i_db='undef'
+i_dbm='define'
+i_dirent='define'
+i_dld='define'
+i_dlfcn='define'
+i_fcntl='undef'
+i_float='define'
+i_gdbm='define'
+i_grp='define'
+i_limits='define'
+i_locale='define'
+i_malloc='undef'
+i_math='define'
+i_memory='define'
+i_ndbm='define'
+i_neterrno='undef'
+i_niin='define'
+i_pwd='define'
+i_rpcsvcdbm='undef'
+i_sfio='undef'
+i_sgtty='undef'
+i_stdarg='define'
+i_stddef='define'
+i_stdlib='define'
+i_string='define'
+i_sysdir='define'
+i_sysfile='define'
+i_sysfilio='undef'
+i_sysin='undef'
+i_sysioctl='define'
+i_sysndir='undef'
+i_sysparam='undef'
+i_sysresrc='define'
+i_sysselct='undef'
+i_syssockio="n"
+i_sysstat='define'
+i_systime='define'
+i_systimek='undef'
+i_systimes='define'
+i_systypes='define'
+i_sysun='define'
+i_syswait='define'
+i_termio='undef'
+i_termios='define'
+i_time='undef'
+i_unistd='define'
+i_utime='define'
+i_values='undef'
+i_varargs='undef'
+i_varhdr='stdarg.h'
+i_vfork='undef'
+ld='c89'
+ldflags='-L/usr/local/lib -L.'
+lib_ext='.a'
+libc=''
+libperl='libperl.a'
+libpth='/usr/local/lib /lib /usr/lib'
+libs='-l//posxsock -l//vmmtlib -lgdbm -lxpg4'
+libswanted='gdbm'
+lint="n"
+locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include'
+loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib'
+make_set_make='#'
+make='gnumake'
+mallocobj=''
+mallocsrc=''
+malloctype='void *'
+models='none'
+netdb_hlen_type='size_t'
+netdb_host_type='char *'
+netdb_name_type='const char *'
+netdb_net_type='in_addr_t'
+o_nonblock='O_NONBLOCK'
+obj_ext='.o'
+optimize='undef'
+prefix='/usr/local'
+prefixexp='/usr/local'
+prototype='define'
+ranlib=':'
+rd_nodata='-1'
+scriptdir='/usr/local/bin'
+scriptdirexp='/usr/local/bin'
+selecttype='fd_set *'
+shmattype='void *'
+shrpenv=''
+signal_t='void'
+sig_name_init='"ZERO","HUP","INT","ABRT","ILL","POLL","URG","STOP","FPE","KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","USR1","USR2","NUM18","CONT","CHLD","TTIN","TTOU","IO","QUIT","TSTP","TRAP","NUM27","WINCH","XCPU","XFSZ","VTALRM","PROF","NUM33","NUM34","NUM35","NUM36","NUM3","NUM38","NUM39","NUM40","NUM41","NUM42","NUM43","NUM44","NUM45","NUM46","NUM47","NUM48","NUM49","CLD"'
+sig_num='0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,20 '
+sizetype='size_t'
+so='.a'
+ssizetype='ssize_t'
+static_ext='Data/Dumper Fcntl GDBM_File IO IPC/SysV NDBM_File Opcode POSIX Socket Thread attrs re'
+stdchar='char'
+stdio_cnt='(fp)->__countIn'
+stdio_ptr='(fp)->__bufPtr'
+timeincl='sys/time.h '
+timetype='time_t'
+uidtype='uid_t'
+usedl='define'
+usemymalloc='n'
+usenm='false'
+useopcode='true'
+useperlio='undef'
+useposix='true'
+usesfio='false'
+useshrplib='false'
+usethreads='y'
+usevfork='true'
+vi='x'
--- /dev/null
+/************************************************************/
+/* */
+/* Module ID - vmesa.c */
+/* */
+/* Function - Provide operating system dependent process- */
+/* ing for perl under VM/ESA. */
+/* */
+/* Parameters - See individual entry points. */
+/* */
+/* Called By - N/A - see individual entry points. */
+/* */
+/* Calling To - N/A - see individual entry points. */
+/* */
+/* Notes - (1) ....................................... */
+/* */
+/* (2) ....................................... */
+/* */
+/* Name - Neale Ferguson. */
+/* */
+/* Date - August, 1998. */
+/* */
+/* */
+/* Associated - (1) Refer To ........................... */
+/* Documentation */
+/* (2) Refer To ........................... */
+/* */
+/************************************************************/
+/************************************************************/
+/* */
+/* MODULE MAINTENANCE HISTORY */
+/* -------------------------- */
+/* */
+static char REQ_REL_WHO [13] =
+/*-------------- -------------------------------------*/
+ "9999_99 NAF "; /* Original module */
+/* */
+/*============ End of Module Maintenance History ===========*/
+
+/************************************************************/
+/* */
+/* DEFINES */
+/* ------- */
+/* */
+/************************************************************/
+
+#define FAIL 65280
+
+/*=============== END OF DEFINES ===========================*/
+
+/************************************************************/
+/* */
+/* INCLUDE STATEMENTS */
+/* ------------------ */
+/* */
+/************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <spawn.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <dll.h>
+#include "EXTERN.h"
+#include "perl.h"
+#pragma map(truncate, "@@TRUNC")
+
+/*================== End of Include Statements =============*/
+
+/************************************************************/
+/* */
+/* Global Variables */
+/* ---------------- */
+/* */
+/************************************************************/
+
+static int Perl_stdin_fd = STDIN_FILENO,
+ Perl_stdout_fd = STDOUT_FILENO;
+
+static long dl_retcode = 0;
+
+/*================== End of Global Variables ===============*/
+
+/************************************************************/
+/* */
+/* FUNCTION PROTOTYPES */
+/* ------------------- */
+/* */
+/************************************************************/
+
+int do_aspawn(SV *, SV **, SV **);
+int do_spawn(char *, int);
+static int spawnit(char *);
+static pid_t spawn_cmd(char *, int, int);
+struct perl_thread * getTHR(void);
+
+/*================== End of Prototypes =====================*/
+
+/************************************************************/
+/* */
+/* D O _ A S P A W N */
+/* ----------------- */
+/* */
+/************************************************************/
+
+int
+do_aspawn(SV* really, SV **mark, SV **sp)
+{
+ char **a,
+ *tmps;
+ struct inheritance inherit;
+ pid_t pid;
+ int status,
+ fd,
+ nFd,
+ fdMap[3];
+ SV *sv,
+ **p_sv;
+
+ status = FAIL;
+ if (sp > mark)
+ {
+ dTHR;
+ New(401,PL_Argv, sp - mark + 1, char*);
+ a = PL_Argv;
+ while (++mark <= sp)
+ {
+ if (*mark)
+ *a++ = SvPVx(*mark, na);
+ else
+ *a++ = "";
+ }
+ inherit.flags = SPAWN_SETGROUP;
+ inherit.pgroup = SPAWN_NEWPGROUP;
+ fdMap[STDIN_FILENO] = Perl_stdin_fd;
+ fdMap[STDOUT_FILENO] = Perl_stdout_fd;
+ fdMap[STDERR_FILENO] = STDERR_FILENO;
+ nFd = 3;
+ *a = Nullch;
+ /*-----------------------------------------------------*/
+ /* Will execvp() use PATH? */
+ /*-----------------------------------------------------*/
+ if (*PL_Argv[0] != '/')
+ TAINT_ENV();
+ if (really && *(tmps = SvPV(really, na)))
+ pid = spawnp(tmps, nFd, fdMap, &inherit,
+ (const char **) PL_Argv,
+ (const char **) environ);
+ else
+ pid = spawnp(PL_Argv[0], nFd, fdMap, &inherit,
+ (const char **) PL_Argv,
+ (const char **) environ);
+ if (pid < 0)
+ {
+ status = FAIL;
+ if (ckWARN(WARN_EXEC))
+ warner(WARN_EXEC,"Can't exec \"%s\": %s",
+ PL_Argv[0],
+ Strerror(errno));
+ }
+ else
+ {
+ /*------------------------------------------------*/
+ /* If the file descriptors have been remapped then*/
+ /* we've been called following a my_popen request */
+ /* therefore we don't want to wait for spawnned */
+ /* program to complete. We need to set the fdpid */
+ /* value to the value of the spawnned process' pid*/
+ /*------------------------------------------------*/
+ fd = 0;
+ if (Perl_stdin_fd != STDIN_FILENO)
+ fd = Perl_stdin_fd;
+ else
+ if (Perl_stdout_fd != STDOUT_FILENO)
+ fd = Perl_stdout_fd;
+ if (fd != 0)
+ {
+ /*---------------------------------------------*/
+ /* Get the fd of the other end of the pipe, */
+ /* use this to reference the fdpid which will */
+ /* be used by my_pclose */
+ /*---------------------------------------------*/
+ close(fd);
+ p_sv = av_fetch(PL_fdpid,fd,TRUE);
+ fd = (int) SvIVX(*p_sv);
+ SvREFCNT_dec(*p_sv);
+ *p_sv = &PL_sv_undef;
+ sv = *av_fetch(PL_fdpid,fd,TRUE);
+ (void) SvUPGRADE(sv, SVt_IV);
+ SvIVX(sv) = pid;
+ status = 0;
+ }
+ else
+ wait4pid(pid, &status, 0);
+ }
+ do_execfree();
+ }
+ return (status);
+}
+
+/*===================== End of do_aspawn ===================*/
+
+/************************************************************/
+/* */
+/* D O _ S P A W N */
+/* --------------- */
+/* */
+/************************************************************/
+
+int
+do_spawn(char *cmd, int execf)
+{
+ char **a,
+ *s,
+ flags[10];
+ int status,
+ nFd,
+ fdMap[3];
+ struct inheritance inherit;
+ pid_t pid;
+
+ while (*cmd && isSPACE(*cmd))
+ cmd++;
+
+ /*------------------------------------------------------*/
+ /* See if there are shell metacharacters in it */
+ /*------------------------------------------------------*/
+
+ if (*cmd == '.' && isSPACE(cmd[1]))
+ return (spawnit(cmd));
+ else
+ {
+ if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4]))
+ return (spawnit(cmd));
+ else
+ {
+ /*------------------------------------------------*/
+ /* Catch VAR=val gizmo */
+ /*------------------------------------------------*/
+ for (s = cmd; *s && isALPHA(*s); s++);
+ if (*s != '=')
+ {
+ for (s = cmd; *s; s++)
+ {
+ if (*s != ' ' &&
+ !isALPHA(*s) &&
+ strchr("$&*(){}[]'\";\\|?<>~`\n",*s))
+ {
+ if (*s == '\n' && !s[1])
+ {
+ *s = '\0';
+ break;
+ }
+ return(spawnit(cmd));
+ }
+ }
+ }
+ }
+ }
+
+ New(402,PL_Argv, (s - cmd) / 2 + 2, char*);
+ PL_Cmd = savepvn(cmd, s-cmd);
+ a = PL_Argv;
+ for (s = PL_Cmd; *s;)
+ {
+ while (*s && isSPACE(*s)) s++;
+ if (*s)
+ *(a++) = s;
+ while (*s && !isSPACE(*s)) s++;
+ if (*s)
+ *s++ = '\0';
+ }
+ *a = Nullch;
+ fdMap[STDIN_FILENO] = Perl_stdin_fd;
+ fdMap[STDOUT_FILENO] = Perl_stdout_fd;
+ fdMap[STDERR_FILENO] = STDERR_FILENO;
+ nFd = 3;
+ inherit.flags = 0;
+ if (PL_Argv[0])
+ {
+ pid = spawnp(PL_Argv[0], nFd, fdMap, &inherit,
+ (const char **) PL_Argv,
+ (const char **) environ);
+ if (pid < 0)
+ {
+ dTHR;
+ status = FAIL;
+ if (ckWARN(WARN_EXEC))
+ warner(WARN_EXEC,"Can't exec \"%s\": %s",
+ PL_Argv[0],
+ Strerror(errno));
+ }
+ else
+ wait4pid(pid, &status, 0);
+ }
+ do_execfree();
+ return (status);
+}
+
+/*===================== End of do_spawn ====================*/
+
+/************************************************************/
+/* */
+/* Name - spawnit. */
+/* */
+/* Function - Spawn command and return status. */
+/* */
+/* On Entry - cmd - command to be spawned. */
+/* */
+/* On Exit - status returned. */
+/* */
+/************************************************************/
+
+int
+spawnit(char *cmd)
+{
+ pid_t pid;
+ int status;
+
+ pid = spawn_cmd(cmd, STDIN_FILENO, STDOUT_FILENO);
+ if (pid < 0)
+ status = FAIL;
+ else
+ wait4pid(pid, &status, 0);
+
+ return (status);
+}
+
+/*===================== End of spawnit =====================*/
+
+/************************************************************/
+/* */
+/* Name - spawn_cmd. */
+/* */
+/* Function - Spawn command and return pid. */
+/* */
+/* On Entry - cmd - command to be spawned. */
+/* */
+/* On Exit - pid returned. */
+/* */
+/************************************************************/
+
+pid_t
+spawn_cmd(char *cmd, int inFd, int outFd)
+{
+ struct inheritance inherit;
+ pid_t pid;
+ const char *argV[4] = {"/bin/sh","-c",NULL,NULL};
+ int nFd,
+ fdMap[3];
+
+ argV[2] = cmd;
+ fdMap[STDIN_FILENO] = inFd;
+ fdMap[STDOUT_FILENO] = outFd;
+ fdMap[STDERR_FILENO] = STDERR_FILENO;
+ nFd = 3;
+ inherit.flags = SPAWN_SETGROUP;
+ inherit.pgroup = SPAWN_NEWPGROUP;
+ pid = spawn(argV[0], nFd, fdMap, &inherit,
+ argV, (const char **) environ);
+ return (pid);
+}
+
+/*===================== End of spawnit =====================*/
+
+/************************************************************/
+/* */
+/* Name - my_popen. */
+/* */
+/* Function - Use popen to execute a command return a */
+/* file descriptor. */
+/* */
+/* On Entry - cmd - command to be executed. */
+/* */
+/* On Exit - FILE * returned. */
+/* */
+/************************************************************/
+
+#include <ctest.h>
+PerlIO *
+my_popen(char *cmd, char *mode)
+{
+ FILE *fd;
+ int pFd[2],
+ this,
+ that,
+ pid;
+ SV *sv;
+
+ if (PerlProc_pipe(pFd) >= 0)
+ {
+ this = (*mode == 'w');
+ that = !this;
+ /*-------------------------------------------------*/
+ /* If this is a read mode pipe */
+ /* - map the write end of the pipe to STDOUT */
+ /* - return the *FILE for the read end of the pipe */
+ /*-------------------------------------------------*/
+ if (!this)
+ Perl_stdout_fd = pFd[that];
+ /*-------------------------------------------------*/
+ /* Else */
+ /* - map the read end of the pipe to STDIN */
+ /* - return the *FILE for the write end of the pipe*/
+ /*-------------------------------------------------*/
+ else
+ Perl_stdin_fd = pFd[that];
+ if (strNE(cmd,"-"))
+ {
+ pid = spawn_cmd(cmd, Perl_stdin_fd, Perl_stdout_fd);
+ if (pid >= 0)
+ {
+ sv = *av_fetch(PL_fdpid,pFd[this],TRUE);
+ (void) SvUPGRADE(sv, SVt_IV);
+ SvIVX(sv) = pid;
+ fd = PerlIO_fdopen(pFd[this], mode);
+ close(pFd[that]);
+ }
+ else
+ fd = Nullfp;
+ }
+ else
+ {
+ sv = *av_fetch(PL_fdpid,pFd[that],TRUE);
+ (void) SvUPGRADE(sv, SVt_IV);
+ SvIVX(sv) = pFd[this];
+ fd = PerlIO_fdopen(pFd[this], mode);
+ }
+ }
+ else
+ fd = Nullfp;
+ return (fd);
+}
+
+/*===================== End of my_popen ====================*/
+
+/************************************************************/
+/* */
+/* Name - my_pclose. */
+/* */
+/* Function - Use pclose to terminate a piped command */
+/* file stream. */
+/* */
+/* On Entry - fd - FILE pointer. */
+/* */
+/* On Exit - Status returned. */
+/* */
+/************************************************************/
+
+long
+my_pclose(FILE *fp)
+{
+ int pid,
+ saveErrno,
+ status;
+ long rc,
+ wRc;
+ SV **sv;
+ FILE *other;
+
+ sv = av_fetch(PL_fdpid,PerlIO_fileno(fp),TRUE);
+ pid = (int) SvIVX(*sv);
+ SvREFCNT_dec(*sv);
+ *sv = &PL_sv_undef;
+ rc = PerlIO_close(fp);
+ saveErrno = errno;
+ do
+ {
+ wRc = waitpid(pid, &status, 0);
+ } while ((wRc == -1) && (errno == EINTR));
+ Perl_stdin_fd = STDIN_FILENO;
+ Perl_stdout_fd = STDOUT_FILENO;
+ errno = saveErrno;
+ if (rc != 0)
+ SETERRNO(errno, garbage);
+ return (rc);
+
+}
+
+/*===================== End of my_pclose ===================*/
+
+/************************************************************/
+/* */
+/* Name - getTHR. */
+/* */
+/* Function - Use pclose to terminate a piped command */
+/* file stream. */
+/* */
+/* On Exit - Thread specific data returned. */
+/* */
+/************************************************************/
+
+struct perl_thread *
+getTHR()
+{
+ int status;
+ struct perl_thread *pThread;
+
+ status = pthread_getspecific(PL_thr_key, (void **) &pThread);
+ if (status != 0)
+ pThread = NULL;
+ return (pThread);
+}
+
+/*===================== End of getTHR ======================*/
+
+/************************************************************/
+/* */
+/* Name - dlopen. */
+/* */
+/* Function - Load a DLL. */
+/* */
+/* On Exit - */
+/* */
+/************************************************************/
+
+void *
+dlopen(const char *path)
+{
+ dllhandle *handle;
+
+fprintf(stderr,"Loading %s\n",path);
+ handle = dllload(path);
+ dl_retcode = errno;
+fprintf(stderr,"Handle %08X %s\n",handle,strerror(errno));
+ return ((void *) handle);
+}
+
+/*===================== End of dlopen ======================*/
+
+/************************************************************/
+/* */
+/* Name - dlsym. */
+/* */
+/* Function - Locate a DLL symbol. */
+/* */
+/* On Exit - */
+/* */
+/************************************************************/
+
+void *
+dlsym(void *handle, const char *symbol)
+{
+ void *symLoc;
+
+fprintf(stderr,"Finding %s\n",symbol);
+ symLoc = dllqueryvar((dllhandle *) handle, (char *) symbol);
+ if (symLoc == NULL)
+ symLoc = (void *) dllqueryfn((dllhandle *) handle,
+ (char *) symbol);
+ dl_retcode = errno;
+ return(symLoc);
+}
+
+/*===================== End of dlsym =======================*/
+
+/************************************************************/
+/* */
+/* Name - dlerror. */
+/* */
+/* Function - Return the last errno pertaining to a DLL */
+/* operation. */
+/* */
+/* On Exit - */
+/* */
+/************************************************************/
+
+void *
+dlerror(void)
+{
+ char * dlEmsg;
+
+ dlEmsg = strerror(dl_retcode);
+ dl_retcode = 0;
+ return(dlEmsg);
+}
+
+/*===================== End of dlerror =====================*/
+
+/************************************************************/
+/* */
+/* Name - TRUNCATE. */
+/* */
+/* Function - Truncate a file identified by 'path' to */
+/* a given length. */
+/* */
+/* On Entry - path - Path of file to be truncated. */
+/* length - length of truncated file. */
+/* */
+/* On Exit - retC - return code. */
+/* */
+/************************************************************/
+
+int
+truncate(const unsigned char *path, off_t length)
+{
+ int fd,
+ retC;
+
+ fd = open((const char *) path, O_RDWR);
+ if (fd > 0)
+ {
+ retC = ftruncate(fd, length);
+ close(fd);
+ }
+ else
+ retC = fd;
+ return(retC);
+}
+
+/*===================== End of trunc =======================*/