本文整理汇总了C++中Ustrcmp函数的典型用法代码示例。如果您正苦于以下问题:C++ Ustrcmp函数的具体用法?C++ Ustrcmp怎么用?C++ Ustrcmp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Ustrcmp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testdb_find
int
testdb_find(void *handle, uschar *filename, uschar *query, int length,
uschar **result, uschar **errmsg, BOOL *do_cache)
{
handle = handle; /* Keep picky compilers happy */
filename = filename;
length = length;
if (Ustrcmp(query, "fail") == 0)
{
*errmsg = US"testdb lookup forced FAIL";
DEBUG(D_lookup) debug_printf("%s\n", *errmsg);
return FAIL;
}
if (Ustrcmp(query, "defer") == 0)
{
*errmsg = US"testdb lookup forced DEFER";
DEBUG(D_lookup) debug_printf("%s\n", *errmsg);
return DEFER;
}
if (Ustrcmp(query, "nocache") == 0) *do_cache = FALSE;
*result = string_copy(query);
return OK;
}
示例2: read_paragraph
uschar *
read_paragraph(uschar *p, int *nest_info)
{
uschar *q = parabuffer;
int length = Ustrlen(p);
memcpy(q, p, length);
q += length;
*nest_info = NEST_NO; /* Not hit .nest */
for (;;)
{
uschar *s;
if ((p = read_nextline()) == NULL) break;
if (Ustrncmp(p, ".literal ", 9) == 0)
{
next_line = p;
break;
}
if (Ustrncmp(p, ".nest ", 6) == 0)
{
p += 6;
while (isspace(*p)) p++;
s = p + Ustrlen(p);
while (s > p && isspace(s[-1])) s--;
*s = 0;
if (Ustrcmp(p, "begin") == 0) *nest_info = NEST_BEGIN;
else if (Ustrcmp(p, "end") == 0) *nest_info = NEST_END;
else error(26, p);
break;
}
else if (*p == '.')
{
dot_process(p);
continue;
}
/* End paragraph on encountering a completely blank line */
for (s = p; *s == ' ' || *s == '\t'; s++);
if (*s == '\n') break;
length = Ustrlen(p);
memcpy(q, p, length);
q += length;
}
*q = 0;
return parabuffer;
}
示例3: check_args
static int
check_args(int argc, uschar **argv, uschar *name, uschar *options)
{
if (argc == 3)
{
if (Ustrcmp(argv[2], "retry") == 0) return type_retry;
if (Ustrcmp(argv[2], "misc") == 0) return type_misc;
if (Ustrncmp(argv[2], "wait-", 5) == 0) return type_wait;
if (Ustrcmp(argv[2], "callout") == 0) return type_callout;
if (Ustrcmp(argv[2], "ratelimit") == 0) return type_ratelimit;
}
usage(name, options);
return -1; /* Never obeyed */
}
示例4: open_temporary_file
void open_temporary_file(char *editname, char *filename, int disp, int linenum)
{
EDITINFO *edata;
int i;
Char *newname;
newname=concat(LocaletoUstr(editname),0);
i=0;
while (aig(edata = (EDITINFO*) next_data_with_type(MAINEDITWINDOW, &i)) &&
Ustrcmp(edata->pathname,newname))
i++;
if (!edata) {
as_icon=1;
edit_open();
as_icon=0;
if (state_window) edata = state_window;
}
handle_view_filename((void *) edata, concat(LocaletoUstr(filename),NULL));
editwindow_line(edata->info, linenum-1);
set_name(edata,newname);
if (edata->iconized) {
XMapWindow(display, edata->win_id);
}
if (disp) XRaiseWindow(display, edata->win_id);
}
示例5: while
static EDITINFO *message_window(Char *messagetitle)
{
int i=0;
EDITINFO *edata;
if (!messagetitle) return NULL;
while (aig(edata = (EDITINFO*) next_data_with_type(MAINEDITWINDOW, &i)) &&
Ustrcmp(edata->pathname,messagetitle)) {
i++;
}
if (!edata) {
int old_icon=as_icon;
as_icon=MP_True;
edit_open();
as_icon=old_icon;
if (state_window) {
edata=state_window;
edata->view_mode=MP_True;
set_name(edata, concat(messagetitle,NULL));
}
}
if (edata && edata->iconized && 0) {
XMapWindow(display, edata->win_id);
XFlush(display);
}
return edata;
}
示例6: merge_queue_lists
static queue_filename *
merge_queue_lists(queue_filename *a, queue_filename *b)
{
queue_filename *first = NULL;
queue_filename **append = &first;
while (a != NULL && b != NULL)
{
if (Ustrcmp(a->text, b->text) < 0)
{
*append = a;
append= &a->next;
a = a->next;
}
else
{
*append = b;
append= &b->next;
b = b->next;
}
}
*append=((a != NULL)? a : b);
return first;
}
示例7: compile
static pcre_list *
compile(const uschar * list)
{
int sep = 0;
uschar *regex_string;
const char *pcre_error;
int pcre_erroffset;
pcre_list *re_list_head = NULL;
pcre_list *ri;
/* precompile our regexes */
while ((regex_string = string_nextinlist(&list, &sep, NULL, 0)))
if (strcmpic(regex_string, US"false") != 0 && Ustrcmp(regex_string, "0") != 0)
{
pcre *re;
/* compile our regular expression */
if (!(re = pcre_compile( CS regex_string,
0, &pcre_error, &pcre_erroffset, NULL )))
{
log_write(0, LOG_MAIN,
"regex acl condition warning - error in regex '%s': %s at offset %d, skipped.",
regex_string, pcre_error, pcre_erroffset);
continue;
}
ri = store_get(sizeof(pcre_list));
ri->re = re;
ri->pcre_text = regex_string;
ri->next = re_list_head;
re_list_head = ri;
}
return re_list_head;
}
示例8: open_helpfile
/* header to be able to add this function to a menu */
void open_helpfile(void *data, int nr __attribute__((unused)))
{
Char *c = (Char*) data;
int i=0,hpos=0;
Char *f;
Char *name;
Char *fullname;
EDITINFO *edata;
if (!c || !(f = (Char*) malloc(sizeof(Char)*(Ustrlen(c)+1)))) return;
for (i=0; (f[i]=c[i]) ; i++)
if (c[i]=='#') if (!i) hpos=-1; else if (hpos) hpos=0; else hpos=i;
if (hpos>0) {
name = c+hpos+1;
f[hpos]='\0';
} else name = c+i;
f = standard_dir(f);
fullname = search_through_dirs(help_dirs, nr_help_dirs, f);
if (!fullname && f[0]=='/')
fullname=f;
else
free(f);
if (!fullname) {
message(MP_ERROR, translate("Help document not found."));
return;
}
i=0;
while (aig(edata = (EDITINFO*) next_data_with_type(MAINEDITWINDOW, &i)) &&
Ustrcmp(edata->pathname,fullname))
i++;
if (!edata) {
as_icon=1;
edit_open();
as_icon=0;
if (state_window) {
edata = state_window;
handle_view_filename((void *) state_window, concat(fullname,NULL));
word_wrap_window(edata->info);
}
}
if (!edata) {
message2(MP_CLICKREMARK, translate("Unable to open an edit window for document "),
name);
return;
}
if (name[0]) {
int j=Ustrlen(name)+1;
Char *cname = (Char*) malloc(j*sizeof(Char));
if (cname) {
for (i=j-1;i>=0; i--) cname[i]=name[i];
editwindow_topto(edata->info, cname);
free(cname);
}
}
if (edata->iconized) {
XMapWindow(display, edata->win_id);
}
XRaiseWindow(display, edata->win_id);
}
示例9: spf_process
int
spf_process(const uschar **listptr, uschar *spf_envelope_sender, int action)
{
int sep = 0;
const uschar *list = *listptr;
uschar *spf_result_id;
int rc = SPF_RESULT_PERMERROR;
if (!(spf_server && spf_request))
/* no global context, assume temp error and skip to evaluation */
rc = SPF_RESULT_PERMERROR;
else if (SPF_request_set_env_from(spf_request, CS spf_envelope_sender))
/* Invalid sender address. This should be a real rare occurrence */
rc = SPF_RESULT_PERMERROR;
else
{
/* get SPF result */
if (action == SPF_PROCESS_FALLBACK)
{
SPF_request_query_fallback(spf_request, &spf_response, CS spf_guess);
spf_result_guessed = TRUE;
}
else
SPF_request_query_mailfrom(spf_request, &spf_response);
/* set up expansion items */
spf_header_comment = US SPF_response_get_header_comment(spf_response);
spf_received = US SPF_response_get_received_spf(spf_response);
spf_result = US SPF_strresult(SPF_response_result(spf_response));
spf_smtp_comment = US SPF_response_get_smtp_comment(spf_response);
rc = SPF_response_result(spf_response);
}
/* We got a result. Now see if we should return OK or FAIL for it */
DEBUG(D_acl) debug_printf("SPF result is %s (%d)\n", SPF_strresult(rc), rc);
if (action == SPF_PROCESS_GUESS && (!strcmp (SPF_strresult(rc), "none")))
return spf_process(listptr, spf_envelope_sender, SPF_PROCESS_FALLBACK);
while ((spf_result_id = string_nextinlist(&list, &sep, NULL, 0)))
{
BOOL negate, result;
if ((negate = spf_result_id[0] == '!'))
spf_result_id++;
result = Ustrcmp(spf_result_id, spf_result_id_list[rc].name) == 0;
if (negate != result) return OK;
}
/* no match */
return FAIL;
}
示例10: tree_search
tree_node *
tree_search(tree_node *p, uschar *name)
{
while (p != NULL)
{
int c = Ustrcmp(name, p->name);
if (c == 0) return p;
p = (c < 0)? p->left : p->right;
}
return NULL;
}
示例11: manualroute_router_init
void
manualroute_router_init(router_instance *rblock)
{
manualroute_router_options_block *ob =
(manualroute_router_options_block *)(rblock->options_block);
int i;
/* Host_find_failed must be a recognized word */
for (i = 0; i < hff_count; i++)
{
if (Ustrcmp(ob->host_find_failed, hff_names[i]) == 0)
{
ob->hff_code = hff_codes[i];
break;
}
}
if (ob->hff_code < 0)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n "
"unrecognized setting for host_find_failed option", rblock->name);
for (i = 1; i < hff_count; i++) /* NB starts at 1 to skip "ignore" */
{
if (Ustrcmp(ob->host_all_ignored, hff_names[i]) == 0)
{
ob->hai_code = hff_codes[i];
break;
}
}
if (ob->hai_code < 0)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n "
"unrecognized setting for host_all_ignored option", rblock->name);
/* One of route_list or route_data must be specified */
if ((ob->route_list == NULL && ob->route_data == NULL) ||
(ob->route_list != NULL && ob->route_data != NULL))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG_FOR, "%s router:\n "
"route_list or route_data (but not both) must be specified",
rblock->name);
}
示例12: time_copy
static uschar *
time_copy(time_t t, uschar * mod)
{
uschar * cp;
struct tm * tp;
size_t len;
if (mod && Ustrcmp(mod, "int") == 0)
return string_sprintf("%u", (unsigned)t);
cp = store_get(32);
tp = gmtime(&t);
len = strftime(CS cp, 32, "%b %e %T %Y %Z", tp);
return len > 0 ? cp : NULL;
}
示例13: rf_get_transport
BOOL
rf_get_transport(uschar *tpname, transport_instance **tpptr, address_item *addr,
uschar *router_name, uschar *require_name)
{
uschar *ss;
BOOL expandable;
transport_instance *tp;
if (tpname == NULL)
{
if (require_name == NULL) return TRUE;
addr->basic_errno = ERRNO_BADTRANSPORT;
addr->message = string_sprintf("%s unset in %s router", require_name,
router_name);
return FALSE;
}
expandable = Ustrchr(tpname, '$') != NULL;
if (*tpptr != NULL && !expandable) return TRUE;
if (expandable)
{
ss = expand_string(tpname);
if (ss == NULL)
{
addr->basic_errno = ERRNO_BADTRANSPORT;
addr->message = string_sprintf("failed to expand transport "
"\"%s\" in %s router: %s", tpname, router_name, expand_string_message);
return FALSE;
}
}
else ss = tpname;
for (tp = transports; tp != NULL; tp = tp->next)
{
if (Ustrcmp(tp->name, ss) == 0)
{
DEBUG(D_route) debug_printf("set transport %s\n", ss);
*tpptr = tp;
return TRUE;
}
}
addr->basic_errno = ERRNO_BADTRANSPORT;
addr->message = string_sprintf("transport \"%s\" not found in %s router", ss,
router_name);
return FALSE;
}
示例14: edit_signal_to_proces
void edit_signal_to_proces(int signl, Char *shname)
{
EDITINFO *edata;
int i=0;
while (aig(edata = (EDITINFO*) next_data_with_type(MAINEDITWINDOW,&i)) &&
Ustrcmp(edata->pathname,shname)) i++;
if (!edata) {
message2(MP_ERROR, shname, translate(" is not running."));
return;
}
if (!edata->pid) {
message2(MP_ERROR, translate("Unable to send signals to "),shname);
return;
}
kill(edata->pid, signl);
}
示例15: auth_get_no64_data
int
auth_get_no64_data(uschar **aptr, uschar *challenge)
{
int c;
int p = 0;
smtp_printf("334 %s\r\n", challenge);
while ((c = receive_getc()) != '\n' && c != EOF)
{
if (p >= big_buffer_size - 1) return BAD64;
big_buffer[p++] = c;
}
if (p > 0 && big_buffer[p-1] == '\r') p--;
big_buffer[p] = 0;
if (Ustrcmp(big_buffer, "*") == 0) return CANCELLED;
*aptr = big_buffer;
return OK;
}