DOS---------------------- < Пред. | След. > -- < @ > -- < Сообщ. > -- < Эхи > --
 Nп/п : 15 из 15
 От   : Ben Collver                         1:124/5016        18 фев 24 11:39:08
 К    : All                                                   18 фев 24 06:54:01
 Тема : Running GNU on DOS with DJGPP part 3
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 177.fido_dos@1:124/5016 2a37776d
@TZUTC: -0600
@PID: Synchronet 3.20a-Linux master/862753d6c Feb 16
2024 GCC 11.4.0
@TID: SBBSecho 3.20-Linux master/862753d6c Feb 16
2024 GCC 11.4.0
@BBSID: EOTLBBS
@CHRS: ASCII 1
@NOTE: SlyEdit 1.88d (2024-02-16) (ICE style)
The second is that DOS paths may include an optional drive name such
as C: and... the drive name has the colon character int. While Unix
uses the colon character to separate multiple components of the
search PATH, DOS could not do that: it had to pick a different
character, and it picked the semicolon. Take a look:

    C:\\>path
    PATH=Z:\\;C:\\DEVEL\\BIN;C:\\DEVEL\\DJGPP\\BIN;C:\\DEVEL\\TC\\BIN

The problem here is that many Unix applications, particularly shell
scripts like configure--especially configure--read the value of the
PATH variable and split it at colon separators or append to it by
adding a colon. But if we do these textual manipulations on a
DOS-style PATH like the one shown above... we`ll get the wrong
behavior because of the drive names--and Unix programs don`t know
they have to split on the semicolon instead and we cannot be expected
to fix them all.

The way DJGPP deals with this is by faking the /dev/ device tree.
While DJGPP provides implementations of things like /dev/null, it
also exposes DOS drives via their corresponding /dev/[a-z]/ virtual
directory. So, if you wanted to run applications that parse or modify
the PATH, you could rewrite the above as this:

    PATH=/dev/z:/dev/c/devel/bin:/dev/c/devel/djgpp/bin:/dev/c/devel/tc/bin

This would allow any application reading the PATH to continue to
work. But note that this value doesn`t seem to leave the realm of the
current process, which is interesting:

    D:\\>path
    PATH=Z:\\;C:\\DEVEL\\BIN;C:\\DJGPP\\BIN;C:\\DEVEL\\TC\\BIN
    D:\\>
    
    D:\\>bash
    bash-4.2$ echo $PATH
    z:/;c:/devel/bin;c:/djgpp/bin;c:/devel/tc/bin
    bash-4.2$ env | grep ^PATH=
    PATH=z:/;c:/devel/bin;c:/djgpp/bin;c:/devel/tc/bin
    bash-4.2$
    bash-4.2$ PATH=/dev/c/djgpp/bin
    bash-4.2$
    bash-4.2$ echo $PATH
    /dev/c/djgpp/bin
    bash-4.2$ env | grep ^PATH=
    PATH=c:\\djgpp\bin
    bash-4.2$

The picture above shows how bash sees a DOS-style PATH after it
starts. Manually setting it to a Unix path keeps the Unix path in the
current process (as shown by the built-in echo calls), but when we
spawn a different one (env is a separate executable), the value is
reset. This makes sense because, if we are running a regular DOS
program from within a DJGPP one, we want to export a DOS-compatible
environment. Which means the Unix variants probably only stick within
shell scripts. You can also see how this works by peeking at
dosexec.c again.

But wait a minute... did I just show you bash?! On DOS? Oh yes, yes I
did...

# Trying it out yourself

It`s time to get our hands dirty, try this out, and reminisce the old
days! Or, actually, not so old. You should know that DJGPP is still
available in this day and age and that it is quite up to date with
GCC 12.3--released less than a year ago.

