本文整理汇总了C++中HAVE_OPT函数的典型用法代码示例。如果您正苦于以下问题:C++ HAVE_OPT函数的具体用法?C++ HAVE_OPT怎么用?C++ HAVE_OPT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAVE_OPT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cmd_parser
static void cmd_parser(int argc, char **argv)
{
const char *rest = NULL;
int optct = optionProcess(&gnutls_cli_debugOptions, argc, argv);
argc -= optct;
argv += optct;
if (rest == NULL && argc > 0)
rest = argv[0];
if (HAVE_OPT(PORT))
port = OPT_VALUE_PORT;
else {
if (HAVE_OPT(STARTTLS_PROTO))
port = starttls_proto_to_port(OPT_ARG(STARTTLS_PROTO));
else
port = 443;
}
if (rest == NULL)
hostname = "localhost";
else
hostname = rest;
if (HAVE_OPT(DEBUG))
debug = OPT_VALUE_DEBUG;
if (HAVE_OPT(VERBOSE))
verbose++;
}
开发者ID:komh,项目名称:gnutls-os2,代码行数:31,代码来源:cli-debug.c
示例2: verify_response
static void verify_response(gnutls_datum_t *nonce)
{
gnutls_datum_t dat;
size_t size;
gnutls_x509_crt_t signer;
int v;
if (HAVE_OPT(LOAD_RESPONSE))
dat.data =
(void *) read_binary_file(OPT_ARG(LOAD_RESPONSE),
&size);
else
dat.data = (void *) fread_file(infile, &size);
if (dat.data == NULL) {
fprintf(stderr, "error reading response\n");
exit(1);
}
dat.size = size;
signer = load_signer();
v = _verify_response(&dat, nonce, signer);
if (v && !HAVE_OPT(IGNORE_ERRORS))
exit(1);
}
开发者ID:ffmpeg-build-win,项目名称:gnutls,代码行数:25,代码来源:ocsptool.c
示例3: processEmbeddedOptions
/*
* processEmbeddedOptions
*
* This routine processes the text contained within "/\*==--"
* and "=\*\/" as a single option. If that option is the SUBBLOCK
* option, it will need to be massaged for use.
*/
LOCAL void
processEmbeddedOptions(char* pzText)
{
tSCC zStStr[] = "/*=--";
tSCC zEndSt[] = "=*/";
for (;;) {
char* pzStart = strstr(pzText, zStStr);
char* pzEnd;
int sblct = 0;
if (pzStart == NULL)
return;
if (HAVE_OPT(SUBBLOCK))
sblct = STACKCT_OPT(SUBBLOCK);
pzEnd = strstr(pzStart, zEndSt);
if (pzEnd == NULL)
return;
pzStart = compressOptionText(pzStart + sizeof(zStStr)-1, pzEnd);
optionLoadLine(&getdefsOptions, pzStart);
if (HAVE_OPT(SUBBLOCK) && (sblct != STACKCT_OPT(SUBBLOCK))) {
tCC** ppz = STACKLST_OPT(SUBBLOCK);
ppz[ sblct ] = fixupSubblockString(ppz[sblct]);
}
pzText = pzEnd + sizeof(zEndSt);
}
}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:39,代码来源:gdinit.c
示例4: ask_server
static void ask_server(const char* url)
{
gnutls_datum_t resp_data;
int ret, v;
gnutls_x509_crt_t cert, issuer;
cert = load_cert();
issuer = load_issuer();
ret = send_ocsp_request(url, cert, issuer, &resp_data, ENABLED_OPT(NONCE));
if (ret < 0)
{
fprintf(stderr, "Cannot send OCSP request\n");
exit(1);
}
_response_info (&resp_data);
if (HAVE_OPT(LOAD_SIGNER) || HAVE_OPT(LOAD_TRUST))
{
fprintf(outfile, "\n");
v = _verify_response(&resp_data);
}
else
{
fprintf(stderr, "\nResponse could not be verified (use --load-signer).\n");
v = 0;
}
if (HAVE_OPT(OUTFILE) && v == 0)
{
fwrite(resp_data.data, 1, resp_data.size, outfile);
}
}
开发者ID:frankmorgner,项目名称:gnutls,代码行数:34,代码来源:ocsptool.c
示例5: ask_server
static void ask_server(const char *url)
{
gnutls_datum_t resp_data;
int ret, v = 0;
gnutls_x509_crt_t cert, issuer;
unsigned char noncebuf[23];
gnutls_datum_t nonce = { noncebuf, sizeof(noncebuf) };
gnutls_datum_t *n;
cert = load_cert();
issuer = load_issuer();
if (ENABLED_OPT(NONCE)) {
ret =
gnutls_rnd(GNUTLS_RND_NONCE, nonce.data, nonce.size);
if (ret < 0) {
fprintf(stderr, "gnutls_rnd: %s\n",
gnutls_strerror(ret));
exit(1);
}
n = &nonce;
} else {
n = NULL;
}
ret =
send_ocsp_request(url, cert, issuer, &resp_data, n);
if (ret < 0) {
fprintf(stderr, "Cannot send OCSP request\n");
exit(1);
}
_response_info(&resp_data);
if (HAVE_OPT(LOAD_TRUST)) {
v = _verify_response(&resp_data, n, NULL);
} else if (HAVE_OPT(LOAD_SIGNER)) {
v = _verify_response(&resp_data, n, load_signer());
} else {
fprintf(stderr,
"\nAssuming response's signer = issuer (use --load-signer to override).\n");
v = _verify_response(&resp_data, n, issuer);
}
if (HAVE_OPT(OUTFILE) && (v == 0 || HAVE_OPT(IGNORE_ERRORS))) {
fwrite(resp_data.data, 1, resp_data.size, outfile);
}
if (v && !HAVE_OPT(IGNORE_ERRORS))
exit(1);
}
开发者ID:ffmpeg-build-win,项目名称:gnutls,代码行数:53,代码来源:ocsptool.c
示例6: load_cert
static gnutls_x509_crt_t
load_cert (void)
{
gnutls_x509_crt_t crt;
int ret;
gnutls_datum_t dat;
size_t size;
if (!HAVE_OPT(LOAD_CERT))
error (EXIT_FAILURE, 0, "missing --load-cert");
ret = gnutls_x509_crt_init (&crt);
if (ret < 0)
error (EXIT_FAILURE, 0, "crt_init: %s", gnutls_strerror (ret));
dat.data = (void*)read_binary_file (OPT_ARG(LOAD_CERT), &size);
dat.size = size;
if (!dat.data)
error (EXIT_FAILURE, errno, "reading --load-cert: %s", OPT_ARG(LOAD_CERT));
ret = gnutls_x509_crt_import (crt, &dat, encoding);
free (dat.data);
if (ret < 0)
error (EXIT_FAILURE, 0, "importing --load-cert: %s: %s",
OPT_ARG(LOAD_CERT), gnutls_strerror (ret));
return crt;
}
开发者ID:frankmorgner,项目名称:gnutls,代码行数:29,代码来源:ocsptool.c
示例7: run
int run(void)
{
#ifdef USE_ST
st_usleep(1); //force context switch so timers will work
#endif
g_hash_table_foreach(hash, create_q_threads, NULL);
#ifdef USE_ST
if (debug > 3) { LOG(LOG_DEBUG, "waiting for all threads to finish"); }
while (thread_count) {
st_usleep(10000); /* 10 ms */
}
#endif
if (HAVE_OPT(HANGUPSCRIPT) && online) {
int status;
status = system(OPT_ARG(HANGUPSCRIPT));
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0) {
LOG(LOG_WARNING, "%s: error %d", OPT_ARG(HANGUPSCRIPT), WEXITSTATUS(status));
}
} else {
LOG(LOG_ERR, "%s exited abnormally", OPT_ARG(HANGUPSCRIPT));
}
}
online = FALSE;
uw_setproctitle("sleeping");
return 0;
}
开发者ID:BackupTheBerlios,项目名称:upwatch-svn,代码行数:28,代码来源:run.c
示例8: opt_to_flags
static
unsigned opt_to_flags(void)
{
unsigned flags = 0;
if (HAVE_OPT(MARK_PRIVATE)) {
if (ENABLED_OPT(MARK_PRIVATE)) {
flags |= GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE;
} else {
flags |= GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_PRIVATE;
}
}
if (ENABLED_OPT(MARK_TRUSTED))
flags |=
GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED;
if (ENABLED_OPT(MARK_CA))
flags |=
GNUTLS_PKCS11_OBJ_FLAG_MARK_CA;
if (ENABLED_OPT(MARK_WRAP))
flags |= GNUTLS_PKCS11_OBJ_FLAG_MARK_KEY_WRAP;
if (ENABLED_OPT(LOGIN))
flags |= GNUTLS_PKCS11_OBJ_FLAG_LOGIN;
if (ENABLED_OPT(SO_LOGIN))
flags |= GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO;
return flags;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:32,代码来源:p11tool.c
示例9: request_info
static void
request_info (void)
{
gnutls_ocsp_req_t req;
int ret;
gnutls_datum_t dat;
size_t size;
ret = gnutls_ocsp_req_init (&req);
if (ret < 0)
error (EXIT_FAILURE, 0, "ocsp_req_init: %s", gnutls_strerror (ret));
if (HAVE_OPT(LOAD_REQUEST))
dat.data = (void*)read_binary_file (OPT_ARG(LOAD_REQUEST), &size);
else
dat.data = (void*)fread_file (infile, &size);
if (dat.data == NULL)
error (EXIT_FAILURE, errno, "reading request");
dat.size = size;
ret = gnutls_ocsp_req_import (req, &dat);
free (dat.data);
if (ret < 0)
error (EXIT_FAILURE, 0, "importing request: %s", gnutls_strerror (ret));
ret = gnutls_ocsp_req_print (req, GNUTLS_OCSP_PRINT_FULL, &dat);
if (ret != 0)
error (EXIT_FAILURE, 0, "ocsp_req_print: %s", gnutls_strerror (ret));
printf ("%.*s", dat.size, dat.data);
gnutls_free (dat.data);
gnutls_ocsp_req_deinit (req);
}
开发者ID:frankmorgner,项目名称:gnutls,代码行数:34,代码来源:ocsptool.c
示例10: dlt_user_parse_opts
/*
* This is where you should define all your AutoGen AutoOpts option parsing.
* Any user specified option should have it's bit turned on in the 'provides'
* bit mask.
* Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN
*/
int
dlt_user_parse_opts(tcpeditdlt_t *ctx)
{
tcpeditdlt_plugin_t *plugin;
user_config_t *config;
assert(ctx);
plugin = tcpedit_dlt_getplugin(ctx, dlt_value);
config = plugin->config;
/*
* --user-dlt will override the output DLT type, otherwise we'll use
* the DLT of the decoder
*/
if (HAVE_OPT(USER_DLT)) {
config->dlt = OPT_VALUE_USER_DLT;
} else {
config->dlt = ctx->decoder->dlt;
}
/* --user-dlink */
if (HAVE_OPT(USER_DLINK)) {
int ct = STACKCT_OPT(USER_DLINK);
char **list = STACKLST_OPT(USER_DLINK);
int first = 1;
do {
char *p = *list++;
if (first) {
config->length = read_hexstring(p, config->l2server, USER_L2MAXLEN);
memcpy(config->l2client, config->l2server, config->length);
} else {
if (config->length != read_hexstring(p, config->l2client, USER_L2MAXLEN)) {
tcpedit_seterr(ctx->tcpedit, "%s",
"both --dlink's must contain the same number of bytes");
return TCPEDIT_ERROR;
}
}
first = 0;
} while (--ct > 0);
}
return TCPEDIT_OK; /* success */
}
开发者ID:corentin-p1,项目名称:tcpreplay,代码行数:51,代码来源:user.c
示例11: dlt_hdlc_parse_opts
/*
* This is where you should define all your AutoGen AutoOpts option parsing.
* Any user specified option should have it's bit turned on in the 'provides'
* bit mask.
* Returns: TCPEDIT_ERROR | TCPEDIT_OK | TCPEDIT_WARN
*/
int
dlt_hdlc_parse_opts(tcpeditdlt_t *ctx)
{
tcpeditdlt_plugin_t *plugin;
hdlc_config_t *config;
assert(ctx);
plugin = tcpedit_dlt_getplugin(ctx, dlt_value);
config = plugin->config;
if (HAVE_OPT(HDLC_CONTROL)) {
config->control = (uint16_t)OPT_VALUE_HDLC_CONTROL;
}
if (HAVE_OPT(HDLC_ADDRESS)) {
config->address = (uint16_t)OPT_VALUE_HDLC_ADDRESS;
}
return TCPEDIT_OK; /* success */
}
开发者ID:Mipam,项目名称:tcpreplay,代码行数:26,代码来源:hdlc.c
示例12: init
int init(void)
{
if (!HAVE_OPT(OUTPUT)) {
LOG(LOG_ERR, "missing output option");
return 0;
}
daemonize = TRUE;
every = EVERY_MINUTE;
xmlSetGenericErrorFunc(NULL, UpwatchXmlGenericErrorFunc);
return(1);
}
开发者ID:BackupTheBerlios,项目名称:upwatch-svn,代码行数:11,代码来源:run.c
示例13: printHeader
static xmlNodePtr
printHeader( xmlDocPtr pDoc )
{
tSCC zDef[] = "AutoGen Definitions %s%s;\n";
char const* pzSfx = ".tpl";
xmlNodePtr pRootNode = xmlDocGetRootElement( pDoc );
xmlChar* pTpl = NULL;
xmlChar* pzTpl;
if (pRootNode == NULL) {
fprintf( stderr, "Root node not found\n" );
exit( EXIT_FAILURE );
}
if (HAVE_OPT( OVERRIDE_TPL )) {
if (strchr( OPT_ARG( OVERRIDE_TPL ), '.' ) != NULL)
pzSfx = "";
pzTpl = (xmlChar*)(void*)OPT_ARG( OVERRIDE_TPL );
}
else {
pTpl = xmlGetProp( pRootNode, (xmlChar*)(void*)"template" );
if (pTpl == NULL) {
fprintf( stderr, "No template was specified.\n" );
exit( EXIT_FAILURE );
}
pzTpl = pTpl;
if (strchr( (char*)pzTpl, '.' ) != NULL)
pzSfx = "";
}
fprintf( outFp, zDef, pzTpl, pzSfx );
if (pTpl != NULL)
free( pTpl );
if (pDoc->name != NULL)
fprintf( outFp, "XML-name = '%s';\n", TRIM( pDoc->name, NULL ));
if (pDoc->version != NULL)
fprintf( outFp, "XML-version = '%s';\n", TRIM( pDoc->version, NULL ));
if (pDoc->encoding != NULL)
fprintf( outFp, "XML-encoding = '%s';\n", TRIM( pDoc->encoding, NULL ));
if (pDoc->URL != NULL)
fprintf( outFp, "XML-URL = '%s';\n", TRIM( pDoc->URL, NULL ));
if (pDoc->standalone)
fputs( "XML-standalone = true;\n", outFp );
return pRootNode;
}
开发者ID:pexip,项目名称:os-autogen,代码行数:53,代码来源:xml2ag.c
示例14: check_exit_conditions
/*
* check_exit_conditions()
*
* If sntp has a reply, ask the event loop to stop after this round of
* callbacks, unless --wait was used.
*/
void
check_exit_conditions(void)
{
if ((0 == n_pending_ntp && 0 == n_pending_dns) ||
(time_derived && !HAVE_OPT(WAIT))) {
event_base_loopexit(base, NULL);
shutting_down = TRUE;
} else {
TRACE(2, ("%d NTP and %d name queries pending\n",
n_pending_ntp, n_pending_dns));
}
}
开发者ID:cemeyer,项目名称:freebsd-base-graphics,代码行数:18,代码来源:main.c
示例15: exec_autogen
static void
exec_autogen(char ** pzBase)
{
char const ** paparg;
char const ** pparg;
int argCt = 5;
/*
* IF we don't have template search directories,
* THEN allocate the default arg counter of pointers and
* set the program name into it.
* ELSE insert each one into the arg list.
*/
if (! HAVE_OPT(AGARG)) {
paparg = pparg = (char const **)malloc(argCt * sizeof(char*));
*pparg++ = pzAutogen;
} else {
int ct = STACKCT_OPT(AGARG);
char const ** ppz = STACKLST_OPT(AGARG);
argCt += ct;
paparg = pparg = (char const **)malloc(argCt * sizeof(char*));
*pparg++ = pzAutogen;
do {
*pparg++ = *ppz++;
} while (--ct > 0);
}
*pparg++ = *pzBase;
*pparg++ = "--";
*pparg++ = "-";
*pparg++ = NULL;
#ifdef DEBUG
fputc('\n', stderr);
pparg = paparg;
for (;;) {
fputs(*pparg++, stderr);
if (*pparg == NULL)
break;
fputc(' ', stderr);
}
fputc('\n', stderr);
fputc('\n', stderr);
#endif
execvp(pzAutogen, (char**)(void*)paparg);
fserr_die("exec of %s %s %s %s\n", paparg[0], paparg[1], paparg[2],
paparg[3]);
}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:52,代码来源:getdefs.c
示例16: main
int main(int argc, char **argv)
{
int ret;
if ((ret = gnutls_global_init()) < 0) {
fprintf(stderr, "global_init: %s\n", gnutls_strerror(ret));
exit(1);
}
optionProcess(&ocsptoolOptions, argc, argv);
gnutls_global_set_log_function(tls_log_func);
gnutls_global_set_log_level(OPT_VALUE_DEBUG);
if (HAVE_OPT(OUTFILE)) {
outfile = fopen(OPT_ARG(OUTFILE), "wb");
if (outfile == NULL) {
fprintf(stderr, "%s\n", OPT_ARG(OUTFILE));
exit(1);
}
} else
outfile = stdout;
if (HAVE_OPT(INFILE)) {
infile = fopen(OPT_ARG(INFILE), "rb");
if (infile == NULL) {
fprintf(stderr, "%s\n", OPT_ARG(INFILE));
exit(1);
}
} else
infile = stdin;
if (ENABLED_OPT(INDER))
encoding = GNUTLS_X509_FMT_DER;
else
encoding = GNUTLS_X509_FMT_PEM;
if (HAVE_OPT(REQUEST_INFO))
request_info();
else if (HAVE_OPT(RESPONSE_INFO))
response_info();
else if (HAVE_OPT(GENERATE_REQUEST))
generate_request(NULL);
else if (HAVE_OPT(VERIFY_RESPONSE))
verify_response(NULL);
else if (HAVE_OPT(ASK))
ask_server(OPT_ARG(ASK));
else {
USAGE(1);
}
return 0;
}
开发者ID:ffmpeg-build-win,项目名称:gnutls,代码行数:53,代码来源:ocsptool.c
示例17: compar_text
/*
* compar_text
*
* merely returns the relative ordering of two input strings.
* The arguments are pointers to pointers to NUL-terminated strings.
* IF the definiton was mal-formed, an error message was printed
* earlier. When we get here, we wil fail to find the "zNameTag"
* string and EXIT_FAILURE.
*/
static int
compar_text(const void* p1, const void* p2)
{
char* pz1 = strstr(*(char const * const *)p1, zNameTag);
char* pe1;
char* pz2 = strstr(*(char const * const *)p2, zNameTag);
char* pe2;
int res;
if (pz1 == NULL) {
if (strncmp(*(char const * const *)p1, zGlobal, sizeof(zGlobal)-1) == 0)
return -1;
die(zBogusDef, *(char const * const *)p1);
}
if (pz2 == NULL) {
if (strncmp(*(char const * const *)p2, zGlobal, sizeof(zGlobal)-1) == 0)
return 1;
die(zBogusDef, *(char const * const *)p2);
}
pz1 += sizeof(zNameTag)-1;
pe1 = strchr(pz1, '\'');
if (pe1 == NULL)
die(zBogusDef, *(char const * const *)p1);
pz2 += sizeof(zNameTag)-1;
pe2 = strchr(pz2, '\'');
if (pe2 == NULL)
die(zBogusDef, *(char const * const *)p2);
*pe1 = *pe2 = NUL;
/*
* We know ordering is enabled because we only get called when
* it is enabled. If the option was also specified, then
* we sort without case sensitivity (and we compare '-', '_'
* and '^' as being equal as well). Otherwise, we do a
* strict string comparison.
*/
if (HAVE_OPT(ORDERING))
res = streqvcmp(pz1, pz2);
else res = strcmp(pz1, pz2);
*pe1 = *pe2 = '\'';
return res;
}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:59,代码来源:getdefs.c
示例18: debug_msg
void debug_msg(char *message) {
if(HAVE_OPT(FILELOG)) {
time_t cur_time = time(NULL);
char *timestamp = ctime(&cur_time);
fprintf(stderr, "%s: %s\n", timestamp, message);
}
else {
syslog(LOG_DEBUG
#ifdef LOG_PERROR
| LOG_PERROR
#endif
| LOG_CONS, "%s", message);
}
}
开发者ID:Leon555,项目名称:Mac-src-essentials,代码行数:15,代码来源:log.c
示例19: open_ag_file
static FILE*
open_ag_file(char ** pzBase)
{
switch (WHICH_IDX_AUTOGEN) {
case INDEX_OPT_OUTPUT:
{
static char const zFileFmt[] = " * %s\n";
FILE* fp;
if (*pzBase != NULL)
free(*pzBase);
if (strcmp(OPT_ARG(OUTPUT), "-") == 0)
return stdout;
unlink(OPT_ARG(OUTPUT));
fp = fopen(OPT_ARG(OUTPUT), "w" FOPEN_BINARY_FLAG);
fprintf(fp, zDne, OPT_ARG(OUTPUT));
if (HAVE_OPT(INPUT)) {
int ct = STACKCT_OPT(INPUT);
char const ** ppz = STACKLST_OPT(INPUT);
do {
fprintf(fp, zFileFmt, *ppz++);
} while (--ct > 0);
}
fputs(" */\n", fp);
return fp;
}
case INDEX_OPT_AUTOGEN:
if (! ENABLED_OPT(AUTOGEN)) {
if (*pzBase != NULL)
free(*pzBase);
return stdout;
}
if ( ( OPT_ARG(AUTOGEN) != NULL)
&& (*OPT_ARG(AUTOGEN) != NUL ))
pzAutogen = OPT_ARG(AUTOGEN);
break;
}
return NULL;
}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:48,代码来源:getdefs.c
示例20: verify_response
static void
verify_response (void)
{
gnutls_datum_t dat;
size_t size;
if (HAVE_OPT(LOAD_RESPONSE))
dat.data = (void*)read_binary_file (OPT_ARG(LOAD_RESPONSE), &size);
else
dat.data = (void*)fread_file (infile, &size);
if (dat.data == NULL)
error (EXIT_FAILURE, errno, "reading response");
dat.size = size;
_verify_response(&dat);
}
开发者ID:frankmorgner,项目名称:gnutls,代码行数:16,代码来源:ocsptool.c
注:本文中的HAVE_OPT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论