Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 1, or (at your option) any later
+ Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#include <config.h>
#endif
#include "../bashtypes.h"
-#include "../posixstat.h"
-#include "../filecntl.h"
+#include "posixstat.h"
+#include "filecntl.h"
#include <stdio.h>
#include <signal.h>
#define FEVAL_NONINT 0x008
#define FEVAL_LONGJMP 0x010
#define FEVAL_HISTORY 0x020
+#define FEVAL_CHECKBINARY 0x040
extern int interactive, interactive_shell, posixly_correct;
extern int indirection_level, startup_state, subshell_environment;
file_error (filename);
if (flags & FEVAL_LONGJMP)
- {
+ {
last_command_exit_value = 1;
jump_to_top_level (EXITPROG);
}
(*errfunc) ("%s: file is too large", filename);
return ((flags & FEVAL_BUILTIN) ? EXECUTION_FAILURE : -1);
}
+
+#if defined (__CYGWIN__) && defined (O_TEXT)
+ setmode (fd, O_TEXT);
+#endif
+
string = xmalloc (1 + file_size);
result = read (fd, string, file_size);
string[result] = '\0';
return ((flags & FEVAL_BUILTIN) ? EXECUTION_SUCCESS : 1);
}
- if (check_binary_file ((unsigned char *)string, (result > 80) ? 80 : result))
+ if ((flags & FEVAL_CHECKBINARY) &&
+ check_binary_file ((unsigned char *)string, (result > 80) ? 80 : result))
{
free (string);
(*errfunc) ("%s: cannot execute binary file", filename);