本文整理汇总了C++中cleanup_until函数的典型用法代码示例。如果您正苦于以下问题:C++ cleanup_until函数的具体用法?C++ cleanup_until怎么用?C++ cleanup_until使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cleanup_until函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: period_cmd
/*
* Karl Kleinpaste, 18 Jan 1984.
* Added period_cmd(), which executes the alias "periodic" every
* $tperiod minutes. Useful for occasional checking of msgs and such.
*/
void
period_cmd(void)
{
Char *vp;
time_t t, interval;
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
if (periodic_active) { /* an error must have been caught */
aliasrun(2, STRunalias, STRperiodic);
xprintf("%s", CGETS(22, 6, "Faulty alias 'periodic' removed.\n"));
goto leave;
}
periodic_active = 1;
if (!whyles && adrof1(STRperiodic, &aliases)) {
vp = varval(STRtperiod);
if (vp == STRNULL) {
aliasrun(1, STRperiodic, NULL);
goto leave;
}
interval = getn(vp);
(void) time(&t);
if (t - t_period >= interval * 60) {
t_period = t;
aliasrun(1, STRperiodic, NULL);
}
}
leave:
periodic_active = 0;
cleanup_until(&pintr_disabled);
}
开发者ID:VojtechVitek,项目名称:tcsh,代码行数:36,代码来源:tc.func.c
示例2: dgoto
static Char *
dgoto(Char *cp)
{
Char *dp, *ret;
if (!ABSOLUTEP(cp))
{
Char *p, *q;
size_t cwdlen;
cwdlen = Strlen(dcwd->di_name);
if (cwdlen == 1) /* root */
cwdlen = 0;
dp = xmalloc((cwdlen + Strlen(cp) + 2) * sizeof(Char));
for (p = dp, q = dcwd->di_name; (*p++ = *q++) != '\0';)
continue;
if (cwdlen)
p[-1] = '/';
else
p--; /* don't add a / after root */
Strcpy(p, cp);
xfree(cp);
cp = dp;
dp += cwdlen;
}
else
dp = cp;
#if defined(WINNT_NATIVE)
return agetcwd();
#elif defined(__CYGWIN__)
if (ABSOLUTEP(cp) && cp[1] == ':') { /* Only DOS paths are treated that way */
return agetcwd();
} else {
cleanup_push(cp, xfree);
ret = dcanon(cp, dp);
cleanup_ignore(cp);
cleanup_until(cp);
}
#else /* !WINNT_NATIVE */
cleanup_push(cp, xfree);
ret = dcanon(cp, dp);
cleanup_ignore(cp);
cleanup_until(cp);
#endif /* WINNT_NATIVE */
return ret;
}
开发者ID:lukem,项目名称:tcsh,代码行数:47,代码来源:sh.dir.c
示例3: dotitle
void dotitle(Char **vc, struct command * c) {
int k;
char titlebuf[512];
char errbuf[128],err2[128];
char **v;
Char **nvc;
UNREFERENCED_PARAMETER(c);
vc++;
nvc = glob_all_or_error(vc);
if (nvc == NULL)
return;
if (nvc != vc)
cleanup_push(nvc, blk_cleanup);
if ((k = GetConsoleTitle(titlebuf, sizeof(titlebuf))) != 0) {
setcopy(STRoldtitle,str2short(titlebuf),
VAR_READWRITE|VAR_NOGLOB);
}
titlebuf[0] = '\0';
v = short2blk(nvc);
if (nvc != vc)
cleanup_until(nvc);
cleanup_push((Char **)v, blk_cleanup);
for (k = 0; v[k] != NULL ; k++){
__try {
StringCbCat(titlebuf,sizeof(titlebuf),v[k]);
StringCbCat(titlebuf,sizeof(titlebuf)," ");
}
__except(GetExceptionCode()) {
stderror(ERR_TOOMANY);
}
}
if (!SetConsoleTitle(titlebuf) ) {
make_err_str(GetLastError(),errbuf,128);
(void)StringCbPrintf(err2,sizeof(err2),"%s",v[k]);
stderror(ERR_SYSTEM,err2,errbuf);
}
cleanup_until((Char **)v);
return;
}
开发者ID:phase,项目名称:tcsh,代码行数:44,代码来源:ntfunc.c
示例4: EchoTC
/*
* Print the termcap string out with variable substitution
*/
void
EchoTC(Char **v)
{
Char **globbed;
char cv[BUFSIZE];/*FIXBUF*/
int verbose = 0, silent = 0;
static char *fmts = "%s\n", *fmtd = "%d\n";
int li,co;
setname("echotc");
v = glob_all_or_error(v);
globbed = v;
cleanup_push(globbed, blk_cleanup);
if (!v || !*v || *v[0] == '\0')
goto end;
if (v[0][0] == '-') {
switch (v[0][1]) {
case 'v':
verbose = 1;
break;
case 's':
silent = 1;
break;
default:
stderror(ERR_NAME | ERR_TCUSAGE);
break;
}
v++;
}
if (!*v || *v[0] == '\0')
goto end;
(void) StringCbCopy(cv,sizeof(cv), short2str(*v));
GetSize(&li,&co);
if(!lstrcmp(cv,"rows") || !lstrcmp(cv,"lines") ) {
xprintf(fmtd,T_Lines);
goto end;
}
else if(!lstrcmp(cv,"cols") ) {
xprintf(fmtd,T_ActualWindowSize);
goto end;
}
else if(!lstrcmp(cv,"buffer") ) {
xprintf(fmtd,T_Cols);
goto end;
}
else
stderror(ERR_SYSTEM, "EchoTC","Sorry, this function is not supported");
end:
cleanup_until(globbed);
}
开发者ID:Lance0312,项目名称:tcsh,代码行数:59,代码来源:nt.screen.c
示例5: globone
Char *
globone(Char *str, int action)
{
Char *v[2], **vl, **vo;
int gflg, noglob;
noglob = adrof(STRnoglob) != 0;
v[0] = str;
v[1] = 0;
gflg = tglob(v);
if (gflg == G_NONE)
return (strip(Strsave(str)));
if (gflg & G_CSH) {
/*
* Expand back-quote, tilde and brace
*/
vo = globexpand(v, noglob);
if (noglob || (gflg & G_GLOB) == 0) {
vl = vo;
goto result;
}
cleanup_push(vo, blk_cleanup);
}
else if (noglob || (gflg & G_GLOB) == 0)
return (strip(Strsave(str)));
else
vo = v;
vl = libglob(vo);
if (gflg & G_CSH) {
if (vl != vo)
cleanup_until(vo);
else
cleanup_ignore(vo);
}
if (vl == NULL) {
setname(short2str(str));
stderror(ERR_NAME | ERR_NOMATCH);
}
result:
if (vl && vl[0] == NULL) {
xfree(vl);
return (Strsave(STRNULL));
}
if (vl && vl[1])
return (handleone(str, vl, action));
else {
str = strip(*vl);
xfree(vl);
return (str);
}
}
开发者ID:2014-class,项目名称:freerouter,代码行数:53,代码来源:sh.glob.c
示例6: put_color
/* put_color():
*/
static void
put_color(const Str *color)
{
size_t i;
const char *c = color->s;
int original_output_raw = output_raw;
output_raw = TRUE;
cleanup_push(&original_output_raw, output_raw_restore);
for (i = color->len; 0 < i; i--)
xputchar(*c++);
cleanup_until(&original_output_raw);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:15,代码来源:tw.color.c
示例7: doucb
/*ARGSUSED*/
void
doucb(Char **v, struct command *c)
{
Char *cp = v[1];
char ubuf[100];
if (cp == 0)
(void) setuniverse("ucb");
else {
(void) getuniverse(ubuf);
(void) setuniverse("ucb");
cleanup_push(ubuf, setuniverse_cleanup);
if (setintr) {
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
}
lshift(v, 1);
if (setintr)
cleanup_until(&pintr_disabled);
reexecute(c);
cleanup_until(ubuf);
}
}
开发者ID:tcsh-org,项目名称:tcsh,代码行数:24,代码来源:tc.os.c
示例8: doinlib
/*ARGSUSED*/
void
doinlib(Char **v, struct command *c)
{
Char **globbed;
setname(short2str(*v++));
v = glob_all_or_error(v);
globbed = v;
cleanup_push(globbed, blk_cleanup);
while (v && *v)
llib(*v++);
cleanup_until(globbed);
}
开发者ID:tcsh-org,项目名称:tcsh,代码行数:15,代码来源:tc.os.c
示例9: loaddirs
void
loaddirs(Char *fname)
{
static Char *loaddirs_cmd[] = { STRsource, NULL, NULL };
bequiet = 1;
cleanup_push(&bequiet, bequiet_cleanup);
if (fname)
loaddirs_cmd[1] = fname;
else if ((fname = varval(STRdirsfile)) != STRNULL)
loaddirs_cmd[1] = fname;
else
loaddirs_cmd[1] = STRtildotdirs;
dosource(loaddirs_cmd, NULL);
cleanup_until(&bequiet);
}
开发者ID:lukem,项目名称:tcsh,代码行数:16,代码来源:sh.dir.c
示例10: dosettc
/*ARGSUSED*/
void
dosettc(Char **v, struct command *c)
{
char *tv[2];
USE(c);
if (!GotTermCaps)
GetTermCaps();
tv[0] = strsave(short2str(v[1]));
cleanup_push(tv[0], xfree);
tv[1] = strsave(short2str(v[2]));
cleanup_push(tv[1], xfree);
SetTC(tv[0], tv[1]);
cleanup_until(tv[0]);
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:17,代码来源:tc.func.c
示例11: beep_cmd
/*
* Joachim Hoenig 07/16/91 Added beep_cmd, run every time tcsh wishes
* to beep the terminal bell. Useful for playing nice sounds instead.
*/
void
beep_cmd(void)
{
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
if (beepcmd_active) { /* an error must have been caught */
aliasrun(2, STRunalias, STRbeepcmd);
xprintf("%s", CGETS(22, 5, "Faulty alias 'beepcmd' removed.\n"));
}
else {
beepcmd_active = 1;
if (!whyles && adrof1(STRbeepcmd, &aliases))
aliasrun(1, STRbeepcmd, NULL);
}
beepcmd_active = 0;
cleanup_until(&pintr_disabled);
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:21,代码来源:tc.func.c
示例12: cwd_cmd
/*
* Paul Placeway 11/24/87 Added cwd_cmd by hacking precmd() into
* submission... Run every time $cwd is set (after it is set). Useful
* for putting your machine and cwd (or anything else) in an xterm title
* space.
*/
void
cwd_cmd(void)
{
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
if (cwdcmd_active) { /* an error must have been caught */
aliasrun(2, STRunalias, STRcwdcmd);
xprintf("%s", CGETS(22, 4, "Faulty alias 'cwdcmd' removed.\n"));
goto leave;
}
cwdcmd_active = 1;
if (!whyles && adrof1(STRcwdcmd, &aliases))
aliasrun(1, STRcwdcmd, NULL);
leave:
cwdcmd_active = 0;
cleanup_until(&pintr_disabled);
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:23,代码来源:tc.func.c
示例13: job_cmd
/*
* GrP Greg Parker May 2001
* Added job_cmd(), which is run every time a job is started or
* foregrounded. The command is passed a single argument, the string
* used to start the job originally. With precmd, useful for setting
* xterm titles.
* Cloned from cwd_cmd().
*/
void
job_cmd(Char *args)
{
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
if (jobcmd_active) { /* an error must have been caught */
aliasrun(2, STRunalias, STRjobcmd);
xprintf("%s", CGETS(22, 14, "Faulty alias 'jobcmd' removed.\n"));
goto leave;
}
jobcmd_active = 1;
if (!whyles && adrof1(STRjobcmd, &aliases)) {
struct process *pp = pcurrjob; /* put things back after the hook */
aliasrun(2, STRjobcmd, args);
pcurrjob = pp;
}
leave:
jobcmd_active = 0;
cleanup_until(&pintr_disabled);
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:28,代码来源:tc.func.c
示例14: xgetpass
static char *
xgetpass(const char *prm)
{
static struct strbuf pass; /* = strbuf_INIT; */
int fd;
sigset_t oset, set;
struct sigaction sa, osa;
sa.sa_handler = SIG_IGN;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
(void)sigaction(SIGINT, &sa, &osa);
sigemptyset(&set);
sigaddset(&set, SIGINT);
(void)sigprocmask(SIG_UNBLOCK, &set, &oset);
cleanup_push(&osa, sigint_cleanup);
cleanup_push(&oset, sigprocmask_cleanup);
(void) Rawmode(); /* Make sure, cause we want echo off */
fd = xopen("/dev/tty", O_RDWR|O_LARGEFILE);
if (fd == -1)
fd = SHIN;
else
cleanup_push(&fd, open_cleanup);
xprintf("%s", prm); flush();
pass.len = 0;
for (;;) {
char c;
if (xread(fd, &c, 1) < 1 || c == '\n')
break;
strbuf_append1(&pass, c);
}
strbuf_terminate(&pass);
cleanup_until(&osa);
return pass.s;
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:41,代码来源:tc.func.c
示例15: Gnmatch
int
Gnmatch(const Char *string, const Char *pattern, const Char **endstr)
{
Char ***fblk, **p;
const Char *tstring = string;
int gpol = 1, gres = 0;
if (*pattern == '^') {
gpol = 0;
pattern++;
}
fblk = xmalloc(sizeof(Char ***));
*fblk = xmalloc(GLOBSPACE * sizeof(Char *));
(*fblk)[0] = Strsave(pattern);
(*fblk)[1] = NULL;
cleanup_push(fblk, blk_indirect_cleanup);
expbrace(fblk, NULL, GLOBSPACE);
if (endstr == NULL)
/* Exact matches only */
for (p = *fblk; *p; p++)
gres |= t_pmatch(string, *p, &tstring, 1) == 2 ? 1 : 0;
else {
const Char *end;
/* partial matches */
end = Strend(string);
for (p = *fblk; *p; p++)
if (t_pmatch(string, *p, &tstring, 1) != 0) {
gres |= 1;
if (end > tstring)
end = tstring;
}
*endstr = end;
}
cleanup_until(fblk);
return(gres == gpol);
}
开发者ID:2014-class,项目名称:freerouter,代码行数:41,代码来源:sh.glob.c
示例16: dgetstack
static void
dgetstack(void)
{
int i = 0;
Char **dblk, **dbp;
struct directory *dn;
if (adrof(STRdirstack) == NULL)
return;
for (dn = dhead.di_prev; dn != &dhead; dn = dn->di_prev, i++)
continue;
dbp = dblk = xmalloc((i + 1) * sizeof(Char *));
for (dn = dhead.di_prev; dn != &dhead; dn = dn->di_prev, dbp++)
*dbp = Strsave(dn->di_name);
*dbp = NULL;
cleanup_push(dblk, blk_cleanup);
setq(STRdirstack, dblk, &shvhed, VAR_READWRITE);
cleanup_ignore(dblk);
cleanup_until(dblk);
}
开发者ID:lukem,项目名称:tcsh,代码行数:21,代码来源:sh.dir.c
示例17: splicepipe
/*
* Expand and glob the words after an i/o redirection.
* If more than one word is generated, then update the command vector.
*
* This is done differently in all the shells:
* 1. in the bourne shell and ksh globbing is not performed
* 2. Bash/csh say ambiguous
* 3. zsh does i/o to/from all the files
* 4. itcsh concatenates the words.
*
* I don't know what is best to do. I think that Ambiguous is better
* than restructuring the command vector, because the user can get
* unexpected results. In any case, the command vector restructuring
* code is present and the user can choose it by setting noambiguous
*/
static Char *
splicepipe(struct command *t, Char *cp)
{
Char *blk[2];
if (adrof(STRnoambiguous)) {
Char **pv;
int gflag;
blk[0] = Dfix1(cp); /* expand $ */
blk[1] = NULL;
gflag = tglob(blk);
if (gflag) {
pv = globall(blk, gflag);
if (pv == NULL) {
setname(short2str(blk[0]));
xfree(blk[0]);
stderror(ERR_NAME | ERR_NOMATCH);
}
if (pv[1] != NULL) { /* we need to fix the command vector */
Char **av = blkspl(t->t_dcom, &pv[1]);
xfree(t->t_dcom);
t->t_dcom = av;
}
xfree(blk[0]);
blk[0] = pv[0];
xfree(pv);
}
}
else {
Char *buf;
buf = Dfix1(cp);
cleanup_push(buf, xfree);
blk[0] = globone(buf, G_ERROR);
cleanup_until(buf);
}
return(blk[0]);
}
开发者ID:lukem,项目名称:tcsh,代码行数:55,代码来源:sh.sem.c
示例18: fix_version
//.........这里部分代码省略.........
# define BYESTR ""
#endif
#ifdef AUTOLOGOUT
# define ALSTR ",al"
#else
# define ALSTR ""
#endif
#ifdef KANJI
# define KANSTR ",kan"
#else
# define KANSTR ""
#endif
#ifdef SYSMALLOC
# define SMSTR ",sm"
#else
# define SMSTR ""
#endif
#ifdef HASHBANG
# define HBSTR ",hb"
#else
# define HBSTR ""
#endif
#ifdef NEWGRP
# define NGSTR ",ng"
#else
# define NGSTR ""
#endif
#ifdef REMOTEHOST
# define RHSTR ",rh"
#else
# define RHSTR ""
#endif
#ifdef AFS
# define AFSSTR ",afs"
#else
# define AFSSTR ""
#endif
#ifdef NODOT
# define NDSTR ",nd"
#else
# define NDSTR ""
#endif
#ifdef COLOR_LS_F
# define COLORSTR ",color"
#else /* ifndef COLOR_LS_F */
# define COLORSTR ""
#endif /* COLOR_LS_F */
#ifdef DSPMBYTE
# define DSPMSTR ",dspm"
#else
# define DSPMSTR ""
#endif
#ifdef COLORCAT
# define CCATSTR ",ccat"
#else
# define CCATSTR ""
#endif
#if defined(FILEC) && defined(TIOCSTI)
# define FILECSTR ",filec"
#else
# define FILECSTR ""
#endif
/* if you want your local version to say something */
#ifndef LOCALSTR
# define LOCALSTR ""
#endif /* LOCALSTR */
char *version;
const Char *machtype = tgetenv(STRMACHTYPE);
const Char *vendor = tgetenv(STRVENDOR);
const Char *ostype = tgetenv(STROSTYPE);
if (vendor == NULL)
vendor = STRunknown;
if (machtype == NULL)
machtype = STRunknown;
if (ostype == NULL)
ostype = STRunknown;
version = xasprintf(
"%s"
#ifdef CATCH_EXEC
"(%s)"
#endif
" %d.%.2d.%.2d (%s) %s (%S-%S-%S) options %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", PROG_NAME,
#ifdef CATCH_EXEC
GDI_VERSION,
#endif
REV, VERS, PATCHLEVEL, ORIGIN, DATE, machtype, vendor, ostype,
SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, BYESTR,
ALSTR, KANSTR, SMSTR, HBSTR, NGSTR, RHSTR, AFSSTR, NDSTR,
COLORSTR, DSPMSTR, CCATSTR, FILECSTR, LOCALSTR);
cleanup_push(version, xfree);
setcopy(STRversion, str2short(version), VAR_READWRITE);
cleanup_until(version);
version = xasprintf("%d.%.2d.%.2d", REV, VERS, PATCHLEVEL);
cleanup_push(version, xfree);
setcopy(STRtcsh, str2short(version), VAR_READWRITE);
cleanup_until(version);
}
开发者ID:valhallasw,项目名称:son-of-gridengine,代码行数:101,代码来源:tc.vers.c
示例19: dolist
/*ARGSUSED*/
void
dolist(Char **v, struct command *c)
{
Char **globbed;
int i, k, ret = 0;
struct stat st;
USE(c);
if (*++v == NULL) {
struct Strbuf word = Strbuf_INIT;
Strbuf_terminate(&word);
cleanup_push(&word, Strbuf_cleanup);
(void) t_search(&word, LIST, TW_ZERO, 0, STRNULL, 0);
cleanup_until(&word);
return;
}
v = glob_all_or_error(v);
globbed = v;
cleanup_push(globbed, blk_cleanup);
for (k = 0; v[k] != NULL && v[k][0] != '-'; k++)
continue;
if (v[k]) {
/*
* We cannot process a flag therefore we let ls do it right.
*/
Char *lspath;
struct command *t;
struct wordent cmd, *nextword, *lastword;
Char *cp;
struct varent *vp;
if (setintr) {
pintr_disabled++;
cleanup_push(&pintr_disabled, disabled_cleanup);
}
if (seterr) {
xfree(seterr);
seterr = NULL;
}
lspath = STRls;
STRmCF[1] = 'C';
STRmCF[3] = '\0';
/* Look at listflags, to add -A to the flags, to get a path
of ls if necessary */
if ((vp = adrof(STRlistflags)) != NULL && vp->vec != NULL &&
vp->vec[0] != STRNULL) {
if (vp->vec[1] != NULL && vp->vec[1][0] != '\0')
lspath = vp->vec[1];
for (cp = vp->vec[0]; *cp; cp++)
switch (*cp) {
case 'x':
STRmCF[1] = 'x';
break;
case 'a':
STRmCF[3] = 'a';
break;
case 'A':
STRmCF[3] = 'A';
break;
default:
break;
}
}
cmd.word = STRNULL;
lastword = &cmd;
nextword = xcalloc(1, sizeof cmd);
nextword->word = Strsave(lspath);
lastword->next = nextword;
nextword->prev = lastword;
lastword = nextword;
nextword = xcalloc(1, sizeof cmd);
nextword->word = Strsave(STRmCF);
lastword->next = nextword;
nextword->prev = lastword;
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
if (dspmbyte_ls) {
lastword = nextword;
nextword = xcalloc(1, sizeof cmd);
nextword->word = Strsave(STRmmliteral);
lastword->next = nextword;
nextword->prev = lastword;
}
#endif
#ifdef COLOR_LS_F
if (color_context_ls) {
lastword = nextword;
nextword = xcalloc(1, sizeof cmd);
nextword->word = Strsave(STRmmcolormauto);
lastword->next = nextword;
nextword->prev = lastword;
}
#endif /* COLOR_LS_F */
lastword = nextword;
for (cp = *v; cp; cp = *++v) {
nextword = xcalloc(1, sizeof cmd);
nextword->word = quote(Strsave(cp));
//.........这里部分代码省略.........
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:101,代码来源:tc.func.c
示例20: aliasrun
/*
* Karl Kleinpaste, 21oct1983.
* Set up a one-word alias command, for use for special things.
* This code is based on the mainline of process().
*/
void
aliasrun(int cnt, Char *s1, Char *s2)
{
struct wordent w, *new1, *new2; /* for holding alias name */
struct command *t = NULL;
jmp_buf_t osetexit;
int status;
size_t omark;
getexit(osetexit);
if (seterr) {
xfree(seterr);
seterr = NULL; /* don't repeatedly print err msg. */
}
w.word = STRNULL;
new1 = xcalloc(1, sizeof w);
new1->word = Strsave(s1);
if (cnt == 1) {
/* build a lex list with one word. */
w.next = w.prev = new1;
new1->next = new1->prev = &w;
}
else {
/* build a lex list with two words. */
new2 = xcalloc(1, sizeof w);
new2->word = Strsave(s2);
w.next = new2->prev = new1;
new1->next = w.prev = new2;
new1->prev = new2->next = &w;
}
cleanup_push(&w, lex_cleanup);
/* Save the old status */
status = getn(varval(STRstatus));
/* expand aliases like process() does. */
alias(&w);
/* build a syntax tree for the command. */
t = syntax(w.next, &w, 0);
cleanup_push(t, syntax_cleanup);
if (seterr)
stderror(ERR_OLD);
psavejob();
cleanup_push(&cnt, psavejob_cleanup); /* cnt is used only as a marker */
/* catch any errors here */
omark = cleanup_push_mark();
if (setexit() == 0)
/* execute the parse tree. */
/*
* From: Michael Schroeder <[email protected]>
* was execute(t, tpgrp);
*/
execute(t, tpgrp > 0 ? tpgrp : -1, NULL, NULL, TRUE);
/* reset the error catcher to the old place */
cleanup_pop_mark(omark);
resexit(osetexit);
if (haderr) {
haderr = 0;
/*
* Either precmd, or cwdcmd, or periodic had an error. Call it again so
* that it is removed
*/
if (precmd_active)
precmd();
if (postcmd_active)
postcmd();
#ifdef notdef
/*
* XXX: On the other hand, just interrupting them causes an error too.
* So if we hit ^C in the middle of cwdcmd or periodic the alias gets
* removed. We don't want that. Note that we want to remove precmd
* though, cause that could lead into an infinite loop. This should be
* fixed correctly, but then haderr should give us the whole exit
* status not just true or false.
*/
else if (cwdcmd_active)
cwd_cmd();
else if (beepcmd_active)
beep_cmd();
else if (periodic_active)
period_cmd();
#endif /* notdef */
}
cleanup_until(&w);
pendjob();
/* Restore status */
setv(STRstatus, putn((tcsh_number_t)status), VAR_READWRITE);
}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:95,代码来源:tc.func.c
注:本文中的cleanup_until函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论