/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2007-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 *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#include <shell.h>
#include <option.h>
#include <stk.h>
#include <tm.h>
#ifndef SH_DICT
#endif
#ifndef array_elem
#endif
/*
* time formatting related
*/
struct dctime
{
};
{
return(buff);
}
{
char *last;
if(val)
{
int32_t t;
if(flag&NV_INTEGER)
{
t = *(Sfdouble_t*)val;
else
t = *(double*)val;
}
else
{
if(*last)
}
}
else
{
}
}
{
return((Namval_t*)0);
}
{
sizeof(struct dctime),
0,
0,
};
{
if(!dp)
return((Namval_t*)0);
return(np);
}
/*
* mode formatting related
*/
{
}
{
if(val)
{
char *last;
if(flag&NV_INTEGER)
{
else
}
else
{
if(*last)
}
}
else
}
{
0,
};
{
if(!nfp)
return((Namval_t*)0);
return(np);
}
/*
* field related typese and functions
*/
typedef struct _field_
{
} Shfield_t;
/*
* lookup field in field table
*/
{
register int i,n;
register const char *cp;
{
if(*cp=='.')
break;
}
{
return(fp);
}
return(0);
}
/*
* class types and functions
*/
typedef struct _class_
{
} Shclass_t;
struct dcclass
{
};
{
return(nq);
}
{
{
}
return(nq);
return(nq);
}
{
register int i,isarray;
if(out)
{
indent++;
}
{
#if 0
/* handle recursive case */
#endif
if(np)
{
isarray=0;
{
isarray=1;
isarray=2;
else
}
if(isarray)
{
if(isarray==2)
continue;
}
while(1)
{
char *fmtq;
if(isarray)
{
}
fmtq = "";
if(!nv_nextsub(np))
break;
}
if(isarray)
{
}
}
}
if(out)
{
if(indent>1)
}
}
{
if(dlete)
outfile = 0;
else
if(!outfile)
return((char*)0);
}
{
}
{
{
}
if(val)
}
{
sizeof(struct dcclass),
0,
0,
};
{
if(!tcp)
return(0);
return(1);
}
/*
* ====================from here down is file class specific
*/
struct filedata
{
int fd;
char *name;
};
{
};
{
sizeof(struct filedata),
};
static const char sh_optopen[] =
"[-?\n@(#)$Id: open (AT&T Labs Research) 2007-03-11 $\n]"
"[-author?David Korn <dgk@research.att.com>]"
"[-license?http://www.opensource.org/licenses/cpl1.0.txt]"
"[+NAME? open - create a shell variable correspnding to a file]"
"[+DESCRIPTION?\bopen\b creates the compound variable \avar\a correspinding "
"to the file given by the pathname \afile\a. The elements of \avar\a "
"are the names of elements in the \astat\a structure with the \bst_\b "
"prefix removed.]"
"the variable \avar\a\b.fd\b is the file descriptor.]"
"[a:append?Open for append.]"
"[b:binary?Open in binary mode.]"
"[c:create?Open for create.]"
"[i:inherit?Open without the close-on-exec bit set.]"
"[r:read?Open with read access.]"
"[w:write?Open with write access.]"
"[m:mode]:[mode:=rwrwrw?Open with access mode \amode\a.]"
"[x:exclusive?Open exclusive.]"
"\n"
"\nvar file\n"
"\n"
"[+EXIT STATUS?]{"
"[+0?Success.]"
"[+>0?An error occurred.]"
"}"
"[+SEE ALSO?\bstat\b(2)]"
;
{
register int n,oflag=0;
long flags = 0;
{
case 'r':
case 'i':
case 'w':
break;
case 'b':
#ifdef O_BINARY
#endif
break;
case 't':
#ifdef O_TEXT
#endif
break;
case 'x':
break;
case 'c':
break;
case 'a':
break;
case 'm':
break;
case ':':
break;
case '?':
break;
}
if(argc!=2)
{
}
else
{
{
else
}
if(fd<0)
}
else
return(0);
}