LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-21-2005, 05:39 PM   #1
RodimusProblem
Member
 
Registered: Dec 2004
Distribution: Knoppix 3.6
Posts: 135

Rep: Reputation: 15
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?
 
Old 01-21-2005, 06:46 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
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.
 
Old 01-22-2005, 04:24 AM   #3
RodimusProblem
Member
 
Registered: Dec 2004
Distribution: Knoppix 3.6
Posts: 135

Original Poster
Rep: Reputation: 15
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.
 
Old 01-22-2005, 10:19 AM   #4
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
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.
 
Old 01-22-2005, 11:46 AM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
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
 
Old 01-22-2005, 11:51 AM   #6
RodimusProblem
Member
 
Registered: Dec 2004
Distribution: Knoppix 3.6
Posts: 135

Original Poster
Rep: Reputation: 15
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.
 
Old 01-23-2005, 10:03 AM   #7
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 110Reputation: 110
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.
 
Old 01-23-2005, 11:44 AM   #8
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
Ohh I agree that windows programs do exactly the same thing :P
 
Old 01-23-2005, 06:57 PM   #9
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Maybe I'm missing something, but I do believe that there is a Windows port of ncurses available with Cygwin...
 
Old 01-24-2005, 11:01 AM   #10
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Thoughts on 2.6.10? scuzzman Linux - General 5 12-27-2004 07:34 AM
Just some thoughts neocookie General 29 05-12-2004 02:39 PM
Need Some Thoughts Please!!! blmartin777 Debian 9 04-23-2004 05:14 PM
Your thoughts... bkeating General 21 12-09-2002 11:07 AM
ncurses-5.2-28 conflicts with file from package ncurses-5.2-12 tubby Linux - Software 4 06-16-2002 12:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration