/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* return job initialization commands
*/
#if _WIN32
#endif
#include "colib.h"
#include <ctype.h>
#include <fs3d.h>
#include <ls.h>
static void
{
int c;
if ((c = *name++) && c != '=')
{
if (isdigit(c))
do
{
if (!isalnum(c))
c = '_';
} while ((c = *name++) && c != '=');
}
else
}
/*
* add n to the export list
* old!=0 formats in old style
* coex!=0 for CO_ENV_EXPORT
* if n prefixed by % then coquote conversion enabled
*/
static void
{
int cvt;
char* v;
if (cvt = *n == '%')
n++;
/*
* currently limited to valid identifer env var names
*/
{
if (old)
cvt = 0;
{
if (!old)
v = "(*)";
if (v)
{
v = v ? ":" : "";
{
v = ":";
}
}
if (old)
}
}
}
/*
* return job initialization commands
*/
char*
{
register char* s;
int n;
int m;
int old;
int sync;
char* t;
long p;
/*
* pwd
*/
return 0;
{
{
return 0;
{
return 0;
}
}
sync = 1;
}
/*
* umask
*/
{
sync = 1;
}
{
/*
* co_export[] vars
*/
return 0;
tp = 0;
if (!old)
if (sync)
{
s = "(*)";
else
{
for (n = 0; s = co_export[n]; n++)
}
if (s)
{
if (*s == '(')
{
register char* e;
char* v;
char* es;
char* xs;
if (v = strchr(s, ':'))
*v = 0;
while (e = *ep++)
{
m = (int)(t - e);
{
{
es = e;
{
es++;
xs++;
}
break;
}
if (!xs)
{
if (!old)
if (old)
}
}
}
if (v)
{
*v++ = ':';
s = v;
}
}
if (*s)
for (;;)
{
if (t = strchr(s, ':'))
*t = 0;
if (!(s = t))
break;
*s++ = ':';
}
}
{
if (!old)
if (old)
}
}
/*
* PATH
*/
if (!old)
n = PATH_MAX;
{
bad:
sfstrclose(sp);
if (tp)
sfstrclose(tp);
return 0;
}
t += n / 2;
if (!(flags & CO_CROSS) && !pathpath("ignore", NiL, PATH_ABSOLUTE|PATH_REGULAR|PATH_EXECUTE, t, n / 2) && pathpath("bin/ignore", "", PATH_ABSOLUTE|PATH_REGULAR|PATH_EXECUTE, t, n / 2))
{
*strrchr(t, '/') = 0;
s = pathbin();
}
else
{
s = pathbin();
{
{
goto done;
}
}
}
for (;;)
{
if (*s == ':')
s++;
else if (*s == '.' && *(s + 1) == ':')
s += 2;
else
break;
}
tp = 0;
goto bad;
else
{
while (n = *s++)
{
if (n == ':')
{
while (*s == ':')
s++;
if (!*s)
break;
if (*s == '.')
{
if (!*(s + 1))
break;
if (*(s + 1) == ':')
{
s++;
continue;
}
}
}
}
goto bad;
}
if (tp)
sfstrclose(tp);
if (old)
if (sync)
{
/*
* VPATH
*/
n = PATH_MAX;
for (;;)
{
goto bad;
m = n;
else
{
if (!m)
break;
}
}
else
{
m = 0;
}
if (m)
else
}
done:
{
sfprintf(sp, "%s%s=%05d${!%s-$$}\n", old ? "" : "export ", CO_ENV_TEMP, getpid(), (flags & CO_OSH) ? "" : ":");
if (old)
}
{
goto bad;
}
else
{
goto bad;
}
sfstrclose(sp);
}
{
}
}
/*
* return generic job initialization commands
*/
char*
{
{
return 0;
}
}