您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ stralloc_cats函数代码示例

51自学网 2021-06-03 08:27:01
  C++
这篇教程C++ stralloc_cats函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中stralloc_cats函数的典型用法代码示例。如果您正苦于以下问题:C++ stralloc_cats函数的具体用法?C++ stralloc_cats怎么用?C++ stralloc_cats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了stralloc_cats函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: 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(&params[0],strnum,fmt_ulong(strnum,msgnum));  stralloc_copyb(&params[1],hashout,COOKIE);  stralloc_copyb(&params[2],strnum,fmt_ulong(strnum,bodysize));  stralloc_copyb(&params[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,


示例2: httpdate

int httpdate(stralloc *sa,struct tai *t){  struct caltime ct;  int i;  caltime_utc(&ct,t,&i,(int *) 0);  if (i < 0) i = 0;  if (i > 6) i = 6;  if (!stralloc_copys(sa,weekday[i])) return 0;  if (!stralloc_catuint0(sa,ct.date.day,2)) return 0;  i = ct.date.month - 1;  if (i < 0) i = 0;  if (i > 11) i = 11;  if (!stralloc_cats(sa,month[i])) return 0;  if (!stralloc_catuint0(sa,ct.date.year,0)) return 0;  if (!stralloc_cats(sa," ")) return 0;  if (!stralloc_catuint0(sa,ct.hour,2)) return 0;  if (!stralloc_cats(sa,":")) return 0;  if (!stralloc_catuint0(sa,ct.minute,2)) return 0;  if (!stralloc_cats(sa,":")) return 0;  if (!stralloc_catuint0(sa,ct.second,2)) return 0;  if (!stralloc_cats(sa," GMT")) return 0;  return 1;}
开发者ID:stribika,项目名称:curveprotect,代码行数:26,


示例3: 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(&params[0],strnum,fmt_ulong(strnum,hash_lo));  stralloc_copyb(&params[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,


示例4: stralloc_cats

static char *set_workdir(char *action){  if (case_starts(action,"digest")) {			/* digest */    action += 6;    stralloc_cats(&outlocal,"-digest");    workdir = "digest";    flagdig = FLD_DIGEST;  } else if (case_starts(action,ACTION_ALLOW)) {	/* allow */    action += str_len(ACTION_ALLOW);    stralloc_append(&outlocal,'-');    stralloc_cats(&outlocal,ACTION_ALLOW);    workdir = "allow";    flagdig = FLD_ALLOW;  } else if (case_starts(action,ACTION_DENY)) {		/* deny */    action += str_len(ACTION_DENY);    stralloc_append(&outlocal,'-');    stralloc_cats(&outlocal,ACTION_DENY);    workdir = "deny";    flagdig = FLD_DENY;  }  else {    workdir = ".";    flagdig = 0;  }  if (flagdig)				/* zap '-' after db specifier */    if (*(action++) != '-') die_badaddr();  return action;}
开发者ID:chayapan-computing,项目名称:ezmlm-idx,代码行数:30,


示例5: 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(&params[0],strnum,fmt_ulong(strnum,num));  stralloc_copyb(&params[1],strnum,fmt_ulong(strnum,listno));  stralloc_copyb(&params[2],strnum,fmt_ulong(strnum,subs));  s = strnum;  if (done < 0) {    done = - done;    *s++ = '-';  }  s[fmt_uint(s,done)] = 0;  stralloc_copys(&params[3],s);  sql_exec(info,&query,4,params); /* ignore dups */  return 0;}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:29,


示例6:

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,


示例7: logaddr

void logaddr(const char *subdir,const char *event,	     const char *addr,const char *comment){  char ch;  int fd;  stralloc_copyb(&line,num,fmt_ulong(num,(unsigned long) now()));  stralloc_cats(&line," ");  stralloc_cats(&line,event);  stralloc_cats(&line," ");  while ((ch = *addr++) != 0) {    if ((ch < 33) || (ch > 126)) ch = '?';    stralloc_append(&line,ch);  }  if (comment && *comment) {    stralloc_cats(&line," ");    while ((ch = *comment++) != 0) {      if (ch == '/t')        ch = ' ';      else         if ((ch < 32) || (ch > 126)) ch = '?';      stralloc_append(&line,ch);    }  }  stralloc_cats(&line,"/n");  makepath(&fn,subdir,"/Log",0);  fd = open_append(fn.s);  if (fd == -1) return;  substdio_fdbuf(&ss,write,fd,NULL,0);  substdio_putflush(&ss,line.s,line.len);  close(fd);  return;}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:34,


示例8: dateline

int 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,


示例9: make_name

static void make_name(struct subdbinfo *info,		      const char *suffix1,		      const char *suffix2,		      int terminate){  stralloc_copys(&name,info->base_table);  if (suffix1) stralloc_cats(&name,suffix1);  if (suffix2) stralloc_cats(&name,suffix2);  if (terminate) stralloc_0(&name);}
开发者ID:bruceg,项目名称:ezmlm-idx,代码行数:10,


示例10: write_fifodir

int write_fifodir(char *dirname, stralloc *sa, void (*oaw_func)(char *, stralloc *)){  DIR *dir = NULL;  stralloc name = {0};  struct dirent *x = NULL;  static struct stat st;  /* read directory */  dir = opendir(dirname);  if(dir == NULL)    {      strerr_warn3("can't opendir() ", dirname, ": ", &strerr_sys);      return -1;    }  while (x = readdir(dir))    {      if(x == NULL)	{	  strerr_warn3("can't readdir() ", dirname, ": ", &strerr_sys);	  if(name.a) 	    stralloc_free(&name);	  return -1;	}      /* Ignore everything starting with a . */      if(x->d_name[0] != '.')	{ 	  stralloc_copys(&name, dirname);	  stralloc_cats(&name, "/");	  stralloc_cats(&name, x->d_name);	  stralloc_0(&name);	  if(stat(name.s, &st) == -1)	    {	      strerr_warn2("can't stat ", name.s, &strerr_sys);	    }	  if(S_ISFIFO(st.st_mode))	    {	      oaw_func(name.s, sa);	    }	  else	    {	      buffer_puts(buffer_2, "ddnsd: warning: ");	      buffer_puts(buffer_2, name.s);	      buffer_puts(buffer_2, " is no fifo, ignoring/n");	      buffer_flush(buffer_2);	    }	}    }  closedir(dir);    return 0;}
开发者ID:mdornseif,项目名称:ddns,代码行数:55,


示例11: geton

int geton(const char *action){  const char *fl;  int r;  unsigned int i;  unsigned char ch;  fl = get_from(target.s,action);		/* try to match up */  r = subscribe(workdir,target.s,1,fl,(*action == ACTION_RC[0]) ? "+mod" : "+",-1);  if (flagdig == FLD_DENY || flagdig == FLD_ALLOW)    strerr_die2x(0,INFO,MSG1(ERR_EXTRA_SUB,target.s));  switch (r) {    case 1:	    qmail_puts(&qq,"List-Unsubscribe: <mailto:");	/*rfc2369 */	    qmail_put(&qq,outlocal.s,outlocal.len);	    qmail_puts(&qq,"-unsubscribe-");		/* url-encode since verptarget is controlled by sender */		/* note &verptarget ends in '/0', hence len - 1! */	    for (i = 0; i < verptarget.len - 1; i++) {	      ch = verptarget.s[i];	      if (str_chr("/"?;<>&/:%+#",ch) < 10 ||			 (ch <= ' ') || (ch & 0x80)) {		urlstr[1] = hex[ch / 16];	        urlstr[2] = hex[ch & 0xf];		qmail_put(&qq,urlstr,3);	      } else {		qmail_put(&qq,verptarget.s + i, 1);	      }	    }	    qmail_puts(&qq,"@");	    qmail_put(&qq,outhost.s,outhost.len);	/* safe */	    qmail_puts(&qq,">/n");	    hdr_subject(MSG(SUB_WELCOME));            hdr_ctboundary();	    stralloc_copy(&confirm,&outlocal);	    stralloc_cats(&confirm,"-unsubscribe-");	    stralloc_cats(&confirm,verptarget.s);	    stralloc_append(&confirm,'@');	    stralloc_cat(&confirm,&outhost);	    stralloc_0(&confirm);	    set_cpconfirm(confirm.s,outlocal.len);	/* for !R in copy */            copy(&qq,"text/top",flagcd);            copy_act("text/sub-ok");            break;    default:            if (str_start(action,ACTION_TC))              strerr_die2x(0,INFO,MSG(ERR_SUB_NOP));	    hdr_subject(MSG(SUB_SUBSCRIBE_NOP));            hdr_ctboundary();            copy(&qq,"text/top",flagcd);            copy_act("text/sub-nop");            break;  }  return r;}
开发者ID:chayapan-computing,项目名称:ezmlm-idx,代码行数:55,


示例12: pathexec_env

int pathexec_env(const char *s,const char *t){  if (!s) return 1;  if (!stralloc_copys(&tmp,s)) return 0;  if (t) {    if (!stralloc_cats(&tmp,"=")) return 0;    if (!stralloc_cats(&tmp,t)) return 0;  }  if (!stralloc_0(&tmp)) return 0;  return stralloc_cat(&plus,&tmp);}
开发者ID:Gottox,项目名称:runit,代码行数:11,


示例13: stralloc_cat_table

static int stralloc_cat_table(stralloc *s,                              const struct subdbinfo *info,                              const char *table){    if (!stralloc_cats(s,info->base_table)) return 0;    if (table) {        if (!stralloc_append(s,"_")) return 0;        if (!stralloc_cats(s,table)) return 0;    }    return 1;}
开发者ID:abh,项目名称:ezmlm-idx,代码行数:11,


示例14: env_addmodif

intenv_addmodif(stralloc* sa, const char* s, const char* t) {  size_t oldlen = sa->len;  if(!s)    return 1;  if(!stralloc_cats(sa, s))    return 0;  if((t && (!stralloc_catb(sa, "=", 1) || !stralloc_cats(sa, t))) || !stralloc_0(sa)) {    sa->len = oldlen;    return 0;  }  return 1;}
开发者ID:rsenn,项目名称:dirlist,代码行数:13,


示例15: generateSearchCMD

/* * generate the search command for a given manual; * return a stralloc with the command string */stralloc generateSearchCMD( char *manual , stralloc temp ){      stralloc_cats( &temp, findCMD );            // append "/usr/bin/find "    //stralloc_cats( &temp, searchDIR_1 );        // append "/usr/local/share/man "    //stralloc_cats( &temp, searchDIR_2 );        // append "/usr/man "    stralloc_cats( &temp, searchDIR_3 );        // append "/usr/share/man "    stralloc_cats( &temp, findOption);          // append "-name "    stralloc_cats( &temp, manual );             // append "[uncrustify]"    stralloc_cats( &temp, findAppendix );       // append ".* "    //stralloc_cats( &temp, ignoreError);         // append "2>/dev/null"    //stralloc_cats( &temp, topResult );          // append "| head -1"    return temp;}
开发者ID:snSWIIue,项目名称:snUebungen,代码行数:16,


示例16: _issub

static 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,


示例17: makeuniquename

static int makeuniquename (stralloc *sa, char const *path, char const *magic){  unsigned int base = sa->len ;  int wasnull = !sa->s ;  if (!stralloc_cats(sa, path)) return 0 ;  if (!stralloc_cats(sa, magic)) goto err ;  if (random_sauniquename(sa, 8) == -1) goto err ;  if (!stralloc_0(sa)) goto err ;  return 1 ;err:  if (wasnull) stralloc_free(sa) ; else sa->len = base ;  return 0 ;}
开发者ID:rlonstein,项目名称:s6-portable-utils,代码行数:14,


示例18: _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 '_'. */static void _searchlog(struct subdbinfo *info,                       const char *table,                       char *search,		/* search string */                       int subwrite())		/* output fxn */{    sqlite3_stmt *stmt;    int res;    datetime_sec when;    struct datetime dt;    char date[DATE822FMT];    /* 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.     */    if (!stralloc_copys(&line,"SELECT tai, edir||etype||' '||address||' '||fromline"                        " FROM ")) die_nomem();    if (!stralloc_cat_table(&line,info,table)) die_nomem();    if (!stralloc_cats(&line,"_slog")) die_nomem();    if (*search) {	/* We can afford to wait for LIKE '%xx%' */        if (!stralloc_cats(&line," WHERE fromline LIKE '%")) die_nomem();        if (!stralloc_cats(&line,search)) die_nomem();        if (!stralloc_cats(&line,"%' OR address LIKE '%")) die_nomem();        if (!stralloc_cats(&line,search)) die_nomem();        if (!stralloc_cats(&line,"%'")) die_nomem();    }	/* ordering by tai which is an index */    if (!stralloc_cats(&line," ORDER by tai")) die_nomem();    if (!stralloc_0(&line)) die_nomem();    if ((stmt = _sqlquery(info, &line)) == NULL)        strerr_die2x(111,FATAL,sqlite3_errmsg((sqlite3*)info->conn));    while ((res = sqlite3_step(stmt)) != SQLITE_DONE) {        if (res != SQLITE_ROW)            strerr_die2x(111,FATAL,sqlite3_errmsg((sqlite3*)info->conn));        (void)scan_ulong((const char*)sqlite3_column_text(stmt,0),&when);        datetime_tai(&dt,when);        if (!stralloc_copyb(&line,date,date822fmt(date,&dt)-1)) die_nomem();        if (!stralloc_cats(&line,": ")) die_nomem();        if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,when))) die_nomem();        if (!stralloc_cats(&line," ")) die_nomem();        if (!stralloc_catb(&line,                           (const char*)sqlite3_column_text(stmt,1),                           sqlite3_column_bytes(stmt,1)))            die_nomem();        if (subwrite(line.s,line.len) == -1) die_write();    }    sqlite3_finalize(stmt);}
开发者ID:abh,项目名称:ezmlm-idx,代码行数:56,


示例19: main

int main (int argc, char const *const *argv){  stralloc sa = STRALLOC_ZERO ;  unsigned int n = 8 ;  PROG = "s6-uniquename" ;  {    subgetopt_t l = SUBGETOPT_ZERO ;    for (;;)    {      register int opt = subgetopt_r(argc, argv, "n:", &l) ;      if (opt == -1) break ;      switch (opt)      {        case 'n' : if (!uint0_scan(l.arg, &n)) usage() ; break ;        default : usage() ;      }    }    argc -= l.ind ; argv += l.ind ;  }  if (argc < 1) usage() ;  if (!stralloc_cats(&sa, argv[0])) strerr_diefu1sys(111, "stralloc_cats") ;  if ((n ? random_sauniquename(&sa, n) : sauniquename(&sa)) < 0)    strerr_diefu1sys(111, "make unique name") ;  if (!stralloc_catb(&sa, "/n", 1)) strerr_diefu1sys(111, "stralloc_cats") ;  if (allwrite(1, sa.s, sa.len) < sa.len) strerr_diefu1sys(111, "write to stdout") ;  return 0 ;}
开发者ID:matya,项目名称:s6-portable-utils,代码行数:27,


示例20: decode_prvs

static 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++ stralloc_copys函数代码示例
C++ stralloc_catb函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。