1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-15 14:27:19 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Nick Briggs
987cf4c7c6 Correct error for missing byteswap macros in tosfns.h EVAL implementation (#407)
Commit c46fcce307 fixed a warning for
incompatible pointers to nnewframe() but did not consider that the
order of the DLwords is swapped depending on the endianness of the
system it is running on.  Add the necessary GETBASEWORD() macros to
access the items when constructing the pointer.
2021-11-06 18:36:25 -07:00
Nick Briggs
c46fcce307 Fix "warning: incompatible pointer types" in EVAL implementation (#406)
nnewframe() as called from the EVAL implementation expects to be passed
the address of an array of two DLwords.  Do that, and compose the 32-bit
result correctly rather than passing the address of a (32-bit) LispPTR
and then having to swapx() that result to get the expected value.
2021-11-04 20:18:27 -07:00
Nick Briggs
de5ea2110f Correct integer type warnings (#405)
* Correct warning: cast to smaller integer type -- X_init/lispbitmap

* Fixes to INTRSAFE, INTRSAFE0 and ensure TIMEOUT, TIMEOUT0 used appropriately

INTRSAFE and INTRSAFE0 must clear errno before executing the library or system
call because not all library calls set errno on success.
Avoid casting pointers or larger integer values down to smaller ints before
comparing to 0 or -1, and use NULL (a pointer) rather than 0.

Fix cases where the result of the library call is a pointer rather than an int
to use TIMEOUT0 instead of TIMEOUT, testing for NULL rather than -1
on timeout (errno == EINTR)

* Remove useless validity check of LASTVMEMFILEPAGE_word pointer

* Convert pointer arithmetic type in drawline from int to ptrdiff_t

* Add NOTE warning about a 32-bit vs 64-bit issue affecting currently unused GET_NATIVE_ADDR_FROM_LISP_PTR
2021-11-04 09:08:55 -07:00
Nick Briggs
6c241f1eaa Make opcode_table (names of opcodes) visible as useful debug aid. 2021-10-29 10:02:47 -07:00
Nick Briggs
19688bc314 Drop setuid privilege correctly. (#401) 2021-10-29 09:52:51 -07:00
Nick Briggs
c39b751f42 Rework make_atom() to allow removal of parse_number() (#404)
No calls to make_atom() depend on the ability to parse the atom's
pname as a number.  Additionally, the parse_number() implementation
used here was non-functional.

We remove parse_number() and adjust the parameter list of make_atom()
to remove the non_numericp flag.
2021-10-29 09:51:32 -07:00
Nick Briggs
75c668f1cd The pointers Atomspace, Spospspace, Snegspace, Arrayspace can be removed (#402)
These pointers are neither initialized nor referenced anywhere in the code.
2021-10-10 16:55:33 -07:00
Nick Briggs
a25368714f Use SHELL rather than /bin/csh when forking shells. Issue Interlisp/medley#384 (#400)
As long as $(SHELL) names an executable that appears in /etc/shells (as determined
by the getusershell() function) use that.  It used to always use /bin/csh, but some
modern distros do not ship with csh installed.  Using the user's preferred shell
seems like a better choice, while allowing the choice from /etc/shells gives some
additional flexibility.
2021-10-08 17:58:29 -07:00
22 changed files with 136 additions and 217 deletions

View File

@@ -31,7 +31,6 @@
#include "lispemul.h" /* for LispPTR, DLword */
#include "miscstat.h" /* for MISCSTAT */
extern DLword *Atomspace; /* ATOMSPACE */
extern DLword *Stackspace; /* STACKSPACE*/
extern DLword *Plistspace; /* PLISTSPACE */
extern DLword *DTDspace; /* DTDSPACE */
@@ -41,8 +40,6 @@
extern DLword *AtomSpace; /* New atoms, initial set */
extern DLword *Defspace; /* DEFSPACE */
extern DLword *Valspace; /* VALSPACE */
extern DLword *Spospspace; /* POSITIVE Smallp */
extern DLword *Snegspace; /* NEGATIVE Smallp */
/* For Virtual Mem Management */
#ifdef BIGVM
@@ -82,7 +79,6 @@ extern DLword *UFNTable ;
/* FLEX STORAGES */
extern DLword *Arrayspace; /* Start of ARRAYSPACE */
extern DLword *MDS_space_bottom; /* Start of MDS (pre -2) */
extern DLword *PnCharspace ; /* Space for PN char codes (Thin only) */

View File

@@ -5,6 +5,5 @@ DLword compute_hash(const char *char_base, DLword offset, DLword length);
DLword compute_lisp_hash(const char *char_base, DLword offset, DLword length, DLword fatp);
LispPTR compare_chars(register const char *char1, register const char *char2, register DLword length);
LispPTR compare_lisp_chars(register const char *char1, register const char *char2, register DLword length, DLword fat1, DLword fat2);
LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int non_numericp);
LispPTR parse_number(const char *char_base, short int length);
LispPTR make_atom(const char *char_base, DLword offset, DLword length);
#endif

View File

@@ -61,8 +61,8 @@ extern int TIMEOUT_TIME;
/************************************************************************/
#define INTRSAFE(exp) \
do {} while ((int)(exp) == -1 && errno == EINTR)
do {errno = 0; } while ((exp) == -1 && errno == EINTR)
#define INTRSAFE0(exp) \
do {} while ((int)(exp) == 0 && errno == EINTR)
do {errno = 0; } while ((exp) == NULL && errno == EINTR)
#endif /* TIMEOUT_H */

View File

@@ -513,7 +513,8 @@
#ifndef BIGATOMS
#define EVAL \
do { \
LispPTR scratch, work, lookuped; \
LispPTR work, lookuped; \
DLword scratch[2]; \
switch (TOPOFSTACK & SEGMASK) { \
case S_POSITIVE: \
case S_NEGATIVE: \
@@ -521,8 +522,8 @@
case ATOM_OFFSET: \
if ((TOPOFSTACK == NIL_PTR) || (TOPOFSTACK == ATOM_T)) \
goto Hack_Label; \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & swapx(scratch); \
nnewframe(CURRENTFX, scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
if (lookuped == NOBIND_PTR) \
goto op_ufn; \
@@ -552,7 +553,8 @@
#else
#define EVAL \
do { \
LispPTR scratch, work, lookuped; \
LispPTR work, lookuped; \
DLword scratch[2]; \
switch (TOPOFSTACK & SEGMASK) { \
case S_POSITIVE: \
case S_NEGATIVE: \
@@ -560,8 +562,8 @@
case ATOM_OFFSET: \
if ((TOPOFSTACK == NIL_PTR) || (TOPOFSTACK == ATOM_T)) \
goto Hack_Label; \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & swapx(scratch); \
nnewframe(CURRENTFX, scratch, TOPOFSTACK & 0xffff); \
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
if (lookuped == NOBIND_PTR) \
goto op_ufn; \
@@ -584,8 +586,8 @@
fn_apply = 0; \
goto op_fn_common; \
case TYPE_NEWATOM: \
nnewframe(CURRENTFX, &scratch, TOPOFSTACK); \
work = POINTERMASK & swapx(scratch); \
nnewframe(CURRENTFX, scratch, TOPOFSTACK); \
work = POINTERMASK & ((GETBASEWORD(scratch,1) << 16) | GETBASEWORD(scratch,0)); \
lookuped = *((LispPTR *)(Addr68k_from_LADDR(work))); \
if (lookuped == NOBIND_PTR) \
goto op_ufn; \

View File

@@ -6,5 +6,5 @@ void lisp_Xexit(DspInterface dsp);
void Xevent_before_raid(DspInterface dsp);
void Xevent_after_raid(DspInterface dsp);
void Open_Display(DspInterface dsp);
DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint, int depth_hint);
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int height_hint, int depth_hint);
#endif

View File

@@ -691,7 +691,7 @@ static int enum_dsk_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
nextp->prop->wdate = (unsigned)ToLispTime(sbuf.st_mtime);
nextp->prop->rdate = (unsigned)ToLispTime(sbuf.st_atime);
nextp->prop->protect = (unsigned)sbuf.st_mode;
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
nextp->prop->au_len = 0;
} else {
@@ -1080,7 +1080,7 @@ static int enum_ufs_prop(char *dir, char *name, char *ver, FINFO **finfo_buf)
char namebuf[MAXPATHLEN];
errno = 0;
TIMEOUT(dirp = opendir(dir));
TIMEOUT0(dirp = opendir(dir));
if (dirp == NULL) {
*Lisp_errno = errno;
return (-1);
@@ -1263,7 +1263,7 @@ static int enum_ufs(char *dir, char *name, char *ver, FINFO **finfo_buf)
char namebuf[MAXPATHLEN];
errno = 0;
TIMEOUT(dirp = opendir(dir));
TIMEOUT0(dirp = opendir(dir));
if (dirp == NULL) {
*Lisp_errno = errno;
return (-1);

View File

@@ -17,10 +17,10 @@
#include "version.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "lispemul.h"
#include "lspglob.h"
#include "lispmap.h"
@@ -268,21 +268,21 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
#endif /* COLOR */
{
DLword *start_addr, *temp_s, *temp_e;
DLword *start_addr;
start_addr = (DLword *)Addr68k_from_LADDR(ptr);
if (((int)(temp_s = (DLword *)(start_addr - DisplayRegion68k)) >= 0) &&
(start_addr < DisplayRegion68k_end_addr) &&
((int)(temp_e = (DLword *)(dataptr - DisplayRegion68k)) >= 0) &&
((DLword *)dataptr < DisplayRegion68k_end_addr)) {
if (in_display_segment(start_addr) && in_display_segment(dataptr)) {
int start_x, start_y, end_x, end_y, w, h;
ptrdiff_t temp_s, temp_e;
start_y = (int)temp_s / DisplayRasterWidth;
start_x = ((int)temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
temp_s = start_addr - DisplayRegion68k;
temp_e = dataptr - DisplayRegion68k;
end_y = (int)temp_e / DisplayRasterWidth;
end_x = ((int)temp_e % DisplayRasterWidth) * BITSPER_DLWORD + (BITSPER_DLWORD - 1);
start_y = temp_s / DisplayRasterWidth;
start_x = (temp_s % DisplayRasterWidth) * BITSPER_DLWORD;
end_y = temp_e / DisplayRasterWidth;
end_x = (temp_e % DisplayRasterWidth) * BITSPER_DLWORD + (BITSPER_DLWORD - 1);
w = abs(start_x - end_x) + 1;
h = abs(start_y - end_y) + 1;
@@ -290,10 +290,8 @@ int N_OP_drawline(LispPTR ptr, int curbit, int xsize, int width, int ysize, int
if (start_x > end_x) start_x = end_x;
if (start_y > end_y) start_y = end_y;
#if defined(XWINDOW) || defined(BYTESWAP)
flush_display_region(start_x, start_y, w, h);
#endif /* XWINDOW */
}
}

View File

@@ -1702,7 +1702,7 @@ LispPTR COM_getfileinfo(register LispPTR *args)
case AUTHOR: {
size_t rval;
#ifndef DOS
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
/*
* Returns Lisp 0. Lisp code handles this case as author
@@ -1748,7 +1748,7 @@ LispPTR COM_getfileinfo(register LispPTR *args)
bufp = (unsigned *)(Addr68k_from_LADDR(laddr));
*bufp = sbuf.st_mode;
#ifndef DOS
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
TIMEOUT0(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) { return (GetSmallp(0)); }
laddr = cdr(car(cdr(cdr(cdr(cdr(args[2]))))));
STRING_BASE(laddr, base);

View File

@@ -27,9 +27,6 @@ DspInterface currentdsp = &curdsp;
#ifdef XWINDOW
extern int LispDisplayRequestedWidth;
extern int LispDisplayRequestedHeight;
extern DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
int depth_hint);
#endif /* XWINDOW */
#ifdef DOS

View File

@@ -742,7 +742,7 @@ static int check_filter(u_char *buffer)
static void init_uid() {
int rid;
rid = getuid();
seteuid(rid);
setuid(rid);
}
#endif /* MAIKO_ENABLE_ETHERNET */
@@ -830,7 +830,7 @@ void init_ether() {
/* JDS 991228 remove perror("Can't open network; XNS unavailable.\n"); */
ether_fd = -1;
}
seteuid(getuid());
setuid(getuid());
}
#elif defined(USE_NIT)
#ifndef OS4
@@ -952,7 +952,7 @@ void init_ether() {
perror("Can't open network; XNS unavailable.\n");
ether_fd = -1;
}
seteuid(getuid());
setuid(getuid());
}
#endif /* OS4 */

View File

@@ -139,8 +139,7 @@ void init_ifpage(int sysout_size) {
#ifdef BIGVM
/* For BIGVM system, save the value in \LASTVMEMFILEPAGE for lisp's use */
if ((LispPTR)LASTVMEMFILEPAGE_word != 0xFFFFFFFF)
*LASTVMEMFILEPAGE_word = InterfacePage->dllastvmempage;
*LASTVMEMFILEPAGE_word = InterfacePage->dllastvmempage;
#endif /* BIGVM */
/* unfortunately, Lisp only looks at a 16 bit serial number */

View File

@@ -214,7 +214,7 @@ int main(int argc, char *argv[]) {
ether_fd = -1;
/* exit(); */
}
seteuid(getuid());
setuid(getuid());
}
/* OK, right here do other stuff like scan args */

View File

@@ -75,7 +75,6 @@
DLword *Lisp_world; /* lispworld */
/********** 68k address for Lisp Space **********/
DLword *Atomspace;
DLword *Stackspace;
DLword *Plistspace;
DLword *DTDspace;
@@ -85,8 +84,6 @@ DLword *Pnamespace;
DLword *AtomSpace;
DLword *Defspace;
DLword *Valspace;
DLword *Spospspace;
DLword *Snegspace;
/********** For Virtual Memory Management **********/
#ifdef BIGVM
@@ -124,7 +121,6 @@ DLword *HTcoll;
DLword *DisplayRegion;
int DisplayInitialized = NIL;
DLword *Arrayspace;
DLword *MDS_space_bottom;
DLword *PnCharspace;
struct dtd *ListpDTD;
@@ -490,9 +486,9 @@ int main(int argc, char *argv[])
probemouse(); /* See if the mouse is connected. */
#else
if (getuid() != geteuid()) {
fprintf(stderr, "Effective user is not real user. Setting euid to uid.\n");
if (seteuid(getuid()) == -1) {
fprintf(stderr, "Unable to reset effective user id to real user id\n");
fprintf(stderr, "Effective user is not real user. Resetting uid\n");
if (setuid(getuid()) == -1) {
fprintf(stderr, "Unable to reset user id to real user id\n");
exit(1);
}
}
@@ -663,7 +659,7 @@ int makepathname(char *src, char *dst)
#ifdef DOS
pwd = 0;
#else
TIMEOUT(pwd = getpwuid(getuid()));
TIMEOUT0(pwd = getpwuid(getuid()));
#endif /* DOS */
if (pwd == NULL) {
*Lisp_errno = errno;
@@ -682,7 +678,7 @@ int makepathname(char *src, char *dst)
strncpy(name, base + 1, len);
name[len] = '\0';
#ifndef DOS
TIMEOUT(pwd = getpwnam(name));
TIMEOUT0(pwd = getpwnam(name));
#endif /* DOS */
if (pwd == NULL) {
*Lisp_errno = errno;

View File

@@ -27,7 +27,6 @@
compute_hash
create_symbol
compare_chars
parse_number
*/
/**********************************************************************/
@@ -248,10 +247,11 @@ LispPTR compare_lisp_chars(register const char *char1, register const char *char
/*
Func name : make_atom
If the atom already existed then return
else create new atom . Returns the Atom's index.
Look up the atom index of an existing atom, or return 0xFFFFFFFF
This function does not handle FAT pname's.
This function is a subset of \MKATOM (in LLBASIC), but only handles
thin text atom names (no numbers, no 2-byte pnames).
It MUST return the same atom index number as \MKATOM
Date : January 29, 1987
Edited by : Takeshi Shimizu
@@ -264,10 +264,8 @@ LispPTR compare_lisp_chars(register const char *char1, register const char *char
*/
/**********************************************************************/
LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int non_numericp)
/* if it is NIL then these chars are treated as NUMBER */
LispPTR make_atom(const char *char_base, DLword offset, DLword length)
{
extern DLword *Spospspace;
extern DLword *AtomHT;
extern DLword *Pnamespace;
extern DLword *AtomSpace;
@@ -282,41 +280,34 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
unsigned short first_char;
#ifdef TRACE2
printf("TRACE: make_atom( %s , offset= %d, len= %d, non_numericp = %d)\n", char_base, offset,
length, non_numericp);
printf("TRACE: make_atom( %s , offset= %d, len= %d)\n", char_base, offset, length);
#endif
first_char = (*(char_base + offset)) & 0xff;
if (length != 0) {
if (length == 1) /* one char. atoms */
{
if (first_char > 57) /* greater than '9 */
return ((LispPTR)(ATOMoffset + (first_char - 10)));
else if (first_char > 47) /* between '0 to '9 */
return ((LispPTR)(S_POSITIVE + (first_char - 48)));
/* fixed S_... mar-27-87 take */
else /* other one char. atoms */
return ((LispPTR)(ATOMoffset + first_char));
} /* if(length==1.. end */
else if ((non_numericp == NIL) && (first_char <= '9'))
/* more than 10 arithmetic aon + - mixed atom process */
{
if ((hash_entry = parse_number(char_base + offset, length)) != 0)
return ((LispPTR)hash_entry); /* if NIL that means THE ATOM is +- mixed litatom */
/* 15 may 87 take */
}
hash = compute_hash(char_base, offset, length);
} /* if(lengt.. end */
else {
switch (length) {
case 0:
/* the zero-length atom has hashcode 0 */
hash = 0;
first_char = 255;
break;
case 1:
/* One-character atoms live in well known places, no need to hash */
if (first_char > '9')
return ((LispPTR)(ATOMoffset + (first_char - 10)));
if (first_char >= '0' ) /* 0..9 */
return ((LispPTR)(S_POSITIVE + (first_char - '0')));
/* other one character atoms */
return ((LispPTR)(ATOMoffset + first_char));
default:
hash = compute_hash(char_base, offset, length);
break;
}
/* This point corresponds with LP in Lisp source */
/* following for loop never exits until it finds new hash entry or same atom */
/* following for loop does not exit until it finds new hash entry or same atom */
for (reprobe = Atom_reprobe(hash, first_char); (hash_entry = GETWORD(AtomHT + hash)) != 0;
hash = ((hash + reprobe) & 0xffff)) {
atom_index = hash_entry - 1;
@@ -327,7 +318,7 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
if ((length == GETBYTE(pname_base)) &&
(compare_chars(++pname_base, char_base + offset, length) == T)) {
DBPRINT(("FOUND the atom. \n"));
return (atom_index); /* find already existed atom */
return (atom_index); /* found existing atom */
}
DBPRINT(("HASH doesn't hit. reprobe!\n"));
@@ -338,65 +329,3 @@ LispPTR make_atom(const char *char_base, DLword offset, DLword length, short int
return (0xffffffff);
/** Don't create newatom now **/
} /* make_atom end */
/*********************************************************************/
/*
Func name : parse_number
Desc : It can treat -65534 to 65535 integer
Returns SMALLP PTR
Date : 1,May 1987 Take
15 May 87 take
*/
/*********************************************************************/
/* Assume this func. should be called with C string in "char_base" */
LispPTR parse_number(const char *char_base, short int length) {
register LispPTR sign_mask;
register LispPTR val;
register int radix;
register int *cell68k;
#ifdef TRACE2
printf("TRACE: parse_number()\n");
#endif
/* Check for Radix 8(Q) postfixed ?? */
if ((*(char_base + (length - 1))) == 'Q') {
radix = 8;
length--;
} else
radix = 10;
/* Check for Sign */
sign_mask = S_POSITIVE;
if ((*(char_base) == '+') || (*(char_base) == '-')) {
sign_mask = ((*char_base++) == '+') ? S_POSITIVE : S_NEGATIVE;
length--;
}
for (val = 0; length > 0; length--) {
if ((((*char_base)) < '0') || ('9' < ((*char_base)))) return (NIL);
val = radix * val + (*char_base++) - '0';
}
if (val > 0xffffffff) error("parse_number : Overflow ...exceeded range of FIXP");
if ((sign_mask == S_POSITIVE) && (val > 0xffff)) {
cell68k = (int *)createcell68k(TYPE_FIXP);
*cell68k = val;
return (LADDR_from_68k(cell68k));
} else if ((sign_mask == S_NEGATIVE) && (val > 0xffff)) {
cell68k = (int *)createcell68k(TYPE_FIXP);
*cell68k = ~val + 1;
return (LADDR_from_68k(cell68k));
}
else if (sign_mask == S_NEGATIVE)
return (sign_mask | (~((DLword)val) + 1));
else {
return (sign_mask | val);
}
}
/* end parse_number */

View File

@@ -35,7 +35,7 @@
#include "conspagedefs.h"
#include "gcfinaldefs.h"
#include "gchtfinddefs.h"
#include "mkatomdefs.h"
#include "testtooldefs.h"
#define MINARRAYBLOCKSIZE 4
#define GUARDVMEMFULL 500
@@ -374,7 +374,7 @@ LispPTR newpage(LispPTR base) {
} else if (InterfacePage->key == IFPVALID_KEY) {
*VMEM_FULL_STATE_word = ATOM_T;
} else
*VMEM_FULL_STATE_word = make_atom("DIRTY", 0, 5, 0);
*VMEM_FULL_STATE_word = MAKEATOM("DIRTY");
}
return (base);

View File

@@ -484,6 +484,7 @@ void OP_subrcall(int subr_no, int argnum) {
case sb_GET_NATIVE_ADDR_FROM_LISP_PTR:
POP_SUBR_ARGS;
/* XXX: this WILL NOT WORK if Lisp memory is allocated outside the low 4GB */
ARITH_SWITCH(Addr68k_from_LADDR(args[0]), TopOfStack);
break;

View File

@@ -424,7 +424,7 @@ void dump_fnobj(LispPTR index)
/************************************************************************/
/* Opcode names, by opcode */
static const char *opcode_table[256] = {
const char *opcode_table[256] = {
"-X-",
"CAR",
"CDR",
@@ -1018,7 +1018,7 @@ FX *get_nextFX(FX *fx) {
} /* get_nextFX end */
LispPTR MAKEATOM(char *string) {
return (make_atom(string, 0, strlen(string), 0));
return (make_atom(string, 0, strlen(string)));
}
/************************************************************************/
@@ -1032,7 +1032,7 @@ LispPTR MAKEATOM(char *string) {
LispPTR *MakeAtom68k(char *string) {
LispPTR index;
index = make_atom(string, 0, strlen(string), 0);
index = make_atom(string, 0, strlen(string));
if (index == 0xffffffff) {
error("MakeAtom68k: no such atom found");
}

View File

@@ -566,7 +566,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
case '~':
if (*(cp + 1) == '>' || *(cp + 1) == '\0') {
/* "~>" or "~" means the user's home directory. */
TIMEOUT(pwd = getpwuid(getuid()));
TIMEOUT0(pwd = getpwuid(getuid()));
if (pwd == NULL) return (0);
strcpy(dst, pwd->pw_dir);
@@ -590,7 +590,7 @@ int unixpathname(char *src, char *dst, int versionp, int genp)
*/
for (++cp, np = name; *cp != '\0' && *cp != '>';) *np++ = *cp++;
*np = '\0';
TIMEOUT(pwd = getpwnam(name));
TIMEOUT0(pwd = getpwnam(name));
if (pwd == NULL) return (0);
strcpy(dst, pwd->pw_dir);

View File

@@ -351,7 +351,7 @@ static int FindAvailablePty(char *Slave) {
/* => byte count (<= 512), NIL (no data), or T (EOF) */
/* 10 Set Window Size, Arg2 = rows, Arg3 = columns */
/* 11 Fork PTY to Shell (obsoletes command 4) */
/* Arg1 = termtype, Arg2 = csh command string */
/* Arg1 = termtype, Arg2 = shell command string */
/* => Job # or NIL */
/* 12 Create Unix Socket */
/* Arg1 = pathname to bind socket to (string) */

View File

@@ -75,76 +75,78 @@ static inline ssize_t SAFEREAD(int f, char *b, int c)
/* */
/************************************************************************/
/* Creates a PTY connection to a csh */
/* Creates a PTY connection to a shell */
static int ForkUnixShell(int slot, char *PtySlave, char *termtype, char *shellarg)
{
int PID, SlaveFD;
struct termios tio;
char *argvec[4] = {NULL, NULL, NULL, NULL};
char *shell = NULL;
char *userShell = NULL;
PID = fork();
if (PID == 0) {
char *argvec[4];
if (0 > setsid()) /* create us a new session for tty purposes */
perror("setsid");
/* Open the slave side */
SlaveFD = open(PtySlave, O_RDWR);
if (SlaveFD == -1) {
perror("Slave Open");
perror(PtySlave);
exit(0);
}
#ifdef OS5
ioctl(SlaveFD, I_PUSH, "ptem");
ioctl(SlaveFD, I_PUSH, "ldterm");
#endif /* OS5 */
/* Set up as basic display terminal: canonical erase,
kill processing, echo, backspace to erase, echo ctrl
chars as ^x, kill line by backspacing */
tcgetattr(SlaveFD, &tio);
tio.c_lflag |= ICANON | ECHO | ECHOE | ECHOCTL | ECHOKE;
tcsetattr(SlaveFD, TCSANOW, &tio);
(void)dup2(SlaveFD, 0);
(void)dup2(SlaveFD, 1);
(void)dup2(SlaveFD, 2);
(void)close(SlaveFD);
/* set the LDESHELL variable so the underlying .cshrc can see it and
configure the shell appropriately, though this may not be so important any more */
setenv("LDESHELL", "YES", 1);
if (termtype[0] != 0) { /* set the TERM environment var */
setenv("TERM", termtype, 1);
}
/* Start up csh */
argvec[0] = "csh";
if (shellarg[0] != 0) { /* setup to run command */
argvec[1] = "-c"; /* read commands from next arg */
argvec[2] = shellarg;
argvec[3] = (char *)0;
} else
argvec[1] = (char *)0;
execv("/bin/csh", argvec);
/* Should never get here */
perror("execv");
exit(0);
} else { /* not the forked process. */
if (PID != 0) {
if (shellarg != shcom) free(shellarg);
return (PID);
}
/* Set the process group so all the kids get the bullet too
if (setpgrp(PID, PID) != 0)
perror("setpgrp"); */
if (0 > setsid()) /* create us a new session for tty purposes */
perror("setsid");
return (PID);
/* Open the slave side */
SlaveFD = open(PtySlave, O_RDWR);
if (SlaveFD == -1) {
perror("Slave Open");
perror(PtySlave);
exit(0);
}
#ifdef OS5
ioctl(SlaveFD, I_PUSH, "ptem");
ioctl(SlaveFD, I_PUSH, "ldterm");
#endif /* OS5 */
/* Set up as basic display terminal: canonical erase,
kill processing, echo, backspace to erase, echo ctrl
chars as ^x, kill line by backspacing */
tcgetattr(SlaveFD, &tio);
tio.c_lflag |= ICANON | ECHO | ECHOE | ECHOCTL | ECHOKE;
tcsetattr(SlaveFD, TCSANOW, &tio);
(void)dup2(SlaveFD, 0);
(void)dup2(SlaveFD, 1);
(void)dup2(SlaveFD, 2);
(void)close(SlaveFD);
/* set the LDESHELL variable so the underlying shell initialization can see it and
configure the shell appropriately, though this may not be so important any more */
setenv("LDESHELL", "YES", 1);
if (termtype[0] != 0) { /* set the TERM environment var */
setenv("TERM", termtype, 1);
}
/* Start up shell -- use SHELL environment variable as long as it's in /etc/shells */
shell = getenv("SHELL");
for (userShell = getusershell(); userShell != NULL && strcmp(shell, userShell) != 0; userShell = getusershell());
if (userShell == NULL) {
perror("$(SHELL) not found in /etc/shells");
exit(0);
}
/* argvec entries initialized to NULL */
argvec[0] = strrchr(userShell, '/') + 1;
if (shellarg[0] != 0) { /* setup to run command */
argvec[1] = "-c"; /* read commands from next arg */
argvec[2] = shellarg;
}
execv(userShell, argvec);
/* Should never get here */
perror("execv");
exit(0);
}
/* fork_Unix is the secondary process spawned right after LISP is

View File

@@ -286,7 +286,7 @@ LispPTR parse_atomstring(char *string)
namelen = cnt - 1;
if ((packagelen == 0) || (strncmp(packageptr, "IL", packagelen) == 0)) { /* default IL: */
aindex = make_atom(nameptr, 0, namelen, T);
aindex = make_atom(nameptr, 0, namelen);
if (aindex == 0xffffffff) {
printf("trying IL:\n");
aindex = get_package_atom(nameptr, namelen, "INTERLISP", 9, 0);

View File

@@ -222,7 +222,7 @@ void Open_Display(DspInterface dsp)
/* */
/*********************************************************************/
DspInterface X_init(DspInterface dsp, char *lispbitmap, int width_hint, int height_hint,
DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, int width_hint, int height_hint,
int depth_hint)
{
Screen *Xscreen;