[comp.sources.bugs] fep - patch #3

utashiro@sran84.sra.JUNET (Kazumasa Utashiro) (01/06/89)

Description:

	* Fix bug in aliasing
	* Change multiple command notation

*** /tmp/,RCSt1021579	Sun Nov 13 15:54:39 1988
--- fep_alias.c	Sun Nov 13 15:50:58 1988
***************
*** 2,8
  
  #ifndef lint
  static char rcsid[]=
! "$Header: fep_alias.c,v 4.1 88/08/28 18:57:17 utashiro Exp $ (SRA)";
  #endif lint
  
  #include <stdio.h>

--- 2,8 -----
  
  #ifndef lint
  static char rcsid[]=
! "$Header: fep_alias.c,v 4.2 88/11/13 15:50:52 utashiro Exp $ (SRA)";
  #endif lint
  
  #include <stdio.h>
***************
*** 40,45
      char *argv[MAXARGS];
      int argc;
      char *av;
  
      while (isspace (*comline))
  	++comline;

--- 40,46 -----
      char *argv[MAXARGS];
      int argc;
      char *av;
+     int substitute = 0;
  
      while (isspace (*comline))
  	++comline;
***************
*** 67,72
  			strcpy (ap, argv[1]);
  			ap += strlen (argv[1]);
  		    }
  		    break;
  
  		case '$':

--- 68,74 -----
  			strcpy (ap, argv[1]);
  			ap += strlen (argv[1]);
  		    }
+ 		    substitute++;
  		    break;
  
  		case '$':
***************
*** 74,79
  			strcpy (ap, argv[argc-1]);
  			ap += strlen (argv[argc - 1]);
  		    }
  		    break;
  
  		case '*':

--- 76,82 -----
  			strcpy (ap, argv[argc-1]);
  			ap += strlen (argv[argc - 1]);
  		    }
+ 		    substitute++;
  		    break;
  
  		case '*':
***************
*** 85,90
  			strcat (ap, argv[j]);
  			ap += strlen (argv[j]) + 1;
  		    }
  		    break;
  		}
  

--- 88,94 -----
  			strcat (ap, argv[j]);
  			ap += strlen (argv[j]) + 1;
  		    }
+ 		    substitute++;
  		    break;
  		}
  
***************
*** 98,103
  	}
  	*ap = '\0';
  		    
  	return (aliased_line);
      }
      else

--- 102,113 -----
  	}
  	*ap = '\0';
  		    
+ 	/*
+ 	 * If there is no ! notation, copy all arguments in command line.
+ 	 */
+ 	if (substitute == 0)
+ 	    strcat (aliased_line, comline + len);
+ 
  	return (aliased_line);
      }
      else
*** /tmp/,RCSt1021593	Sun Nov 13 15:54:45 1988
--- fep_com.c	Sun Nov 13 15:51:42 1988
***************
*** 2,8
  
  #ifndef lint
  static char rcsid[]=
! "$Header: fep_com.c,v 4.6 88/08/28 18:57:22 utashiro Exp $ (SRA)";
  #endif lint
  
  #include <stdio.h>

--- 2,8 -----
  
  #ifndef lint
  static char rcsid[]=
! "$Header: fep_com.c,v 4.7 88/11/13 15:51:24 utashiro Exp $ (SRA)";
  #endif lint
  
  #include <stdio.h>
