Changes from arch/CVS synchronization
[bpt/guile.git] / libguile / script.c
index cbcbe9d..b024378 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -11,7 +11,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /* "script.c" argv tricks for `#!' scripts.
@@ -120,7 +120,7 @@ char *
 scm_find_executable (const char *name)
 {
   char tbuf[MAXPATHLEN];
-  int i = 0;
+  int i = 0, c;
   FILE *f;
 
   /* fprintf(stderr, "s_f_e checking access %s ->%d\n", name, access(name, X_OK)); fflush(stderr); */
@@ -132,16 +132,19 @@ scm_find_executable (const char *name)
   if ((fgetc (f) == '#') && (fgetc (f) == '!'))
     {
       while (1)
-       switch (tbuf[i++] = fgetc (f))
+       switch (c = fgetc (f))
          {
          case /*WHITE_SPACES */ ' ':
          case '\t':
          case '\r':
          case '\f':
          case EOF:
-           tbuf[--i] = 0;
+           tbuf[i] = 0;
            fclose (f);
            return scm_cat_path (0L, tbuf, 0L);
+         default:
+           tbuf[i++] = c;
+           break;
          }
     }
   fclose (f);
@@ -378,7 +381,9 @@ scm_shell_usage (int fatal, char *message)
            "  -v, --version  display version information and exit\n"
           "  \\              read arguments from following script lines\n"
            "\n"
-          "Please report bugs to bug-guile@gnu.org\n",
+          "Please report bugs to bug-guile@gnu.org.  (Note that you must\n"
+          "be subscribed to this list first, in order to successfully send\n"
+          "a report to it).\n",
            scm_usage_name);
 
   if (fatal)
@@ -630,7 +635,7 @@ scm_compile_shell_switches (int argc, char **argv)
        {
          /* Print version number.  */
          printf ("Guile %s\n"
-                 "Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free Software Foundation\n"
+                 "Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation\n"
                  "Guile may be distributed under the terms of the GNU General Public Licence;\n"
                  "certain other uses are permitted as well.  For details, see the file\n"
                  "`COPYING', which is included in the Guile distribution.\n"