Need help with C (setupterm() function)

Need help with C (setupterm() function)

Post by Tayfun Ozdemi » Sat, 04 Jan 2003 21:34:30



Hello there,
I have been working under linux to gain some programming experience.
But i have got a problem i use
setupterm function as

test = setupterm((char *)0, 1, (int *)0);

or

test = setupterm(NULL, lineno(stdout), (int *)0);

both of them returns 0 which means no matching entry in terminfo database.
It would be nice if you help me to figure out whats wrong with those
calls.
Thank you so much.
Tayfun ?zdemir.

 
 
 

Need help with C (setupterm() function)

Post by Robert Newso » Sun, 05 Jan 2003 07:52:27



> Hello there,
> I have been working under linux to gain some programming experience.
> But i have got a problem i use
> setupterm function as

> test = setupterm((char *)0, 1, (int *)0);

> or

> test = setupterm(NULL, lineno(stdout), (int *)0);

> both of them returns 0 which means no matching entry in terminfo database.
> It would be nice if you help me to figure out whats wrong with those
> calls.

Nothing is wrong with the calls, just your interpretation of them:

$ man curs_terminfo
...
        int setupterm(const char *term, int fildes, int *errret);
...
        The setupterm routine reads in the terminfo database, ini-
        tializing the terminfo structures, but does not set up the
        output virtualization structures used by curses.  The ter-
        minal  type is the character string term; if term is null,
        the environment variable TERM is used.  All output  is  to
        file  descriptor  fildes  which is initialized for output.
        If errret is not null, then setupterm returns  OK  or  ERR
        and  stores  a  status  value in the integer pointed to by
        errret.  A return value of OK combined with status of 1 in
        errret is normal.  If ERR is returned, examine errret:
...
               0    means that the terminal could not be found, or
                    that  it  is a generic type, having too little
                    information for curses applications to run.
...

seeing as you've told it to ignore the error code:

   test = setupterm((char *)0, 1, (int *)0);

HOW do you know the error return (in errret) is 0?  I've just tried:

    int err;
    int test = setupterm((char *)0, 1, &err);
    printf("test = %d, err = %d\n", test, err);
    printf("OK = %d, ERR = %d\n", OK, ERR);

and got back:

test = 0, err = 1
OK = 0, ERR = -1

So, setupterm() has returned OK, with a staus (in err) of 1, which is
totally normal (see man extract above) for a successful call.

 
 
 

1. Functions for JavaScript function are needed

I am building a program  that uses The  " FindProxyForURL(url,host) "
function (
http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html )

that browsers uses in order to evaluate which proxy server to send the
requests.

The program  download this function  and then run it in order to get the
proxy server address,
my question is about the Methods that  function
FindProxyForURL(url,host)
     uses like : isPlainHostName()       dnsDomainIs() ,
localHostOrDomainIs() ,
                        isResolvable()  dnsResolve()   myIpAddress()
dnsDomainLevels()
                        shExpMatch()      weekdayRange()
dateRange()          timeRange()
where can i find their implementation in order to run this function in
my program.

the program run on linux  , written in C and uses an API libraries
(http://www.nombas.com/us/toolkit/index.htm )
to run the FindProxyForURL(...) function.

Thanks in advance raanan.

2. NN displays external stylesheet rather than html file

3. redefined Functions for JavaScript function are needed

4. OpenWindows window manager hangs

5. Fun with descriptors, curses, and setupterm()

6. errno

7. Where is setupterm() defined

8. problems with gnome

9. Why doesn' setupterm() work in his context?

10. function, function...who's got the function?

11. Help need with a Shell Function

12. Need help with function select

13. Need help about kerner sys_xxx file functions