/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#include "defs.h"
#include <stak.h>
#include <ls.h>
#include <error.h>
#include "variables.h"
#include "io.h"
#include "name.h"
#include "history.h"
#include "builtins.h"
#if SHOPT_HISTEXPAND
# include "edit.h"
#endif
static void hist_subst(const char*, int fd, char*);
#if 0
/* for the benefit of the dictionary generator */
#endif
{
register char *arg;
char *fname;
#if SHOPT_HISTEXPAND
int pflag = 0;
#endif
if(!sh_histinit((void*)shp))
{
case 'e':
break;
case 'n':
nflag++;
break;
case 'l':
lflag++;
break;
case 'r':
rflag++;
break;
case 's':
edit = "-";
break;
#if SHOPT_HISTEXPAND
case 'p':
pflag++;
break;
#endif
case 'N':
if(indx<=0)
{
flag = 1;
break;
}
case ':':
break;
case '?':
break;
}
if(error_info.errors)
#if SHOPT_HISTEXPAND
if(pflag)
{
pflag = 0;
{
if(!(flag & HIST_ERROR))
else
pflag = 1;
if(replace)
argv++;
}
return pflag;
}
#endif
{
/* look for old=new argument */
{
argv++;
continue;
}
{
/* see if completely numeric */
do arg++;
if(*arg==0)
{
if(*arg == '-')
argv++;
continue;
}
}
/* search for last line starting with string */
argv++;
}
if(flag <0)
{
/* set default starting range */
if(lflag)
{
if(flag<1)
flag = 1;
}
else
flag = 0;
}
if(flag==0)
/* set default termination range */
/* check for valid ranges */
/* now list commands from range[rflag] to range[1-rflag] */
incr = 1;
incr = -1;
if(lflag)
{
arg = "\n\t";
}
else
{
arg = "\n";
nflag++;
}
while(1)
{
if(nflag==0)
else if(lflag)
if(lflag)
break;
}
if(lflag)
return(0);
{
if(*arg!='/')
}
#ifdef apollo
/*
* Code to support the FC using the pad editor.
* Exampled of how to use: HISTEDIT=pad
*/
{
extern int pad_create(char*);
}
else
{
#endif /* apollo */
if(*arg != '-')
{
com[2] = 0;
}
#ifdef apollo
}
#endif /* apollo */
/* don't history fc itself unless forked */
if(!sh_isstate(SH_FORKED))
if(replace)
else if(error_info.errors == 0)
{
/* read in and run the command */
shp->hist_depth--;
}
else
{
if(!sh_isoption(SH_VERBOSE))
}
}
/*
* given a file containing a command and a string of the form old=new,
* execute the command with the string old replaced by new
*/
{
register char *sp;
register int c;
char *string;
return;
c = (int)size;
return;
string[c] = 0;
*newp++ = 0;
}