run a bit of indent over it
not really suitable tho
This commit is contained in:
127
main.c
127
main.c
@ -1,4 +1,4 @@
|
|||||||
/** $MirOS: src/bin/mksh/main.c,v 1.11 2005/06/08 21:51:21 tg Exp $ */
|
/** $MirOS: src/bin/mksh/main.c,v 1.12 2005/06/08 22:22:24 tg Exp $ */
|
||||||
/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
/* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
|
/* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
|
||||||
@ -13,21 +13,21 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.11 2005/06/08 21:51:21 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.12 2005/06/08 22:22:24 tg Exp $");
|
||||||
|
|
||||||
const char ksh_version[] = "@(#)MIRBSD KSH R23 2005/06/08";
|
const char ksh_version[] = "@(#)MIRBSD KSH R23 2005/06/08";
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
static void reclaim(void);
|
static void reclaim(void);
|
||||||
static void remove_temps(struct temp *tp);
|
static void remove_temps(struct temp * tp);
|
||||||
static int is_restricted(char *name);
|
static int is_restricted(char *name);
|
||||||
|
|
||||||
static const char initifs[] = "IFS= \t\n";
|
static const char initifs[] = "IFS= \t\n";
|
||||||
|
|
||||||
static const char initsubs[] = "${PS2=> } ${PS3=#? } ${PS4=+ }";
|
static const char initsubs[] = "${PS2=> } ${PS3=#? } ${PS4=+ }";
|
||||||
|
|
||||||
static const char *initcoms [] = {
|
static const char *initcoms[] = {
|
||||||
"typeset", "-r", "KSH_VERSION", NULL,
|
"typeset", "-r", "KSH_VERSION", NULL,
|
||||||
"typeset", "-x", "SHELL", "PATH", "HOME", NULL,
|
"typeset", "-x", "SHELL", "PATH", "HOME", NULL,
|
||||||
"typeset", "-i", "PGRP=0", "PPID", NULL,
|
"typeset", "-i", "PGRP=0", "PPID", NULL,
|
||||||
@ -35,24 +35,24 @@ static const char *initcoms [] = {
|
|||||||
"eval", "typeset -i RANDOM SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
|
"eval", "typeset -i RANDOM SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
|
||||||
"alias",
|
"alias",
|
||||||
/* Standard ksh aliases */
|
/* Standard ksh aliases */
|
||||||
"hash=alias -t", /* not "alias -t --": hash -r needs to work */
|
"hash=alias -t", /* not "alias -t --": hash -r needs to work */
|
||||||
"type=whence -v",
|
"type=whence -v",
|
||||||
"stop=kill -STOP",
|
"stop=kill -STOP",
|
||||||
"suspend=kill -STOP $$",
|
"suspend=kill -STOP $$",
|
||||||
"autoload=typeset -fu",
|
"autoload=typeset -fu",
|
||||||
"functions=typeset -f",
|
"functions=typeset -f",
|
||||||
"history=fc -l",
|
"history=fc -l",
|
||||||
"integer=typeset -i",
|
"integer=typeset -i",
|
||||||
"nohup=nohup ",
|
"nohup=nohup ",
|
||||||
"local=typeset",
|
"local=typeset",
|
||||||
"r=fc -e -",
|
"r=fc -e -",
|
||||||
/* Aliases that are builtin commands in at&t */
|
/* Aliases that are builtin commands in at&t */
|
||||||
"login=exec login",
|
"login=exec login",
|
||||||
NULL,
|
NULL,
|
||||||
/* this is what at&t ksh seems to track, with the addition of emacs */
|
/* this is what at&t ksh seems to track, with the addition of emacs */
|
||||||
"alias", "-tU",
|
"alias", "-tU",
|
||||||
"cat", "cc", "chmod", "cp", "date", "ed", "emacs", "grep", "ls",
|
"cat", "cc", "chmod", "cp", "date", "ed", "emacs", "grep", "ls",
|
||||||
"make", "mv", "pr", "rm", "sed", "sh", "vi", "who", NULL,
|
"make", "mv", "pr", "rm", "sed", "sh", "vi", "who", NULL,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ main(int argc, char *argv[])
|
|||||||
"mksh", NULL
|
"mksh", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
argv = (char **) empty_argv;
|
argv = (char **)empty_argv;
|
||||||
argc = 1;
|
argc = 1;
|
||||||
}
|
}
|
||||||
kshname = *argv;
|
kshname = *argv;
|
||||||
@ -171,7 +171,7 @@ main(int argc, char *argv[])
|
|||||||
/* import environment */
|
/* import environment */
|
||||||
if (environ != NULL)
|
if (environ != NULL)
|
||||||
for (wp = environ; *wp != NULL; wp++)
|
for (wp = environ; *wp != NULL; wp++)
|
||||||
typeset(*wp, IMPORT|EXPORT, 0, 0, 0);
|
typeset(*wp, IMPORT | EXPORT, 0, 0, 0);
|
||||||
|
|
||||||
kshpid = procpid = getpid();
|
kshpid = procpid = getpid();
|
||||||
typeset(initifs, 0, 0, 0, 0); /* for security */
|
typeset(initifs, 0, 0, 0, 0); /* for security */
|
||||||
@ -206,13 +206,13 @@ main(int argc, char *argv[])
|
|||||||
#if !HAVE_ARC4RANDOM
|
#if !HAVE_ARC4RANDOM
|
||||||
srand((*((long *)kshname)) ^ ((long)time(NULL) * kshpid * ppid));
|
srand((*((long *)kshname)) ^ ((long)time(NULL) * kshpid * ppid));
|
||||||
#endif
|
#endif
|
||||||
setint(global("PPID"), (long) ppid);
|
setint(global("PPID"), (long)ppid);
|
||||||
/* setstr can't fail here */
|
/* setstr can't fail here */
|
||||||
if (!Flag(FSH))
|
if (!Flag(FSH))
|
||||||
setstr(global("KSH_VERSION"), ksh_version, KSH_RETURN_ERROR);
|
setstr(global("KSH_VERSION"), ksh_version, KSH_RETURN_ERROR);
|
||||||
|
|
||||||
/* execute initialisation statements */
|
/* execute initialisation statements */
|
||||||
for (wp = (char**) initcoms; *wp != NULL; wp++) {
|
for (wp = (char **)initcoms; *wp != NULL; wp++) {
|
||||||
shcomexec(wp);
|
shcomexec(wp);
|
||||||
for (; *wp != NULL; wp++)
|
for (; *wp != NULL; wp++)
|
||||||
;
|
;
|
||||||
@ -254,7 +254,8 @@ main(int argc, char *argv[])
|
|||||||
} else if (argi < argc && !Flag(FSTDIN)) {
|
} else if (argi < argc && !Flag(FSTDIN)) {
|
||||||
s = pushs(SFILE, ATEMP);
|
s = pushs(SFILE, ATEMP);
|
||||||
s->file = kshname = argv[argi++];
|
s->file = kshname = argv[argi++];
|
||||||
s->u.shf = shf_open(s->file, O_RDONLY, 0, SHF_MAPHI|SHF_CLEXEC);
|
s->u.shf = shf_open(s->file, O_RDONLY, 0,
|
||||||
|
SHF_MAPHI | SHF_CLEXEC);
|
||||||
if (s->u.shf == NULL) {
|
if (s->u.shf == NULL) {
|
||||||
exstat = 127; /* POSIX */
|
exstat = 127; /* POSIX */
|
||||||
errorf("%s: %s", s->file, strerror(errno));
|
errorf("%s: %s", s->file, strerror(errno));
|
||||||
@ -294,7 +295,7 @@ main(int argc, char *argv[])
|
|||||||
l = e->loc;
|
l = e->loc;
|
||||||
l->argv = &argv[argi - 1];
|
l->argv = &argv[argi - 1];
|
||||||
l->argc = argc - argi;
|
l->argc = argc - argi;
|
||||||
l->argv[0] = (char *) kshname;
|
l->argv[0] = (char *)kshname;
|
||||||
getopts_reset(1);
|
getopts_reset(1);
|
||||||
|
|
||||||
/* Disable during .profile/ENV reading */
|
/* Disable during .profile/ENV reading */
|
||||||
@ -315,7 +316,6 @@ main(int argc, char *argv[])
|
|||||||
include(substitute("$HOME/.profile", 0), 0,
|
include(substitute("$HOME/.profile", 0), 0,
|
||||||
NULL, 1);
|
NULL, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flag(FPRIVILEGED))
|
if (Flag(FPRIVILEGED))
|
||||||
include("/etc/suid_profile", 0, NULL, 1);
|
include("/etc/suid_profile", 0, NULL, 1);
|
||||||
else {
|
else {
|
||||||
@ -335,7 +335,7 @@ main(int argc, char *argv[])
|
|||||||
"ENV", "SHELL",
|
"ENV", "SHELL",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
shcomexec((char **) restr_com);
|
shcomexec((char **)restr_com);
|
||||||
/* After typeset command... */
|
/* After typeset command... */
|
||||||
Flag(FRESTRICTED) = 1;
|
Flag(FRESTRICTED) = 1;
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ include(const char *name, int argc, char **argv, int intr_ok)
|
|||||||
volatile int old_argc;
|
volatile int old_argc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
shf = shf_open(name, O_RDONLY, 0, SHF_MAPHI|SHF_CLEXEC);
|
shf = shf_open(name, O_RDONLY, 0, SHF_MAPHI | SHF_CLEXEC);
|
||||||
if (shf == NULL)
|
if (shf == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ command(const char *comm)
|
|||||||
* run the commands from the input source, returning status.
|
* run the commands from the input source, returning status.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
shell(Source *volatile s, volatile int toplevel)
|
shell(Source * volatile s, volatile int toplevel)
|
||||||
{
|
{
|
||||||
struct op *t;
|
struct op *t;
|
||||||
volatile int wastty = s->flags & SF_TTY;
|
volatile int wastty = s->flags & SF_TTY;
|
||||||
@ -483,7 +483,6 @@ shell(Source *volatile s, volatile int toplevel)
|
|||||||
/*NOREACHED*/
|
/*NOREACHED*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (trap)
|
if (trap)
|
||||||
runtraps(0);
|
runtraps(0);
|
||||||
@ -494,12 +493,10 @@ shell(Source *volatile s, volatile int toplevel)
|
|||||||
else
|
else
|
||||||
s->flags &= ~SF_ECHO;
|
s->flags &= ~SF_ECHO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
j_notify();
|
j_notify();
|
||||||
set_prompt(PS1, s);
|
set_prompt(PS1, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
t = compile(s);
|
t = compile(s);
|
||||||
if (t != NULL && t->type == TEOF) {
|
if (t != NULL && t->type == TEOF) {
|
||||||
if (wastty && Flag(FIGNOREEOF) && --attempts > 0) {
|
if (wastty && Flag(FIGNOREEOF) && --attempts > 0) {
|
||||||
@ -520,7 +517,6 @@ shell(Source *volatile s, volatile int toplevel)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t && (!Flag(FNOEXEC) || (s->flags & SF_TTY)))
|
if (t && (!Flag(FNOEXEC) || (s->flags & SF_TTY)))
|
||||||
exstat = execute(t, 0);
|
exstat = execute(t, 0);
|
||||||
|
|
||||||
@ -597,10 +593,9 @@ quitenv(struct shf *shf)
|
|||||||
/* if ep->savefd[fd] < 0, means fd was closed */
|
/* if ep->savefd[fd] < 0, means fd was closed */
|
||||||
if (ep->savefd[fd])
|
if (ep->savefd[fd])
|
||||||
restfd(fd, ep->savefd[fd]);
|
restfd(fd, ep->savefd[fd]);
|
||||||
if (ep->savefd[2]) /* Clear any write errors */
|
if (ep->savefd[2]) /* Clear any write errors */
|
||||||
shf_reopen(2, SHF_WR, shl_out);
|
shf_reopen(2, SHF_WR, shl_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bottom of the stack.
|
/* Bottom of the stack.
|
||||||
* Either main shell is exiting or cleanup_parents_env() was called.
|
* Either main shell is exiting or cleanup_parents_env() was called.
|
||||||
*/
|
*/
|
||||||
@ -620,7 +615,7 @@ quitenv(struct shf *shf)
|
|||||||
if ((sig == SIGINT || sig == SIGTERM) &&
|
if ((sig == SIGINT || sig == SIGTERM) &&
|
||||||
getpgrp() == kshpid) {
|
getpgrp() == kshpid) {
|
||||||
setsig(&sigtraps[sig], SIG_DFL,
|
setsig(&sigtraps[sig], SIG_DFL,
|
||||||
SS_RESTORE_CURR|SS_FORCE);
|
SS_RESTORE_CURR | SS_FORCE);
|
||||||
kill(0, sig);
|
kill(0, sig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -719,8 +714,8 @@ aerror(Area *ap __attribute__((unused)), const char *msg)
|
|||||||
void
|
void
|
||||||
tty_init(int init_ttystate)
|
tty_init(int init_ttystate)
|
||||||
{
|
{
|
||||||
int do_close = 1;
|
int do_close = 1;
|
||||||
int tfd;
|
int tfd;
|
||||||
|
|
||||||
if (tty_fd >= 0) {
|
if (tty_fd >= 0) {
|
||||||
close(tty_fd);
|
close(tty_fd);
|
||||||
@ -736,7 +731,6 @@ tty_init(int init_ttystate)
|
|||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tfd < 0) {
|
if (tfd < 0) {
|
||||||
do_close = 0;
|
do_close = 0;
|
||||||
if (isatty(0))
|
if (isatty(0))
|
||||||
@ -905,7 +899,7 @@ can_seek(int fd)
|
|||||||
SHF_UNBUF : 0;
|
SHF_UNBUF : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct shf shf_iob[3];
|
struct shf shf_iob[3];
|
||||||
|
|
||||||
void
|
void
|
||||||
initio(void)
|
initio(void)
|
||||||
@ -1113,7 +1107,7 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist)
|
|||||||
dir = tmpdir ? tmpdir : "/tmp";
|
dir = tmpdir ? tmpdir : "/tmp";
|
||||||
len = strlen(dir) + 6 + 10 + 1;
|
len = strlen(dir) + 6 + 10 + 1;
|
||||||
tp = (struct temp *) alloc(sizeof(struct temp) + len, ap);
|
tp = (struct temp *) alloc(sizeof(struct temp) + len, ap);
|
||||||
tp->name = pathname = (char *) &tp[1];
|
tp->name = pathname = (char *)&tp[1];
|
||||||
tp->shf = NULL;
|
tp->shf = NULL;
|
||||||
tp->type = type;
|
tp->type = type;
|
||||||
shf_snprintf(pathname, len, "%s/mksh.XXXXXXXXXX", dir);
|
shf_snprintf(pathname, len, "%s/mksh.XXXXXXXXXX", dir);
|
||||||
@ -1128,8 +1122,8 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist)
|
|||||||
|
|
||||||
#define INIT_TBLS 8 /* initial table size (power of 2) */
|
#define INIT_TBLS 8 /* initial table size (power of 2) */
|
||||||
|
|
||||||
static void texpand(struct table *, int);
|
static void texpand(struct table *, int);
|
||||||
static int tnamecmp(void *, void *);
|
static int tnamecmp(void *, void *);
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
hash(const char *n)
|
hash(const char *n)
|
||||||
@ -1159,28 +1153,28 @@ texpand(struct table *tp, int nsize)
|
|||||||
struct tbl **ntblp, **otblp = tp->tbls;
|
struct tbl **ntblp, **otblp = tp->tbls;
|
||||||
int osize = tp->size;
|
int osize = tp->size;
|
||||||
|
|
||||||
ntblp = (struct tbl**) alloc(sizeofN(struct tbl *, nsize), tp->areap);
|
ntblp = (struct tbl **)alloc(sizeofN(struct tbl *, nsize), tp->areap);
|
||||||
for (i = 0; i < nsize; i++)
|
for (i = 0; i < nsize; i++)
|
||||||
ntblp[i] = NULL;
|
ntblp[i] = NULL;
|
||||||
tp->size = nsize;
|
tp->size = nsize;
|
||||||
tp->nfree = 8*nsize/10; /* table can get 80% full */
|
tp->nfree = 8 * nsize / 10; /* table can get 80% full */
|
||||||
tp->tbls = ntblp;
|
tp->tbls = ntblp;
|
||||||
if (otblp == NULL)
|
if (otblp == NULL)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < osize; i++)
|
for (i = 0; i < osize; i++)
|
||||||
if ((tblp = otblp[i]) != NULL) {
|
if ((tblp = otblp[i]) != NULL) {
|
||||||
if ((tblp->flag&DEFINED)) {
|
if ((tblp->flag & DEFINED)) {
|
||||||
for (p = &ntblp[hash(tblp->name) &
|
for (p = &ntblp[hash(tblp->name) &
|
||||||
(tp->size-1)]; *p != NULL; p--)
|
(tp->size - 1)]; *p != NULL; p--)
|
||||||
if (p == ntblp) /* wrap */
|
if (p == ntblp) /* wrap */
|
||||||
p += tp->size;
|
p += tp->size;
|
||||||
*p = tblp;
|
*p = tblp;
|
||||||
tp->nfree--;
|
tp->nfree--;
|
||||||
} else if (!(tblp->flag & FINUSE)) {
|
} else if (!(tblp->flag & FINUSE)) {
|
||||||
afree((void*)tblp, tp->areap);
|
afree((void *)tblp, tp->areap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
afree((void*)otblp, tp->areap);
|
afree((void *)otblp, tp->areap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* table */
|
/* table */
|
||||||
@ -1195,11 +1189,11 @@ tsearch(struct table *tp, const char *n, unsigned int h)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* search for name in hashed table */
|
/* search for name in hashed table */
|
||||||
for (pp = &tp->tbls[h & (tp->size-1)]; (p = *pp) != NULL; pp--) {
|
for (pp = &tp->tbls[h & (tp->size - 1)]; (p = *pp) != NULL; pp--) {
|
||||||
if (*p->name == *n && strcmp(p->name, n) == 0 &&
|
if (*p->name == *n && strcmp(p->name, n) == 0 &&
|
||||||
(p->flag&DEFINED))
|
(p->flag & DEFINED))
|
||||||
return p;
|
return p;
|
||||||
if (pp == tp->tbls) /* wrap */
|
if (pp == tp->tbls) /* wrap */
|
||||||
pp += tp->size;
|
pp += tp->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,24 +1211,23 @@ tenter(struct table *tp, const char *n, unsigned int h)
|
|||||||
|
|
||||||
if (tp->size == 0)
|
if (tp->size == 0)
|
||||||
texpand(tp, INIT_TBLS);
|
texpand(tp, INIT_TBLS);
|
||||||
Search:
|
Search:
|
||||||
/* search for name in hashed table */
|
/* search for name in hashed table */
|
||||||
for (pp = &tp->tbls[h & (tp->size-1)]; (p = *pp) != NULL; pp--) {
|
for (pp = &tp->tbls[h & (tp->size - 1)]; (p = *pp) != NULL; pp--) {
|
||||||
if (*p->name == *n && strcmp(p->name, n) == 0)
|
if (*p->name == *n && strcmp(p->name, n) == 0)
|
||||||
return p; /* found */
|
return p; /* found */
|
||||||
if (pp == tp->tbls) /* wrap */
|
if (pp == tp->tbls) /* wrap */
|
||||||
pp += tp->size;
|
pp += tp->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tp->nfree <= 0) { /* too full */
|
if (tp->nfree <= 0) { /* too full */
|
||||||
texpand(tp, 2*tp->size);
|
texpand(tp, 2 * tp->size);
|
||||||
goto Search;
|
goto Search;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create new tbl entry */
|
/* create new tbl entry */
|
||||||
len = strlen(n) + 1;
|
len = strlen(n) + 1;
|
||||||
p = (struct tbl *) alloc(offsetof(struct tbl, name[0]) + len,
|
p = (struct tbl *)alloc(offsetof(struct tbl, name[0])+len,
|
||||||
tp->areap);
|
tp->areap);
|
||||||
p->flag = 0;
|
p->flag = 0;
|
||||||
p->type = 0;
|
p->type = 0;
|
||||||
p->areap = tp->areap;
|
p->areap = tp->areap;
|
||||||
@ -1266,7 +1259,7 @@ tnext(struct tstate *ts)
|
|||||||
{
|
{
|
||||||
while (--ts->left >= 0) {
|
while (--ts->left >= 0) {
|
||||||
struct tbl *p = *ts->next++;
|
struct tbl *p = *ts->next++;
|
||||||
if (p != NULL && (p->flag&DEFINED))
|
if (p != NULL && (p->flag & DEFINED))
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1284,15 +1277,15 @@ tsort(struct table *tp)
|
|||||||
int i;
|
int i;
|
||||||
struct tbl **p, **sp, **dp;
|
struct tbl **p, **sp, **dp;
|
||||||
|
|
||||||
p = (struct tbl **)alloc(sizeofN(struct tbl *, tp->size+1), ATEMP);
|
p = (struct tbl **)alloc(sizeofN(struct tbl *, tp->size + 1), ATEMP);
|
||||||
sp = tp->tbls; /* source */
|
sp = tp->tbls; /* source */
|
||||||
dp = p; /* dest */
|
dp = p; /* dest */
|
||||||
for (i = 0; i < tp->size; i++)
|
for (i = 0; i < tp->size; i++)
|
||||||
if ((*dp = *sp++) != NULL && (((*dp)->flag&DEFINED) ||
|
if ((*dp = *sp++) != NULL && (((*dp)->flag & DEFINED) ||
|
||||||
((*dp)->flag&ARRAY)))
|
((*dp)->flag & ARRAY)))
|
||||||
dp++;
|
dp++;
|
||||||
i = dp - p;
|
i = dp - p;
|
||||||
qsortp((void**)p, (size_t)i, tnamecmp);
|
qsortp((void **)p, (size_t)i, tnamecmp);
|
||||||
p[i] = NULL;
|
p[i] = NULL;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user