Programming in TUI not CLI like the program "links", the text webbrowser.

C

C_learner

When I am using the program "links" the text web browser, i want to know
how to make the menu in the first line of the program, like

File View Link Downloads Setup Help

I can choose one of these.
After i choose, the sub-menu of 'File', for example, shows up.
I heard from somewhere that Programs like that one are in TUI(Text User
Interface).
So, While I was finding about the development in TUI, I found People
usually use 'ncurses' library.. and they include "#include <ncurses.h>" in
their source.

And I got the source from here,
http://www.jikos.cz/~mikulas/links//download/links-1.01pre1.tar.gz
and i used the command 'cat * | grep "#include"' in the main folder
after extract.

the result
------------------
#include "links.h"
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <be/kernel/OS.h>
#include <errno.h>
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "codepage.inc"
#include "uni_7b.inc"
#include "entity.inc"
#include "upcase.inc"
#include <sys/systemcfg.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include <features.h>
#include <sys/param.h>
#include "confdefs.h"
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
#include "confdefs.h"
#include <string.h>
#include "confdefs.h"
#include <stdlib.h>
#include "confdefs.h"
#include <ctype.h>
#include "confdefs.h"
#include <sgtty.h>
#include "confdefs.h"
#include <termio.h>
#include "confdefs.h"
#include "confdefs.h"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
#include "confdefs.h"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
#include <stdlib.h>
#include <stddef.h>
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
#include "confdefs.h"
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include "confdefs.h"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include "confdefs.h"
#include <$ac_hdr>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#AC_TRY_LINK([#include <netdb.h>], [gethostbyname("")], cf_result=yes,
cf_result=no)
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include "confdefs.h"
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <stdlib.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <assert.h>
#include "confdefs.h"
#include <pty.h>
#include "confdefs.h"
#include <pty.h>
#include "confdefs.h"
#include "confdefs.h"
#include <openssl/ssl.h>
#include "confdefs.h"
#include <openssl/ssl.h>
#include "confdefs.h"
#include <openssl/ssl.h>
#include "confdefs.h"
#include <openssl/ssl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#AC_TRY_LINK([#include <netdb.h>], [gethostbyname("")], cf_result=yes,
cf_result=no)
AC_TRY_LINK([#include <stdlib.h>], [_beginthread(NULL, NULL, 0, NULL)],
cf_result=yes, cf_result=no)
AC_TRY_LINK([#include <pty.h>], [struct winsize win;ptioctl(1,
TIOCGWINSZ, &win)], cf_result=yes, cf_result=no)
AC_TRY_LINK([#include <pty.h>], [struct winsize
win;ptioctl(1, TIOCGWINSZ, &win)], cf_result=yes, cf_result=no)
AC_TRY_LINK([#include <openssl/ssl.h>],
[OpenSSL_add_all_algorithms()], cf_result=yes, cf_result=no)
AC_TRY_LINK([#include <openssl/ssl.h>],
[SSLeay_add_ssl_algorithms()], cf_result=yes, cf_result=no)
AC_TRY_LINK([#include <openssl/ssl.h>],
[OpenSSL_add_all_algorithms()], cf_result=yes, cf_result=no)
AC_TRY_LINK([#include
<openssl/ssl.h>], [SSLeay_add_ssl_algorithms()], cf_result=yes,
cf_result=no)
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "language.inc"
#include "config.h"
#include "config2.h"
#include "os_dep.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include <sys/time.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <signal.h>
#include <sigaction.h>
#include <sys/wait.h>
#include <sys/select.h>
#include <sys/resource.h>
#include <sys/cygwin.h>
#include <io.h>
#include <sys/utsname.h>
#include <wait.h>
#include <netinet/in_systm.h>
#include <netinet/in_system.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <utime.h>
#include <termios.h>
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include "os_depx.h"
#include "setup.h"
#include "language.h"
#include "codepage.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include <sys/ioctl.h>
#include <gpm.h>
#include <windows.h>
#include <os2.h>
#include <io.h>
#include <process.h>
#include <sys/video.h>
#include <sys/builtin.h>
#include <sys/fmutex.h>
#include <pty.h>
#include <be/kernel/OS.h>
#include <sched.h>
#include <pthread.h>
#include <pwd.h>
#include <grp.h>
#include <pwd.h>
#include <grp.h>
#include <sys/time.h>
#include <sys/types.h>
#include <net/socket.h>
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"
#include "links.h"

------------------------------------------

there is no "#include <ncurses.h>".
So, i think the developer of the program didn't use ncurses library....

Did he use another library or the system default library??

if he did use the system default library, Would you let me know what I
have to know to make menus and others in TUI using the "system default"
library and where to find the reference of it??

like "the interaction of program and terminal, to adjust menu bar size."
 
A

Alan Curry

So, While I was finding about the development in TUI, I found People
usually use 'ncurses' library.. and they include "#include <ncurses.h>" in
their source.

And I got the source from here,
http://www.jikos.cz/~mikulas/links//download/links-1.01pre1.tar.gz

After a couple minutes of looking, I believe that code was written by a
Real Programmer who thinks using libraries (or writing comments) is a sign
of weakness. Instead of using curses, it contains a crude imitation.
 
B

Barry Schwarz

When I am using the program "links" the text web browser, i want to know
how to make the menu in the first line of the program, like

File View Link Downloads Setup Help

I can choose one of these.
After i choose, the sub-menu of 'File', for example, shows up.
I heard from somewhere that Programs like that one are in TUI(Text User
Interface).
So, While I was finding about the development in TUI, I found People
usually use 'ncurses' library.. and they include "#include <ncurses.h>" in
their source.

And I got the source from here,
http://www.jikos.cz/~mikulas/links//download/links-1.01pre1.tar.gz
and i used the command 'cat * | grep "#include"' in the main folder
after extract.

the result
------------------

snip 280+ lines

Did you really need to quote all that crap just to say you couldn't
find ncurses? Why didn't you grep for ncurses instead?
 
J

James Waldby

.
And I got the source from here,
http://www.jikos.cz/~mikulas/links//download/links-1.01pre1.tar.gz and i
used the command 'cat * | grep "#include"' in the main folder after
extract.

the result
------------------
[snip about 280 repetitious unsorted lines -- See my OT comments below]
------------------------------------------
....

Off topic in c.l.c but relevant to OP --

If you add ' | sort -u ' after your grep command, you get a sorted
list of 87 lines instead of that much longer unsorted list.
(If your sort doesn't have a -u option, try sort | uniq .)

grep has a -h option; you can use 'grep -h "#include" *' instead
of the cat * | grep construction.

Some of the 87 lines differ only via leading tabs and spaces. To
get rid of those, use:
grep -h '#include' * | sed -e 's/^[ \t]*//' | sort -u
which gives you a list of 77 lines containing #include.
 
A

Anand Hariharan

[Follow-ups set to comp.unix.shell.]

On Sun, 24 Oct 2010 17:25:03 +0900, C_learner wrote:

...> And I got the source from here,

Google for UUOC.

the result
------------------

[snip about 280 repetitious unsorted lines -- See my OT comments below]> ------------------------------------------

...

Off topic in c.l.c but relevant to OP --

If you add ' | sort -u ' after your grep command, you get a sorted
list of 87 lines instead of that much longer unsorted list.
(If your sort doesn't have a -u option, try  sort | uniq .)

grep has a -h option; you can use  'grep -h "#include" *' instead
of the cat * | grep construction.  

Some of the 87 lines differ only via leading tabs and spaces.  To
get rid of those, use:
      grep -h '#include' * | sed -e 's/^[ \t]*//' | sort -u
which gives you a list of 77 lines containing #include.

sed -n 's/^#include[[:space:]]*["<]\([^">]*\)[">].*$/\1/p' * | sort -u
 
C

C_learner

of course, I did "find ncurses". but I don't know the most of the headers
the program used. and I asked about a library to make the menu.
So, I thought maybe in the crap, someone can find a library header which
makes the menu in the program if he have an experience making a program
using them. If someone knows making a program using one or some of those
libraries just by seeing that crap, Inform to me.
 
L

luser- -droog

of course, I did "find ncurses". but I don't know the most of the headers
the program used. and I asked about a library to make the menu.
So, I thought maybe in the crap, someone can find a library header which
makes the menu in the program if he have an experience making a program
using them. If someone knows making a program using one or some of those
libraries just by seeing that crap, Inform to me.

from the Wikipedia entry on curses I found

Writing Programs with NCURSES
by Eric S. Raymond and Zeyd M. Ben-Halim
http://invisible-island.net/ncurses/ncurses-intro.html

You just "got spooked" at the size of the article
and didn't scroll down that far, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top