1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtksh: remove unused files and functions

This commit is contained in:
Chase 2019-12-15 10:19:37 -06:00 committed by Jon Trulson
parent 6c07a2ae69
commit 3152b0bc4e
26 changed files with 0 additions and 5911 deletions

View file

@ -1,124 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: basetbl.c /main/3 1995/11/01 15:50:27 rswiston $ */
/** %W% **/
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/types.h>
#include "exksh.h"
#include "msgs.h"
/*
* Declare all strings in one place to avoid duplication
*/
char STR_uint[] = "uint";
static char STR_intp[] = "intp";
static char STR_int[] = "int";
static char STR_dint[] = "dint";
char STR_unsigned_long[] = "unsigned_long";
static char STR_longp[] = "longp";
static char STR_long[] = "long";
static char STR_dlong[] = "dlong";
static char STR_ushort[] = "ushort";
static char STR_short[] = "short";
static char STR_dshort[] = "dshort";
static char STR_unchar[] = "unchar";
static char STR_char[] = "char";
char STR_string_t[] = "string_t";
struct memtbl T_uint[] = {
{ (char *) STR_uint, (char *) STR_uint, K_INT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(uint), 0 }, NULL
};
struct memtbl T_dint[] = {
{ (char *) STR_dint, (char *) STR_dint, K_DINT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(int) }, NULL
};
struct memtbl T_int[] = {
{ (char *) STR_int, (char *) STR_int, K_INT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(int) }, NULL
};
struct memtbl T_intp[] = {
{ (char *) STR_intp, (char *) STR_intp, K_INT, F_SIMPLE, -1, 1, 0, 0, 0, 0, sizeof(int) }, NULL
};
struct memtbl T_unsigned_long[] = {
{ (char *) STR_unsigned_long, (char *) STR_unsigned_long, K_LONG, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(unsigned long), 0 }, NULL
};
struct memtbl T_long[] = {
{ (char *) STR_long, (char *) STR_long, K_LONG, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(long) }, NULL
};
struct memtbl T_dlong[] = {
{ (char *) STR_dlong, (char *) STR_dlong, K_DLONG, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(long) }, NULL
};
struct memtbl T_longp[] = {
{ (char *) STR_longp, (char *) STR_longp, K_LONG, F_SIMPLE, -1, 1, 0, 0, 0, 0, sizeof(long) }, NULL
};
struct memtbl T_ushort[] = {
{ (char *) STR_ushort, (char *) STR_ushort, K_SHORT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(ushort) }, NULL
};
struct memtbl T_short[] = {
{ (char *) STR_dshort, (char *) STR_dshort, K_DSHORT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(short) }, NULL
};
struct memtbl T_dshort[] = {
{ (char *) STR_short, (char *) STR_short, K_SHORT, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(short) }, NULL
};
struct memtbl T_unchar[] = {
{ (char *) STR_unchar, (char *) STR_unchar, K_CHAR, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(unsigned char) }, NULL
};
struct memtbl T_char[] = {
{ (char *) STR_char, (char *) STR_char, K_CHAR, F_SIMPLE, -1, 0, 0, 0, 0, 0, sizeof(char) }, NULL
};
struct memtbl T_string_t[] = {
{ (char *) STR_string_t, (char *) STR_string_t, K_STRING, F_TYPE_IS_PTR, -1, 0, 0, -1, 0, 0, sizeof(char *) }, NULL
};
struct memtbl *basemems[] = {
T_uint,
T_int,
T_dint,
T_intp,
T_unsigned_long,
T_long,
T_dlong,
T_longp,
T_ushort,
T_short,
T_dshort,
T_unchar,
T_char,
T_string_t,
NULL
};
struct symarray basedefs[] = {
{ "PRDECIMAL", PRDECIMAL },
{ "PRHEX", PRHEX },
{ "PRMIXED", PRMIXED },
{ "PRMIXED_SYMBOLIC", PRMIXED_SYMBOLIC },
{ "PRNAMES", PRNAMES },
{ "PRSYMBOLIC", PRSYMBOLIC },
{ NULL, 0 }
};

View file

