wrapping the linux "C" signal function

new topic     » topic index » view thread      » older message » newer message

i am having troubles *wrapping* the "C" language signal function in linux.
when i read the man page for signal the syntax is very confusing and even
when they tries to make it easier to read, it still confuses me.

here are both the function header syntaxes for "signal":

## C code ##

void (*signal(int signum, void(*handler)(int)))(int);

or

typedef void (*sighandler_t)(int);
sighandler_t signal(int signum, sighandler_t handler);

## end C code ##

can anyone clarify what this exactly means? C syntax can get so stupidly
cryptic sometimes. euphoria is simple, and thats good.

here is the euphoria code i have so far:

## eu code clip ##

include mixedlib.e -- Bernie's mixlib library
include lsock.e -- has the c_func definition for signal ( this works fine )

global function c_signal( int signum, pointer sig_handler )
  pointer sighandler_t, signum_ptr

  signum_ptr = get_pointer( signum ) -- get_pointer() just allocs mem for object
                                     -- and returns the pointer to mem
  sighandler_t = c_func( signal_, { signum_ptr, sig_handler } )

  return sighandler_t
end function

## end eu code clip ##

am i on the right track? any help would be appreciated.
thanks in advance everyone.

--
cense,
a member of the
ak-software development team

http://www.ak-software.com/

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu