more work
This commit is contained in:
parent
8bc2f4770d
commit
ae1f366586
|
|
@ -8,14 +8,9 @@ ffltioc.o ffltioc.c C
|
||||||
fltioc.o fltioc.c C
|
fltioc.o fltioc.c C
|
||||||
goodmagic.o goodmagic.c C
|
goodmagic.o goodmagic.c C
|
||||||
length.o length.c C
|
length.o length.c C
|
||||||
mpx.o mpx.c C
|
|
||||||
pow10.o pow10.s ASM
|
pow10.o pow10.s ASM
|
||||||
readsym.o readsym.c C
|
readsym.o readsym.c C
|
||||||
rindex.o rindex.c C
|
|
||||||
setret.o setret.s ASM
|
setret.o setret.s ASM
|
||||||
stfl.o ???
|
stfl.o ???
|
||||||
swap.o swap.c C
|
swap.o swap.c C
|
||||||
symscan.o symscan.c C
|
symscan.o symscan.c C
|
||||||
tmpfile.o tmpfile.c C
|
|
||||||
tolower.o tolower.c C
|
|
||||||
toupper.o toupper.c C
|
|
||||||
|
|
|
||||||
|
|
@ -157,3 +157,8 @@ tmpnam.o tmpnam.c C
|
||||||
ctermid.o ctermid.c C
|
ctermid.o ctermid.c C
|
||||||
cuserid.o cuserid.c C
|
cuserid.o cuserid.c C
|
||||||
index.o index.c C
|
index.o index.c C
|
||||||
|
mpx.o mpx.c C
|
||||||
|
rindex.o rindex.c C
|
||||||
|
tmpfile.o tmpfile.c C
|
||||||
|
tolower.o tolower.c C
|
||||||
|
toupper.o toupper.c C
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
/* @[$] mpx.c 2.1 09/12/83 11:27:38 - 87wega3.2 */
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/tty.h>
|
||||||
|
#include "mx.h"
|
||||||
|
|
||||||
|
static struct mx_args vec;
|
||||||
|
int mpxcall();
|
||||||
|
|
||||||
|
|
||||||
|
mpx(name,mode)
|
||||||
|
char *name;
|
||||||
|
{
|
||||||
|
if (*name) {
|
||||||
|
vec.m_name = name;
|
||||||
|
vec.m_arg[0] = mode;
|
||||||
|
return(mpxcall(MPX, &vec));
|
||||||
|
} else
|
||||||
|
return(mpxcall(MPXN, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
chan(gr)
|
||||||
|
{
|
||||||
|
vec.m_arg[1] = gr;
|
||||||
|
return(mpxcall(CHAN, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
join(fd,ch)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = fd;
|
||||||
|
vec.m_arg[1] = ch;
|
||||||
|
return(mpxcall(JOIN, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(fd,ch,side)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = fd;
|
||||||
|
vec.m_arg[1] = ch;
|
||||||
|
vec.m_arg[2] = side;
|
||||||
|
return(mpxcall(CONNECT, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
attach(sub,gp)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = sub;
|
||||||
|
vec.m_arg[1] = gp;
|
||||||
|
return(mpxcall(ATTACH, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
detach(sub,gp)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = sub;
|
||||||
|
vec.m_arg[1] = gp;
|
||||||
|
return(mpxcall(DETACH, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
extract(sub,ch,side)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = sub;
|
||||||
|
vec.m_arg[1] = ch;
|
||||||
|
vec.m_arg[2] = side;
|
||||||
|
return(mpxcall(EXTR, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
debug(var,val)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = var;
|
||||||
|
vec.m_arg[1] = val;
|
||||||
|
return(mpxcall(DEBUG, &vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
npgrp(ch, gfd, pid)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = ch;
|
||||||
|
vec.m_arg[1] = gfd;
|
||||||
|
vec.m_arg[2] = pid;
|
||||||
|
return(mpxcall(NPGRP, &vec));
|
||||||
|
}
|
||||||
|
ckill(index,gp,sig)
|
||||||
|
{
|
||||||
|
vec.m_arg[0] = index;
|
||||||
|
vec.m_arg[1] = gp;
|
||||||
|
vec.m_arg[2] = sig;
|
||||||
|
return(mpxcall(CSIG, &vec));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
#define NGROUPS 10 /* number of mpx files permitted at one time */
|
||||||
|
#define NCHANS 20 /* number of channel structures */
|
||||||
|
#define NPORTS 30 /* number of channels to i/o ports */
|
||||||
|
#define CNTLSIZ 10
|
||||||
|
#define NLEVELS 4
|
||||||
|
#define NMSIZE 50 /* max size of mxlstn file name */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* header returned on read of mpx
|
||||||
|
*/
|
||||||
|
struct rh {
|
||||||
|
short index;
|
||||||
|
short count;
|
||||||
|
short ccount;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* head expected on write of mpx
|
||||||
|
*/
|
||||||
|
struct wh {
|
||||||
|
short index;
|
||||||
|
short count;
|
||||||
|
short ccount;
|
||||||
|
char *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mx_args {
|
||||||
|
char *m_name;
|
||||||
|
int m_cmd;
|
||||||
|
int m_arg[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef KERNEL
|
||||||
|
/*
|
||||||
|
* internal structure for channel
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct chan {
|
||||||
|
short c_flags;
|
||||||
|
char c_index;
|
||||||
|
char c_line;
|
||||||
|
struct group *c_group;
|
||||||
|
struct file *c_fy;
|
||||||
|
struct tty *c_ttyp;
|
||||||
|
struct clist c_ctlx;
|
||||||
|
int c_pgrp;
|
||||||
|
struct tty *c_ottyp;
|
||||||
|
char c_oline;
|
||||||
|
union {
|
||||||
|
struct clist datq;
|
||||||
|
} cx;
|
||||||
|
union {
|
||||||
|
struct clist datq;
|
||||||
|
struct chan *c_chan;
|
||||||
|
} cy;
|
||||||
|
struct clist c_ctly;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct schan {
|
||||||
|
short c_flags;
|
||||||
|
char c_index;
|
||||||
|
char c_line;
|
||||||
|
struct group *c_group;
|
||||||
|
struct file *c_fy;
|
||||||
|
struct tty *c_ttyp;
|
||||||
|
struct clist c_ctlx;
|
||||||
|
int c_pgrp;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* flags
|
||||||
|
*/
|
||||||
|
#define INUSE 01
|
||||||
|
#define COPEN 02
|
||||||
|
#define XGRP 04
|
||||||
|
#define YGRP 010
|
||||||
|
#define WCLOSE 020
|
||||||
|
#define ISGRP 0100
|
||||||
|
#define BLOCK 0200
|
||||||
|
#define EOTMARK 0400
|
||||||
|
#define SIGBLK 01000
|
||||||
|
#define BLKMSG 01000
|
||||||
|
#define ENAMSG 02000
|
||||||
|
#define WFLUSH 04000
|
||||||
|
#define NMBUF 010000
|
||||||
|
#define PORT 020000
|
||||||
|
#define ALT 040000
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mpxchan command codes
|
||||||
|
*/
|
||||||
|
#define MPX 5
|
||||||
|
#define MPXN 6
|
||||||
|
#define CHAN 1
|
||||||
|
#define JOIN 2
|
||||||
|
#define EXTR 3
|
||||||
|
#define ATTACH 4
|
||||||
|
#define CONNECT 7
|
||||||
|
#define DETACH 8
|
||||||
|
#define DISCON 9
|
||||||
|
#define DEBUG 10
|
||||||
|
#define NPGRP 11
|
||||||
|
#define CSIG 12
|
||||||
|
#define PACK 13
|
||||||
|
|
||||||
|
#define NDEBUGS 30
|
||||||
|
/*
|
||||||
|
* control channel message codes
|
||||||
|
*/
|
||||||
|
#define M_WATCH 1
|
||||||
|
#define M_CLOSE 2
|
||||||
|
#define M_EOT 3
|
||||||
|
#define M_OPEN 4
|
||||||
|
#define M_BLK 5
|
||||||
|
#define M_UBLK 6
|
||||||
|
#define DO_BLK 7
|
||||||
|
#define DO_UBLK 8
|
||||||
|
#define M_IOCTL 12
|
||||||
|
#define M_SIG 14
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* debug codes other than mpxchan cmds
|
||||||
|
*/
|
||||||
|
#define MCCLOSE 29
|
||||||
|
#define MCOPEN 28
|
||||||
|
#define ALL 27
|
||||||
|
#define SCON 26
|
||||||
|
#define MSREAD 25
|
||||||
|
#define SDATA 24
|
||||||
|
#define MCREAD 23
|
||||||
|
#define MCWRITE 22
|
||||||
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* @[$] rindex.c 2.1 09/12/83 11:30:12 - 87wega3.2 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the ptr in sp at which the character c last
|
||||||
|
* appears; NULL if not found
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NULL 0
|
||||||
|
|
||||||
|
char *
|
||||||
|
rindex(sp, c)
|
||||||
|
register char *sp, c;
|
||||||
|
{
|
||||||
|
register char *r;
|
||||||
|
|
||||||
|
r = NULL;
|
||||||
|
do {
|
||||||
|
if (*sp == c)
|
||||||
|
r = sp;
|
||||||
|
} while (*sp++);
|
||||||
|
return(r);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* @[$] tolower.c 2.1 09/12/83 11:37:39 - 87wega3.2 */
|
||||||
|
|
||||||
|
/*LINTLIBRARY*/
|
||||||
|
|
||||||
|
tolower(c)
|
||||||
|
register int c;
|
||||||
|
{
|
||||||
|
if(c >= 'A' && c <= 'Z')
|
||||||
|
c -= 'A' - 'a';
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* @[$] toupper.c 2.1 09/12/83 11:37:53 - 87wega3.2 */
|
||||||
|
|
||||||
|
/*LINTLIBRARY*/
|
||||||
|
|
||||||
|
toupper(c)
|
||||||
|
register int c;
|
||||||
|
{
|
||||||
|
if(c >= 'a' && c <= 'z')
|
||||||
|
c += 'A' - 'a';
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* @[$] tmpfile.c 2.1 09/12/83 11:18:07 - 87wega3.2 */
|
||||||
|
|
||||||
|
/*LINTLIBRARY*/
|
||||||
|
/*
|
||||||
|
* tmpfile - return a pointer to an update file that can be
|
||||||
|
* used for scratch. The file will automatically
|
||||||
|
* go away if the program using it terminates.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
FILE *
|
||||||
|
tmpfile()
|
||||||
|
{
|
||||||
|
char tfname [L_tmpnam];
|
||||||
|
register FILE *p;
|
||||||
|
|
||||||
|
tmpnam (tfname);
|
||||||
|
p = fopen (tfname, "w+");
|
||||||
|
unlink (tfname);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue