www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/10/17:57:08

Date: Sun, 8 Dec 1996 16:45:08 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: John Schucker <gwynn AT globaldialog DOT com>
cc: djgpp AT delorie DOT com, ding AT ptd DOT net
Subject: Re: Bash and less questions.
In-Reply-To: <Pine.BSI.3.91.961205005021.26200D-100000-100000-100000-100000@msn.globaldialog.com>
Message-ID: <Pine.SUN.3.91.961208161509.3423G-100000@is>
MIME-Version: 1.0

On Thu, 5 Dec 1996, John Schucker wrote:

> q foo
> (in editor type)
> echo foo
> (save this)
> And then from 'bash$' type
> foo
> My computer locks with exception 6.  This happens every single time I do 
> this.  I am using qemm 7.5, but since I am not using its DPMI server, I 
> really don't see how it would affect anything.  Help?

I don't think this is a bug, you just force `bash' to do the impossible:
execute an arbitrary text file as a shell script.  The fact that the file 
includes valid shell commands is irrelevant, because `bash' doesn't know 
that (it doesn't read the entire file).  To make the above script look 
like a script, you should put the following on the first line:

	#!/bin/bash

Then two things will automagically happen: (1) a call to `stat' will
return an execute bit set for this file (might be important to `bash',
since it probably requires scripts to be executable); and (2) `bash' will
either call `spawn' to run the script or read and execute it itself, both
of which will succeed (I didn't look into `bash' sources to determine
which of these two alternatives actually gets executed). 

The way you did it, `bash' just tried to call DOS to run the script, and 
DOS thinks that any file which isn't a .exe is a .com image, so it tries 
to load and execute it, with obvious consequences...

> At the risk of having babbled enough already, I tried doing a make of 
> less.  It makes fine, but for some reason, I can't get it to use BIOS 
> writes as opposed to direct video.  I tried setting directvideo = 0; in 
> both screen.c and main.c  I know conio.h said gppconio ignores the value 
> of directvideo, but I thought that was for stuff in the gppconio.h file?

Both conio and gppconio are the same, they don't support BIOS writes.  
That's why the speech-friendly option of Info uses DOS I/O.

> I also tried replacing all occurrences of cputs(foo); in screen.c with:
> fputs(foo,stdout);
> but when I do a make and then do less --help or less less.man, it still 
> uses direct video writes.

I don't see how this can be possible, this replacement should have done
the trick.  Please post all the places where you replaced cputs -> fputs,
and also tell whether direct writes are used (after the replacement) in
all screen writes or just in some of them. 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019