***************
*** 45,51
      strcpy (line, comline);
  
      if (more) {
! 	if (*more = search_string (comline, ";;")) {
  	    *(line + (*more - comline)) = '\0';
  	    *more += 2;
  	}

--- 45,51 -----
      strcpy (line, comline);
  
      if (more) {
! 	if (*more = search_string (comline, ";")) {
  	    *(line + (*more - comline)) = '\0';
  	    do {
  		*more += 1;
***************
*** 47,53
      if (more) {
  	if (*more = search_string (comline, ";;")) {
  	    *(line + (*more - comline)) = '\0';
! 	    *more += 2;
  	}
  	else {
  	    *more = (char*) 0;

--- 47,55 -----
      if (more) {
  	if (*more = search_string (comline, ";")) {
  	    *(line + (*more - comline)) = '\0';
! 	    do {
! 		*more += 1;
! 	    } while (**more == ';');
  	}
  	else {
  	    *more = (char*) 0;
*** /tmp/,RCSt1021631	Sun Nov 13 15:55:00 1988
--- fep.1	Sun Nov 13 15:52:58 1988
***************
*** 1,5
  .\" Copyright (c) 1987, 1988 by Software Research Associates, Inc.
! .\" $Header: fep.1,v 4.4 88/08/28 19:14:44 utashiro Exp $
  .\"----------------------------------------
  .TH FEP 1L "5 Aug 1988" "SRA Distribution"
  .SH NAME

--- 1,5 -----
  .\" Copyright (c) 1987, 1988 by Software Research Associates, Inc.
! .\" $Header: fep.1,v 4.6 88/11/13 15:52:48 utashiro Exp $
  .\"----------------------------------------
  .TH FEP 1L "5 Aug 1988" "SRA Distribution"
  .SH NAME
***************
*** 149,158
  You can refer arguments in command line by !^, !$, !*; they stand for
  first, last, all arguments correspondingly.
  .PP
! To specify multiple commands in one alias, command should be separated
! by ``;;'' string.  For example, next description will allow you to
! execute \fIfep-cd\fP then pass cd command to shell when input ``cd''
! command.
  .if t .sp .3v
  .if n .sp 1
  \h'\w'MMMMM'u'fep-alias\ cd\ 'fep-cd !$;; cd !$'

--- 149,158 -----
  You can refer arguments in command line by !^, !$, !*; they stand for
  first, last, all arguments correspondingly.
  .PP
! To specify multiple commands in one alias, command should be
! separated by semicolon (;) character.  For example, next
! description will allow you to execute \fIfep-cd\fP then pass
! cd command to shell when input ``cd'' command.
  .if t .sp .3v
  .if n .sp 1
  \h'\w'MMMMM'u'fep-alias\ cd\ 'fep-cd !$;cd !$'
***************
*** 155,161
  command.
  .if t .sp .3v
  .if n .sp 1
! \h'\w'MMMMM'u'fep-alias\ cd\ 'fep-cd !$;; cd !$'
  .if t .sp .3v
  .if n .sp 1
  Note: \fIFep\fP built-in functions must be defined before normal commands.

--- 155,161 -----
  cd command to shell when input ``cd'' command.
  .if t .sp .3v
  .if n .sp 1
! \h'\w'MMMMM'u'fep-alias\ cd\ 'fep-cd !$;cd !$'
  .if t .sp .3v
  .if n .sp 1
  Note: \fIFep\fP built-in functions must be defined before normal commands.
*** /tmp/,RCSt1021651	Sun Nov 13 15:55:12 1988
--- feprc.sample	Sun Nov 13 15:53:24 1988
***************
*** 1,5
  #
! # $Header: feprc.sample,v 4.2 88/08/28 20:12:48 utashiro Exp $
  # This is a sample .feprc file.
  #
  

--- 1,5 -----
  #
! # $Header: feprc.sample,v 4.3 88/11/13 15:53:17 utashiro Exp $
  # This is a sample .feprc file.
  #
  
***************
*** 19,26
  	set delimiters=" 	\"';&<>()|^%"
  	set auto-repaint
  	set clear-repaint
! 	alias cd 'fep-cd !$;;cd !$'
! 	alias chdir 'fep-cd !$;;cd !$'
  
  	if $editmode == vi
  		fep-bind list-file-name "\^D"

--- 19,26 -----
  	set delimiters=" 	\"';&<>()|^%"
  	set auto-repaint
  	set clear-repaint
! 	alias cd 'fep-cd !$;cd !$'
! 	alias chdir 'fep-cd !$;cd !$'
  
  	if $editmode == vi
  		fep-bind list-file-name "\^D"