这篇教程C++ stralloc_copys函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stralloc_copys函数的典型用法代码示例。如果您正苦于以下问题:C++ stralloc_copys函数的具体用法?C++ stralloc_copys怎么用?C++ stralloc_copys使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stralloc_copys函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: absolutepathint absolutepath (stralloc *sa, const char *path){ int r = 1 ; if (!path) r = stralloc_copys(sa, "/") ; else if (path[0] == '/') r = stralloc_copys(sa, path) ; else { unsigned int n = 0 ; for (;;) { n += 1024 ; if (!stralloc_ready(sa, n)) { r = 0 ; break ; } if (getcwd(sa->s, n)) break ; if (errno != ENOMEM) { r = 0 ; break ; } } sa->len = str_len(sa->s) ; if (r) r = stralloc_append(sa, "/") && stralloc_cats(sa, path) ; if (!r) stralloc_free(sa) ; } return r ? stralloc_0(sa) : 0 ;}
开发者ID:mgpld,项目名称:Easy-Server-Framework--C-,代码行数:29,
示例2: stralloc_copys/* Creates an entry for message num and the list listno and code "done". * Returns NULL on success, and the error string on error. */const char *sub_sql_logmsg(struct subdbinfo *info, unsigned long num, unsigned long listno, unsigned long subs, int done){ char *s; char strnum[FMT_ULONG]; stralloc_copys(&query,"INSERT INTO "); stralloc_cats(&query,info->base_table); stralloc_cats(&query,"_mlog (msgnum,listno,subs,done) VALUES "); stralloc_cats(&query,sql_logmsg_values_defn); stralloc_copyb(¶ms[0],strnum,fmt_ulong(strnum,num)); stralloc_copyb(¶ms[1],strnum,fmt_ulong(strnum,listno)); stralloc_copyb(¶ms[2],strnum,fmt_ulong(strnum,subs)); s = strnum; if (done < 0) { done = - done; *s++ = '-'; } s[fmt_uint(s,done)] = 0; stralloc_copys(¶ms[3],s); sql_exec(info,&query,4,params); /* ignore dups */ return 0;}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:29,
示例3: qldap_get_dotmodeintqldap_get_dotmode(qldap *q, stralloc *dm){ int r; /* get and check the status of the account */ r = qldap_get_attr(q, LDAP_DOTMODE, &ldap_attr, SINGLE_VALUE); if (r == NOSUCH) { if (!stralloc_copy(dm, &dotmode)) return ERRNO; return OK; } if (r != OK) return r; if (!case_diffs(DOTMODE_LDAPONLY, ldap_attr.s)) { if (!stralloc_copys(dm, DOTMODE_LDAPONLY)) return ERRNO; } else if (!str_diff(DOTMODE_LDAPWITHPROG, ldap_attr.s)) { if (!stralloc_copys(dm, DOTMODE_LDAPWITHPROG)) return ERRNO; } else if (!str_diff(DOTMODE_DOTONLY, ldap_attr.s)) { if (!stralloc_copys(dm, DOTMODE_DOTONLY)) return ERRNO; } else if (!str_diff(DOTMODE_BOTH, ldap_attr.s)) { if (!stralloc_copys(dm, DOTMODE_BOTH)) return ERRNO; } else if (!str_diff(DOTMODE_NONE, ldap_attr.s)) { if (!stralloc_copys(dm, DOTMODE_NONE)) return ERRNO; } else { return ILLVAL; } if (!stralloc_0(dm)) return ERRNO; return OK;}
开发者ID:ajtulloch,项目名称:qmail,代码行数:30,
示例4: getmessvoid getmess(){ int match; if (slurpclose(0,&message,1024) == -1) die_read(); strnum[fmt_uint(strnum,message.len)] = 0; if (!stralloc_copys(&beforemessage,strnum)) nomem(); if (!stralloc_cats(&beforemessage,":")) nomem(); if (!stralloc_copys(&aftermessage,",")) nomem(); if (getln(&envelope,&line,&match,'/0') == -1) die_read(); if (!match) die_format(); if (line.len < 2) die_format(); if (line.s[0] != 'F') die_format(); strnum[fmt_uint(strnum,line.len - 2)] = 0; if (!stralloc_cats(&aftermessage,strnum)) nomem(); if (!stralloc_cats(&aftermessage,":")) nomem(); if (!stralloc_catb(&aftermessage,line.s + 1,line.len - 2)) nomem(); if (!stralloc_cats(&aftermessage,",")) nomem(); for (;;) { if (getln(&envelope,&line,&match,'/0') == -1) die_read(); if (!match) die_format(); if (line.len < 2) break; if (line.s[0] != 'T') die_format(); strnum[fmt_uint(strnum,line.len - 2)] = 0; if (!stralloc_cats(&aftermessage,strnum)) nomem(); if (!stralloc_cats(&aftermessage,":")) nomem(); if (!stralloc_catb(&aftermessage,line.s + 1,line.len - 2)) nomem(); if (!stralloc_cats(&aftermessage,",")) nomem(); }}
开发者ID:ajtulloch,项目名称:qmail,代码行数:35,
示例5: die_nomem/* Checks the hash against the cookie table. If it matches, returns NULL, * else returns "". If error, returns error string. */static const char *_checktag (struct subdbinfo *info, unsigned long num, /* message number */ unsigned long listno, /* bottom of range => slave */ const char *action, const char *seed, const char *hash) /* cookie */{ sqlite3_stmt *stmt; int res; /* SELECT msgnum FROM table_cookie WHERE msgnum=num and cookie='hash' */ /* succeeds only is everything correct. 'hash' is quoted since it is */ /* potentially hostile. */ if (listno) { /* only for slaves */ if (!stralloc_copys(&line,"SELECT listno FROM ")) die_nomem(); if (!stralloc_cats(&line,info->base_table)) die_nomem(); if (!stralloc_cats(&line,"_mlog WHERE listno=")) die_nomem(); if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,listno))) die_nomem(); if (!stralloc_cats(&line," AND msgnum=")) die_nomem(); if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,num))) die_nomem(); if (!stralloc_cats(&line," AND done > 3")) die_nomem(); if (!stralloc_0(&line)) die_nomem(); if ((stmt = _sqlquery(info, &line)) == NULL) return sqlite3_errmsg((sqlite3*)info->conn); /* query */ res = sqlite3_step(stmt); sqlite3_finalize(stmt); /* free res */ if (res == SQLITE_ROW) return ""; /*already done */ else if (res != SQLITE_DONE) return sqlite3_errmsg((sqlite3*)info->conn); } if (!stralloc_copys(&line,"SELECT msgnum FROM ")) die_nomem(); if (!stralloc_cats(&line,info->base_table)) die_nomem(); if (!stralloc_cats(&line,"_cookie WHERE msgnum=")) die_nomem(); if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,num))) die_nomem(); if (!stralloc_cats(&line," and cookie='")) die_nomem(); if (!stralloc_catb(&line,strnum,fmt_str(strnum,hash))) die_nomem(); if (!stralloc_cats(&line,"'")) die_nomem(); if (!stralloc_0(&line)) die_nomem(); if ((stmt = _sqlquery(info, &line)) == NULL) /* select */ return sqlite3_errmsg((sqlite3*)info->conn); res = sqlite3_step(stmt); sqlite3_finalize(stmt); /* free res */ if (res == SQLITE_DONE) return ""; /* eof => query ok, but null result*/ else if (res != SQLITE_ROW) return sqlite3_errmsg((sqlite3*)info->conn); /* some error occurred */ return (char *)0; /* success! cookie matches */ (void)action; (void)seed;}
开发者ID:abh,项目名称:ezmlm-idx,代码行数:57,
示例6: qldap_get_mailstoreintqldap_get_mailstore(qldap *q, stralloc *hd, stralloc *ms){ int r; /* * get and check the mailstores. * Both homedir and maildir are set from the three * values ~control/ldapmessagestore, homedirectory * and mailmessagestore. * ms is only filled with a value if both homedir * and maildir is used. */ r = qldap_get_attr(q, LDAP_HOMEDIR, hd, SINGLE_VALUE); if (r == NOSUCH) { if (!stralloc_copys(hd, "")) return ERRNO; } else if (r != OK) return r; if (0 < hd->len) { if (hd->s[0] != '/' || check_paths(hd->s) == 0) { /* probably some log warning would be good */ return ILLVAL; } } r = qldap_get_attr(q, LDAP_MAILSTORE, ms, SINGLE_VALUE); if (r == NOSUCH) { if (!stralloc_copys(ms, "")) return ERRNO; } else if (r != OK) return r; if (ms->len > 0) if (check_paths(ms->s) == 0) { /* probably some log warning would be good */ return ILLVAL; } if (hd->len > 0 && ms->len > 0) return OK; if (hd->len > 0) return OK; if (ms->len > 0) { if (ms->s[0] != '/') { if (default_messagestore.s == 0 || default_messagestore.len == 0) return ILLVAL; if (!stralloc_cat(hd, &default_messagestore)) return ERRNO; } if (!stralloc_cat(hd, ms)) return ERRNO; if (!stralloc_copys(ms, "")) return ERRNO; return OK; } return NEEDED;}
开发者ID:ajtulloch,项目名称:qmail,代码行数:52,
示例7: pls_readerstatic intpls_reader(playlist* pl) { int ret; static playlist_entry entry; buffer* inbuf = pl->ptr; stralloc line; stralloc_init(&line); if(( ret = buffer_getline_sa(inbuf, &line))) { size_t index2, index; index2 = index = 0; while(line.len > 1 && (line.s[line.len - 1] == '/r' || line.s[line.len - 1] == '/n')) line.len--; stralloc_0(&line); if(!str_diffn(&line.s[index], "Number", 6)) { } else if(line.s[index] == '[') { } else if((index2 = str_chr(&line.s[index], '=')) > 0) { unsigned long trackno = 0; index = index2; index2++; do { index--; } while(isdigit(line.s[index]) && index > 0); scan_ulong(&line.s[index], &trackno); if(!str_diffn(&line.s[index], "File", 4)) { stralloc_copys(&entry.path, &line.s[index2]); stralloc_0(&entry.path); } else if(!str_diffn(&line.s[index], "Title", 5)) { stralloc_copys(&entry.title, &line.s[index2]); stralloc_0(&entry.title); } else if(!str_diffn(&line.s[index], "Length", 6)) { unsigned long len; scan_ulong(&line.s[index2], &len); entry.length = len; } /* uint32 index = 8; index += scan_ulong(&line.s[index], &len); entry.length = len; index++; stralloc_copys(&entry.title, &line.s[index]); stralloc_0(&entry.title); */ } else { /* stralloc_copy(&entry.path, &line); stralloc_0(&entry.path); if(pl->callback) { pl->callback(pl, &entry.title, &entry.path, entry.length); }*/ } } return ret;}
开发者ID:rsenn,项目名称:dirlist,代码行数:52,
示例8: _issubstatic int _issub(struct subdbinfo *info, const char *table, const char *userhost, stralloc *recorded){ sqlite3_stmt *stmt; unsigned int j; int res; /* SELECT address FROM list WHERE address = 'userhost' AND hash */ /* BETWEEN 0 AND 52. Without the hash restriction, we'd make it */ /* even easier to defeat. Just faking sender to the list name would*/ /* work. Since sender checks for posts are bogus anyway, I don't */ /* know if it's worth the cost of the "WHERE ...". */ if (!stralloc_copys(&addr,userhost)) die_nomem(); j = byte_rchr(addr.s,addr.len,'@'); if (j == addr.len) return 0; case_lowerb(addr.s + j + 1,addr.len - j - 1); if (!stralloc_copys(&line,"SELECT address FROM ")) die_nomem(); if (!stralloc_cat_table(&line,info,table)) die_nomem(); if (!stralloc_cats(&line," WHERE address LIKE '")) die_nomem(); if (!stralloc_cat(&line,&addr)) die_nomem(); if (!stralloc_cats(&line,"'")) die_nomem(); if (!stralloc_0(&line)) die_nomem(); if ((stmt = _sqlquery(info, &line)) == NULL) /* select */ strerr_die2x(111,FATAL,sqlite3_errmsg((sqlite3*)info->conn)); /* No data returned in QUERY */ res = sqlite3_step(stmt); if (res != SQLITE_ROW) { if (res != SQLITE_DONE) strerr_die2x(111,FATAL,sqlite3_errmsg((sqlite3*)info->conn)); sqlite3_finalize(stmt); return 0; } if (recorded) { if (!stralloc_copyb(recorded, (const char*)sqlite3_column_text(stmt, 0), sqlite3_column_bytes(stmt, 0))) die_nomem(); if (!stralloc_0(recorded)) die_nomem(); } sqlite3_finalize(stmt); return 1;}
开发者ID:abh,项目名称:ezmlm-idx,代码行数:51,
示例9: sub_sql_searchlog/* Searches the subscriber log and outputs via subwrite(s,len) any entry * that matches search. A '_' is search is a wildcard. Any other * non-alphanum/'.' char is replaced by a '_'. */void sub_sql_searchlog(struct subdbinfo *info, const char *table, char *search, /* search string */ int subwrite()) /* output fxn */{ void *result; datetime_sec when; struct datetime dt; char date[DATE822FMT]; int nparams; char strnum[FMT_ULONG]; make_name(info,table?"_":0,table,0);/* SELECT (*) FROM list_slog WHERE fromline LIKE '%search%' OR address *//* LIKE '%search%' ORDER BY tai; *//* The '*' is formatted to look like the output of the non-mysql version *//* This requires reading the entire table, since search fields are not *//* indexed, but this is a rare query and time is not of the essence. */ stralloc_copys(&query,"SELECT "); stralloc_cats(&query,sql_searchlog_select_defn); stralloc_cats(&query," FROM "); stralloc_cat(&query,&name); stralloc_cats(&query,"_slog"); if (*search) { /* We can afford to wait for LIKE '%xx%' */ stralloc_copys(¶ms[0],search); stralloc_copys(¶ms[1],search); nparams = 2; stralloc_cats(&query," WHERE "); stralloc_cats(&query,sql_searchlog_where_defn); } else nparams = 0; /* ordering by tai which is an index */ stralloc_cats(&query," ORDER by tai"); result = sql_select(info,&query,nparams,params); while (sql_fetch_row(info,result,2,params)) { stralloc_0(¶ms[0]); (void)scan_ulong(params[0].s,&when); datetime_tai(&dt,when); stralloc_copyb(¶ms[0],date,date822fmt(date,&dt)-1); stralloc_cats(¶ms[0],": "); stralloc_catb(¶ms[0],strnum,fmt_ulong(strnum,when)); stralloc_cats(¶ms[0]," "); stralloc_cat(¶ms[0],¶ms[1]); if (subwrite(params[0].s,params[0].len) == -1) die_write(); } sql_free_result(info,result);}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:53,
示例10: sub_sql_tagmsg/* This routine inserts the cookie into table_cookie. We log arrival of * the message (done=0). */void sub_sql_tagmsg(struct subdbinfo *info, unsigned long msgnum, /* number of this message */ const char *hashout, /* previously calculated hash */ unsigned long bodysize, unsigned long chunk){ const char *ret; char strnum[FMT_ULONG]; if (chunk >= 53L) chunk = 0L; /* sanity */ /* INSERT INTO table_cookie (msgnum,tai,cookie,bodysize,chunk) VALUES (...) */ /* (we may have tried message before, but failed to complete, so */ /* ER_DUP_ENTRY is ok) */ stralloc_copys(&query,"INSERT INTO "); stralloc_cats(&query,info->base_table); stralloc_cats(&query,"_cookie (msgnum,tai,cookie,bodysize,chunk) VALUES "); stralloc_cats(&query,sql_tagmsg_values_defn); stralloc_copyb(¶ms[0],strnum,fmt_ulong(strnum,msgnum)); stralloc_copyb(¶ms[1],hashout,COOKIE); stralloc_copyb(¶ms[2],strnum,fmt_ulong(strnum,bodysize)); stralloc_copyb(¶ms[3],strnum,fmt_ulong(strnum,chunk)); sql_exec(info,&query,4,params); /* ignore dups */ if (! (ret = logmsg(msgnum,0L,0L,1))) return; /* log done=1*/ if (*ret) strerr_die2x(111,FATAL,ret);}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:31,
示例11: mx_list_fill_namevoid mx_list_fill_name( mx_list_t* ml, const char* host ){ stralloc out = {0}; stralloc shost = {0}; static char ip[ 16 ]; // 16 => xxx.xxx.xxx.xxx/0 uchar_t* xtra; int i; stralloc_copys( &shost, host ); // do the lookup dns_ip4( &out, &shost ); // for each entry, rebuild the IP address i = 0; xtra = (uchar_t*)out.s; while ( i < out.len ) { snprintf( ip, 16, "%d.%d.%d.%d", (uint16) xtra[i], (uint16) xtra[i+1], (uint16) xtra[i+2], (uint16) xtra[i+3] ); // and add it to the list mx_list_add_ip( ml, ip ); i += 4; }}
开发者ID:stanguy,项目名称:scripts,代码行数:27,
示例12: static const char *remove_table(struct subdbinfo *info, const char *suffix1, const char *suffix2){ sqlite3_stmt *stmt; int res; if (table_exists(info,suffix1,suffix2) == 0) return 0; if (!stralloc_copys(&line,"DROP TABLE ")) die_nomem(); if (!stralloc_cats(&line,info->base_table)) die_nomem(); if (!stralloc_cats(&line,suffix1)) die_nomem(); if (!stralloc_cats(&line,suffix2)) die_nomem(); if (!stralloc_0(&line)) die_nomem(); if ((stmt = _sqlquery(info, &line)) == NULL) return sqlite3_errmsg((sqlite3*)info->conn); res = sqlite3_step(stmt); sqlite3_finalize(stmt); if (res != SQLITE_DONE) return sqlite3_errmsg((sqlite3*)info->conn); return 0;}
开发者ID:abh,项目名称:ezmlm-idx,代码行数:26,
示例13: mx_list_fillvoid mx_list_fill( mx_list_t* ml, const char* domain ){ stralloc mxs = { 0 }; stralloc host = { 0 }; char* current; // create the "djb-string" and look up the MX servers stralloc_copys( &host, domain ); if ( 0 != dns_mx( &mxs, &host ) ) { fprintf( stderr, "Error resolving/n" ); exit( -1 ); } // now, for each MX, we resolve the hostname current = mxs.s; while ( current < ( mxs.s + mxs.len ) ) { int weight = 255 * current[ 0 ] + current[ 1 ]; current += 2; if ( mx_debug_mode ) fprintf( stdout, "%s/t/tMX/t%-2d/t%s/n", domain, weight, current ); // we have one hostname, look that up mx_list_fill_name( ml, current ); while ( *current != 0 ) current++; current++; }}
开发者ID:stanguy,项目名称:scripts,代码行数:31,
示例14: encodeQvoid encodeQ(const char *indata,unsigned int n,stralloc *outdata) /* converts any character with the high order bit set to */ /* quoted printable. In: n chars of indata, out: stralloc outdata*/{ char *cpout; char ch; unsigned int i; const char *cpin; cpin = indata; i = 0; /* max 3 outchars per inchar & 2 char newline per 72 chars */ stralloc_copys(outdata,""); stralloc_ready(outdata,n * 3 + n/36); /* worst case */ cpout = outdata->s; while (n--) { ch = *cpin++; if (ch != ' ' && ch != '/n' && ch != '/t' && (ch > 126 || ch < 33 || ch == 61)) { *(cpout++) = '='; *(cpout++) = hexchar[(ch >> 4) & 0xf]; *(cpout++) = hexchar[ch & 0xf]; i += 3; } else { if (ch == '/n')
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:25,
示例15: sub_sql_putsubs/* Outputs all addresses in the table through subwrite. subwrite must be * a function returning >=0 on success, -1 on error, and taking * arguments (char* string, unsigned int length). It will be called once * per address and should take care of newline or whatever needed for * the output form. */unsigned long sub_sql_putsubs(struct subdbinfo *info, const char *table, unsigned long hash_lo, unsigned long hash_hi, int subwrite()) /* write function. */{ void *result; unsigned long no = 0L; char strnum[FMT_ULONG]; stralloc_copyb(¶ms[0],strnum,fmt_ulong(strnum,hash_lo)); stralloc_copyb(¶ms[1],strnum,fmt_ulong(strnum,hash_hi)); make_name(info,table?"_":0,table,0); /* main query */ stralloc_copys(&query,"SELECT address FROM "); stralloc_cat(&query,&name); stralloc_cats(&query," WHERE "); stralloc_cats(&query,sql_putsubs_where_defn); result = sql_select(info,&query,2,params); no = 0; while (sql_fetch_row(info,result,1,&addr)) { if (subwrite(addr.s,addr.len) == -1) die_write(); no++; /* count for list-list fxn */ } sql_free_result(info,result); return no;}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:35,
示例16: slnintsln(const char* path) { stralloc s, d; char* to; ssize_t i; stralloc_init(&s); stralloc_copys(&s, path); stralloc_init(&d); stralloc_copy(&d, &s); while(reduce(&d)) { buffer_puts(buffer_2, "'"); buffer_putsa(buffer_2, &d); buffer_puts(buffer_2, "' -> '"); buffer_putsa(buffer_2, &s); buffer_puts(buffer_2, "'/n"); buffer_flush(buffer_2); stralloc_nul(&s); stralloc_nul(&d); if(mklink_sa(&s, &d) == -1) { errmsg_warnsys("symlink failed", NULL); exit(2); } stralloc_copy(&s, &d); } return 0;}
开发者ID:rsenn,项目名称:dirlist,代码行数:32,
示例17: mainint main(int argc,char **argv){ int i; dns_random_init(seed); if (*argv) ++argv; while (*argv) { if (!stralloc_copys(&fqdn,*argv)) strerr_die2x(111,FATAL,"out of memory"); if (dns_ip4(&out,&fqdn) == -1) strerr_die4sys(111,FATAL,"unable to find IP address for ",*argv,": "); for (i = 0; i + 4 <= out.len; i += 4) { buffer_put(buffer_1,str,ip4_fmt(str,out.s + i)); buffer_puts(buffer_1," "); } buffer_puts(buffer_1,"/n"); ++argv; } buffer_flush(buffer_1); _exit(0);}
开发者ID:kunishi,项目名称:qmail-hg,代码行数:26,
示例18: read_file_configint read_file_config(void){ stralloc_copys(&oldflags,"-ABCDEFGHIJKLMNOPqRSTUVWXYZ"); oldflags.s[1] = "Aa"[exists("/archived")]; oldflags.s[2] = "Bb"[exists("/modgetonly")]; //oldflags.s[3] = "Cc"[exists("/ezmlmrc")]; /* Should always end up set */ oldflags.s[4] = "Dd"[exists("/digested")]; /* -e is not applicable */ oldflags.s[6] = "Ff"[exists("/prefix")]; oldflags.s[7] = "Gg"[exists("/subgetonly")]; oldflags.s[8] = "Hh"[exists("/nosubconfirm")]; oldflags.s[9] = "Ii"[exists("/threaded")]; oldflags.s[10] = "Jj"[exists("/nounsubconfirm")]; oldflags.s[11] = 'k'; /* -k is always enabled */ oldflags.s[12] = "Ll"[exists("/modcanlist")]; oldflags.s[13] = "Mm"[exists("/modpost")]; oldflags.s[14] = "Nn"[exists("/modcanedit")]; oldflags.s[15] = "Oo"[exists("/modpostonly")]; oldflags.s[16] = "Pp"[exists("/public")]; oldflags.s[17] = 'q'; /* -q is always enabled */ oldflags.s[18] = "Rr"[exists("/remote")]; oldflags.s[19] = "Ss"[exists("/modsub")]; oldflags.s[20] = "Tt"[exists("/addtrailer")]; oldflags.s[21] = "Uu"[exists("/subpostonly")]; /* -v is not applicable */ oldflags.s[23] = "Ww"[exists("/nowarn")]; oldflags.s[24] = "Xx"[exists("/mimeremove")]; oldflags.s[25] = "Yy"[exists("/confirmpost")]; /* -z is unused */ read_files(); return 1;}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:32,
示例19: dns_mx_packetint dns_mx_packet(stralloc *out,const char *buf,unsigned int len){ unsigned int pos; char header[12]; char pref[2]; uint16 numanswers; uint16 datalen; if (!stralloc_copys(out,"")) return -1; pos = dns_packet_copy(buf,len,0,header,12); if (!pos) return -1; uint16_unpack_big(header + 6,&numanswers); pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; pos += 4; while (numanswers--) { pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) return -1; uint16_unpack_big(header + 8,&datalen); if (byte_equal(header,2,DNS_T_MX)) if (byte_equal(header + 2,2,DNS_C_IN)) { if (!dns_packet_copy(buf,len,pos,pref,2)) return -1; if (!dns_packet_getname(buf,len,pos + 2,&q)) return -1; if (!stralloc_catb(out,pref,2)) return -1; if (!dns_domain_todot_cat(out,q)) return -1; if (!stralloc_0(out)) return -1; } pos += datalen; } return 0;}
开发者ID:darcyg,项目名称:chaosircd,代码行数:32,
示例20: datelineint dateline(stralloc *dt, unsigned long d)/* converts yyyymm from unsigned long d to text dt */{ const char *mo; switch (d % 100) { case 1: mo = "January"; break; case 2: mo = "February"; break; case 3: mo = "March"; break; case 4: mo = "April"; break; case 5: mo = "May"; break; case 6: mo = "June"; break; case 7: mo = "July"; break; case 8: mo = "August"; break; case 9: mo = "September"; break; case 10: mo = "October"; break; case 11: mo = "November"; break; case 12: mo = "December"; break; case 0: mo = "????"; break; default: cgierr("I don't know any month > 12", "",""); } if (!stralloc_copys(dt,mo)) return -1; if (!stralloc_cats(dt," ")) return -1; if ((d/100)) { if (!stralloc_catb(dt,strnum,fmt_ulong(strnum,d/100))) return -1; } else if (!stralloc_cats(dt,"????")) return 0; return 1;}
开发者ID:kunishi,项目名称:qmail-hg,代码行数:29,
示例21: dns_ip4_packetint dns_ip4_packet(stralloc *out,const char *buf,unsigned int len){ unsigned int pos; char header[12]; uint16 numanswers; uint16 datalen; if (!stralloc_copys(out,"")) return -1; pos = dns_packet_copy(buf,len,0,header,12); if (!pos) return -1; uint16_unpack_big(header + 6,&numanswers); pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; pos += 4; while (numanswers--) { pos = dns_packet_skipname(buf,len,pos); if (!pos) return -1; pos = dns_packet_copy(buf,len,pos,header,10); if (!pos) return -1; uint16_unpack_big(header + 8,&datalen); if (byte_equal(header,2,DNS_T_A)) if (byte_equal(header + 2,2,DNS_C_IN)) if (datalen == 4) { if (!dns_packet_copy(buf,len,pos,header,4)) return -1; if (!stralloc_catb(out,header,4)) return -1; } pos += datalen; } dns_sortip(out->s,out->len); return 0;}
开发者ID:GunioRobot,项目名称:djbdns,代码行数:30,
示例22: decode_prvsstatic int decode_prvs(const char *s){ /* The BATV standard says the user part should have the format * "tag-type=tag-val=loc-core" where "loc-core" is the original local * address, but all the examples I could find in actual use had the * last two parts reversed. What a mess. So, I have to check if * either the first or second part is a valid prvs tag, and use the * other one. */ int at; int sep; if (s[at = str_rchr(s,'@')] == 0) return 0; /* Format: [email C++ strappend函数代码示例 C++ stralloc_cats函数代码示例
|