On Wed, 11 Mar 2020 18:03:27 -0700
"Joe Lowder" <
joe@actionline.com> wrote:
> One c-programming objective pertains to a small utility
> that I have used every day for the past 30+ years. It has
> worked flawlessly on a number of different flavor Linux
> installs on many dozens of computers.
>
> The utility is called: 'readin' and it works similiarly
> to the standard linux or 'c' command 'read' except it acts
> instantly instead of requiring the user to press <ENTER>
>
> Today, I found that it did not work when I copied it on
> to a new installation of Linux Mint 18.3 on a Lenovo
> model 500 laptop, giving me a segmentation core fault.
>
> So, I wonder if the source code perhaps needs to be
> re-compiled for this kernel? Or, is there something else
> I could try? The current compiled version and the source
> code can be downloaded from these links:
>
> http://www.upquick.com/temp/readin
> http://www.upquick.com/temp/readin.c
C programmers are expensive, and the readin.c code is ancient. At first
I couldn't understand it at all: Then I remembered that back before
maybe 1983, C arguments were listed rather than prototyped: Like the
program in your link. Meanwhile, this code makes tremendous use of goto,
a 1940's thru early 1970's technique to save stack when you might have
only 256bytes or 1K RAM. To add insult to injury, the indentation
appears to be all over the place. You don't need just any C programmer:
You need a spaghetti programmer from the 1960's.
You can easily rewrite this program in Python. Because the program
(appears to) operates on human keystrokes, even the slowest interpreted
language is more than fast enough to keep up with the fastest typist in
the world.
If you're wondering how to take raw keystrokes, not requiring an Enter
key press, in Python, download my UMENU2 from
http://troubleshooters.com/projects/umenu2/ , look in file
UmenuUtils.py for method (function) getch_unix(), which reads raw
keystrokes without requiring an Enter.
I read later in the thread that you got your program to work. That's
good, for now, but the code is old and ugly, and sooner or later you'll
need to replace it.
What does that program do, anyway? The code was so whack I couldn't
tell.
SteveT
Steve Litt
March 2020 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss