LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Ncurses Thoughts (https://www.linuxquestions.org/questions/programming-9/ncurses-thoughts-280647/)

RodimusProblem 01-21-2005 05:39 PM

Ncurses Thoughts
 
I plan to make several console-mode only programs, and thus have been researching ncurses. However, I'm not impressed by it.

To be quite frank, many of the programs I see using it shouldn't need it at all ( bsdgames package has some good examples there).

Many man pages and web pages claim ncurses key value is the portability it gives to programs.

Let's look at this a moment shall we?

-ncurses is not "forward compatable". ie stuff compiled against version 5 won't work with version 4.

-ncurses has no Windows or DOS ports.

A while back I wrote a simple program that demos all of the key functions I use. It is statically linked. It has no dependencies (under linux; under Windows it has 4 dependencies).

-Compiled under kernel version 2.4.27, it runs without change on systems with different kernel versions (older and newer kernels).

-Compiled under ncurses 5, it runs on systems with version 4.

-I only have to compile this program on Windows to make it Windows / DOS compatable. (no editing of source code needed).



NCurses' other features include writing text to the terminal screen, blanking the screen, and changing text color. All of which are already present APIs like getc.

Is there any reason to use ncurses?

jtshaw 01-21-2005 06:46 PM

Not to be critical of you, but when they say ncurses is "portable" they were really saying that it is a free software version of curses from SysV R4.0 that will work on any ANSI/POSIX compliant UNIX system (or *nix system). Nobody ever said it would work on Windows or DOS because they aren't UNIX OS's... but it does work on Solaris, AIX, IRIX, MacOSX, Linux, BSD, ect. You need to keep in mind why they wrote it in the first place. There were a bunch of apps people had written with curses on SysV and everyone wanted to use those apps on new systems running other Unix OS's. Compared to curses it is VERY portable.

I do agree that there are some apps out there that use it that probably don't need to, but as far as emulating basic windowing in text mode unix it is hard to beat.

RodimusProblem 01-22-2005 04:24 AM

Quote:

Not to be critical of you, but when they say ncurses is "portable" they were really saying that it is a free software version of curses from SysV R4.0 that will work on any ANSI/POSIX compliant UNIX system (or *nix system). Nobody ever said it would work on Windows or DOS because they aren't UNIX OS's... but it does work on Solaris, AIX, IRIX, MacOSX, Linux, BSD, ect. You need to keep in mind why they wrote it in the first place. There were a bunch of apps people had written with curses on SysV and everyone wanted to use those apps on new systems running other Unix OS's. Compared to curses it is VERY portable.
I'm a bit of an "old-school" programmer. It used to be when code was "portable" it worked on the three major platforms ( Mac, Windows & UNIX ). For example Java and Flash were touted as being "portable". Hence why I found ncurses' lack of non-*nix support disappointing. ;)


Quote:

I do agree that there are some apps out there that use it that probably don't need to, but as far as emulating basic windowing in text mode unix it is hard to beat.
The "forms characters" pretty much need ncurses to be displayed properly on unix. The standard ASCII characters are another matter. That's also why I wonder why some programs like boggle, wumpus, adventure, quiz and other text-mode games that don't use special characters even bother with ncurses.

After all loading 350 KB of libraries to run a 30 KB program is a good portion of the definition of bloatware. ;)

exvor 01-22-2005 10:19 AM

I agree with you about some linux apps being total bloatware. I find from time to time just utterly stupid actions programmers take when creating a program. One of my bigest beef's i would say with some programs is a over dependancy on librarys. Now im not saying librarys are bad but we need to be a little more less dependant on obscure shared librarys. IF you know that a library you used in a program is not very common in any of the distros and you use it in your program "INCLUDE IT WITH THE SOURCE" <--- why is this such a problem to do.


another reason i belive a 40kb program requires so many librarys is because the programer will use a function in one of the librarys and its the only one he used in there. So you have to load the whole library just to get the one function used.


an example i would say is i found this wonderfull program online that shows me the wireless stregth of my wireless signal. But after about 2 hours of trying to find a java library i think cant rember too good on this one for tcl looking on cspan i gave up trying to compile the program. The programmer had used a library that is almost impossible to get online.

jtshaw 01-22-2005 11:46 AM

Quote:

I'm a bit of an "old-school" programmer. It used to be when code was "portable" it worked on the three major platforms ( Mac, Windows & UNIX ). For example Java and Flash were touted as being "portable". Hence why I found ncurses' lack of non-*nix support disappointing.
I agree with you, those Gnu people are strange folk though.. I'm not sure some of them even know Windows exists:)

RodimusProblem 01-22-2005 11:51 AM

Quote:

another reason i belive a 40kb program requires so many librarys is because the programer will use a function in one of the librarys and its the only one he used in there. So you have to load the whole library just to get the one function used.
Like Win32 Solitare ( 32-bit version of sol.exe ).

Wine can't run it because it calls a DLL that isn't supported.

Using a dependency checker I found that sol.exe calls exactly one function from a 2.3 MB DLL. That function is just a "OK" response to Windows shutting down. :rolleyes:

Hko 01-23-2005 10:03 AM

But that's very likely to be library that is used by a lot of programs, if not virtually all programs that have a user-interface.

So I guess when you start sol.exe 99 out of a 100 times, this DLL is already loaded.

Though ncurses is not that common, the same reasoning applies.

exvor 01-23-2005 11:44 AM

Ohh I agree that windows programs do exactly the same thing :P

deiussum 01-23-2005 06:57 PM

Maybe I'm missing something, but I do believe that there is a Windows port of ncurses available with Cygwin...

Hko 01-24-2005 11:01 AM

Probably true,..
Strictly speaking that's not a Windows-port, but a unix/linux emulation layer.


All times are GMT -5. The time now is 11:07 PM.