killbss routine smarter now; does not overwrite all BSS; did not work

as it should, because systemcall interface also uses the fact that BSS = 0
This commit is contained in:
ceriel 1988-12-02 15:39:59 +00:00
parent 5252b760d9
commit 18b719de80
4 changed files with 47 additions and 18 deletions

View file

@ -19,12 +19,12 @@
#define ISSPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') #define ISSPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
#define ISDIGIT(x) ((x) >= '0' && (x) <= '9') #define ISDIGIT(x) ((x) >= '0' && (x) <= '9')
short ospeed; /* output speed */ short ospeed = 0; /* output speed */
char PC; /* padding character */ char PC = 0; /* padding character */
char *BC; /* back cursor movement */ char *BC = 0; /* back cursor movement */
char *UP; /* up cursor movement */ char *UP = 0; /* up cursor movement */
static char *capab; /* the capability itself */ static char *capab = 0; /* the capability itself */
static int check_for_tc(); static int check_for_tc();
static int match_name(); static int match_name();
@ -181,8 +181,10 @@ char *name;
else file = "/etc/termcap"; else file = "/etc/termcap";
} else } else
file = "/etc/termcap"; file = "/etc/termcap";
if ((fp = open(file, 0)) < 0) if ((fp = open(file, 0)) < 0) {
capab = 0;
return(-1); return(-1);
}
while (fgets(buf, 1024, fp) != NULL) { while (fgets(buf, 1024, fp) != NULL) {
if (buf[0] == '#') continue; if (buf[0] == '#') continue;
while (*(cp = &buf[strlen(buf) - 2]) == '\\') while (*(cp = &buf[strlen(buf) - 2]) == '\\')
@ -191,9 +193,14 @@ char *name;
if (match_name(buf, name)) { if (match_name(buf, name)) {
strcpy(bp, buf); strcpy(bp, buf);
close(fp); close(fp);
return(check_for_tc()); if(check_for_tc() == 0) {
capab = 0;
return 0;
}
return 1;
} }
} }
capab = 0;
close(fp); close(fp);
return(0); return(0);
} }
@ -236,7 +243,9 @@ check_for_tc()
return(0); /* no : in termcap entry */ return(0); /* no : in termcap entry */
if (p[1] != 't' || p[2] != 'c') if (p[1] != 't' || p[2] != 'c')
return(1); return(1);
if (count > 16) return(0); /* recursion in tc= definitions */ if (count > 16) {
return(0); /* recursion in tc= definitions */
}
count++; count++;
strcpy(terminalname, &p[4]); strcpy(terminalname, &p[4]);
q = terminalname; q = terminalname;
@ -264,9 +273,9 @@ char *id;
char *cp; char *cp;
int ret; int ret;
if ((cp = capab) == NULL || id == NULL) if ((cp = capab) == NULL || id == NULL || *cp == 0)
return(-1); return(-1);
while (*++cp != ':') while (*++cp && *cp != ':')
; ;
while (*cp) { while (*cp) {
cp++; cp++;
@ -298,9 +307,9 @@ char *id;
{ {
char *cp; char *cp;
if ((cp = capab) == NULL || id == NULL) if ((cp = capab) == NULL || id == NULL || *cp == 0)
return(-1); return(-1);
while (*++cp != ':') while (*++cp && *cp != ':')
; ;
while (*cp) { while (*cp) {
cp++; cp++;
@ -328,7 +337,7 @@ char **area;
char *ret; char *ret;
int i; int i;
if ((cp = capab) == NULL || id == NULL) if ((cp = capab) == NULL || id == NULL || *cp == 0)
return(NULL); return(NULL);
while (*++cp != ':') while (*++cp != ':')
; ;

View file

@ -10,7 +10,7 @@
*/ */
#define MAXPROCS 16 #define MAXPROCS 16
static int callindex; static int callindex = 0;
static int (*proclist[MAXPROCS])(); static int (*proclist[MAXPROCS])();
_cleanup() _cleanup()

View file

@ -31,10 +31,30 @@ init()
sigtrp(M2_UNIXSIG, SIGALRM); sigtrp(M2_UNIXSIG, SIGALRM);
sigtrp(M2_UNIXSIG, SIGTERM); sigtrp(M2_UNIXSIG, SIGTERM);
} }
#if em22 || em24 || em44
killbss()
{
}
#else
static int blablabla; /* We cannot use end, because then also
bss allocated for the systemcall lib
would be overwritten. Lets hope that
this helps ...
*/
killbss()
{
extern char *edata;
register char *p = (char *) &edata;
while (p < (char *) &blablabla) *p++ = 0x66;
}
#endif
extern int catch(); extern int catch();
int (*handler)() = catch; int (*handler)() = catch;
char **argv, **environ; char **argv = 0, **environ = 0;
int argc, StackSize; int argc = 0, StackSize = 0;
char *CurrentProcess, MainProcess, StackBase, MainLB; char *CurrentProcess = 0, MainProcess = 0, StackBase = 0, MainLB = 0;

View file

@ -9,7 +9,7 @@
Version: $Header$ Version: $Header$
*/ */
static unsigned prio; static unsigned prio = 0;
stackprio(n) stackprio(n)
unsigned n; unsigned n;