This commit is contained in:
Jan Nieuwenhuizen 2019-10-30 13:34:05 +01:00
parent 13c99740ef
commit 40ccecb12c
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
3 changed files with 14 additions and 9 deletions

View File

@ -28,22 +28,22 @@
char *
getenv (char const *s)
{
/* eputs ("\ngetenv s="); eputs (s); eputs ("\n"); */
eputs ("\ngetenv s="); eputs (s); eputs ("\n");
char **p = environ;
int length = strlen (s);
while (p[0] != 0)
{
/* eputs ("getenv p[0]="); eputs (p[0]); eputs ("\n"); */
eputs ("getenv p[0]="); eputs (p[0]); eputs ("\n");
if (strncmp (s, p[0], length) == 0)
{
/* eputs ("found!\n"); */
eputs ("found!\n");
char *q = p[0] + length;
if (q[0] == '=')
return q + 1;
}
/* else */
/* eputs ("not found!\n"); */
else
eputs ("not found!\n");
p = p + M2_PTR_SIZE;
}

View File

@ -170,10 +170,15 @@ write_byte (struct scm* x) /*:((arity . n)) */
struct scm*
getenv_ (struct scm* s) /*:((name . "getenv")) */
{
char *p;
p = getenv (cell_bytes (s->string));
char *p = cell_bytes (s->string);
eputs ("getenv p="); eputs (p); eputs ("\n");
p = getenv (p);
if (p != 0)
return make_string0 (p);
{
eputs (" => p="); eputs (p); eputs ("\n");
return make_string0 (p);
}
eputs (" p == 0\n");
return cell_f;
}

View File

@ -1,6 +1,6 @@
#! /bin/sh
# -*-scheme-*-
####MES_ARENA=10000
#MES_ARENA=10000
MES_MAX_ARENA=$MES_ARENA
export MES_ARENA
export MES_MAX_ARENA