@ -1,51 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: basetbl.h /main/3 1995/11/01 15:50:37 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: basetbl.h
**
** Project: CDE
**
** Description: Public include file for basetbl.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_basetbl_h
#define _Dtksh_basetbl_h
extern struct memtbl *basemems[];
extern struct symarray basedefs[];
extern struct memtbl T_unsigned_long[];
extern struct memtbl T_string_t[];
#endif /* _Dtksh_basetbl_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,346 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: define.c /main/4 1995/11/01 15:51:03 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include "exksh.h" /* which includes sys/types.h */
#include <sys/param.h>
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "misc.h"
#include "docall.h"
#include "basetbl.h"
#include "msgs.h"
static growdef( void ) ;
static int add_deflist(
struct symarray *defptr,
char *prefix) ;
static def_init( void ) ;
static struct symarray *Dyndef = NULL;
static int Ndyndef = 0;
static int Sdyndef = 0;
static char defInited = 0;
static char use[] = "0x%x";
static char use2[] = "%s=0x%x";
struct deflist {
char *prefix;
int size;
struct symarray *defs;
};
struct deflist *Deflist = NULL;
int Ndeflist;
static
growdef( void )
{
int i;
if (!defInited)
def_init();
if (!(Dyndef = (struct symarray *) realloc(Dyndef, (Sdyndef + 20) *
sizeof(struct symarray))))
{
return(SH_FAIL);
}
Deflist->defs = Dyndef;
memset(((char *) Dyndef) + Sdyndef * sizeof(struct symarray), '\0',
20 * sizeof(struct symarray));
Sdyndef += 20;
}
int
do_define(
int argc,
char **argv )
{
int i, argstart, redo;
char *name;
struct symarray *found, dummy;
if (!defInited)
def_init();
if (argc > 1 && C_PAIR(argv[1], '-', 'R'))
{
redo = 0;
argstart = 2;
}
else
{
argstart = 1;
redo = 1;
}
if ((argstart +1) >= argc)
XK_USAGE(argv[0]);
name = argv[argstart++];
dummy.str = name;
found = (struct symarray *) bsearch((char *) &dummy, Dyndef, Ndyndef,
sizeof(struct symarray), symcomp);
if (found)
{
if (!redo)
return(SH_SUCC);
i = found - Dyndef;
}
else
{
if (Sdyndef == Ndyndef)
growdef();
Ndyndef++;
if (Ndyndef > 1)
for (i = Ndyndef - 1; i > 0; i--)
{
if (strcmp(name, Dyndef[i - 1].str) >= 0)
break;
Dyndef[i] = Dyndef[i - 1];
}
else
i = 0;
Dyndef[i].str = strdup(name);
Deflist->size++;
}
RIF(xk_par_int(argv + argstart, &Dyndef[i].addr, NULL));
return(SH_SUCC);
}
int
fdef(
char *str,
unsigned long *val )
{
struct symarray *found, dummy;
int i;
dummy.str = str;
if (!Deflist)
return(0);
for (i = 0; i < Ndeflist; i++)
{
if (Deflist[i].defs)
{
if (Deflist[i].size < 0)
{
found = (struct symarray *) lfind((char *) &dummy, Deflist[i].defs,
(unsigned int *) &Deflist[i].size, sizeof(struct symarray),
symcomp);
}
else
{
found = (struct symarray *) bsearch((char *) &dummy,
Deflist[i].defs, Deflist[i].size, sizeof(struct symarray),
symcomp);
}
if (found != NULL)
{
*val = found->addr;
return(1);
}
}
}
return(0);
}
int
do_deflist(
int argc,
char **argv )
{
int i, j;
char *prefix = NULL;
struct symarray *defptr = NULL;
char * errmsg;
for (i = 1; (i < argc) && argv[i]; i++)
{
if (argv[i][0] == '-')
{
for (j = 1; argv[i][j]; j++)
{
switch(argv[i][j])
{
case 'p':
{
if (argv[i][j + 1])
{
prefix = argv[i] + j;
j += strlen(prefix) - 2;
}
else
{
prefix = argv[++i];
j = strlen(prefix) - 1;
}
}
}
}
}
else
{
if ((defptr = (struct symarray *) getaddr(argv[i])) == NULL)
{
errmsg=strdup(GETMESSAGE(3,1,
"Unable to locate the definition list '%s'"));
printerrf(argv[0], errmsg, argv[i], NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
}
}
if (defptr == NULL)
{
XK_USAGE(argv[0]);
}
for (i = 0; i < Ndeflist; i++)
if ((Deflist[i].defs == defptr) &&
(!prefix || (strcmp(Deflist[i].prefix, prefix) == 0)))
{
return(SH_SUCC);
}
return(add_deflist(defptr, prefix));
}
static int
add_deflist(
struct symarray *defptr,
char *prefix )
{
int i;
if (!Deflist)
{
Deflist = (struct deflist *) malloc((Ndeflist + 1) *
sizeof(struct deflist));
}
else
{
Deflist = (struct deflist *) realloc(Deflist, (Ndeflist + 1) *
sizeof(struct deflist));
}
if (!Deflist)
return(SH_FAIL);
Deflist[Ndeflist].defs = defptr;
Deflist[Ndeflist].prefix = strdup(prefix);
if (!defptr[0].str)
Deflist[Ndeflist].size = 0;
else
{
for (i = 1; defptr[i].str && defptr[i].str[0]; i++)
if (symcomp((void *) (defptr + i), (void *) (defptr + i - 1)) < 0)
break;
if (!(defptr[i].str && defptr[i].str[0]))
Deflist[Ndeflist].size = i;
else
Deflist[Ndeflist].size = -1;
}
Ndeflist++;
return(SH_SUCC);
}
int
do_finddef(
int argc,
char **argv )
{
unsigned long found;
struct symarray dummy;
char * errmsg;
if (argc < 2)
XK_USAGE(argv[0]);
if (fdef(argv[1], &found))
{
if (argc >= 3)
{
char buf[50];
sprintf(buf, use2, argv[2], found);
env_set(buf);
}
else
{
sprintf(xk_ret_buffer, use, found);
xk_ret_buf = xk_ret_buffer;
}
return(SH_SUCC);
}
errmsg = strdup(GETMESSAGE(3, 2, "Unable to locate the define '%s'"));
printerrf(argv[0], errmsg, argv[1], NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
static
def_init( void )
{
char * errhdr;
char * errmsg;
defInited = 1;
if (!(Dyndef = (struct symarray *) malloc(20 * sizeof(struct symarray))))
{
errhdr = strdup(GetSharedMsg(DT_ERROR));
errmsg = strdup(GetSharedMsg(DT_ALLOC_FAILURE));
printerr(errhdr, errmsg, NULL);
free(errhdr);
free(errmsg);
exit(1);
}
Dyndef[0].str = NULL;
Sdyndef = 20;
Ndyndef = 0;
add_deflist(Dyndef, "dynamic");
add_deflist(basedefs, "base");
}

View file

@ -1,63 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: define.h /main/4 1995/11/01 15:51:12 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: define.h
**
** Project: CDE
**
** Description: Public include file for define.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_define_h
#define _Dtksh_define_h
extern int do_define(
int argc,
char **argv) ;
extern int fdef(
char *str,
unsigned long *val) ;
extern int do_deflist(
int argc,
char **argv) ;
extern int do_finddef(
int argc,
char **argv) ;
#endif /* _Dtksh_define_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,774 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $TOG: docall.c /main/7 1998/04/17 11:22:59 mgreess $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include "exksh.h" /* which includes sys/types.h */
#include "docall.h"
#include <sys/param.h>
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "struct.h"
#include "misc.h"
#include "exksh_tbls.h"
#include "basetbl.h"
#include "msgs.h"
#include <X11/Xosdefs.h>
#include <errno.h>
#ifdef X_NOT_STDC_ENV
extern int errno;
#endif
static int allprint(
unsigned long *pargs,
memtbl_t *tbls) ;
static pp_usage( void ) ;
static int call_postprompt(
char * argv0,
unsigned long *pargs,
memtbl_t *tbls,
int *freeit) ;
static long get_prdebug( void ) ;
static long set_prdebug(
long n) ;
static int myprompt(
char *prompt) ;
struct memtbl Null_tbl = { NULL };
static char use[] = "0x%x";
static char use2[] = "%s=0x%x";
int Xk_errno = 0;
int Xkdebug = 0;
char xk_ret_buffer[100];
char *xk_ret_buf = xk_ret_buffer;
struct Bfunction xk_prdebug = { get_prdebug, set_prdebug };
int
do_field_get(
int argc,
char **argv )
{
char buf[BIGBUFSIZ], *p, *bufstart;
char *fld, *type, *ptr, *ptr2, **pptr2;
memtbl_t tbl[2], *tbl2;
int i;
char *targvar = NULL;
char fail = 0, always_ptr;
char * errmsg;
always_ptr = 0;
for (i = 1; (i < argc) && argv[i] != NULL && argv[i][0] == '-'; i++) {
switch(argv[i][1]) {
case 'p':
always_ptr = 1;
break;
case 'v':
targvar = argv[++i];
break;
}
}
if ((i + 1) >= argc)
{
XK_USAGE(argv[0]);
}
type = argv[i++];
if (!isdigit(argv[i][0]))
always_ptr = 1;
ptr = (char *) getaddr(argv[i++]);
tbl[1] = Null_tbl;
if (!type || !ptr || (parse_decl(argv[0], tbl, type, 1) == FAIL)) {
if (!type || !ptr)
{
XK_USAGE(argv[0]);
}
else
{
errmsg = strdup(GETMESSAGE(4,1,
"Cannot parse the structure named '%s'; it may not have been defined"));
printerrf(argv[0], errmsg, type, NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
}
if ((always_ptr || !IS_SIMPLE(tbl)) && !tbl->ptr && !(tbl->flags & F_TYPE_IS_PTR))
tbl->ptr = 1;
else while (tbl->ptr > 1) {
ptr = *((void **) ptr);
tbl->ptr--;
}
Pr_tmpnonames = 1;
p = buf;
if (targvar) {
strcpy(p, targvar);
p += strlen(p);
*p++ = '=';
bufstart = p;
}
else
bufstart = buf;
while ((i < argc) && (fld = argv[i++])) {
if (p != bufstart)
*p++ = targvar ? ' ' : '\n';
tbl2 = tbl;
ptr2 = ptr;
pptr2 = &ptr2;
if (!C_PAIR(fld, '.', '\0'))
tbl2 = ffind(tbl, fld, (char **)&pptr2);
if (!tbl2) {
errmsg = strdup(GetSharedMsg(DT_BAD_FIELD_NAME));
printerrf(argv[0], errmsg, fld, type,
NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
fail = 1;
break;
}
if (XK_PRINT(tbl2, &p, (char *)pptr2, 0, 0, NULL,
all_tbl_find) == FAIL)
{
errmsg=strdup(GETMESSAGE(4,2,
"Cannot print the field '%s' in structure '%s'"));
printerrf(argv[0], errmsg, fld, type,
NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
fail = 1;
break;
}
}
if (!fail) {
*p = '\0';
if (targvar)
env_set(buf);
else
ALTPUTS(buf);
}
Pr_tmpnonames = 0;
return(fail ? SH_FAIL : SH_SUCC);
}
static int
allprint(
unsigned long *pargs,
memtbl_t *tbls )
{
char buf[BIGBUFSIZ], *p;
int i;
char * errmsg;
for (i = 0; tbls[i].name; i++) {
errmsg = strdup(GETMESSAGE(4,3, "Argument %d (type %s):\n\t"));
printf(errmsg, i + 1, tbls[i].name);
free(errmsg);
p = buf;
XK_PRINT(tbls + i, &p, (char *)(pargs + i), 0, 0, NULL,
all_tbl_find);
ALTPUTS(buf);
}
}
static
pp_usage( void )
{
char * errmsg;
errmsg = strdup(GETMESSAGE(4,4,
"Please enter p(rint), s(end), q(uit) or field=value\n"));
printf(errmsg);
free(errmsg);
}
static int
call_postprompt(
char * argv0 ,
unsigned long *pargs,
memtbl_t *tbls,
int *freeit )
{
char buf[BUFSIZ];
char * errmsg;
char * quitStr, *printStr, *sendStr, *promptStr;
int returnVal = 0;
quitStr = strdup(GETMESSAGE(4,5, "q"));
printStr = strdup(GETMESSAGE(4,6, "p"));
sendStr = strdup(GETMESSAGE(4,7, "s"));
promptStr = strdup(GETMESSAGE(4,8, "Postprompt: "));
for ( ; ; ) {
myprompt(promptStr);
strcpy(buf, quitStr);
*buf = '\0';
fgets(buf, sizeof(buf), stdin);
if (strlen(buf) && buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0';
if (xk_Strncmp(buf, quitStr, 2) == 0)
{
errmsg=strdup(GETMESSAGE(4,9,
"Warning: command was not executed\n"));
printf(errmsg);
free(errmsg);
returnVal = 0;
break;
}
else if (xk_Strncmp(buf, printStr, 2) == 0)
allprint(pargs, tbls);
else if (xk_Strncmp(buf, sendStr, 2) == 0)
{
returnVal = 1;
break;
}
else if (!strchr(buf, '=') ||
(asl_set(argv0,tbls, buf, (unsigned char **)pargs) == SH_FAIL))
{
pp_usage();
}
}
free(quitStr);
free(printStr);
free(sendStr);
free(promptStr);
return(returnVal);
}
#define ZERORET 0
#define NONZERO 1
#define NONNEGATIVE 2
/* In shell, 0 is success so, ZERORET means direct return, NONZERO means
** return the opposite of its truth value and NONNEGATIVE means return
** true if the value IS negative (since FALSE is success)
*/
#define CALL_RETURN(RET) return(SET_RET(RET), ((ret_type == ZERORET) ? (RET) : ((ret_type == NONZERO) ? !(RET) : ((RET) < 0))))
#define EARLY_RETURN(RET) return(SET_RET(RET))
#define SET_RET(RET) (((int) sprintf(xk_ret_buffer, use, (RET))), (int) (xk_ret_buf = xk_ret_buffer), RET)
int
do_call(
int argc,
char **argv )
{
void *pargs[MAX_CALL_ARGS];
memtbl_t tblarray[MAX_CALL_ARGS];
char freeit[MAX_CALL_ARGS];
unsigned long (*func)();
char *p;
char dorun, promptflag;
unsigned char freeval, ret_type;
int i, j, ret;
char * msg;
char * errbuf;
char * errmsg;
promptflag = 0;
freeval = 1;
ret_type = ZERORET;
dorun = 1;
if (argc == 1) {
errmsg = strdup(GetSharedMsg(DT_NO_FUNC_NAME));
printerr(argv[0], errmsg, NULL);
free(errmsg);
xk_usage(argv[0]);
EARLY_RETURN(1);
}
for (j = 1; (j < argc) && argv[j][0] == '-'; j++) {
for (i = 1; argv[j][i]; i++) {
switch(argv[j][i]) {
case 'F':
/* Do not free */
freeval = 0;
break;
case 'r':
/* reverse sense of return value */
ret_type = NONZERO;
break;
case 'n':
/* Non-negative return value is okay */
ret_type = NONNEGATIVE;
break;
default:
errmsg =strdup(GetSharedMsg(DT_UNKNOWN_OPTION));
printerrf(argv[0], errmsg,
argv[j], NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
xk_usage(argv[0]);
EARLY_RETURN(1);
}
}
}
if (j >= argc) {
errmsg = strdup(GetSharedMsg(DT_NO_FUNC_NAME));
printerr(argv[0], errmsg, NULL);
free(errmsg);
xk_usage(argv[0]);
CALL_RETURN(1);
}
memset(tblarray, '\0', MAX_CALL_ARGS * sizeof(memtbl_t));
memset(pargs, '\0', MAX_CALL_ARGS * sizeof(void *));
memset(freeit, '\0', MAX_CALL_ARGS * sizeof(char));
func = (unsigned long (*)()) fsym(argv[j], -1);
if (!func && ((argv[j][0] != '0') || (UPP(argv[j][1]) != 'X') || !(func = (unsigned long (*)()) strtoul(argv[j], &p, 16)) || *p)) {
errmsg = strdup(GETMESSAGE(4,10,
"Unable to locate the function '%s'"));
printerrf(argv[0], errmsg,
argv[j], NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
CALL_RETURN(1);
}
j++;
for (i = 0; (i < MAX_CALL_ARGS) && (j < argc) && argv[j]; j++, i++) {
char *val;
char type[100];
if (C_PAIR(argv[j], '+', '?')) {
promptflag = 1;
continue;
}
else if (C_PAIR(argv[j], '+', '+')) {
j++;
break;
}
if (argv[j][0] == '@') {
if (!(val = strchr(argv[j] + 1, ':'))) {
dorun = 0;
ret = -1;
break;
}
strncpy(type, argv[j] + 1, val - argv[j] - 1);
type[val - argv[j] - 1] = '\0';
val++;
if (parse_decl(argv[0], tblarray + i, type, 1) == FAIL)
{
dorun = 0;
ret = -1;
break;
}
else {
if (!strparse(tblarray + i,
(char **)(pargs + i), val))
{
errmsg=strdup(GETMESSAGE(4,11,
"The value descriptor '%s' does not match the definition for structure '%s'"));
printerrf(argv[0], errmsg,
val, type, NULL, NULL, NULL,
NULL, NULL, NULL);
free(errmsg);
dorun = 0;
ret = -1;
break;
}
else
freeit[i] = freeval;
}
}
else if (isdigit(argv[j][0])) {
char *p;
p = argv[j];
tblarray[i] = T_unsigned_long[0];
xk_par_int(&p, pargs + i, NULL);
}
else if (strcmp(argv[j], (char *) "NULL") == 0) {
tblarray[i] = T_unsigned_long[0];
pargs[i] = NULL;
}
else {
pargs[i] = (void *) argv[j];
tblarray[i] = T_string_t[0];
}
}
/* Process special arguments */
while (j < argc) {
asl_set(argv[0], tblarray, argv[j], (unsigned char **)pargs);
j++;
}
if (dorun) {
if (!promptflag ||
call_postprompt(argv[0], (unsigned long *)pargs, tblarray,
(int *)freeit))
{
ret = (*func)(pargs[0], pargs[1], pargs[2], pargs[3],
pargs[4], pargs[5], pargs[6], pargs[7],
pargs[8], pargs[9], pargs[10], pargs[11],
pargs[12], pargs[13], pargs[14]);
}
else
ret = 0;
Xk_errno = errno;
}
for (i = 0; i < MAX_CALL_ARGS; i++) {
if (pargs[i] && freeit[i])
{
/* There is no recourse for failure */
XK_FREE(tblarray + i, (char *)(pargs + i), 0, 0,
all_tbl_find);
}
}
CALL_RETURN(ret);
}
int _Prdebug;
static long
get_prdebug( void )
{
return(_Prdebug);
}
static long
set_prdebug(
long n )
{
_Prdebug = n;
}
int
asl_set(
char *argv0,
memtbl_t *tblarray,
char *desc,
unsigned char **pargs )
{
char *ptr;
char *val;
memtbl_t *tbl;
memtbl_t usetbl[2];
char op;
char field[80], *fldp = field;
unsigned long intval, i, newval;
unsigned long top, bottom;
char * errmsg;
if ((val = strchr(desc, '=')) == NULL)
return(SH_FAIL);
if (ispunct(val[-1]) && (val[-1] != ']')) {
op = val[-1];
strncpy(field, desc, val - desc - 1);
field[val - desc - 1] = '\0';
val++;
}
else {
op = '\0';
strncpy(field, desc, val - desc);
field[val - desc] = '\0';
val++;
}
if (isdigit(fldp[0])) {
top = bottom = strtoul(fldp, &fldp, 0) - 1;
if (*fldp == '.')
fldp++;
}
else {
top = 9;
bottom = 0;
}
usetbl[1] = Null_tbl;
for (i = bottom; i <= top; i++) {
usetbl[0] = tblarray[i];
ptr = (char *) (pargs + i);
if (tbl = ffind(usetbl, fldp, &ptr))
break;
}
if (!tbl || (i > top)) {
errmsg=strdup(GETMESSAGE(4,12, "Cannot locate the field '%s'"));
printerrf(argv0, errmsg, fldp, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
if (!op || !(tbl->flags & F_SIMPLE))
{
if (XK_PARSE(tbl, &val, ptr, 0, 0, NULL, all_tbl_find) < 0)
{
errmsg = strdup(GETMESSAGE(4,13,
"Cannot set the following value for the field '%s': %s"));
printerrf(argv0, errmsg, val, NULL,
NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
}
}
else {
xk_par_int(&val, &newval, NULL);
switch (tbl->size) {
case sizeof(long):
intval = ((unsigned long *) ptr)[0];
break;
case sizeof(short):
intval = ((unsigned short *) ptr)[0];
break;
case sizeof(char):
intval = ((unsigned char *) ptr)[0];
break;
default:
if (tbl-size == sizeof(int))
{
intval = ((unsigned int *) ptr)[0];
break;
}
}
switch(op) {
case '+':
intval += newval;
break;
case '-':
intval -= newval;
break;
case '*':
intval *= newval;
break;
case '/':
intval /= newval;
break;
case '%':
intval %= newval;
break;
case '&':
intval &= newval;
break;
case '|':
intval |= newval;
break;
case '^':
intval ^= newval;
break;
}
switch (tbl->size) {
case sizeof(long):
((unsigned long *) ptr)[0] = intval;
break;
case sizeof(short):
((unsigned short *) ptr)[0] = intval;
break;
case sizeof(char):
((unsigned char *) ptr)[0] = intval;
break;
default:
if (tbl->size == sizeof(int))
{
((unsigned int *) ptr)[0] = intval;
break;
}
}
}
return(SH_SUCC);
}
int
do_field_comp(
int argc,
char **argv )
{
char *val, *type;
void *ptr, *ptr2, **pptr2, *nuptr;
memtbl_t tbl[2], *tbl2;
unsigned int i;
unsigned char always_ptr;
char pr1[5 * BUFSIZ], pr2[5 * BUFSIZ], *p1, *p2;
char * errbuf;
char * msg;
char * errmsg;
i = 1;
if (argc > 1 && C_PAIR(argv[i], '-', 'p')) {
i++;
always_ptr = 1;
}
else
always_ptr = 0;
if ((i + 2) > argc)
{
XK_USAGE(argv[0]);
}
type = argv[i++];
if (!isdigit(argv[i][0]))
always_ptr = 1;
ptr = getaddr(argv[i++]);
tbl[1] = Null_tbl;
if (!type || !ptr || (parse_decl(argv[0], tbl, type, 1) == FAIL))
{
XK_USAGE(argv[0]);
}
if ((always_ptr || !IS_SIMPLE(tbl)) && !tbl->ptr && !(tbl->flags & F_TYPE_IS_PTR))
tbl->ptr = 1;
else while (tbl->ptr > 1) {
ptr = *((void **) ptr);
tbl->ptr--;
}
for ( ; (i < argc) && argv[i]; i++) {
tbl2 = tbl;
ptr2 = ptr;
pptr2 = &ptr2;
if (val = strchr(argv[i], '=')) {
*val++ = '\0';
tbl2 = ffind(tbl, argv[i], (char **)&pptr2);
if (!tbl2) {
errmsg = strdup(GetSharedMsg(DT_BAD_FIELD_NAME));
printerrf(argv[0], errmsg, argv[i],
type, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
val[-1] = '=';
}
else
val = argv[i];
p1 = pr1;
p2 = pr2;
Pr_tmpnonames = 1;
XK_PRINT(tbl2, &p1, (char *)pptr2, 0, 0, NULL, all_tbl_find);
if (XK_PARSE(tbl2, &val, (char *)&nuptr, 0, 0, NULL,
all_tbl_find) < 0)
{
errmsg=strdup(GETMESSAGE(4,15,
"Cannot parse the following expression: %s"));
printerrf(argv[0], errmsg, argv[i],
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
XK_PRINT(tbl2, &p2, (char *)&nuptr, 0, 0, NULL, all_tbl_find);
XK_FREE(tbl2, (char *)&nuptr, 0, 0, all_tbl_find);
Pr_tmpnonames = 0;
if (strcmp(pr1, pr2)) {
if (env_get((char *) "PRCOMPARE"))
{
errmsg=strdup(GETMESSAGE(4,16,
"The following comparision failed: '%s'\n\tActual: %s\n\tCompare: %s"));
printerrf(argv[0], errmsg,
argv[i], pr1, pr2, NULL, NULL, NULL,
NULL, NULL);
free(errmsg);
}
return(SH_FAIL);
}
}
return(SH_SUCC);
}
static int
myprompt(
char *prompt )
{
fprintf(stderr,prompt);
}
#if 0
/* This needs a functional proto, and needs to be extern'ed in docall.h */
unsigned long
strprint(va_alist)
va_dcl
{
va_list ap;
char *arg;
char *variable = NULL;
memtbl_t tbl;
char *p;
char buf[5 * BUFSIZ];
char *name;
void *val;
char always_ptr;
int nonames = 0;
int ret;
va_start(ap);
always_ptr = 0;
while ((arg = (char *) va_arg(ap, unsigned long)) && (arg[0] == '-')) {
int i;
for (i = 1; arg[i]; i++) {
switch (arg[i]) {
case 'v':
variable = va_arg(ap, char *);
i = strlen(arg) - 1;
break;
case 'p':
always_ptr = 1;
break;
case 'N':
nonames = 1;
}
}
}
name = arg;
if (!arg) {
printerr(argv[0], "Insufficient arguments", NULL);
va_end(ap);
return(SH_FAIL);
}
val = (void *) va_arg(ap, unsigned long);
va_end(ap);
if (parse_decl("strprintf", &tbl, name, 1) == FAIL)
return(SH_FAIL);
if (variable)
p = buf + lsprintf(buf, "%s=", variable);
else
p = buf;
if ((always_ptr || !IS_SIMPLE(&tbl)) && !tbl.ptr && !(tbl.flags & F_TYPE_IS_PTR))
tbl.ptr = 1;
if (!val && (tbl.ptr || (tbl.flags & F_TYPE_IS_PTR))) {
printerr(argv[0], "NULL value argument to strprint", NULL);
return(SH_FAIL);
}
if (always_ptr && (tbl.flags & F_TYPE_IS_PTR))
val = *((void **) val);
else while (tbl.ptr > 1) {
val = *((void **) val);
tbl.ptr--;
}
Pr_tmpnonames = nonames;
ret = XK_PRINT(&tbl, &p, (void *) &val, 0, 0, NULL, all_tbl_find);
Pr_tmpnonames = 0;
if (ret == FAIL)
return(SH_FAIL);
if (variable)
env_set(buf);
else
ALTPUTS(buf);
return(SH_SUCC);
}
#endif

View file

@ -1,73 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: docall.h /main/4 1995/11/01 15:51:36 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: docall.h
**
** Project: CDE
**
** Description: Public include file for docall.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_docall_h
#define _Dtksh_docall_h
#include "exksh.h"
extern int _Prdebug;
extern struct memtbl Null_tbl;
extern char xk_ret_buffer[];
extern char * xk_ret_buf;
extern struct Bfunction xk_prdebug;
extern int do_field_get(
int argc,
char **argv) ;
extern int do_call(
int argc,
char **argv) ;
extern int asl_set(
char *argv0,
memtbl_t *tblarray,
char *desc,
unsigned char **pargs) ;
extern int do_field_comp(
int argc,
char **argv) ;
#endif /* _Dtksh_docall_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,137 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: dtksh.c /main/3 1995/11/01 15:53:19 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#define CONSTCHAR (const char *)
#define TRUE 1
#define FALSE 0
#ifndef DTKSHBINDIR
#define DTKSHBINDIR "/usr/bin"
#endif
static int
FileExists(dir, file)
char *dir, *file;
{
struct stat sbuf;
char path[1024];
sprintf(path, "%s/%s", dir, file);
return(stat(path, &sbuf) != -1);
}
/*
* Bootstrap dtksh by calling xmcoeksh and forcing it to execute
* an rc file that calls the dtksh init function and does some
* other minor housekeeping.
*
* The rc file then sees if there was a previous user rc file (in $_HOLDENV_)
* and if so executes it.
*/
int
main(argc, argv)
int argc;
char *argv[];
{
char *env;
char *bindir = NULL;
char *executable, *envfile;
char *buf;
char envbuf[1024];
/*
* Set the ENV variable to the standard dtksh rc file, which
* will do a libdirload of the dtksh shared object file and add all
* the dtksh commands and widgets to the exksh. If the user already
* had an ENV file, then set the variable _HOLDENV_ to it so the
* standard dtksh rc file can execute it later.
*/
env = getenv((const char *)"ENV");
buf = (char *)malloc((env ? strlen(env) : 0) + 12);
strcpy(buf, "_HOLDENV_=");
strcat(buf, env ? env : "");
putenv(buf);
executable = "xmcoeksh";
envfile = "xmcoeksh.rc";
/*
* Search order for DTKSH binaries:
*
* 1. if $DTKSHBINDIR is set, use that path if it exists.
* 2. if the hard-wired #define DTKSHBINDIR is set and is a
* readable directory, use it.
* 3. punt.
*/
if ((bindir = getenv((const char *)"DTKSHBINDIR")) != NULL) {
if ((!FileExists(bindir, executable)) ||
(!FileExists(bindir, envfile)))
{
bindir = NULL;
}
}
if (bindir == NULL)
{
bindir = DTKSHBINDIR;
if ((!FileExists(bindir, executable)) ||
(!FileExists(bindir, envfile)))
{
bindir = NULL;
}
}
if (bindir == NULL) {
fprintf(stderr,
"dtksh: bootstrap failed. Unable to locate both\nxmcoeksh and xmcoeksh.rc in the same directory.\n Try setting $DTKSHBINDIR.\n");
exit(1);
}
sprintf(envbuf, "DTKSHBINDIR=%s", bindir);
putenv(strdup(envbuf));
sprintf(envbuf, "ENV=%s/%s", bindir, envfile);
putenv(strdup(envbuf));
sprintf(envbuf, "%s/%s", bindir, executable);
execv(envbuf, argv);
fprintf(stderr, "dtksh: Bootstrap of dtksh failed: '%s'\n", envbuf);
perror("Reason");
return(1); /* failure */
}

View file

@ -1,60 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: exextra.h /main/3 1995/11/01 15:53:50 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ifndef _Dtksh_exextra_h
#define _Dtksh_exextra_h
#define EXKSH_EXTRA_TABLE \
{ "call", NV_BLTIN|BLT_ENV|BLT_SPC, do_call }, \
{ "field_comp", NV_BLTIN|BLT_ENV|BLT_SPC, do_field_comp }, \
{ "field_get", NV_BLTIN|BLT_ENV|BLT_SPC, do_field_get }, \
{ "sizeof", NV_BLTIN|BLT_ENV|BLT_SPC, do_sizeof }, \
{ "findsym", NV_BLTIN|BLT_ENV|BLT_SPC, do_findsym }, \
{ "finddef", NV_BLTIN|BLT_ENV|BLT_SPC, do_finddef }, \
{ "deflist", NV_BLTIN|BLT_ENV|BLT_SPC, do_deflist }, \
{ "define", NV_BLTIN|BLT_ENV|BLT_SPC, do_define }, \
{ "structlist", NV_BLTIN|BLT_ENV|BLT_SPC, do_structlist }, \
{ "deref", NV_BLTIN|BLT_ENV|BLT_SPC, do_deref }, \
{ "struct", NV_BLTIN|BLT_ENV|BLT_SPC, do_struct }, \
{ "typedef", NV_BLTIN|BLT_ENV|BLT_SPC, do_typedef }, \
{ "symbolic", NV_BLTIN|BLT_ENV|BLT_SPC, do_symbolic }, \
#define EXKSH_EXTRA_VAR \
"RET", NV_NOFREE|NV_RDONLY, (char*)(&xk_ret_buffer[0]), \
"PRDEBUG", NV_NOFREE|NV_INTEGER, (char*)(&xk_prdebug),
#define EXKSH_EXTRA_ALIAS \
"args", NV_NOFREE|NV_EXPORT, "setargs \"$@\"",
#endif /* _Dtksh_exextra_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,662 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: exksh_prpar.c /main/4 1995/11/01 15:54:12 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "name.h"
#include "shell.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include "exksh.h"
#include "stdio.h"
#include "exksh_prpar.h"
#include "symbolic.h"
#include "msgs.h"
static int xk_uppercase(
char *s) ;
static int getsize(
int fd,
int *psize) ;
#define OBJ_END 100
struct symlist Val_list;
unsigned int Pr_format = PRSYMBOLIC|PRMIXED|PRNAMES;
/*
* Takes a pointer to a pointer to a character buffer, and skips any
* whitespace, as defined by isspace(section 3). Increments the
* buf parameter to the first non-whitespace character.
* Returns SUCCESS, there are no known ways for it to fail.
*/
int
xk_skipwhite(
char **buf )
{
while (isspace(**buf))
(*buf)++;
return(SUCCESS);
}
int
xk_backskip(
char **buf,
int *n )
{
*n = 0;
while (isspace(**buf)) {
(*buf)--;
*n++;
}
if ((*buf)[0] == '\\')
return(TRUE);
else
return(FALSE);
}
/*
* Takes a pointer to a character buffer and a string. Sees if
* the str is present as the first part of the buffer (minus any
* whitespace), and if so increments the buffer past the string.
* If not, returns FAIL without incrementing buffer (except perhaps
* by eating leading whitespace).
*/
int
xk_parexpect(
char **buf,
char *str )
{
RIF(xk_skipwhite(buf));
if (strncmp(*buf, str, strlen(str)) == 0) {
*buf += strlen(str);
} else {
return(FAIL);
}
return(SUCCESS);
}
/*
* Takes a pointer to a char buffer, and a string. Returns
* TRUE if the string appears immediately (after skipping whitespace).
* or FALSE otherwise.
*/
int
xk_parpeek(
char **buf,
char *str )
{
RIF(xk_skipwhite(buf));
if (strncmp(*buf, str, strlen(str)) == 0)
return(TRUE);
else
return(FALSE);
}
int
xk_prin_int(
memtbl_t *tbl,
char **buf,
unsigned long *old_v )
{
int i, printed = 0;
struct symlist *sym;
unsigned long v;
switch (tbl->kind) {
case K_CHAR:
v = *((unsigned char *) old_v);
break;
case K_SHORT:
v = *((unsigned short *) old_v);
break;
case K_INT:
v = *((unsigned int *) old_v);
break;
default:
v = *old_v;
}
**buf = '\0';
if ((Pr_format & PRSYMBOLIC) && ((Val_list.syms != NULL) || ((sym = fsymbolic(tbl)) != NULL))) {
if (Val_list.syms != NULL)
sym = &Val_list;
if (sym->isflag) {
if (v == 0) {
*buf += lsprintf(*buf, "0");
return(SUCCESS);
}
for (i = 0; i < sym->nsyms; i++) {
if (sym->syms[i].addr & v) {
if (Pr_format & PRMIXED_SYMBOLIC) {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%s%s(%d)", printed ? "|" : "", sym->syms[i].str, sym->syms[i].addr);
else
*buf += lsprintf(*buf, "%s%s(0x%x)", printed ? "|" : "", sym->syms[i].str, sym->syms[i].addr);
}
else
*buf += lsprintf(*buf, "%s%s", printed ? "|" : "", sym->syms[i].str);
v &= ~(sym->syms[i].addr);
printed++;
}
}
if (v) {
if (Pr_format & PRMIXED_SYMBOLIC) {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%sNOSYMBOLIC(%d)", printed ? "|" : "", v);
else
*buf += lsprintf(*buf, "%sNOSYMBOLIC(0x%x)", printed ? "|" : "", v);
}
else {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%s%d", printed ? "|" : "", v);
else
*buf += lsprintf(*buf, "%s0x%x", printed ? "|" : "", v);
}
}
return(SUCCESS);
}
else {
for (i = 0; i < sym->nsyms; i++) {
if (sym->syms[i].addr == v) {
if (Pr_format & PRMIXED_SYMBOLIC) {
if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%s(%d)", sym->syms[i].str, v);
else
*buf += lsprintf(*buf, "%s(0x%x)", sym->syms[i].str, v);
}
else
*buf += lsprintf(*buf, "%s", sym->syms[i].str);
return(SUCCESS);
}
}
}
}
if (Pr_format & PRHEX)
*buf += lsprintf(*buf, "0x%x", v);
else if (Pr_format & PRDECIMAL)
*buf += lsprintf(*buf, "%d", v);
else
*buf += lsprintf(*buf, "%d(0x%x)", v, v);
return(SUCCESS);
}
int
xk_par_int(
char **buf,
long *v,
struct envsymbols *env )
{
int ret, base;
char *p, *q, *pp;
char nbuf[512];
xk_skipwhite(buf);
strncpy(nbuf, *buf, sizeof(nbuf)-1);
if (strchr(nbuf, '|') == NULL) {
for (p = nbuf; *p && *p != ' ' && *p != ',' && *p != ']'
&& *p != '{' && *p != '}' && *p != '/' && *p != '@'
&& *p != ':' && *p != '.' && *p != 13 && *p != 10 && *p != 11
&& *p != 12 && *p != 9; p++)
;
*p = '\0';
}
else {
for (p = nbuf; *p && *p != ','
&& *p != '{' && *p != '}' && *p != '/' && *p != '@'
&& *p != ':' && *p != '.' ; p++)
;
*p = '\0';
}
ret = strlen(nbuf);
if (ret == 0)
return(OBJ_END);
*v = 0;
if ((p = strchr(nbuf, '"')) != NULL) {
return(FAIL);
}
if ((p = strchr(nbuf, '+')) != NULL) {
char *qq;
long v1, v2;
*p = '\0';
v1 = v2 = 0;
qq = nbuf;
p++;
xk_par_int(&qq, &v1, env);
xk_par_int(&p, &v2, env);
*v = v1 + v2;
*buf += ret;
return(SUCCESS);
}
if ((p = strchr(&nbuf[1], '-')) != NULL) {
long v1, v2;
char *qq;
*p = '\0';
v1 = v2 = 0;
qq = nbuf;
p++;
xk_par_int(&qq, &v1, env);
xk_par_int(&p, &v2, env);
*v = v1 - v2;
*buf += ret;
return(SUCCESS);
}
for (p = strtok(nbuf, " |\t\n"); p; p = strtok(NULL, " |\t\n")) {
for (pp = p; *pp && *pp != ' ' && *pp != ','
&& *pp != '{' && *pp != '}' && *pp != '/' && *pp != '@'
&& *pp != ':' && *pp != '.' && *pp != 13 &&
*pp != 11 && *pp != 12 && *pp != 9; pp++)
;
*pp = '\0';
if ((pp = strchr(p, '#')) != NULL) {
base = strtol(p, &p, 10);
if (p != pp)
return(FAIL);
p++;
}
else
base = 0;
xk_skipwhite(&p);
if (*p == '\0')
continue;
if (isdigit(*p) || *p == '-') {
*v |= strtoul(p, (char **)NULL, base);
}
else {
unsigned long val;
/* knock out commentary parenthesized things */
if ((q = strchr(p, '(' /*)*/ )) != NULL)
*q = '\0';
/* Search through available names for partial match */
if (!fdef(p, &val)) {
return(FAIL);
}
else
*v |= val;
}
}
*buf += ret;
return(SUCCESS);
}
int
xk_prin_nts(
char **buf,
char *str )
{
return(xk_prin_charstr(buf, (unsigned char *)str,
str ? strlen(str) : 0));
}
int
xk_prin_charstr(
char **buf,
unsigned char *str,
int len )
{
int i;
if (str == NULL)
*buf += lsprintf(*buf, "NULL");
else {
*buf += lsprintf(*buf, "\"");
for (i = 0; i < len; i++) {
if (str[i] == '"') {
*buf += lsprintf(*buf, "\\\"");
} else if (isprint(str[i])) {
*buf += lsprintf(*buf, "%c", str[i]);
} else {
switch (str[i]) {
case '\n':
*buf += lsprintf(*buf, "\\n");
break;
case '\t':
*buf += lsprintf(*buf, "\\t");
break;
case '\b':
*buf += lsprintf(*buf, "\\b");
break;
case '\v':
*buf += lsprintf(*buf, "\\v");
break;
case '\f':
*buf += lsprintf(*buf, "\\f");
break;
case '\r':
*buf += lsprintf(*buf, "\\r");
break;
case '\0':
*buf += lsprintf(*buf, "\\00");
break;
default:
*buf += lsprintf(*buf, "\\%x", (unsigned int)str[i]);
break;
}
}
}
*buf += lsprintf(*buf, "\"");
}
return(SUCCESS);
}
int
xk_prin_hexstr(
char **buf,
char *str,
int len )
{
int i;
unsigned char tempc;
if (str == NULL)
*buf += lsprintf(*buf, "NULL");
else {
*buf += lsprintf(*buf, "%s", "0x");
for (i = 0; i < len; i++) {
tempc = str[i];
if (str[i] & 0xf0) {
*buf += lsprintf(*buf, "%x", tempc);
}
else
*buf += lsprintf(*buf, "0%x", tempc);
}
}
return(SUCCESS);
}
#define MALSIZ 16 /* initial size of string to malloc */
int
xk_par_chararr(
char **buf,
char *str,
int *len )
{
return(xk_par_charstr(buf, &str, len));
}
#define CHAR_QUOTED 0
#define CHAR_HEXSTR 1
#define CHAR_FILE 2
int
xk_par_nts(
char **buf,
char **str )
{
int temp = 0;
RIF(xk_par_charstr(buf, str, &temp));
if (temp >= 0)
str[0][temp] = '\0';
return(SUCCESS);
}
int
xk_par_charstr(
char **buf,
char **str,
int *len )
{
int i;
char delim;
int didmalloc = FALSE, getmode;
char cbuf[3]; /* conversion buffer for hex strings */
char filename[128];
char * errmsg;
RIF(xk_skipwhite(buf));
if (xk_parpeek(buf, "NULL")) {
RIF(xk_parexpect(buf, "NULL"));
*str = NULL;
*len = -1;
return(SUCCESS);
}
/* this is pure internal feature, no error setting */
if (**buf == '<') {
char *p;
FILE *fp;
char gbuf[BUFSIZ];
int line;
int size;
(*buf)++;
xk_skipwhite(buf);
for (p = &filename[0];
**buf != ',' && **buf != /* { */ '}' && **buf != ' ' &&
**buf != '\t' && p < &filename[sizeof(filename)];
*p++ = *(*buf)++)
;
*p++ = '\0';
if ((fp = fopen(filename, "r")) == NULL) {
errmsg=strdup(GETMESSAGE(7,1,
"Unable to open the file '%s'; verify that it exists and is readable"));
lsprintf(gbuf, errmsg, filename);
fprintf(stderr, gbuf);
free(errmsg);
return(FAIL);
}
if (*len == 0) {
if (getsize(fileno(fp), &size) == FAIL) {
errmsg=strdup(GETMESSAGE(7,2,
"Unable to access the file '%s'; verify you have permission to access it"));
lsprintf(gbuf, errmsg, filename);
fprintf(stderr, gbuf);
free(errmsg);
return(FAIL);
}
*len = size/2 + 1;
if ((*str = malloc(*len)) == NULL) {
return(FAIL);
}
}
line = i = 0;
while (fgets(gbuf, sizeof(gbuf), fp) != NULL) {
line++;
p = gbuf;
/* eat any leading 0x */
if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
p += 2;
}
for ( ; *p && *p != '\n'; ) {
if (i > *len - 1) {
fclose(fp);
return(FAIL);
}
if (!isxdigit(*p)) {
p++;
continue;
}
if (!isxdigit(p[1])) {
fclose(fp);
return(FAIL);
}
cbuf[0] = p[0];
cbuf[1] = p[1];
cbuf[2] = '\0';
str[0][i++] = (char)strtol(cbuf, (char **)NULL, 16);
p += 2;
xk_skipwhite(&p);
}
}
*len = i;
fclose(fp);
return(SUCCESS);
} else if (!ispunct(**buf)) {
getmode = CHAR_HEXSTR;
if ((*buf)[0] == '0' && ((*buf)[1] == 'x' || (*buf)[1] == 'X'))
(*buf) += 2;
} else {
delim = *((*buf)++);
getmode = CHAR_QUOTED;
}
if (*len == 0) {
if ((*str = malloc(MALSIZ)) == NULL) {
return(FAIL);
}
didmalloc = TRUE;
*len = MALSIZ;
}
i = 0;
while ((*buf)[0] != '\0' && ((getmode == CHAR_QUOTED && (*buf)[0] != delim) ||
(getmode == CHAR_HEXSTR && (isxdigit((*buf)[0]))) ||
(getmode == CHAR_HEXSTR && (isspace((*buf)[0]))))) {
/* NOTE: must always leave 1 additional byte for a null
* termination, because could be called by xk_par_nts!
*/
if (i >= *len - 1) {
if (didmalloc == FALSE) {
return(FAIL);
} else {
if ((*str = realloc(*str, *len + MALSIZ)) == NULL) {
return(FAIL);
}
*len += MALSIZ;
}
}
if (getmode == CHAR_QUOTED) {
if ((*buf)[0] == '\\') {
(*buf)++;
switch ((*buf)[0]) {
case 't':
str[0][i++] = '\t';
(*buf)++;
break;
case 'v':
str[0][i++] = '\v';
(*buf)++;
break;
case 'f':
str[0][i++] = '\f';
(*buf)++;
break;
case 'n':
str[0][i++] = '\n';
(*buf)++;
break;
case 'r':
str[0][i++] = '\r';
(*buf)++;
break;
case 'b':
str[0][i++] = '\b';
(*buf)++;
break;
case '0':
str[0][i++] = (char)strtol(*buf, buf, 8);
break;
case 's':
(*buf)++;
break;
default:
str[0][i++] = *(*buf)++;
}
} else
str[0][i++] = *(*buf)++;
} else {
if (!isxdigit((*buf)[1])) {
return(FAIL);
}
cbuf[0] = (*buf)[0];
cbuf[1] = (*buf)[1];
cbuf[2] = '\0';
str[0][i++] = (char)strtol(cbuf, (char **)NULL, 16);
(*buf) += 2;
xk_skipwhite(buf);
}
}
if (getmode == CHAR_QUOTED)
(*buf)++; /* eat the trailing quote */
/*
* NOTE: We leave a malloced buffer the same size rather
* than realloc()'ing it to be the exact size in order
* to save time and avoid malloc arena fragmentation
*/
*len = i;
return(SUCCESS);
}
/* Case Ignoring String Functions. */
static int
xk_uppercase(
char *s )
{
while (*s) {
if (islower(*s))
*s = toupper(*s);
s++;
}
}
int
xk_Strncmp(
char *s1,
char *s2,
int len )
{
int diff, i;
for (i=0; i < len && s1[i] != '\0' && s2[i] != '\0'; i++)
if ((diff = tolower(s1[i]) - tolower(s2[i])) != 0)
return (diff);
return(i == len ? 0 : s1[i] - s2[i]);
}
static int
getsize(
int fd,
int *psize )
{
struct stat stat;
if (fstat(fd, &stat) == FAIL)
return(FAIL);
*psize = stat.st_size;
return(SUCCESS);
}

View file

@ -1,98 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: exksh_prpar.h /main/4 1995/11/01 15:54:23 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: exksh_prpar.h
**
** Project: CDE
**
** Description: Public include file for exksh_prpar.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_exksh_prpar_h
#define _Dtksh_exksh_prpar_h
extern unsigned int Pr_format;
extern int xk_skipwhite(
char **buf) ;
extern int xk_backskip(
char **buf,
int *n) ;
extern int xk_parexpect(
char **buf,
char *str) ;
extern int xk_parpeek(
char **buf,
char *str) ;
extern int xk_prin_int(
memtbl_t *tbl,
char **buf,
unsigned long *old_v) ;
extern int xk_par_int(
char **buf,
long *v,
struct envsymbols *env) ;
extern int xk_prin_nts(
char **buf,
char *str) ;
extern int xk_prin_charstr(
char **buf,
unsigned char *str,
int len) ;
extern int xk_prin_hexstr(
char **buf,
char *str,
int len) ;
extern int xk_par_chararr(
char **buf,
char *str,
int *len) ;
extern int xk_par_nts(
char **buf,
char **str) ;
extern int xk_par_charstr(
char **buf,
char **str,
int *len) ;
extern int xk_Strncmp(
char *s1,
char *s2,
int len) ;
#endif /* _Dtksh_exksh_prpar_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

File diff suppressed because it is too large Load diff

View file

@ -1,90 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: exksh_tbls.h /main/4 1995/11/01 15:54:45 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: exksh_tbls.h
**
** Project: CDE
**
** Description: Public include file for exksh_tbls.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_exksh_tbls_h
#define _Dtksh_exksh_tbls_h
extern int Pr_tmpnonames;
extern int _Delim;
extern int (*find_special(
int type,
char *name))() ;
extern int set_special(
char *name,
int (*free)(),
int (*parse)(),
int (*print)()) ;
extern int xk_parse(
memtbl_t *tbl,
char **buf,
char *p,
int nptr,
int sub,
void *pass,
memtbl_t *(*tbl_find)()) ;
extern int xk_get_delim(
memtbl_t *tbl,
char *p) ;
extern int xk_get_pardelim(
memtbl_t *tbl,
char *p) ;
extern int xk_print(
memtbl_t *tbl,
char **buf,
char *p,
int nptr,
int sub,
void *pass,
memtbl_t *(*tbl_find)()) ;
extern int xk_free(
memtbl_t *tbl,
char *p,
int nptr,
int sub,
memtbl_t *(*tbl_find)()) ;
#endif /* _Dtksh_exksh_tbls_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -66,39 +66,6 @@ env_get(
}
void *
xkhash_init(
int num )
{
return((void *) hashalloc(NULL,0));
}
void
xkhash_override(
Hash_table_t *tbl,
const char *name,
void *val )
{
hashput(tbl, name, val);
}
void *
xkhash_find(
Hash_table_t *tbl,
const char *name )
{
return(hashget(tbl, name));
}
void
xkhash_add(
Hash_table_t *tbl,
const char *name,
char *val )
{
hashput(tbl, name, val);
}
int
ksh_eval(
char *cmd )

View file

@ -1,258 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: genlib.c /main/5 1996/09/27 19:01:37 drk $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "stdio.h"
#include <sys/types.h>
#ifdef DYNLIB
#include <dlfcn.h>
#endif
#ifdef HPUX_DYNLIB
#include <dl.h>
#endif
#include <string.h>
#include <search.h>
#include <ctype.h>
#include "docall.h"
#include "exksh.h"
#include "misc.h"
#include "xmdtksym.h"
#include "msgs.h"
static char * ReturnUsageMsg(
int msgIndex);
struct libstruct *All_libs;
static int Nlibs;
int sh_errno;
static struct usage {
char *funcname;
int msgId;
} Xk_usage[] = {
"call", 0,
"define", 1,
"deflist", 2,
"deref", 3,
"field_comp", 4,
"field_get", 5,
"finddef", 6,
"findsym", 7,
"sizeof", 8,
"struct", 9,
"structlist", 10,
"symbolic", 11,
"typedef", 12,
};
static char *
ReturnUsageMsg(
int msgId )
{
char * errmsg;
switch (msgId)
{
case 0: errmsg = GETMESSAGE(9,1, "call [-F] [-n] [-r] function [arg] ... [++] [argModifier ...]");
return(errmsg);
case 1: errmsg = GETMESSAGE(9,2, "define [-R] name value");
return(errmsg);
case 2: errmsg = GETMESSAGE(9,3, "deflist [-p prefix] address");
return(errmsg);
case 3: errmsg = GETMESSAGE(9,4, "deref [-p] [-l] [-len] address [variable]");
return(errmsg);
case 4: errmsg = GETMESSAGE(9,5, "field_comp type address [criterion ...]");
return(errmsg);
case 5: errmsg = GETMESSAGE(9,6, "field_get [-v variable] type address [fieldName ...]");
return(errmsg);
case 6: errmsg = GETMESSAGE(9,7, "finddef definitionName [variable]");
return(errmsg);
case 7: errmsg = GETMESSAGE(9,8, "findsym symbolName [variable]");
return(errmsg);
case 8: errmsg = GETMESSAGE(9,9, "sizeof typeName [variable]");
return(errmsg);
case 9: errmsg = GETMESSAGE(9,10,"struct [-R] name fieldName[:type] ...");
return(errmsg);
case 10: errmsg = GETMESSAGE(9,11, "structlist [-i id] [-p prefix] address");
return(errmsg);
case 11: errmsg = GETMESSAGE(9,12, "symbolic [-m] -t type ... symbolic ...");
return(errmsg);
case 12: errmsg = GETMESSAGE(9,13,"typedef [-R] typeDescriptor typeName");
return(errmsg);
}
return("");
}
int
xk_usage(
char *funcname )
{
int i;
char * errhdr;
char * errmsg;
for (i = 0; i < sizeof(Xk_usage) / sizeof(struct usage); i++)
{
if (!funcname)
{
errmsg = strdup(ReturnUsageMsg(Xk_usage[i].msgId));
ALTPUTS(errmsg);
free(errmsg);
}
else if (!funcname || (strcmp(funcname, Xk_usage[i].funcname) == 0))
{
errhdr = strdup(GETMESSAGE(9,14, "Usage: %s"));
errmsg = strdup(ReturnUsageMsg(Xk_usage[i].msgId));
printerrf("", errhdr, errmsg, NULL, NULL, NULL, NULL, NULL, NULL,
NULL);
free(errhdr);
free(errmsg);
return(SH_SUCC);
}
}
return(funcname ? SH_FAIL : SH_SUCC);
}
unsigned long
fsym(
char *str,
int lib )
{
#if defined(STATICLIB) || ( !defined(DYNLIB) && !defined(HPUX_DYNLIB))
struct symarray dummy;
#endif
#if defined(DYNLIB)
int i, j;
#endif
void *found;
#if defined(STATICLIB) || (!defined(DYNLIB) && !defined(HPUX_DYNLIB))
dummy.str = str;
if ((found = (void *) bsearch((char *) &dummy, Symarray,
Symsize-1, sizeof(struct symarray), symcomp)) != NULL)
return(((struct symarray *) found)->addr);
#endif /* STATICLIB */
#ifdef DYNLIB
for (i = 0; i < Nlibs; i++)
for (j = 0; j < All_libs[i].nlibs; j++)
if ((found = dlsym(All_libs[i].libs[j].handle,
str)) != NULL)
return((unsigned long) found);
#endif /* DYNLIB */
#ifdef HPUX_DYNLIB
{
shl_t handle;
handle = NULL;
if ((shl_findsym(&handle, str, TYPE_PROCEDURE, &found)) == 0)
return((unsigned long) found);
if ((shl_findsym(&handle, str, TYPE_DATA, &found)) == 0)
return((unsigned long) found);
handle = PROG_HANDLE;
if ((shl_findsym(&handle, str, TYPE_PROCEDURE, &found)) == 0)
return((unsigned long) found);
if ((shl_findsym(&handle, str, TYPE_DATA, &found)) == 0)
return((unsigned long) found);
}
#endif /* HPUX_DYNLIB */
return(NULL);
}
int
do_findsym(
int argc,
char **argv )
{
unsigned long found;
struct symarray dummy;
char * errmsg;
if (argc == 1) {
XK_USAGE(argv[0]);
}
if ((found = fsym(argv[1], -1)) != NULL) {
if (argc >= 3) {
char buf[50];
sprintf(buf, "%s=0x%lx", argv[2], found);
env_set(buf);
}
else {
sprintf(xk_ret_buffer, "0x%lx", found);
xk_ret_buf = xk_ret_buffer;
}
}
else {
errmsg = strdup(GetSharedMsg(DT_UNDEF_SYMBOL));
printerrf(argv[0], errmsg, argv[1], NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
return(SH_SUCC);
}
#ifndef SPRINTF_RET_LEN
/*
* SYSTEM V sprintf() returns the length of the buffer, other versions
* of the UNIX System don't. So, if the SPRINTF_RET_LEN flag is not true,
* then we define an alternate function, lsprintf(), which has the SYSV
* behavior. Otherwise, lsprintf is #defined in exksh.h to be the
* same as sprintf.
*/
int
lsprintf(
char *buf,
char *fmt,
unsigned long arg1,
unsigned long arg2,
unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
unsigned long arg6,
unsigned long arg7 )
{
sprintf(buf, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
return(strlen(buf));
}
#endif

View file

@ -1,75 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: genlib.h /main/4 1995/11/01 15:55:32 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: genlib.h
**
** Project: CDE
**
** Description: Public include file for genlib.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_genlib_h
#define _Dtksh_genlib_h
#include "exksh.h"
extern struct libstruct *All_libs;
extern int xk_usage(
char *funcname) ;
extern unsigned long fsym(
char *str,
int lib) ;
extern int do_findsym(
int argc,
char **argv) ;
#ifndef SPRINTF_RET_LEN
extern int lsprintf(
char *buf,
char *fmt,
unsigned long arg1,
unsigned long arg2,
unsigned long arg3,
unsigned long arg4,
unsigned long arg5,
unsigned long arg6,
unsigned long arg7) ;
#endif
#endif /* _Dtksh_genlib_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,72 +0,0 @@
# Copyright (c) 1991, 1992 UNIX System Laboratories, Inc.
# All Rights Reserved */
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF
# UNIX System Laboratories, Inc.
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
# Installation Directories
#
COEKSHBINDIR="/usr/bin"
#
# Standard X Libraries
#
XROOT = /usr/lib/X11R4
XINC = /x/r5s700_90
XLIB = $(XROOT)
X11LIB = /x/r5s700_90/lib/X/libX11.sl
XtLIB = /x/r5s700_90/lib/Xt/libXt.sl
#
# MOTIF Libraries
#
MOTIFINC = /x/r5s700_90/X11
XmLIB = /x/r5s700_90/lib/Xm/libXm.sl
#
# COE Libraries
#
CoeINC = /x/r5s700_90/lib1
CoeLIB = /clone/fred/Coe/libCoe.a
#CoeLIB = /x/r5s700_90/lib1/Coe/libCoe.a
#XvhLIB = /clone/fred/Xvh/libXvh.a
XvhLIB = /x/r5s700_90/lib1/Xvh/libXvh.a
IlLIB = /x/r5s700_90/lib1/il/libil.a
BmsLIB = /x/r5s700_90/lib/bms/hpux/s700.9.03/libbms.a
SoftlibLIB = /x/r5s700_90/lib/bms/hpux/s700.9.03/libsoftlib.a
BmsDIR = /x/r5s700_90/lib/bms/hpux/s700.9.03
#
# Standard user level compilation flags for X programs,
# with variations for MOTIF or OPEN LOOK
#
AR = ar
LDFLAGS = -L $(XLIB) -ldld -Wl,-E
SUBCFLAGS = -g -DSYSV -DNLS16 -DMALLOC_0_RETURNS_NULL -DMERGE -DNDEBUG -D__hpux -Dhpux -DOSMAJORVERSION=9 -DOSMINORVERSION=0 -DSHMLINK -D__hp9000s800 -Dhp9000s800 -D__hp9000s700 -DHPPEX -DMESSAGE_CAT +e -DR5TREE -Aa -D_HPUX_SOURCE -DANSICPP -DXK_MISCELLANY -D_BMS -D_CMDINV -DVALUE_ADDED +DA1.0
XFLAGS =
UFLAGS = $(XFLAGS) -DKSHELL -DUSER_PROMPT -DTEST_CODE -D'COEKSHBINDIR=$(COEKSHBINDIR)'
CFLAGS = $(SUBCFLAGS) -I$(BmsDIR) -I$(CoeINC) -I $(MOTIFINC) -I. $(EXKSHINCLUDES) -I$(XINC) $(UFLAGS) -Dconst=
RANLIB = ranlib
MO_CFLAGS = $(CFLAGS) -I $(MOTIFINC) $(MO_UFLAGS)
#
# Dynamic Library Definitions
#
LIB_KIND = .a

View file

@ -1,207 +0,0 @@
Toplevel
do_XBell
do_XClearArea
do_XClearWindow
do_XDrawArc
do_XDrawImageString
do_XDrawLine
do_XDrawLines
do_XDrawPoint
do_XDrawPoints
do_XDrawRectangle
do_XDrawSegments
do_XDrawString
do_XFillArc
do_XFillPolygon
do_XFillRectangle
do_XFlush
do_XSync
do_XRaiseWindow
do_XmCreateArrowButton
do_XmCreateArrowButtonGadget
do_XmCreateBulletinBoard
do_XmCreateBulletinBoardDialog
do_XmCreateCascadeButton
do_XmCreateCascadeButtonGadget
do_XmCreateCommand
do_XmCreateDialogShell
do_XmCreateDrawingArea
do_XmCreateDrawnButton
do_XmCreateErrorDialog
do_XmCreateFileSelectionBox
do_XmCreateFileSelectionDialog
do_XmCreateForm
do_XmCreateFormDialog
do_XmCreateFrame
do_XmCreateInformationDialog
do_XmCreateLabel
do_XmCreateLabelGadget
do_XmCreateList
do_XmListAddItem
do_XmListAddItemUnselected
do_XmListAddItems
do_XmListAddItemsUnselected
do_XmListDeleteAllItems
do_XmListDeleteItem
do_XmListDeleteItems
do_XmListDeleteItemsPos
do_XmListDeletePos
do_XmListDeletePositions
do_XmListDeselectAllItems
do_XmListDeselectItem
do_XmListDeselectPos
do_XmListGetKbdItemPos
do_XmListItemExists
do_XmListItemPos
do_XmListPosSelected
do_XmListPosToBounds
do_XmListReplaceItemsPos
do_XmListReplaceItemsPosUnselected
do_XmListSelectItem
do_XmListSelectPos
do_XmListSetAddMode
do_XmListSetBottomItem
do_XmListSetBottomPos
do_XmListSetHorizPos
do_XmListSetItem
do_XmListSetKbdItemPos
do_XmListSetPos
do_XmListUpdateSelectedList
do_XmCreateMainWindow
do_XmCreateMenuBar
do_XmCreateMenuShell
do_XmCreateMessageBox
do_XmCreateMessageDialog
do_XmCreateOptionMenu
do_XmCreatePanedWindow
do_XmCreatePopupMenu
do_XmCreatePromptDialog
do_XmCreatePulldownMenu
do_XmCreatePushButton
do_XmCreatePushButtonGadget
do_XmCreateQuestionDialog
do_XmCreateRadioBox
do_XmCreateRowColumn
do_XmCreateScale
do_XmCreateScrollBar
do_XmCreateScrolledList
do_XmCreateScrolledText
do_XmCreateScrolledWindow
do_XmCreateSelectionBox
do_XmCreateSelectionDialog
do_XmCreateSeparator
do_XmCreateSeparatorGadget
do_XmCreateText
do_XmCreateTextField
do_XmCreateToggleButton
do_XmCreateToggleButtonGadget
do_XmCreateWarningDialog
do_XmCreateWorkArea
do_XmCreateWorkingDialog
do_DtCreateHelpDialog
do_DtCreateQuickHelpDialog
do_DtHelpReturnSelectedWidgetId
do_DtHelpSetCatalogName
do_DtHelpQuickDialogGetChild
do_XmCommandAppendValue
do_XmCommandError
do_XmCommandSetValue
do_XmCommandGetChild
do_XmMessageBoxGetChild
do_XmFileSelectionBoxGetChild
do_XmMainWindowSetAreas
do_XmMainWindowSep1
do_XmMainWindowSep2
do_XmMainWindowSep3
do_XmProcessTraversal
do_XmInternAtom
do_XmGetAtomName
do_XmGetColors
do_XmUpdateDisplay
do_XmAddWMProtocols
do_XmRemoveWMProtocols
do_XmAddWMProtocolCallback
do_XmRemoveWMProtocolCallback
do_XmMenuPosition
do_XmIsTraversable
do_XmScaleGetValue
do_XmScaleSetValue
do_XmScrollBarGetValues
do_XmScrollBarSetValues
do_XmScrollVisible
do_XmToggleButtonGetState
do_XmToggleButtonGadgetGetState
do_XmToggleButtonSetState
do_XmToggleButtonGadgetSetState
do_XmTextDisableRedisplay
do_XmTextEnableRedisplay
do_XmTextGetTopCharacter
do_XmTextScroll
do_XmTextFindString
do_XmTextGetBaseline
do_XmTextGetEditable
do_XmTextGetInsertionPosition
do_XmTextGetLastPosition
do_XmTextGetMaxLength
do_XmTextGetSelection
do_XmTextGetSelectionPosition
do_XmTextGetString
do_XmTextInsert
do_XmTextPosToXY
do_XmTextRemove
do_XmTextReplace
do_XmTextSetEditable
do_XmTextWetHighlight
do_XmTextSetInsertionPosition
do_XmTextSetMaxLength
do_XmTextSetSelection
do_XmTextSetString
do_XmTextShowPosition
do_XmTextXYToPos
do_XmTextClearSelection
do_XmTextCopy
do_XmTextCut
do_XmTextPaste
do_XmTextSetAddMode
do_XtAddCallback
do_XtRemoveCallback
do_XtAddEventHandler
do_XtRemoveEventHandler
do_XtAddInput
do_XtAddTimeOut
do_XtCreateApplicationShell
do_XtInitialize
do_XtCallCallbacks
do_XtHasCallbacks
do_XtCreateManagedWidget
do_XtCreatePopupShell
do_XtCreateWidget
do_XtDestroyWidget
do_XtGetValues
do_XtIsManaged
do_XtIsRealized
do_XtIsSensitive
do_XtIsShell
do_XtLastTimestampProcessed
do_XtMainLoop
do_XtDisplay
do_XtWindow
do_XtManageChildren
do_XtMapWidget
do_XtParent
do_XtPopdown
do_XtPopup
do_XtRealizeWidget
do_XtRemoveAllCallbacks
do_XtSetSensitive
do_XtSetValues
do_XtUnmanageChildren
do_XtUnmapWidget
do_XtUnrealizeWidget
do_catopen
do_catgets
do_catclose
do_managelist_func
do_widlist
do_widload
handle_to_widget

View file

@ -1,176 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: misc.c /main/5 1996/10/04 16:21:08 drk $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "name.h"
#include "shell.h"
#include "stdio.h"
#include <X11/X.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#define NO_AST
#include "dtksh.h"
#undef NO_AST
#include "exksh.h" /* which includes sys/types.h */
/* #include <sys/param.h> */
#include <string.h>
/* #include <search.h> */
#include <ctype.h>
#include "docall.h"
#include "msgs.h"
static char use[] = "0x%lx";
int
symcomp(
void *sym1,
void *sym2 )
{
return(strcmp(((struct symarray *) sym1)->str, ((struct symarray *) sym2)->str));
}
void *
getaddr(
char *str )
{
if (isdigit(str[0]))
return((void *) strtoul(str, NULL, 0));
else
return((void *) fsym(str, -1));
}
int
do_deref(
int argc,
char **argv )
{
unsigned char *ptr;
long i, len = 0;
short longwise = -1;
char printit = 0;
static char xk_ret_buffer[1024];
char * errmsg;
for (i = 1; (i < argc) && argv[i] != NULL && argv[i][0] == '-'; i++) {
if (isdigit(argv[i][1])) {
if (longwise < 0)
longwise = 0;
ptr = (unsigned char *) argv[i] + 1;
xk_par_int(&ptr, &len, NULL);
if (!len) {
errmsg = strdup(GETMESSAGE(10,1,
"An invalid length parameter was specified: %s"));
printerrf(argv[0], errmsg,
argv[i], NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
}
else if (argv[i][1] == 'l')
longwise = 1;
else if (argv[i][1] == 'p')
printit = 1;
}
if (longwise < 0)
longwise = 1;
if (!len)
len = sizeof(long);
if (i >= argc) {
XK_USAGE(argv[0]);
}
ptr = (unsigned char *) getaddr(argv[i++]);
if (ptr) {
if ( ((i < argc) && argv[i]) || printit) {
char *dbuf, *p;
int totlen;
char buf[10 * BUFSIZ];
int incr;
if (printit)
totlen = len + 1 + 1;
else
totlen = len + strlen(argv[i]) + 1 + 1;
dbuf = (char *) (totlen < (10 * BUFSIZ - 1)) ? buf : malloc(totlen);
if (printit)
strcpy(dbuf, "0x");
else
sprintf(dbuf, "%s=0x", argv[i]);
p = dbuf + strlen(dbuf);
incr = longwise ? sizeof(long) : sizeof(char);
for (i=0; i < len; i += incr, p += 2 * incr)
sprintf(p, "%*.*x", incr * 2, incr * 2, longwise ? *((unsigned long *) (ptr + i)) : (unsigned long) (ptr[i]));
if (printit)
ALTPUTS(dbuf);
else
env_set(dbuf);
if (dbuf != buf)
free(dbuf);
}
else {
if (len > sizeof(unsigned long)) {
char tmpBuf[30];
sprintf(tmpBuf, "%ld", (long)sizeof(unsigned long));
errmsg = strdup(GETMESSAGE(10,2,
"To set RET, the length must be less than: %s"));
printerrf(argv[0], errmsg,
tmpBuf, NULL, NULL, NULL, NULL, NULL, NULL,
NULL);
free(errmsg);
return(SH_FAIL);
}
sprintf(xk_ret_buffer, use, *((unsigned long *) ptr));
xk_ret_buf = xk_ret_buffer;
}
return(SH_SUCC);
}
errmsg = strdup(GetSharedMsg(DT_UNDEF_SYMBOL));
printerrf(argv[0], errmsg, argv[--i], NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
void *
nop(
void *var )
{
return(var);
}
void *
save_alloc(
void *var )
{
return(var);
}

View file

@ -1,62 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: misc.h /main/4 1995/11/01 15:56:04 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: misc.h
**
** Project: CDE
**
** Description: Public include file for misc.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_misc_h
#define _Dtksh_misc_h
extern int symcomp(
const void *sym1,
const void *sym2) ;
extern void * getaddr(
char *str) ;
extern int do_deref(
int argc,
char **argv) ;
extern void * nop(
void *var) ;
extern void * save_alloc(
void *var) ;
#endif /* _Dtksh_misc_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,741 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: struct.c /main/4 1995/11/01 15:56:35 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#undef printf
#include "shell.h"
#include <signal.h>
#include <fcntl.h>
#include <X11/X.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#include <X11/CoreP.h>
#include <X11/StringDefs.h>
#include <Xm/XmStrDefs.h>
#include <Xm/List.h>
#include <setjmp.h>
#include <string.h>
#include <ctype.h>
#include <Xm/Xm.h>
#include <Xm/Protocols.h>
#include "hash.h"
#include "stdio.h"
#define NO_AST
#include "dtksh.h"
#undef NO_AST
#include "exksh.h"
#include "xmksh.h"
#include "dtkcmds.h"
#include "xmcvt.h"
#include "widget.h"
#include "extra.h"
#include "xmwidgets.h"
#include "struct.h"
#include "basetbl.h"
#include "docall.h"
#include "exksh_tbls.h"
#include "msgs.h"
const static char use[] = "0x%x";
const static char use2[] = "%s=0x%x";
static char structInited = 0;
static void *Hashnams = NULL;
static struct memtbl **Dynmem = NULL;
static int Ndynmem = 0;
static int Sdynmem = 0;
struct structlist {
char *prefix;
int id;
int size;
struct memtbl **mem;
};
struct structlist *Structlist = NULL;
int Nstructlist;
static int freemem(
struct memtbl *mem) ;
static growmem( void ) ;
static char * endtok(
char *start) ;
static int chg_structlist(
struct memtbl **memptr,
int id) ;
static struct_init( void ) ;
memtbl_t *
ffind(
memtbl_t *tbl,
char *fld,
char **pptr )
{
static memtbl_t tbluse[2];
memtbl_t *tbl2;
char *p, *q, op;
unsigned int len, sub;
if (!fld || !(*fld))
return(tbl);
tbl2 = tbluse;
tbluse[0] = *tbl;
tbluse[1] = Null_tbl;
q = fld;
while (tbl2 && q && *q) {
p = q;
if (*q == '[') {
if (!tbl2->ptr)
return(NULL);
q++;
xk_par_int(&q, &sub, NULL);
if (*q != ']')
return(NULL);
*pptr = ((char **) (*pptr))[0];
*pptr += sub * tbl2->size;
q++;
tbluse[0].ptr--;
continue;
}
if ((len = strcspn(p, "[.")) < strlen(p)) {
q = p + len;
op = *q;
*q = '\0';
}
else
q = NULL;
tbl2 = asl_find(NULL, tbluse, p, pptr);
if (tbl2 && (tbl2 != tbluse)) {
/* A field should not be a subfield of itself */
tbluse[0] = *tbl2;
tbl2 = tbluse;
tbl2->name = ".";
tbl2->offset = 0;
}
if (q) {
if (op == '.')
*q++ = op;
else
*q = op;
}
}
return(tbl2);
}
static int
freemem(
struct memtbl *mem )
{
free(mem->name);
/*
int i;
** Because structures and typedefs now inherit fields (i.e. copy
** the memtbl entry) we must keep the fields of a structure
** around permanently, (unless we implement a reference count).
** Let's keep the code handy in case we do.
if (mem->kind == K_STRUCT) {
struct memtbl *fmem;
fmem = Dynmem[mem->tbl];
for (i = 0; fmem[i].name; i++) {
free(fmem[i].name);
if (fmem[i].tname)
free(fmem[i].tname);
}
}
*/
free(mem);
}
static
growmem( void )
{
if (!(Dynmem = (struct memtbl **) realloc(Dynmem, (Sdynmem + 20) * sizeof(memtbl_t *))))
return(SH_FAIL);
chg_structlist(Dynmem, DYNMEM_ID);
memset(((char *) Dynmem) + Sdynmem * sizeof(memtbl_t *), '\0', 20 * sizeof(memtbl_t *));
Sdynmem += 20;
}
int
do_struct(
int argc,
char **argv )
{
struct memtbl *mem, *fmem;
int i, j, argstart, redo;
char *name, *fname;
char *p;
if (!structInited)
struct_init();
if (argc > 1 && C_PAIR(argv[1], '-', 'R')) {
redo = 0;
argstart = 2;
}
else {
argstart = 1;
redo = 1;
}
if ((argstart + 1) >= argc)
{
XK_USAGE(argv[0]);
}
name = argv[argstart++];
for (i = 0; i < Ndynmem; i++)
if (!(Dynmem[i]->flags & F_FIELD) && (strcmp(name, Dynmem[i]->name) == 0))
break;
if ((i < Ndynmem) && !redo) {
if (!redo)
return(SH_SUCC);
if (Sdynmem - Ndynmem < 1)
growmem();
}
else if (Sdynmem - Ndynmem < 2)
growmem();
/*
** Number of memtbls needed: two for structure table and one for
** each field plus one for null termination. The number of
** fields is argc - 2.
*/
if (!(mem = (struct memtbl *) malloc(2 * sizeof(struct memtbl))))
return(SH_FAIL);
if (!(fmem = (struct memtbl *) malloc((argc - 1) * sizeof(struct memtbl))))
return(SH_FAIL);
memset(mem, '\0', 2 * sizeof(struct memtbl));
memset(fmem, '\0', (argc - 1) * sizeof(struct memtbl));
if (i < Ndynmem) {
mem->tbl = Ndynmem++;
freemem(Dynmem[i]);
xkhash_override(Hashnams, name, mem);
}
else {
Ndynmem += 2;
mem->tbl = i + 1;
}
Dynmem[i] = mem;
Dynmem[mem->tbl] = fmem;
mem->flags = F_TBL_IS_PTR;
mem->id = DYNMEM_ID;
mem->name = strdup(name);
mem->kind = K_STRUCT;
for (j = argstart; (j < argc) && argv[j]; j++) {
if (p = strchr(argv[j], ':')) {
fname = malloc(p - argv[j] + 1);
strncpy(fname, argv[j], p - argv[j]);
fname[p - argv[j]] = '\0';
parse_decl(argv[0], fmem + j - argstart, p + 1, 0);
}
else {
fname = strdup(argv[j]);
fmem[j - argstart] = T_unsigned_long[0];
}
fmem[j - argstart].name = fname;
fmem[j - argstart].flags |= F_FIELD;
fmem[j - argstart].delim = 0;
fmem[j - argstart].offset = mem->size;
mem->size += (fmem[j - argstart].ptr) ? sizeof(void *) : fmem[j - argstart].size;
}
return(SH_SUCC);
}
int
do_typedef(
int argc,
char **argv )
{
struct memtbl *mem;
int i, redo;
char *name, *decl;
if (!structInited)
struct_init();
i = 1;
if (argc > 1 && C_PAIR(argv[i], '-', 'R'))
{
redo = 0;
i++;
}
else
redo = 1;
if ((i + 1) >= argc)
{
XK_USAGE(argv[0]);
}
decl = argv[i++];
name = argv[i++];
for (i = 0; i < Ndynmem; i++)
if (!(Dynmem[i]->flags & F_FIELD) && (strcmp(name, Dynmem[i]->name) == 0))
break;
if ((i < Ndynmem) && !redo) {
if (!redo)
return(SH_SUCC);
}
else if (Sdynmem - Ndynmem < 1)
growmem();
if (!(mem = (struct memtbl *) malloc(2 * sizeof(struct memtbl))))
return(SH_FAIL);
mem[1] = Null_tbl;
if (i < Ndynmem) {
freemem(Dynmem[i]);
xkhash_override(Hashnams, name, mem);
}
else
Ndynmem++;
Dynmem[i] = mem;
parse_decl(argv[0], mem, decl, 0);
mem->name = strdup(name);
return(SH_SUCC);
}
static char *
endtok(
char *start )
{
while(*start && !isspace(*start))
start++;
return(start);
}
int
parse_decl(
char * argv0,
struct memtbl *mem,
char *decl,
int tst )
{
struct memtbl *tbl;
char *p, *end;
char hold;
int flag = 0, done;
char * msg;
char * errbuf;
char * errmsg;
end = decl;
do {
p = end;
xk_skipwhite(&p);
end = endtok(p);
hold = *end;
*end = '\0';
done = ((strcmp(p, (const char *) "struct") != 0) &&
(strcmp(p, (const char *) "const") != 0) &&
(strcmp(p, (const char *) "unsigned") != 0) &&
(strcmp(p, (const char *) "signed") != 0) &&
(strcmp(p, (const char *) "union") != 0));
*end = hold;
} while (!done && hold);
if (!p[0]) {
if (tst) {
return(FAIL);
}
errmsg = strdup(GetSharedMsg(DT_BAD_DECL));
printerrf(argv0, errmsg,
decl,NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
mem[0] = T_unsigned_long[0];
return(SUCCESS);
}
hold = *end;
*end = '\0';
tbl = all_tbl_search(p, flag|NOHASH);
*end = hold;
if (!tbl) {
if (tst) {
return(FAIL);
}
errmsg = strdup(GetSharedMsg(DT_BAD_DECL));
printerrf(argv0, errmsg,
decl, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
mem[0] = T_unsigned_long[0];
return(SUCCESS);
}
mem[0] = tbl[0];
for (p = end; *p; p++) {
switch(*p) {
case '[':
{
char *q = strchr(p, ']');
if (!q) {
errmsg=strdup(GETMESSAGE(12,1,
"Found a '[' character without a matching ']'"));
printerr(argv0, errmsg, NULL);
free(errmsg);
continue;
}
p++;
xk_par_int(&p, &(mem->subscr), NULL);
mem->flags &= ~(F_SIMPLE);
if (mem->subscr)
mem->size *= mem->subscr;
p = q;
break;
}
case '*':
if ((mem->kind == K_CHAR) && !(mem->ptr)) {
char *name;
name = mem->name;
mem[0] = T_string_t[0];
mem->name = name;
}
else {
mem->ptr++;
mem->flags &= ~(F_SIMPLE);
}
break;
}
}
return(SUCCESS);
}
int
do_structlist(
int argc,
char **argv )
{
int i, j, id = 0;
char *prefix = NULL;
struct memtbl **memptr = NULL;
char * errmsg;
for (i = 1; (i < argc) && argv[i]; i++) {
if (argv[i][0] == '-') {
for (j = 1; argv[i][j]; j++) {
switch(argv[i][j]) {
case 'i':
if (argv[i][j + 1])
fdef(argv[i] + j + 1, &id);
else
fdef(argv[++i], &id);
j = strlen(argv[i]) - 1;
break;
case 'p':
if (argv[i][j + 1])
prefix = argv[i] + j + 1;
else
prefix = argv[++i];
j = strlen(prefix) - 1;
break;
default:
errmsg = strdup(GetSharedMsg(
DT_UNKNOWN_OPTION));
printerrf(argv[0], errmsg,
argv[i], NULL, NULL, NULL, NULL,
NULL, NULL, NULL);
free(errmsg);
xk_usage(argv[0]);
return(SH_FAIL);
}
}
}
else {
if ((memptr = (memtbl_t **) getaddr(argv[i])) == NULL)
{
errmsg=strdup(GETMESSAGE(12,2,
"Unable to locate the following symbol: %s"));
printerrf(argv[0], errmsg, argv[i],
NULL, NULL, NULL, NULL, NULL, NULL,
NULL);
free(errmsg);
return(SH_FAIL);
}
}
}
if (memptr == NULL)
{
XK_USAGE(argv[0]);
}
for (i = 0; i < Nstructlist; i++)
{
if ((Structlist[i].mem == memptr) &&
(!prefix || (Structlist[i].prefix &&
(strcmp(Structlist[i].prefix, prefix) == 0))) &&
(!id || (Structlist[i].id == id)))
{
return(SH_SUCC);
}
}
add_structlist(memptr, prefix, id);
}
static int
chg_structlist(
struct memtbl **memptr,
int id )
{
int i;
for (i = 0; i < Nstructlist; i++)
if (Structlist[i].id == id) {
Structlist[i].mem = memptr;
return;
}
}
int
add_structlist(
struct memtbl **memptr,
char *prefix,
int id )
{
int i;
if (!Structlist)
Structlist = (struct structlist *) malloc((Nstructlist + 1) * sizeof(struct structlist));
else
Structlist = (struct structlist *) realloc(Structlist, (Nstructlist + 1) * sizeof(struct structlist));
if (!Structlist)
return(SH_FAIL);
Structlist[Nstructlist].mem = memptr;
Structlist[Nstructlist].id = id;
Structlist[Nstructlist].prefix = prefix ? strdup(prefix) : (char *)NULL;
if (memptr[0] && memptr[0][0].name) {
for (i = 1; memptr[i] && memptr[i][0].name && memptr[i][0].name[0]; i++)
if (strcmp(memptr[i][0].name, memptr[i - 1][0].name) < 0)
break;
if (!(memptr[i] && memptr[i][0].name && memptr[i][0].name[0]))
Structlist[Nstructlist].size = i - 1;
else
Structlist[Nstructlist].size = -1;
}
else
Structlist[Nstructlist].size = 0;
Nstructlist++;
return(SH_SUCC);
}
int
strparse(
memtbl_t *tbl,
char **pbuf,
char *val )
{
char *p, *phold;
int ret;
if (!IS_SIMPLE(tbl) && !tbl->ptr && !(tbl->flags & F_TYPE_IS_PTR))
tbl->ptr = 1;
phold = p = strdup(val);
ret = XK_PARSE(tbl, &p, (char *)pbuf, 0, 0, NULL, all_tbl_find);
free(phold);
return(ret != FAIL);
}
int
strfree(
char *buf,
char *type )
{
memtbl_t tbl;
if (parse_decl("strfree", &tbl, type, 1) == FAIL)
return(SH_FAIL);
if (!IS_SIMPLE(&tbl) && !tbl.ptr && !(tbl.flags & F_TYPE_IS_PTR))
tbl.ptr = 1;
if (XK_FREE(&tbl, (char *)&buf, 0, 0, all_tbl_find) == FAIL)
return(SH_FAIL);
return(SH_SUCC);
}
int
do_sizeof(
int argc,
char **argv )
{
memtbl_t *tbl;
char * errmsg;
if (argc <= 1) {
XK_USAGE(argv[0]);
}
if ((tbl = all_tbl_search(argv[1], 0)) == NULL) {
errmsg=strdup(GETMESSAGE(12,3,
"The following is not a valid data type or structure name: %s"));
printerrf(argv[0], errmsg, argv[1], NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
if (argc >= 3) {
char buf[50];
sprintf(buf, use2, argv[2], tbl->ptr ? sizeof(void *) : tbl->size);
env_set(buf);
}
else {
sprintf(xk_ret_buffer, use, tbl->ptr ? sizeof(void *) : tbl->size);
xk_ret_buf = xk_ret_buffer;
}
return(SH_SUCC);
}
memtbl_t *
all_tbl_find(
char *name,
int tbl,
long id )
{
int i;
if (tbl != -1) {
for (i = 0; i < Nstructlist; i++)
if (id == Structlist[i].id)
return(Structlist[i].mem[tbl]);
return(NULL);
}
return(all_tbl_search(name, TYPEONLY));
}
memtbl_t *
all_tbl_search(
char *name,
int flag )
{
int i;
void *found;
if (!structInited)
struct_init();
if (found = (void *) xkhash_find(Hashnams, name))
return((memtbl_t *) found);
else {
int j;
memtbl_t **subtbl;
for (i = 0; i < Nstructlist; i++) {
if (subtbl = Structlist[i].mem)
for (j = 0; subtbl[j]; j++)
if (!(subtbl[j]->flags & F_FIELD) && (strcmp(name, subtbl[j]->name) == 0) && ((subtbl[j]->kind != K_TYPEDEF) || (subtbl[j]->tbl != -1))) {
if (!(flag & NOHASH))
xkhash_add(Hashnams, name, (char *)subtbl[j]);
return(subtbl[j]);
}
}
}
return(NULL);
}
memtbl_t *
asl_find(
memtbl_t *ptbl,
memtbl_t *tbls,
char *fld,
char **pptr )
{
int i;
memtbl_t *tbl;
if (!Structlist)
return(NULL);
if (!pptr && (ptbl == tbls))
return(NULL);
for (i = 0; tbls[i].name; i++) {
if ((xk_Strncmp(tbls[i].name, fld, strlen(fld)) == 0) && (strlen(fld) == strlen(tbls[i].name))) {
if (pptr && ptbl && ((ptbl->kind == K_STRUCT) || (ptbl->kind == K_ANY)))
*pptr += tbls[i].offset;
return(tbls + i);
}
}
for (i = 0; tbls[i].name; i++) {
if ((tbls[i].kind == K_TYPEDEF) || (tbls[i].kind == K_STRUCT) || (tbls[i].kind == K_UNION) || (tbls[i].kind == K_ANY)) {
char *hold;
if (!pptr) {
if ((tbl = asl_find(tbls + i, all_tbl_find(tbls[i].tname, tbls[i].tbl, tbls[i].id), fld, pptr)) != NULL)
return(tbl);
continue;
}
hold = *pptr;
if (tbls[i].ptr) {
int nptr;
nptr = tbls[i].ptr;
/* if you hit a NULL, stop the loop */
do {
*pptr = *((char **) *pptr);
} while (*pptr && --nptr);
}
if (*pptr) {
if (!tbls[i].ptr)
*pptr += tbls[i].offset;
if ((tbl = asl_find(tbls + i, all_tbl_find(tbls[i].tname, tbls[i].tbl, tbls[i].id), fld, pptr)) != NULL)
return(tbl);
*pptr = hold;
}
}
}
return(NULL);
}
static
struct_init( void )
{
char * errhdr;
char * errmsg;
structInited = 1;
Hashnams = (void *) xkhash_init(50);
if (!(Dynmem = (struct memtbl **) malloc(20 * sizeof(struct memtbl *))))
{
errhdr = strdup(GetSharedMsg(DT_ERROR));
errmsg = strdup(GetSharedMsg(DT_ALLOC_FAILURE));
printerr(errhdr, errmsg, NULL);
free(errhdr);
free(errmsg);
exit(1);
}
Dynmem[0] = NULL;
Sdynmem = 20;
Ndynmem = 0;
add_structlist(basemems, "base", BASE_ID);
add_structlist(Dynmem, "dynamic", DYNMEM_ID);
}

View file

@ -1,97 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: struct.h /main/4 1995/11/01 15:56:45 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: struct.h
**
** Project: CDE
**
** Description: Public include file for struct.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_struct_h
#define _Dtksh_struct_h
#include "exksh.h"
extern memtbl_t * ffind(
memtbl_t *tbl,
char *fld,
char **pptr) ;
extern int do_struct(
int argc,
char **argv) ;
extern int do_typedef(
int argc,
char **argv) ;
extern int parse_decl(
char * argv0,
struct memtbl *mem,
char *decl,
int tst) ;
extern int do_structlist(
int argc,
char **argv) ;
extern int add_structlist(
struct memtbl **memptr,
char *prefix,
int id) ;
extern int strparse(
memtbl_t *tbl,
char **pbuf,
char *val) ;
extern int strfree(
char *buf,
char *type) ;
extern int do_sizeof(
int argc,
char **argv) ;
extern memtbl_t * all_tbl_find(
char *name,
int tbl,
long id) ;
extern memtbl_t * all_tbl_search(
char *name,
int flag) ;
extern memtbl_t * asl_find(
memtbl_t *ptbl,
memtbl_t *tbls,
char *fld,
char **pptr) ;
#endif /* _Dtksh_struct_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,180 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: symbolic.c /main/4 1995/11/01 15:56:54 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#include "name.h"
#include "shell.h"
#include "stdio.h"
#include "exksh.h" /* which includes sys/types.h */
#include "struct.h" /* which includes sys/types.h */
#include <string.h>
#include "msgs.h"
struct symlist *Symlist = NULL;
int Nsymlist;
/*
** There is an implicit dirty trick going on here. It is effective,
** efficient and will work anywhere but it is tricky. A memtbl has
** strings in it. The fact that a byte-by-byte comparison is being
** done on a memtbl means that pointers are being compared. This
** means that EVERY UNIQUE MEMTBL SHOULD HAVE SOME UNIQUE FIELD (i.e.
** in this case, the string for the name field). If somebody uses
** an algorithm in do_struct() that saves string space (by seeing if
** the same string is lying around) this code will break and an ID
** field will be necessary to maintain uniqueness.
*/
struct symlist *
fsymbolic(
struct memtbl *tbl )
{
int i;
for (i = 0; i < Nsymlist; i++)
if (memcmp(tbl, &Symlist[i].tbl, sizeof(struct memtbl)) == 0)
return(Symlist + i);
return(NULL);
}
int
do_symbolic(
int argc,
char **argv )
{
int i, nsyms, isflag;
unsigned long j;
struct symarray syms[50];
struct memtbl *tbl;
char *p;
char *type = NULL;
char * errmsg;
nsyms = 0;
isflag = 0;
for (i = 1; (i < argc) && argv[i]; i++) {
if (argv[i][0] == '-') {
for (j = 1; argv[i][j]; j++) {
switch(argv[i][j]) {
case 'm':
isflag = 1;
break;
case 't':
if (argv[i][j + 1])
type = argv[i] + j + 1;
else
type = argv[++i];
j = strlen(argv[i]) - 1;
break;
}
}
}
else {
syms[nsyms++].str = argv[i];
if (nsyms == 50)
break;
}
}
if ((type == NULL) || (!nsyms)) {
XK_USAGE(argv[0]);
}
if (p = strchr(type, '.')) {
*p = '\0';
if ((tbl = all_tbl_search(type, 0)) == NULL) {
*p = '.';
errmsg = strdup(GetSharedMsg(DT_UNDEF_TYPE));
printerrf(argv[0], errmsg, type, NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
if ((tbl = ffind(tbl, p + 1, NULL)) == NULL) {
errmsg=strdup(GETMESSAGE(13,1,
"Unable to locate a field named '%s' for the type '%s'"));
printerrf(argv[0], errmsg, p + 1, type, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
*p = '.';
return(SH_FAIL);
}
*p = '.';
}
else if ((tbl = all_tbl_search(type, 0)) == NULL) {
errmsg = strdup(GetSharedMsg(DT_UNDEF_TYPE));
printerrf(argv[0], errmsg, type, NULL, NULL,
NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
for (i = 0; i < nsyms; i++) {
if (!fdef(syms[i].str, &j)) {
errmsg=strdup(GETMESSAGE(13,2,
"The name '%s' has not been defined"));
printerrf(argv[0], errmsg, syms[i].str,
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
free(errmsg);
return(SH_FAIL);
}
syms[i].str = strdup(syms[i].str);
syms[i].addr = j;
}
add_symbolic(isflag, tbl, syms, nsyms);
return(SH_SUCC);
}
int
add_symbolic(
int isflag,
struct memtbl *tbl,
struct symarray *syms,
int nsyms )
{
struct symlist *symptr;
if ((symptr = fsymbolic(tbl)) == NULL) {
if (!Symlist)
Symlist = (struct symlist *) malloc((Nsymlist + 1) * sizeof(struct symlist));
else
Symlist = (struct symlist *) realloc(Symlist, (Nsymlist + 1) * sizeof(struct symlist));
if (!Symlist)
return(SH_FAIL);
symptr = Symlist + Nsymlist;
Nsymlist++;
}
else
free(symptr->syms);
symptr->tbl = *tbl;
symptr->nsyms = nsyms;
symptr->isflag = isflag;
symptr->syms = (struct symarray *) malloc(nsyms * sizeof(struct symarray));
memcpy(symptr->syms, syms, nsyms * sizeof(struct symarray));
}

View file

@ -1,61 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: symbolic.h /main/4 1995/11/01 15:57:03 rswiston $ */
/************************************<+>*************************************
****************************************************************************
**
** File: symbolic.h
**
** Project: CDE
**
** Description: Public include file for symbolic.c
**
**
** (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992
** by Hewlett-Packard Company
**
**
**
****************************************************************************
************************************<+>*************************************/
#ifndef _Dtksh_symbolic_h
#define _Dtksh_symbolic_h
extern struct symlist * fsymbolic(
struct memtbl *tbl) ;
extern int do_symbolic(
int argc,
char **argv) ;
extern int add_symbolic(
int isflag,
struct memtbl *tbl,
struct symarray *syms,
int nsyms) ;
#endif /* _Dtksh_symbolic_h */
/* DON'T ADD ANYTHING AFTER THIS #endif */

View file

@ -1,180 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: variables.c /main/3 1995/11/01 15:57:22 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1993 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Advanced Software Technology Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* {ulysses,attmail}!dgk *
* dgk@ulysses.att.com *
* David Korn 908-582-7975 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#define __VOID__ __V_
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 3
#define mount _AST__mount
#include <ast.h>
#include "FEATURE/options"
#include "FEATURE/dynamic"
#include <shell.h>
#include "shtable.h"
#include "name.h"
#include "exextra.h"
#include "docall.h"
#include "msgs.h"
/*
* This is the list of built-in shell variables and default values
* and default attributes.
*/
const struct shtable2 shtab_variables[] =
{
"PATH", 0, (char*)0,
"PS1", 0, (char*)0,
"PS2", NV_NOFREE, "> ",
"IFS", NV_NOFREE, " \t\n",
"PWD", 0, (char*)0,
"HOME", 0, (char*)0,
"MAIL", 0, (char*)0,
"REPLY", 0, (char*)0,
"SHELL", NV_NOFREE, "/bin/sh",
"EDITOR", 0, (char*)0,
"MAILCHECK", NV_NOFREE|NV_INTEGER, (char*)0,
"RANDOM", NV_NOFREE|NV_INTEGER, (char*)0,
"ENV", 0, (char*)0,
"HISTFILE", 0, (char*)0,
"HISTSIZE", 0, (char*)0,
"HISTEDIT", NV_NOFREE, (char*)0,
"HISTCMD", NV_NOFREE|NV_INTEGER, (char*)0,
"FCEDIT", NV_NOFREE, "/bin/ed",
"CDPATH", 0, (char*)0,
"MAILPATH", 0, (char*)0,
"PS3", NV_NOFREE, "#? ",
"OLDPWD", 0, (char*)0,
"VISUAL", 0, (char*)0,
"COLUMNS", 0, (char*)0,
"LINES", 0, (char*)0,
"PPID", NV_NOFREE|NV_INTEGER, (char*)0,
"_", NV_EXPORT, (char*)0,
"TMOUT", NV_NOFREE|NV_INTEGER, (char*)0,
"SECONDS", NV_NOFREE|NV_INTEGER|NV_DOUBLE, (char*)0,
"LINENO", NV_NOFREE|NV_INTEGER, (char*)0,
"OPTARG", 0, (char*)0,
"OPTIND", NV_NOFREE|NV_INTEGER, (char*)0,
"PS4", 0, (char*)0,
"FPATH", 0, (char*)0,
"LANG", 0, (char*)0,
"LC_CTYPE", 0, (char*)0,
"FIGNORE", 0, (char*)0,
".sh", 0, (char*)0,
".sh.edchar", 0, (char*)0,
".sh.edcol", 0, (char*)0,
".sh.edtext", 0, (char*)0,
".sh.edmode", 0, (char*)0,
".sh.name", 0, (char*)0,
".sh.subscript",0, (char*)0,
".sh.value", 0, (char*)0,
".sh.version", NV_NOFREE, (char*)(&e_version[5]),
#ifdef SHOPT_FS_3D
"VPATH", 0, (char*)0,
#endif /* SHOPT_FS_3D */
#ifdef SHOPT_VPIX
"DOSPATH", 0, (char*)0,
"VPIXDIR", 0, (char*)0,
#endif /* SHOPT_VPIX */
#ifdef MULTIBYTE
"CSWIDTH", 0, (char*)0,
#endif /* MULTIBYTE */
EXKSH_EXTRA_VAR
"", 0, (char*)0
};

View file

@ -1,13 +0,0 @@
if [ "$_HOLDENV_" ]
then
ENV=$_HOLDENV_
. $ENV
else
unset ENV
fi
unset _HOLDENV_
if [ ! "$DTKSHPS1" ]
then DTKSHPS1="[DTKSH] $PS1" export DTKSHPS1
fi
PS1="$DTKSHPS1"
call dtk_libinit

View file

@ -1,77 +0,0 @@
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: xmname.c /main/3 1995/11/01 15:59:34 rswiston $ */
/* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
/* UNIX System Laboratories, Inc. */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#define mount _AST_mount
#include <ast.h>
#include <signal.h>
#include "shtable.h"
#include "name.h"
#ifdef KSHELL
# include "builtins.h"
# include "jobs.h"
# include "FEATURE/cmds"
#if defined(__STDC__) || defined(__STDPP__)
# define bltin(x) (b_##x)
#else
# define bltin(x) (b_/**/x)
#endif
#else
# define bltin(x) 0
#endif
#include <X11/X.h>
#include <X11/Intrinsic.h>
#include <X11/IntrinsicP.h>
#define NO_AST
#include "dtksh.h"
#undef NO_AST
#include "dtextra.h"
#include "xmextra.h"
#include "msgs.h"
#define VALPTR(x) ((char*)x)
const struct shtable3 dtk_functions[] = {
DTK_EXTRA_TABLE
DTK_EXTRA_TABLE2
DTK_TK_EXTRA_TABLE
DTK_TK_LIST_TABLE
DTK_TK_TEXT_TABLE
{ NULL, 0, NULL }
};
const struct shtable2 dtk_aliases[] = {
DTK_EXTRA_ALIAS
DTK_TK_EXTRA_ALIAS
{ NULL, 0, NULL }
};