/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 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
/*
* jcl private library support
*/
#include "jcllib.h"
#include <tm.h>
static char*
{
register char* s;
register char* t;
return getlogin();
{
if (islower(*t))
*t = toupper(*t);
return s;
}
return 0;
}
/*
* return value for &name. variable
* if value!=0 then value is set
* if (set&DEFAULT) then no set if already defined
* if (set&MUST) then error message if not found
* no provision for delete
*/
char*
{
register Jclsym_t* v;
char* s;
char* b;
time_t t;
int j;
int f;
if (!value)
{
goto found;
{
if (scope->scope && scope->scope->step->syms && (v = (Jclsym_t*)dtmatch(scope->scope->step->syms, name)))
goto found;
goto found;
}
}
return 0;
else if ((v = (Jclsym_t*)dtmatch(jcl->syms, name)) && (!(flags & (JCL_SYM_EXPORT|JCL_SYM_SET)) || (v->flags & (JCL_SYM_EXPORT|JCL_SYM_SET))))
{
goto found;
}
if (!value)
{
{
return s;
s = b;
if (*s == '$')
{
s++;
f = 1;
}
else
f = 0;
switch (*s)
{
case 'O':
s++;
break;
case 'R':
s++;
break;
default:
break;
}
if (s[0] == 'J' && s[1] == 'U' && s[2] == 'L')
{
s += 3;
j = 1;
}
else
j = 0;
switch (*s)
{
case 'C':
if (!strcmp(s, "CENT"))
return fmttime("%C", t);
break;
case 'D':
if (!strcmp(s, "DATE"))
else if (!strcmp(s, "DAY"))
break;
case 'M':
if (!strcmp(s, "MONTH"))
return fmttime("%m", t);
break;
case 'W':
if (!strcmp(s, "WDAY"))
return fmttime("%u", t);
else if (!strcmp(s, "WEEK"))
return fmttime("%U", t);
break;
case 'Y':
if (!strcmp(s, "YEAR"))
break;
}
switch (*b)
{
case 'B':
{
if (!(j = (int)strtol(b, &s, 10)))
j = 1;
if (!*s)
{
s = fmtbuf(j + 1);
memset(s, ' ', j);
s[j] = 0;
return s;
}
}
break;
case 'R':
if (!strcmp(b, "RN"))
return "1";
break;
case 'T':
if (!strcmp(b, "TIME"))
return fmttime("%H%M%S", t);
break;
}
(*jcl->disc->errorf)(NiL, jcl->disc, 1, "%%%%%s operand value or %s environment value expected", b, name);
}
return s;
return 0;
}
{
return 0;
}
return 0;
{
register char* s;
if (!*s)
{
{
#if 0
sfprintf(sfstdout, "%s=%s\t# global\n", v->name, fmtquote(v->value, "$'", "'", strlen(v->value), 0));
#endif
return s;
}
}
}
return v->value;
}
/*
* save string in vm
* path==1 enables mvs => unix path conversion
*/
char*
{
char* s;
char* t;
char* e;
int n;
{
if (e == (s + n - 1))
*t = 0;
else
{
*t = '/';
*(s + n - 1) = 0;
}
}
return s;
}
/*
* out of space message
*/
void
{
if (!disc)
}