Monday, May 12 2025

Sync C Code from DOS Machine to Git

To refresh my somewhat faded MS-DOS coding skills, I installed Microsoft C 6.00 and a couple of other tools to my retro PC. I also replicated this environment on my laptop, with DosBox-X, to have it with me on the road.

How nice it would be to code sometimes at my desk, sometimes on the go. But, how could I  sync my work between my devices? There are modern tools for this like git, but unfortunately there are no versions for old operating systems like MS-DOS. What the heck could I do?

A thought started to form ...

What if I use an intermediary agent? Running a more modern operating system that has git on-board and to provide something, like a file service or a share.

As you can conclude from the sentence above, it would be a straithforward solution to instantiate a Linux box that provides FTP service, host a local git repository and sync it to a remote like github by some scripted and automated mechanism that has to be developed later. It would be, but it has two problems:
 

  • I should set up and run a full TCP/IP stack on my MS-DOS machine
  • FTP client available for DOS is basic
     

I found the former a no-no because it eats up a lot of memory. Tried the latter, it was annoying, frustrating. I looked for something, something just a tad better.

Tripped over something interesting

After some searching I found EtherDFS. This little nifty tool runs on a Linux machine and shares a folder over the network to be used by MS-DOS machines. Hmmm ... It looks interesting. If I manage to set up the server side, it promises me that the client is capable of discover it in the same broadcast domain and map the shared folder as a network drive. All I have to do just copy/move/delete the files you want. Just like old times.

Memory wise it is truly what I needed. The only one thing it requires is a packet driver for your network card. It does not need a TCP/IP stack, it communicates with raw ethernet frames. The best of all things is that itself is super small.

It is time for some Linux scripting

But how will this help to sync my work? I have a couple of Raspberry Pi 3B+s laying around so I grabbed one of them, installed vanilla Raspbian and EtherDFS (it is there in the apt repo) and initialized a folder as a git repository and synced the whole thing to github.

To have the Raspberry Pi do the job on its own, I wrote a few systemd units and scripts. One is responsible to fire up EtherDFS server at boot time. Another one’s job is to do the sync. A third one’s task is to wait for and execute a shutdown on demand.

The latter deserves some explanation. As my Pi runs headless I had to find some way to shut it down. I came up with the solution to watch for a specific file “shutdown” appear in the shared folder’s root. If it shows up lights go out.

 

Please check out my repository for the scripts and files at

https://github.com/attila386/netdrive.

Ignition, 3 ..., 2 ..., 1 ...

The site is dedicated to computing in general be it modern or retro. I intend to record various informations for my own and anyone’s sake who might find it helpful. I intend to write short articles about my own experiments and work, publish photos and gather interesting links on the topic from all around the world.

At launch retro topics will revolve around IBM PC compatibles and MS-DOS, modern topics are planned about Linux and Unix. As time goes by I’ll see where this journey is heading to. Although I named my site in honor of the venerable Socket 7, the socket for almost all Intel Pentiums and its pin compatible sibling CPUs it does not mean I will not write about many other technologies from different eras.