Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 1999 06:20:52 +0900 (JST)
From:      dcs@newsguy.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/9473: Loader's builtin "source" collides with ficl's "source"
Message-ID:  <199901132120.GAA00394@daniel.sobral>

next in thread | raw e-mail | index | archive | help

>Number:         9473
>Category:       kern
>Synopsis:       Loader's "source" is also the name of an ANS Forth word
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 13 13:30:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Daniel C. Sobral
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	Current as of Jan 12/1999.

>Description:

	Loader's builtin command "source" is also the name of a ANS Forth
CORE word set word.

>How-To-Repeat:

	Type "source". Compare with ANS Forth standard expected results. :-)

>Fix:

	Apply the fix below.


--- interp.c	1999/01/13 19:48:11	1.1
+++ interp.c	1999/01/13 21:01:10
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$Id: interp.c,v 1.1 1999/01/13 19:48:11 root Exp $
+ *	$Id: interp.c,v 1.3 1999/01/13 21:01:01 root Exp root $
  */
 /*
  * Simple commandline interpreter, toplevel and misc.
@@ -99,7 +100,7 @@
     /*
      * Read our default configuration
      */
-    source("/boot/boot.conf");
+    include("/boot/boot.conf");
     printf("\n");
     /*
      * Before interacting, we might want to autoboot.
@@ -140,34 +141,36 @@
  * Commands may be prefixed with '@' (so they aren't displayed) or '-' (so
  * that the script won't stop if they fail).
  */
-COMMAND_SET(source, "source", "read commands from a file", command_source);
+COMMAND_SET(include, "include", "read commands from a file", command_include);
 
 static int
-command_source(int argc, char *argv[])
+command_include(int argc, char *argv[])
 {
     int		i;
 
     for (i = 1; i < argc; i++)
-	source(argv[i]);
+	include(argv[i]);
     RETURN(CMD_OK);
 }
 
-struct sourceline 
+struct includeline
 {
     char		*text;
     int			flags;
     int			line;
 #define SL_QUIET	(1<<0)
 #define SL_IGNOREERR	(1<<1)
-    struct sourceline	*next;
+    struct includeline	*next;
 };
 
 void
-source(char *filename)
+include(char *filename)
 {
-    struct sourceline	*script, *se, *sp;
+    struct includeline	*script, *se, *sp;
     char		input[256];			/* big enough? */
+#ifndef BOOT_FORTH
     int			argc;
+#endif
     char		**argv, *cp;
     int			fd, flags, line;
 
@@ -200,8 +203,8 @@
 	    flags |= SL_IGNOREERR;
 	}
 	/* Allocate script line structure and copy line, flags */
-	sp = malloc(sizeof(struct sourceline) + strlen(cp) + 1);
-	sp->text = (char *)sp + sizeof(struct sourceline);
+	sp = malloc(sizeof(struct includeline) + strlen(cp) + 1);
+	sp->text = (char *)sp + sizeof(struct includeline);
 	strcpy(sp->text, cp);
 	sp->flags = flags;
 	sp->line = line;
--- help.common	1999/01/13 19:52:19	1.1
+++ help.common	1999/01/13 19:57:16
@@ -213,15 +213,17 @@
 	See the set command for a list of some variables.
 
 ################################################################################
-# Tsource DRead commands from a script file
+# Tinlcude DRead commands from a script file
 
-	source <filename>
+	include <filename>
 
 	The entire contents of <filename> are read into memory before executing
 	commands, so it is safe to source a file from removable media.
 
 	A number of modifiers may be prefixed to commands within a script file
 	to alter their behaviour:
+
+	#	Treat line as comment
 
 	@	Suppresses the printing of the command when executed.
 
--- bootstrap.h	1999/01/13 19:59:00	1.1
+++ bootstrap.h	1999/01/13 20:22:07
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$Id: bootstrap.h,v 1.1 1999/01/13 19:59:00 root Exp $
+ *	$Id: bootstrap.h,v 1.2 1999/01/13 20:20:43 root Exp root $
  */
 
 #include <sys/types.h>
@@ -56,7 +56,7 @@
 
 /* interp.c */
 extern void	interact(void);
-extern void	source(char *filename);
+extern void	include(char *filename);
 
 /* interp_parse.c */
 extern int	parse(int *argc, char ***argv, char *str);
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901132120.GAA00394>