Logo Search packages:      
Sourcecode: fence-agents version File versions  Download package

int main ( int  argc,
char *  argv[] 
)

Entry point of application.

Parameters:
argcNumber of arguments on command line
argvArray of strings with arguments from command line
Returns:
0 on success, otherwise >0.

Definition at line 442 of file fence_nss_wrapper.c.

References create_connected_socket(), init_nss(), MODE_NO_SSL, OPERATION_HELP, parse_cli(), poll_cycle(), print_nspr_error(), return_port(), and show_usage().

                                {
  int mode,operation;
  char *hostname, *port;
  char *pname;
  int port_n;
  PRFileDesc *fd_socket;
  int res;

  pname=basename(argv[0]);

  atexit(atexit_handler);

  if (!parse_cli(argc,argv,&operation,&mode,&hostname,&port) || operation==OPERATION_HELP) {
    show_usage(pname);

    if (operation!=OPERATION_HELP) return 1;

    return 0;
  }

  if ((port_n=return_port(port))==-1) {
    fprintf(stderr,"Error. Unknown port number/name %s!\n",port);

    return 1;
  }

  if (!(mode&MODE_NO_SSL)) {
    if (!init_nss()) return 1;
  }

  if (!(fd_socket=create_connected_socket(hostname,port_n,mode)))
    return 1;

  res=poll_cycle(fd_socket,mode);

  if (PR_Close(fd_socket)!=PR_SUCCESS) {
    print_nspr_error();

    return 1;
  }

  return (res?0:1);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index