First off, start by installing DOSBox. You can use the standard
DOSBox version, but it`s probably better to go the DOSBox-X route so
that you can get Long File Name (LFN) support by setting the ver=7.1
configuration option. Otherwise, beware that running Bash later on
will create .bash_history under C:\\ but the file will be named .BAS
due to some odd truncation, and this will later confuse Bash on a
second start and assume that .BAS is actually .bash_login.

<https://www.dosbox.com/download.php?main=1>

<https://dosbox-x.com/>

Now, pick a mirror for your downloads. You`ll see various uses of FTP
in the list but don`t be surprised if clicking on those doesn`t work:
major browsers have unfortunately dropped their FTP client so you`ll
have to "fall back" to an HTTP mirror.

<https://www.delorie.com/djgpp/getting.html>

From there, you can use the Zip Picker to help you choose what you
need or you can download the same files I did:

* v2apps/csdpmi7b.zip:  The CWSDPMI free DPMI host.
* v2apps/rhid15ab.zip:  The RHIDE console IDE akin to Turbo C++.
* v2/djdev205.zip:      Base DJGPP tools.
* v2gnu/bnu2351b.zip:   GNU Binutils (tools like gas and objdump).
* v2gnu/bsh4253b.zip:   GNU Bash.
* v2gnu/em2802b.zip:    GNU Emacs.
* v2gnu/fil41br3.zip:   GNU coreutils (tools like ls and cp).
* v2gnu/gcc930b.zip:    GCC itself.
* v2gnu/gdb801b.zip:    GDB because why not.
* v2gnu/gpp930b.zip:    G++.
* v2gnu/grep228b.zip:   grep because I find it very handy.
* v2gnu/mak44b.zip:     GNU Make.
* v2gnu/shl2011br3.zip: Various shell utilities (*)
* v2gnu/txt20br3.zip:   GNU textutils (tools like cat and cut).

(*) (like basename and dirname) that you`ll almost-certainly need to
    run shell scripts.

Once you have those files, create the "root" directory for what will
be the C: drive in DOSBox. I keep this under ~/dos/ and it is much
easier to prepare this directory from outside of DOSBox. Within that
location, create a djgpp subdirectory and unpack all the zip files
you downloaded into it. If there are any file conflicts, just tell
unzip to overwrite them.

Once the unpacking finishes, go to your DOSBox configuration. If you
are on Windows, you should have a start menu entry called "DOSBox
0.74-3 Options" or similar which opens the configuration file in
Notepad. If you are on Linux or any other reasonable OS, you can find
the configuration file under ~/.dosbox/. In the configuration, you`ll
want to set up the C: drive at the very bottom of the file where the
[autoexec] section is. Here is what I do:

    [autoexec]
    MOUNT C C:\\Users\\jmmv\\dos
    SET PATH=%PATH%;C:\\DJGPP\\BIN
    SET DJGPP=C:\\DJGPP\\DJGPP.ENV
    C:

Launch DOSBox and you are set. Enter full-screen by pressing
Alt+Enter for the full retro experience and then... launch
bash:

    C:\\>gcc
    gcc.exe: fatal error: no input files
    compilation terminated.
    
    C:\\>bash
    bash-4.2$ uname -a
    MS-DOS #= Don`t 5 00 i486 unknown
    bash-4.2$ gcc
    gcc.exe: fatal error: no input files
    compilation terminated.
    bash-4.2$ pwd
    c:/
    bash-4.2$ ls djgpp
    allegro  copying     djgpp.env  include  libexec     share
    bin      copying.dj  faq        info     manifest    tmp
    contrib  copying.lib gnu        lib      readme.1st
    bash-4.2$ date
    Sat Feb 10 11:09:51 GMT 2024
    bash-4.2$ _

Pretty neat stuff, huh?

From: <https://blogsystem5.substack.com/p/running-gnu-on-dos-with-djgpp>
--- SBBSecho 3.20-Linux
 * Origin: End Of The Line BBS - endofthelinebbs.com (1:124/5016)
SEEN-BY: 1/120 15/0 18/0 50/109 90/1 105/81
106/201 987 123/0 25 180 200 755
SEEN-BY: 123/3001 124/5014 5016 128/260 129/305
135/115 225 138/146 153/757
SEEN-BY: 153/7715 218/700 222/2 226/30 227/114
229/110 112 113 206 307 317
SEEN-BY: 229/400 426 428 470 664 700 240/1120
250/1 261/38 266/512 275/100
SEEN-BY: 275/1000 282/1038 291/111 299/6 301/1
320/219 322/757 342/11 200
SEEN-BY: 387/25 396/45 460/58 467/888 633/280
712/848 1321 1321 2320/105
SEEN-BY: 3634/0 12 27 56 57 119 5001/100 5005/49
5020/400 715 846 848 1042
SEEN-BY: 5020/4441 12000 5030/49 1081 5054/8
5058/104 5061/133 5075/35 128
SEEN-BY: 5083/1 444 5090/958
@PATH: 124/5016 396/45 229/426 153/7715 3634/12
5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх