wtoomey@gara.une.oz (Warren Toomey) (09/13/89)
# This is a shell archive. Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file". (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# clam.1dif hist.cdif job.cdif main.cdif meta.cdif parse.cdif
echo x - clam.1dif
cat > "clam.1dif" << '//E*O*F clam.1dif//'
*** ../Clam/clam.1 Wed Sep 13 12:20:52 1989
--- clam.1 Wed Sep 13 12:41:17 1989
***************
*** 209,214 ****
--- 209,215 ----
ESC-^H
ESC-DEL back-delete character
ESC-^L same as ^L
+ ESC-^P match previous partial command
ESC-ESC
ESC-TAB same as TAB
ESC-b
***************
*** 409,415 ****
.br
% !l"a"
.br
! will give the desired substitution of "ls -la".
.PP
Another form of substitution exists which operates only on the previous
line as an error correction mechanism. Although this is mostly superceded by
--- 410,420 ----
.br
% !l"a"
.br
! will give the desired substitution of "ls -la". Spaces may be included in
! the string by using backslash or quotes.
! .br
! % !"v d"
!
.PP
Another form of substitution exists which operates only on the previous
line as an error correction mechanism. Although this is mostly superceded by
***************
*** 567,575 ****
.I list(1).
Because of the way that these aliases are implemented, it is easy to
call builtins, system commands, and even other aliases, from within an alias.
! You should be careful not to call an alias from within itself unless you are
! aware of the effects of recursion. Aliases can be created using the builtin
! command
.I alias
, see below in Builtin Commands section.
.PP
--- 572,579 ----
.I list(1).
Because of the way that these aliases are implemented, it is easy to
call builtins, system commands, and even other aliases, from within an alias.
! You should be careful not to call an alias from within itself since this will
! cause an error. Aliases can be created using the builtin command
.I alias
, see below in Builtin Commands section.
.PP
***************
*** 665,672 ****
argument which is the name of the directory to change to. The directory name
may be a full path name starting from the root directory or a path name
relative to the current directory. The `~' notation can also be used to refer
! to the home directory of users. If hashing is on, the path is automatically
! rehashed after the directory is changed.
.TP 4
continue
Ignore the statements in the rest of the loop and
--- 669,675 ----
argument which is the name of the directory to change to. The directory name
may be a full path name starting from the root directory or a path name
relative to the current directory. The `~' notation can also be used to refer
! to the home directory of users.
.TP 4
continue
Ignore the statements in the rest of the loop and
***************
*** 857,862 ****
--- 860,867 ----
rehash
This causes the files on the user's path to be entered into a hash table.
If hashing was previously turned off, then it is turned on with this command.
+ You will need to do this if a new executable file appears in a directory on
+ your path.
.TP 4
repeat <number> <command>
This statement causes the command to be executed the number of times specified.
***************
*** 1043,1049 ****
.SH LIMITATIONS
Maximum line length is 2048 (but redefinable). Maximum number of arguments
is 512. Not all of the above features exist, yet, and some new ones may be added
! in future versions.
.SH SEE ALSO
chmod(1), csh(1), sh(1), stty(1), tcsh(1), exec(2), fork(2), pipe(2), umask(2),
wait(2), string(3), signal(3), termcap(4), tty(4), environ(7).
--- 1048,1054 ----
.SH LIMITATIONS
Maximum line length is 2048 (but redefinable). Maximum number of arguments
is 512. Not all of the above features exist, yet, and some new ones may be added
! in future versions. Note: none of the script functions (if, for etc) exist yet.
.SH SEE ALSO
chmod(1), csh(1), sh(1), stty(1), tcsh(1), exec(2), fork(2), pipe(2), umask(2),
wait(2), string(3), signal(3), termcap(4), tty(4), environ(7).
//E*O*F clam.1dif//
echo x - hist.cdif
cat > "hist.cdif" << '//E*O*F hist.cdif//'
*** ../Clam/hist.c Tue Sep 12 21:41:42 1989
--- hist.c Wed Sep 13 12:21:33 1989
***************
*** 86,92 ****
char *line;
int *pos,histnum,curs[];
{
! extern void goend(),go();
extern int lenprompt;
struct histlist *ptr;
--- 86,92 ----
char *line;
int *pos,histnum,curs[];
{
! extern void goend(),go(),clrline();
extern int lenprompt;
struct histlist *ptr;
***************
*** 201,211 ****
{
extern int curr_hist;
struct histlist *ptr;
! char temp[MAXLL];
int lastmatch=(-1);
! if (getnumhist(histnum)!=(char *)UNDEF)
! strncpy(temp,getnumhist(histnum),MAXLL);
else return(0);
for (ptr=htop;ptr && ptr->hnum<histnum;ptr=ptr->next)
if (!strcmp(temp,ptr->hline))
--- 201,211 ----
{
extern int curr_hist;
struct histlist *ptr;
! char *histptr,temp[MAXLL];
int lastmatch=(-1);
! if ((histptr=getnumhist(histnum))!=(char *)UNDEF)
! strncpy(temp,histptr,MAXLL);
else return(0);
for (ptr=htop;ptr && ptr->hnum<histnum;ptr=ptr->next)
if (!strcmp(temp,ptr->hline))
***************
*** 212,215 ****
--- 212,231 ----
lastmatch=ptr->hnum;
/* return the value of the next line after matching one. If none match return 0 */
return(lastmatch+1);
+ }
+
+ int matchhline(line,startnum)
+ char *line;
+ int startnum;
+ {
+ extern int curr_hist;
+ struct histlist *ptr;
+ int lastmatch=0,ll;
+
+ /* finds match backwards for line */
+ ll=strlen(line);
+ for (ptr=htop;ptr && ptr->hnum<startnum;ptr=ptr->next)
+ if (!strncmp(line,ptr->hline,ll))
+ lastmatch=ptr->hnum;
+ return(lastmatch);
}
//E*O*F hist.cdif//
echo x - job.cdif
cat > "job.cdif" << '//E*O*F job.cdif//'
*** ../Clam/job.c Tue Sep 12 21:41:46 1989
--- job.c Wed Sep 13 12:21:33 1989
***************
*** 24,30 ****
#ifdef JOB
static char *siglist[] = { "Done","Hangup","Interrupt","Quit","Illegal Instruction",
"Trace/BPT Trap","IOT Trap","EMT Trap","Floating Point Exception","Killed",
! "Bus Error","Sementation Violation","Bad System Call","Broken Pipe","Done",
"Terminated","Urgent Socket Condition","Stopped (signal)","Stopped","Continue",
"Child Status Change","Stopped (tty input)","Stopped (tty output)","I/O",
"Cpu Time Limit","File Size Limit","Virtual Time Alarm","Profile Alarm" };
--- 24,30 ----
#ifdef JOB
static char *siglist[] = { "Done","Hangup","Interrupt","Quit","Illegal Instruction",
"Trace/BPT Trap","IOT Trap","EMT Trap","Floating Point Exception","Killed",
! "Bus Error","Segmentation Violation","Bad System Call","Broken Pipe","Done",
"Terminated","Urgent Socket Condition","Stopped (signal)","Stopped","Continue",
"Child Status Change","Stopped (tty input)","Stopped (tty output)","I/O",
"Cpu Time Limit","File Size Limit","Virtual Time Alarm","Profile Alarm" };
***************
*** 261,273 ****
union wait status;
{
struct job *ptr;
- int jobno;
#ifdef DEBUG
fprintf(stderr,"updating %d\n",pid);
fflush(stderr);
#endif
! for (jobno=1,ptr=jtop;ptr!=NULL && ptr->pid!=pid;jobno++,ptr=ptr->next)
;
if (ptr!=NULL && ptr->pid==pid)
{
--- 261,272 ----
union wait status;
{
struct job *ptr;
#ifdef DEBUG
fprintf(stderr,"updating %d\n",pid);
fflush(stderr);
#endif
! for (ptr=jtop;ptr!=NULL && ptr->pid!=pid;ptr=ptr->next)
;
if (ptr!=NULL && ptr->pid==pid)
{
//E*O*F job.cdif//
echo x - main.cdif
cat > "main.cdif" << '//E*O*F main.cdif//'
*** ../Clam/main.c Tue Sep 12 21:42:35 1989
--- main.c Wed Sep 13 12:21:33 1989
***************
*** 14,22 ****
******************************************************************************/
#include "header.h"
- #ifndef MINIX
- #include <sys/time.h>
- #endif
int lengthint(num)
int num;
--- 14,19 ----
***************
*** 603,612 ****
void shinit()
{
! extern void loadenv(),vset(),venvprint(),file();
extern int O_faststart;
#ifdef HASH
extern void hashpath();
extern bool hashed;
#endif
--- 600,610 ----
void shinit()
{
! extern void loadenv(),vset(),venvprint(),File();
extern int O_faststart;
#ifdef HASH
+ extern void inihash();
extern void hashpath();
extern bool hashed;
#endif
***************
*** 622,629 ****
extern int disable_auto,curr_hist,O_echoline,O_echoexp,O_echobefore,O_echoexpbefore;
extern bool loginsh;
extern char *current_alias[],*invokename,*vget(),*getlogin();
FILE *fp;
! char dir[MAXPL];
int oldO_el,oldO_ee,i;
#ifdef UNIVERSE
int olduniv;
--- 620,628 ----
extern int disable_auto,curr_hist,O_echoline,O_echoexp,O_echobefore,O_echoexpbefore;
extern bool loginsh;
extern char *current_alias[],*invokename,*vget(),*getlogin();
+ struct passwd *pw;
FILE *fp;
! char *un,dir[MAXPL];
int oldO_el,oldO_ee,i;
#ifdef UNIVERSE
int olduniv;
***************
*** 653,659 ****
#endif
vset("SHELL",DFLTSH);
vset("history","25");
! vset("user",getlogin());
#ifdef ATT
(void) getcwd(dir,MAXPL);
#else
--- 652,661 ----
#endif
vset("SHELL",DFLTSH);
vset("history","25");
! if ((un=getlogin()) == NULL)
! if ((pw=getpwuid(getuid())) == NULL) un="unknown";
! else un=pw->pw_name;
! vset("user",un);
#ifdef ATT
(void) getcwd(dir,MAXPL);
#else
***************
*** 695,701 ****
else O_echoline=0;
if (O_echoexpbefore) O_echoexp=1;
else O_echoexp=0;
! file(fp,1); /* nosave set for .clamrc */
fclose(fp);
if (!O_echobefore) O_echoline=oldO_el;
if (!O_echoexpbefore) O_echoexp=oldO_ee;
--- 697,703 ----
else O_echoline=0;
if (O_echoexpbefore) O_echoexp=1;
else O_echoexp=0;
! File(fp,1); /* nosave set for .clamrc */
fclose(fp);
if (!O_echobefore) O_echoline=oldO_el;
if (!O_echoexpbefore) O_echoexp=oldO_ee;
***************
*** 711,717 ****
(void) strcat(dir,"/.login");
if ((fp=fopen(dir,"r"))!=NULL)
{
! file(fp,1); /* nosave set for .login */
fclose(fp);
}
}
--- 713,719 ----
(void) strcat(dir,"/.login");
if ((fp=fopen(dir,"r"))!=NULL)
{
! File(fp,1); /* nosave set for .login */
fclose(fp);
}
}
***************
*** 719,724 ****
--- 721,727 ----
if (vget("HASH")!=(char *)UNDEF)
{
hashed=TRUE;
+ inihash();
hashpath();
}
#endif
***************
*** 735,741 ****
waitfor();
extern char saveline[];
#ifdef JOB
! extern void checkjobs();
extern int stopped,jobdone;
#endif
SYM_T act;
--- 738,744 ----
waitfor();
extern char saveline[];
#ifdef JOB
! extern void checkjobs(),reportjobs();
extern int stopped,jobdone;
#endif
SYM_T act;
***************
*** 892,898 ****
int argc;
char *argv[],*envp[];
{
! extern void copyenv(),file();
extern char *invokename,**arguments,**environ,*newenv[];
extern FILE *zin,*zout;
extern int fromfile,numargs, O_execstring,NoIoctl;
--- 895,901 ----
int argc;
char *argv[],*envp[];
{
! extern void copyenv(),File();
extern char *invokename,**arguments,**environ,*newenv[];
extern FILE *zin,*zout;
extern int fromfile,numargs, O_execstring,NoIoctl;
***************
*** 938,944 ****
#ifdef DEBUG
fprintf(stderr,"argc %d argp %d numargs %d\n",argc,argp,numargs);
#endif
! file(zin,0); /* nosave isn't set. */
fclose(zin);
exit(0);
}
--- 941,947 ----
#ifdef DEBUG
fprintf(stderr,"argc %d argp %d numargs %d\n",argc,argp,numargs);
#endif
! File(zin,0); /* nosave isn't set. */
fclose(zin);
exit(0);
}
//E*O*F main.cdif//
echo x - meta.cdif
cat > "meta.cdif" << '//E*O*F meta.cdif//'
*** ../Clam/meta.c Tue Sep 12 21:42:35 1989
--- meta.c Wed Sep 13 12:21:34 1989
***************
*** 183,189 ****
union wait status;
# endif
#endif
- int fd = fileno(fp);
int wpid;
#ifdef DEBUG
--- 183,188 ----
***************
*** 204,210 ****
return(status);
# else
status.w_retcode= -1;
! return(status.w_retcode);
# endif
#endif
}
--- 203,209 ----
return(status);
# else
status.w_retcode= -1;
! return((int)status.w_retcode);
# endif
#endif
}
***************
*** 219,227 ****
#ifdef JOB
extern void checkjobs();
#endif
- SYM_T term;
char command[MAXWL];
! int i,c,fd,pos,wpid;
FILE *progout,*popen();
for (i=0;line[i];i++)
--- 218,225 ----
#ifdef JOB
extern void checkjobs();
#endif
char command[MAXWL];
! int i,c;
FILE *progout,*popen();
for (i=0;line[i];i++)
***************
*** 280,311 ****
#endif
return(FALSE);
}
- /****************************************
- {
- fprintf(stderr,"%s: Cannot execute.\n",command);
- #ifdef JOB
- signal(SIGCHLD,checkjobs);
- #endif
- return(FALSE);
- }
- pos=i=0;
- while (read(fd,&c,1)==1)
- {
- if (c==EOF) break;
- switch(c)
- {
- case '\r':case '\n':case '\t':
- output[i]=' ';
- break;
- default :
- output[i]=c;
- break;
- }
- i++;
- if (i==MAXLL) break;
- }
- output[i]=EOS;
- *************/
/* put all the clam stuff back in case it got mangled */
resetsh();
#ifdef JOB
--- 278,283 ----
***************
*** 525,531 ****
char *line,*word;
int *pos;
{
! int l=1,insym=0,inword=0,i=0,quote=0;
word[0]=EOS;
while(l)
--- 497,503 ----
char *line,*word;
int *pos;
{
! int l=1,insym=0,inword=0,i=0;
word[0]=EOS;
while(l)
***************
*** 624,630 ****
bool variable. The return variable is EOLN when the end of line is reached */
*pattern=FALSE;
! if (loadword(line,pos,word,1)==FALSE)
return(EOLN); /* end of line encountered */
#ifdef DEBUG
fprintf(stderr,"word from loadword is %s<\n",word);
--- 596,602 ----
bool variable. The return variable is EOLN when the end of line is reached */
*pattern=FALSE;
! if (loadword(line,pos,word)==FALSE)
return(EOLN); /* end of line encountered */
#ifdef DEBUG
fprintf(stderr,"word from loadword is %s<\n",word);
***************
*** 998,1004 ****
extern char **arguments,*getenv(),*vget(),*vwget();
extern int numargs;
char newline[MAXLL],vname[VARNL];
! int i,j,k,quote=0,num; /* don't need quote=1 for $variables */
for (i=0,j=0;line[i];i++,j++)
{
--- 970,976 ----
extern char **arguments,*getenv(),*vget(),*vwget();
extern int numargs;
char newline[MAXLL],vname[VARNL];
! int i,j,quote=0,num; /* don't need quote=1 for $variables */
for (i=0,j=0;line[i];i++,j++)
{
***************
*** 1023,1029 ****
fprintf(stderr,"Getting an argument $%d %s\n",num,arguments[num]);
#endif
strcpy(&newline[j],arguments[num]);
! for (j;newline[j];j++);
if (j) j--;
}
else j--; /* don't want the increment */
--- 995,1001 ----
fprintf(stderr,"Getting an argument $%d %s\n",num,arguments[num]);
#endif
strcpy(&newline[j],arguments[num]);
! for (;newline[j];j++);
if (j) j--;
}
else j--; /* don't want the increment */
***************
*** 1129,1134 ****
--- 1101,1107 ----
if (getname(line,&i,username)==FALSE)
{
extern char *getlogin(), *getenv();
+ struct passwd *pw;
register char *p;
/* $USER not there on ST Minix so need to be pedantic */
***************
*** 1135,1142 ****
if((p=getenv("USER"))==(char *)NULL)
if ((p=getlogin())==(char *)NULL)
{
! fprintf(stderr,"Cannot determine USER\n");
! return(TL_ERR);
}
strncpy(username,p,USERNL);
}
--- 1108,1119 ----
if((p=getenv("USER"))==(char *)NULL)
if ((p=getlogin())==(char *)NULL)
{
! if ((pw=getpwuid(getuid())) == NULL)
! {
! fprintf(stderr,"Cannot determine USER\n");
! return(TL_ERR);
! }
! else p=pw->pw_name;
}
strncpy(username,p,USERNL);
}
***************
*** 1369,1375 ****
int meta_2(line)
char *line;
{
! int m_err=0,m_err2=0,pos=0,printline=0;
postfilter(line); /* detect other metachars */
if (Dollar==TRUE)
--- 1346,1352 ----
int meta_2(line)
char *line;
{
! int m_err=0;
postfilter(line); /* detect other metachars */
if (Dollar==TRUE)
//E*O*F meta.cdif//
echo x - parse.cdif
cat > "parse.cdif" << '//E*O*F parse.cdif//'
*** ../Clam/parse.c Tue Sep 12 21:41:51 1989
--- parse.c Wed Sep 13 12:21:34 1989
***************
*** 74,81 ****
#endif
{
/*extern char *vget(),*vwget();*/
! char c,vname[VARNL];
! int charcount=0,num;
enum {NEUTRAL,OUTTO,PIP,AMP,QUOTE1,QUOTE2,INWORD,PLUS} state=NEUTRAL;
bool from_INWORD=FALSE;
--- 74,81 ----
#endif
{
/*extern char *vget(),*vwget();*/
! char c;
! int charcount=0;
enum {NEUTRAL,OUTTO,PIP,AMP,QUOTE1,QUOTE2,INWORD,PLUS} state=NEUTRAL;
bool from_INWORD=FALSE;
//E*O*F parse.cdif//
exit 0