changeset 2474:b8c53143581b

[project @ 1996-11-06 19:16:07 by jwe]
author jwe
date Wed, 06 Nov 1996 19:16:08 +0000
parents bb0c213e5885
children 1d7925d6bede
files src/ChangeLog src/variables.cc
diffstat 2 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+Wed Nov  6 12:32:48 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* variables.cc (is_function_file): Call gobble_leading_whitespace
+	here to strip all leading whitespace and comments.
+	(parse_fcn_file): If reading a function file, call
+	gobble_leading_whitespace again after resetting parser state to
+	grab help text.
+
 Tue Nov  5 13:00:35 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* syscalls.cc (Fgeteuid, Fgetuid): New functions.
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -458,7 +458,7 @@
 // code!
 
 static string
-gobble_leading_white_space (FILE *ffile, int in_parts)
+gobble_leading_white_space (FILE *ffile, bool in_parts)
 {
   string help_txt;
 
@@ -560,6 +560,8 @@
 
   long pos = ftell (ffile);
 
+  gobble_leading_white_space (ffile, false);
+
   char buf [10];
   fgets (buf, 10, ffile);
   int len = strlen (buf);
@@ -609,8 +611,6 @@
       // Check to see if this file defines a function or is just a
       // list of commands.
 
-      string tmp_help_txt = gobble_leading_white_space (ffile, 0);
-
       if (is_function_file (ffile))
 	{
 	  // XXX FIXME XXX -- we shouldn't need both the
@@ -642,7 +642,10 @@
 
 	  reset_parser ();
 
-	  help_buf = tmp_help_txt;
+	  help_buf = gobble_leading_white_space (ffile, true);
+
+	  // XXX FIXME XXX -- this should not be necessary.
+	  gobble_leading_white_space (ffile, false);
 
 	  int status = yyparse ();
 
@@ -774,7 +777,7 @@
 
       if (fptr)
 	{
-	  retval = gobble_leading_white_space (fptr, 1);
+	  retval = gobble_leading_white_space (fptr, true);
 	  fclose (fptr);
 	}
     }