samples/straws/args.c
/* Parse the arguments. Return non-zero on error. */
Parse the arguments. Return non-zero on error.
Parse the arguments . Return non - zero on error .
int parse_arguments (int argc, char *argv[]) {
  if (argc != 4) {
    print_usage (stderr);
    return 1;
  }
  strncpy (my_name, argv[1], MAX_NAME);
  strncpy (keyfile, argv[2], MAX_KEYFILE_PATH);
  if (read_port (argv[3], local_port) != 0) {
    is_listener = 0;
    if (read_remote_name (argv[3], remote_host, remote_port) != 0) {
      return 3;
    }
  }
  else {
    is_listener = 1;
  }
  return 0;
}
int parse_arguments ( int argc , char * argv [ ] ) { if ( argc != 4 ) { print_usage ( stderr ) ; return 1 ; } strncpy ( my_name , argv [ 1 ] , MAX_NAME ) ; strncpy ( keyfile , argv [ 2 ] , MAX_KEYFILE_PATH ) ; if ( read_port ( argv [ 3 ] , local_port ) != 0 ) { is_listener = 0 ; if ( read_remote_name ( argv [ 3 ] , remote_host , remote_port ) != 0 ) { return 3 ; } } else { is_listener = 1 ; } return 0 ; }
Parse the arguments.
Parse the arguments .