📄 cmdline.c
字号:
/* File autogenerated by gengetopt version 2.19 generated with the following command: gengetopt --conf-parser The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: we make no copyright claims on it.*//* If we use autoconf. */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <stdio.h>#include <stdlib.h>#include <string.h>#include "getopt.h"#include "cmdline.h"const char *gengetopt_args_info_purpose = "";const char *gengetopt_args_info_usage = "Usage: NSR-SBC [OPTIONS]...";const char *gengetopt_args_info_description = "";const char *gengetopt_args_info_help[] = { " -h, --help Print help and exit", " -V, --version Print version and exit", " --conf_filepath=STRING sbc.conf file path (default=`/etc/sbc.conf')", " --inaddr=STRING sbc inbound ip address", " --outaddr=STRING sbc outbound ip address", " --proxy_addr=STRING sip proxy ip address", " --rtp_port_low=INT the lowest port for relay rtp stream", " --rtp_port_high=INT the highest port for relay rtp stream", " --rtp_timeout=INT how long an rtp stream survive ", " --hosts_deny_sip=STRING the sip address which we deny SIP traffic", " --hosts_allow_sip=STRING the sip address which we accept SIP traffic", " --nat nat function option (default=off)", " --security security function option (default=off)", " --bandctrl bandctrl function option (default=off)", " --interworking interworking function option (default=off)", 0};staticvoid clear_given (struct gengetopt_args_info *args_info);staticvoid clear_args (struct gengetopt_args_info *args_info);static intcmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error);struct line_list{ char * string_arg; struct line_list * next;};static struct line_list *cmd_line_list = 0;static struct line_list *cmd_line_list_tmp = 0;static voidfree_cmd_list(void){ /* free the list of a previous call */ if (cmd_line_list) { while (cmd_line_list) { cmd_line_list_tmp = cmd_line_list; cmd_line_list = cmd_line_list->next; free (cmd_line_list_tmp->string_arg); free (cmd_line_list_tmp); } }}static char *gengetopt_strdup (const char *s);staticvoid clear_given (struct gengetopt_args_info *args_info){ args_info->help_given = 0 ; args_info->version_given = 0 ; args_info->conf_filepath_given = 0 ; args_info->inaddr_given = 0 ; args_info->outaddr_given = 0 ; args_info->proxy_addr_given = 0 ; args_info->rtp_port_low_given = 0 ; args_info->rtp_port_high_given = 0 ; args_info->rtp_timeout_given = 0 ; args_info->hosts_deny_sip_given = 0 ; args_info->hosts_allow_sip_given = 0 ; args_info->nat_given = 0 ; args_info->security_given = 0 ; args_info->bandctrl_given = 0 ; args_info->interworking_given = 0 ;}staticvoid clear_args (struct gengetopt_args_info *args_info){ args_info->conf_filepath_arg = gengetopt_strdup ("/etc/sbc.conf"); args_info->conf_filepath_orig = NULL; args_info->inaddr_arg = NULL; args_info->inaddr_orig = NULL; args_info->outaddr_arg = NULL; args_info->outaddr_orig = NULL; args_info->proxy_addr_arg = NULL; args_info->proxy_addr_orig = NULL; args_info->rtp_port_low_orig = NULL; args_info->rtp_port_high_orig = NULL; args_info->rtp_timeout_orig = NULL; args_info->hosts_deny_sip_arg = NULL; args_info->hosts_deny_sip_orig = NULL; args_info->hosts_allow_sip_arg = NULL; args_info->hosts_allow_sip_orig = NULL; args_info->nat_flag = 0; args_info->security_flag = 0; args_info->bandctrl_flag = 0; args_info->interworking_flag = 0; }staticvoid init_args_info(struct gengetopt_args_info *args_info){ args_info->help_help = gengetopt_args_info_help[0] ; args_info->version_help = gengetopt_args_info_help[1] ; args_info->conf_filepath_help = gengetopt_args_info_help[2] ; args_info->inaddr_help = gengetopt_args_info_help[3] ; args_info->outaddr_help = gengetopt_args_info_help[4] ; args_info->proxy_addr_help = gengetopt_args_info_help[5] ; args_info->rtp_port_low_help = gengetopt_args_info_help[6] ; args_info->rtp_port_high_help = gengetopt_args_info_help[7] ; args_info->rtp_timeout_help = gengetopt_args_info_help[8] ; args_info->hosts_deny_sip_help = gengetopt_args_info_help[9] ; args_info->hosts_allow_sip_help = gengetopt_args_info_help[10] ; args_info->nat_help = gengetopt_args_info_help[11] ; args_info->security_help = gengetopt_args_info_help[12] ; args_info->bandctrl_help = gengetopt_args_info_help[13] ; args_info->interworking_help = gengetopt_args_info_help[14] ; }voidcmdline_parser_print_version (void){ printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);}voidcmdline_parser_print_help (void){ int i = 0; cmdline_parser_print_version (); if (strlen(gengetopt_args_info_purpose) > 0) printf("\n%s\n", gengetopt_args_info_purpose); printf("\n%s\n\n", gengetopt_args_info_usage); if (strlen(gengetopt_args_info_description) > 0) printf("%s\n", gengetopt_args_info_description); while (gengetopt_args_info_help[i]) printf("%s\n", gengetopt_args_info_help[i++]);}voidcmdline_parser_init (struct gengetopt_args_info *args_info){ clear_given (args_info); clear_args (args_info); init_args_info (args_info);}static voidcmdline_parser_release (struct gengetopt_args_info *args_info){ if (args_info->conf_filepath_arg) { free (args_info->conf_filepath_arg); /* free previous argument */ args_info->conf_filepath_arg = 0; } if (args_info->conf_filepath_orig) { free (args_info->conf_filepath_orig); /* free previous argument */ args_info->conf_filepath_orig = 0; } if (args_info->inaddr_arg) { free (args_info->inaddr_arg); /* free previous argument */ args_info->inaddr_arg = 0; } if (args_info->inaddr_orig) { free (args_info->inaddr_orig); /* free previous argument */ args_info->inaddr_orig = 0; } if (args_info->outaddr_arg) { free (args_info->outaddr_arg); /* free previous argument */ args_info->outaddr_arg = 0; } if (args_info->outaddr_orig) { free (args_info->outaddr_orig); /* free previous argument */ args_info->outaddr_orig = 0; } if (args_info->proxy_addr_arg) { free (args_info->proxy_addr_arg); /* free previous argument */ args_info->proxy_addr_arg = 0; } if (args_info->proxy_addr_orig) { free (args_info->proxy_addr_orig); /* free previous argument */ args_info->proxy_addr_orig = 0; } if (args_info->rtp_port_low_orig) { free (args_info->rtp_port_low_orig); /* free previous argument */ args_info->rtp_port_low_orig = 0; } if (args_info->rtp_port_high_orig) { free (args_info->rtp_port_high_orig); /* free previous argument */ args_info->rtp_port_high_orig = 0; } if (args_info->rtp_timeout_orig) { free (args_info->rtp_timeout_orig); /* free previous argument */ args_info->rtp_timeout_orig = 0; } if (args_info->hosts_deny_sip_arg) { free (args_info->hosts_deny_sip_arg); /* free previous argument */ args_info->hosts_deny_sip_arg = 0; } if (args_info->hosts_deny_sip_orig) { free (args_info->hosts_deny_sip_orig); /* free previous argument */ args_info->hosts_deny_sip_orig = 0; } if (args_info->hosts_allow_sip_arg) { free (args_info->hosts_allow_sip_arg); /* free previous argument */ args_info->hosts_allow_sip_arg = 0; } if (args_info->hosts_allow_sip_orig) { free (args_info->hosts_allow_sip_orig); /* free previous argument */ args_info->hosts_allow_sip_orig = 0; } clear_given (args_info);}intcmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info){ FILE *outfile; int i = 0; outfile = fopen(filename, "w"); if (!outfile) { fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); return EXIT_FAILURE; } if (args_info->help_given) { fprintf(outfile, "%s\n", "help"); } if (args_info->version_given) { fprintf(outfile, "%s\n", "version"); } if (args_info->conf_filepath_given) { if (args_info->conf_filepath_orig) { fprintf(outfile, "%s=\"%s\"\n", "conf_filepath", args_info->conf_filepath_orig); } else { fprintf(outfile, "%s\n", "conf_filepath"); } } if (args_info->inaddr_given) { if (args_info->inaddr_orig) { fprintf(outfile, "%s=\"%s\"\n", "inaddr", args_info->inaddr_orig); } else { fprintf(outfile, "%s\n", "inaddr"); } } if (args_info->outaddr_given) { if (args_info->outaddr_orig) { fprintf(outfile, "%s=\"%s\"\n", "outaddr", args_info->outaddr_orig); } else { fprintf(outfile, "%s\n", "outaddr"); } } if (args_info->proxy_addr_given) { if (args_info->proxy_addr_orig) { fprintf(outfile, "%s=\"%s\"\n", "proxy_addr", args_info->proxy_addr_orig); } else { fprintf(outfile, "%s\n", "proxy_addr"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -