diff src/lread.c @ 4556:a1f8c5c250c2

Automated merge with file:/Sources/xemacs-21.5-checked-out
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 11 May 2008 19:50:49 +0200
parents ac6231e0c1df
children 7869173584fc
line wrap: on
line diff
--- a/src/lread.c	Sun May 11 19:50:10 2008 +0200
+++ b/src/lread.c	Sun May 11 19:50:49 2008 +0200
@@ -744,6 +744,25 @@
     internal_bind_lisp_object (&Vfile_domain, Qnil);
 #endif
 
+    /* Is there a #!? If so, read it, and unread ;!.
+
+       GNU implement this by treating any #! anywhere in the source text as
+       commenting out the whole line. */
+    {
+      char shebangp[2];
+      int num_read;
+
+      num_read = Lstream_read (XLSTREAM (lispstream), shebangp,
+                               sizeof(shebangp));
+      if (sizeof(shebangp) == num_read
+	  && 0 == strncmp("#!", shebangp, sizeof(shebangp)))
+	{
+          shebangp[0] = ';';
+	}
+
+      Lstream_unread (XLSTREAM (lispstream), shebangp, num_read);
+    }
+
     /* Now determine what sort of ELC file we're reading in. */
     internal_bind_int (&load_byte_code_version, load_byte_code_version);
     if (reading_elc)