50c406
--- a2ps-4.13/src/sheets-map.l.includes	2000-02-04 21:07:47.000000000 +0000
50c406
+++ a2ps-4.13/src/sheets-map.l	2004-09-07 16:06:27.575891868 +0100
50c406
@@ -40,6 +40,7 @@
50c406
 
50c406
 #define MAX_INCLUDE_DEPTH 10
50c406
 static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
50c406
+static int lineno_stack[MAX_INCLUDE_DEPTH];
50c406
 static char *filename_stack[MAX_INCLUDE_DEPTH];
50c406
 static int include_stack_ptr;
50c406
 static char *yyfilename;
50c406
@@ -93,7 +94,7 @@
50c406
 white         [[:space:]]+
50c406
 key           [-a-zA-Z0-9_]+:
50c406
 comment       #.*
50c406
-include       include([^)]+)
50c406
+include       include\([^)]+\)
50c406
 %%
50c406
 
50c406
 {key}         token_val = xstrndup (yytext, yyleng - 1); return tKEY;
50c406
@@ -102,7 +103,7 @@
50c406
 {white}       ;
50c406
 {comment}     ;
50c406
 {include}     {	/* Kill the closing paren and pass the file name. */
50c406
-                yytext[yyleng] = '\0';
50c406
+                yytext[yyleng-1] = '\0';
50c406
                 yy_include_push (yytext + strlen ("include("));
50c406
               }
50c406
 
50c406
@@ -210,11 +211,13 @@
50c406
     error (1, 0, _("too many includes"));
50c406
 
50c406
   include_stack[include_stack_ptr] = YY_CURRENT_BUFFER;
50c406
-  filename_stack[include_stack_ptr++] = file;
50c406
+  lineno_stack[include_stack_ptr] = yylineno;
50c406
+  filename_stack[include_stack_ptr++] = yyfilename;
50c406
 
50c406
   message (msg_file, (stderr, "%s:%d: includes %s\n",
50c406
 		      yyfilename, yylineno, file));
50c406
 
50c406
+  yyfilename = file;
50c406
   yyin = xrfopen (yyfilename);
50c406
 
50c406
   yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
50c406
@@ -227,8 +230,8 @@
50c406
 {
50c406
   fclose (yyin);
50c406
   yy_delete_buffer (YY_CURRENT_BUFFER);
50c406
-  free (yyfilename);
50c406
   yyfilename = filename_stack[include_stack_ptr];
50c406
+  yylineno = lineno_stack[include_stack_ptr];
50c406
   yy_switch_to_buffer (include_stack[include_stack_ptr]);
50c406
   message (msg_file, (stderr, "Back to file `%s'.\n", yyfilename));
50c406
 }
50c406
@@ -254,6 +257,7 @@
50c406
 yy_close (void)
50c406
 {
50c406
   fclose (yyin);
50c406
+  free (yyfilename);
50c406
 }
50c406
 
50c406
 int