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

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

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

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

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

示例1: printer_set

/* Set the value. */static voidprinter_set (struct printer *p,	     const char * ppdkey, const char * command){  xstrcpy (p->ppdkey, ppdkey);  xstrcpy (p->command, command);}
开发者ID:OS2World,项目名称:UTIL-CONV-a2ps,代码行数:8,


示例2: out_get_root

/***************************************************************************** * Devide full outbound path on "root" directory, there other oubound * directories created, and main outbound directory name * * Arguments: *   path       pointer to the null-terminated outbound path string *   out_root   pointer to the pointer for the resulting root directory *   out_main   pointer to the pointer for the resulting main outbound *              name w/o path * * Return value: *   Zero on success (*out_root and *out_main must be freed) */int out_get_root(const char *path, char **out_root, char **out_main){	char *p, *outb;	ASSERT(path != NULL && out_root != NULL && out_main != NULL);	*out_root = NULL;	*out_main = NULL;		outb = (char *)xstrcpy(path);	p = outb + strlen(outb) - 1;	if( *p == DIRSEPCHR )		*p = '/0';		/* Ohh.. where is no full path for outbound directory */	if( (p=strrchr(outb, DIRSEPCHR)) == NULL )	{		free(outb);		return -1;	}		*p = '/0';	*out_main = xstrcpy(p+1);	*out_root = xstrcat(outb, "/");		DEB((D_OUTBOUND, "out_getroot: out_root /"%s/", out_main /"%s/"",		*out_root, *out_main));			return 0;}
开发者ID:askovpen,项目名称:binkleyforce,代码行数:44,


示例3: irc_get_mask

char* irc_get_mask(char *buf, char *raw) {    char *data;    char *seperateFrmSp;    char *mask;        if(buf == NULL)        return buf;        data = (char*)callocm(MAX_LEN, sizeof(char));    if(data == NULL)        return NULL;        xstrcpy(data, raw, MAX_LEN);        seperateFrmSp = xstrtok(data, " ", NULL);    if(seperateFrmSp == NULL) {        freem(data);        return NULL;    }        xstrcpy(data, seperateFrmSp, MAX_LEN);    mask = xstrtok(data, ":", NULL);    if(mask == NULL) {        freem(data);        return NULL;    }        strcpy(buf, mask);        freem(data);    return buf;}
开发者ID:jameslk,项目名称:xionbot-archive,代码行数:32,


示例4: irc_get_nick

char* irc_get_nick(char *buf, char *raw) {    char *data;    char *seperateFrmCol;    char *nick;        if(buf == NULL)        return buf;        data = (char*)callocm(MAX_LEN, sizeof(char));    if(data == NULL)        return NULL;        xstrcpy(data, raw, MAX_LEN);        seperateFrmCol = xstrtok(data, ":", NULL);    if(seperateFrmCol == NULL) {        freem(data);        return NULL;    }        strcpy(data, seperateFrmCol);    if(strchr(data, '!') == NULL)        nick = xstrtok(data, " ", NULL);    else        nick = xstrtok(data, "!", NULL);    if(nick == NULL) {        freem(data);        return NULL;    }        xstrcpy(buf, nick, MAX_NICKLEN);        freem(data);    return buf;}
开发者ID:jameslk,项目名称:xionbot-archive,代码行数:35,


示例5: reg_ipm_r

/* * Check for personal message */void reg_ipm_r(char *data, char *buf){    char    *name, *msg;    int	    rec;    pid_t   pid;    buf[0] = '/0';    snprintf(buf, SS_BUFSIZE, "100:0;");    strtok(data, ",");    pid = (pid_t)atoi(strtok(NULL, ";"));    if ((rec = reg_find(pid)) == -1)	return;    reginfo[rec].lastcon = (int)time(NULL);    if (!reginfo[rec].ismsg)	return;    name = xstrcpy(clencode(reginfo[rec].fname[reginfo[rec].ptr_out]));    msg  = xstrcpy(clencode(reginfo[rec].msg[reginfo[rec].ptr_out]));    snprintf(buf, SS_BUFSIZE, "100:2,%s,%s;", name, msg);    if (reginfo[rec].ptr_out < RB)	reginfo[rec].ptr_out++;    else	reginfo[rec].ptr_out = 0;    if (reginfo[rec].ptr_out == reginfo[rec].ptr_in)	reginfo[rec].ismsg = FALSE;        Syslog('+', "reg_ipm: in=%d out=%d ismsg=%d", reginfo[rec].ptr_in, reginfo[rec].ptr_out, reginfo[rec].ismsg);    free(name);    free(msg);    return;}
开发者ID:ftnapps,项目名称:FTNd,代码行数:37,


示例6: Syslog

char *xtodos(char *orig){    char	buf[13], *copy, *p;    if (orig == NULL) 	return NULL;    if ((remote_flags & SESSION_FNC) == 0) {	Syslog('o', "No filename conversion for /"%s/"", MBSE_SS(orig));	return xstrcpy(orig);    }    copy = xstrcpy(orig);    if ((p = strrchr(copy,'/'))) 	p++;    else 	p = copy;    name_mangle(p);    memset(&buf, 0, sizeof(buf));    strncpy(buf, p, 12);    Syslog('o', "name /"%s/" converted to /"%s/"", MBSE_SS(orig), buf);    free(copy);    return xstrcpy(buf);}
开发者ID:ftnapps,项目名称:mbsebbs,代码行数:25,


示例7: coprintf

intcoprintf (const char *format, ...){    va_list        argptr;                         /*  Argument list pointer            */    int        fmtsize = 0;                    /*  Size of formatted line           */    char        *formatted = NULL,              /*  Formatted line                   */        *prefixed = NULL;               /*  Prefixed formatted line          */    if (console_active)      {        formatted = mem_alloc (LINE_MAX + 1);        if (!formatted)            return (0);        va_start (argptr, format);      /*  Start variable args processing   */        vsnprintf (formatted, LINE_MAX, format, argptr);        va_end (argptr);                /*  End variable args processing     */        switch (console_mode)          {            case CONSOLE_DATETIME:                xstrcpy_debug ();                prefixed = xstrcpy (NULL, date_str (), " ", time_str (), ": ",                                    formatted, NULL);                break;            case CONSOLE_TIME:                xstrcpy_debug ();                prefixed = xstrcpy (NULL, time_str (), ": ", formatted, NULL);                break;          }        if (console_file)          {            file_write (console_file, prefixed? prefixed: formatted);            fflush (console_file);          }        if (console_fct)            (console_fct) (prefixed? prefixed: formatted);        if (console_echo)          {            fprintf (stdout, "%s", prefixed? prefixed: formatted);            fprintf (stdout, "/n");            fflush  (stdout);          }        if (prefixed)          {            fmtsize = strlen (prefixed);            mem_free (prefixed);          }        else            fmtsize = strlen (formatted);        mem_free (formatted);      }    return (fmtsize);}
开发者ID:imatix,项目名称:Xitami-25,代码行数:57,


示例8: UserCity

void UserCity(pid_t pid, char *user, char *city){    char    *u, *c;    u = xstrcpy(clencode(user));    c = xstrcpy(clencode(city));    SockS("AUSR:3,%d,%s,%s;", pid, u, c);    free(u);    free(c);}
开发者ID:ftnapps,项目名称:mbsebbs,代码行数:10,


示例9: log_init

int log_init(const char *logname, const char *ttyname){	FILE	*log_f;	char	*n, fac[30], *prio;	int	fc;	size_t	len;	if ( logname == NULL )		return 0;	log_tty = ttyname ? xstrdup( ttyname ) : NULL;	if ( *logname != '$' ) {		log_f = fopen( logname, "at" );		if ( log_f ) {			fclose( log_f );			log_type = LT_LOGFILE;			log_name = xstrdup( logname );			return 1;		}		return 0;	}	if ( ttyname ) {		len = strlen( progname ) + 2 + strlen( ttyname );		n = malloc( len );		if ( !n ) {			fprintf( stderr, "can't malloc() %d bytes of memory/n", len );			abort();			exit(1);		}		xstrcpy( n, progname, len );		xstrcat( n, ".", len );		xstrcat( n, ttyname, len );	} else		n = xstrdup( progname );	prio = strchr( logname + 1, ':' );	if ( prio ) {		prio++;		xstrcpy( fac, logname + 1, 30 );		if (( syslog_priority = parsefacorprio( prio, (SLNCODE *) prioritynames )) < 0 )			syslog_priority = LOG_INFO;	} else		xstrcpy( fac, logname + 1, 30);	if (( fc = parsefacorprio( fac, (SLNCODE *) facilitynames )) < 0 )		return 0;	log_type = LT_SYSLOG;	log_name = NULL;	openlog( n, LOG_PID, fc );	xfree( n );	return 1;}
开发者ID:ftnapps,项目名称:qico,代码行数:55,


示例10: WriteError

void WriteError(const char *format, ...){    char    *outputstr, *temp;    va_list va_ptr;    int	    i;    outputstr = calloc(10240, sizeof(char));    va_start(va_ptr, format);    vsnprintf(outputstr, 10240, format, va_ptr);    va_end(va_ptr);    for (i = 0; i < strlen(outputstr); i++)	if (outputstr[i] == '/r' || outputstr[i] == '/n')	    outputstr[i] = ' ';    if (*outputstr == '$')	snprintf(outputstr+strlen(outputstr), 10240, ": %s", strerror(errno));    if (strlen(outputstr) > (SS_BUFSIZE - 64)) {	outputstr[SS_BUFSIZE - 65] = ';';	outputstr[SS_BUFSIZE - 64] = '/0';    }    tcrc = StringCRC32(outputstr);    if (tcrc == lcrc) {	lcnt++;	free(outputstr);	return;    } else {	lcrc = tcrc;	if (lcnt) {	    lcnt++;	    SockS("ALOG:5,%s,%s,%d,?,Last message repeated %d times;", logdebug, progname, mypid, lcnt);	    SockS("ALOG:5,%s,%s,%d,?,Last message repeated %d times;", logfile, progname, mypid, lcnt);	    SockS("ALOG:5,%s,%s,%d,?,Last message repeated %d times;", errfile, progname, mypid, lcnt);	}	lcnt = 0;    }    if (*outputstr == '$') {	temp = xstrcpy(clencode(outputstr+1));    } else {	temp = xstrcpy(clencode(outputstr));    }    SockS("ALOG:5,%s,%s,%d,?,%s;", logdebug, progname, mypid, temp);    SockS("ALOG:5,%s,%s,%d,?,%s;", logfile, progname, mypid, temp);    SockS("ALOG:5,%s,%s,%d,?,%s;", errfile, progname, mypid, temp);    free(temp);    free(outputstr);}
开发者ID:ftnapps,项目名称:mbsebbs,代码行数:51,


示例11: reg_newcon

int reg_newcon(char *data){    char    *tty, *uid, *prg, *city;    int	    retval;    pid_t   pid;    strtok(data, ",");    pid = (pid_t)atoi(strtok(NULL, ","));    tty = xstrcpy(strtok(NULL, ","));    uid = xstrcpy(cldecode(strtok(NULL, ",")));    prg = xstrcpy(cldecode(strtok(NULL, ",")));    city = xstrcpy(cldecode(strtok(NULL, ";")));    /*     * Abort if no empty record is found      */    if ((retval = reg_find((pid_t)0)) == -1) {	Syslog('?', "Maximum clients (%d) reached", MAXCLIENT);	retval = -1;    } else {	memset((char *)&reginfo[retval], 0, sizeof(reg_info));	reginfo[retval].pid = pid;	strncpy((char *)&reginfo[retval].tty, tty, 6);	strncpy((char *)&reginfo[retval].uname, uid, 35);	strncpy((char *)&reginfo[retval].prg, prg, 14); 	strncpy((char *)&reginfo[retval].city, city, 35);	strcpy((char *)&reginfo[retval].doing, "-"); 	reginfo[retval].started = (int)time(NULL); 	reginfo[retval].lastcon = (int)time(NULL);	reginfo[retval].altime = 600;	/*	 * Everyone says do not disturb, unless the flag	 * is cleared by the owner of this process.	 */	reginfo[retval].silent = 1;	stat_inc_clients();	if (strcmp(prg, (char *)"ftncico") == 0)	    mailers++;	Syslog('-', "Registered client pgm /"%s/", pid %d, slot %d, mailers %d, TCP/IP %d", 		prg, (int)pid, retval, mailers, ipmailers);    }    free(uid);    free(prg);    free(city);    free(tty);    return retval;}
开发者ID:ftnapps,项目名称:FTNd,代码行数:50,


示例12: xmsg_unlink_dotfiles

/* kind = 0 for sent, 1 for toobig */static void xmsg_unlink_dotfiles(session_t *s, const char *varname){	if (session_int_get(s, varname)) {		const int kind = !xstrcasecmp(varname, "unlink_sent");		const int maxfs = session_int_get(s, "max_filesize");		const char *dfsuffix = session_get(s, "dotfile_suffix");		const char *dir = xmsg_dirfix(session_uid_get(s)+XMSG_UID_DIROFFSET);		DIR *d;		struct dirent *de;		struct stat st, std;		char *df, *dfd, *dp, *dpd;				if (!dir || !(d = opendir(dir))) {			xdebug("unable to open specified directory");			return;		}				df = xmalloc(xstrlen(dir) + NAME_MAX + 2);		dfd = xmalloc(xstrlen(dir) + NAME_MAX + 3 + xstrlen(dfsuffix));		xstrcpy(df, dir);		dp = df + xstrlen(df);		*(dp++) = '/';		xstrcpy(dfd, df);		dpd = dfd + xstrlen(dfd);		*(dpd++) = '.';				while ((de = readdir(d))) {			if (de->d_name[0] == '.')				continue;			if (xstrlen(de->d_name) > NAME_MAX) {				xdebug2(DEBUG_ERROR, "Filename longer than NAME_MAX (%s), skipping.", de->d_name);				continue;			}			xstrcpy(dp, de->d_name);			xstrcpy(dpd, de->d_name);			xstrcat(dpd, dfsuffix);			if (!stat(df, &st) && !stat(dfd, &std)					&& ((!maxfs || (st.st_size < maxfs)) == kind)) {				xdebug("removing %s", de->d_name);				unlink(df);				unlink(dfd);			}		}		closedir(d);		xfree(df);		xfree(dfd);	}}
开发者ID:dmilith,项目名称:ekg2-bsd,代码行数:50,


示例13: get_lastcallerrec_r

void get_lastcallerrec_r(int Rec, char *buf){    char        *temp, action[9], *name, *city;    FILE        *fp;    snprintf(buf, SS_BUFSIZE, "201:1,16;");    temp = calloc(PATH_MAX, sizeof(char));    snprintf(temp, PATH_MAX, "%s/etc/lastcall.data", getenv("MBSE_ROOT"));    if ((fp = fopen(temp, "r")) == NULL) {	free(temp);	return;    }    fread(&LCALLhdr, sizeof(LCALLhdr), 1, fp);    fseek(fp, ((Rec -1) * LCALLhdr.recsize) + LCALLhdr.hdrsize, SEEK_SET);    if (fread(&LCALL, LCALLhdr.recsize, 1, fp) == 1) {	LCALL.UserName[15] = '/0';	LCALL.Location[12] = '/0';	strcpy(action, "--------");	if (LCALL.Hidden)	    action[0] = 'H';	if (LCALL.Download)	    action[1] = 'D';	if (LCALL.Upload)	    action[2] = 'U';	if (LCALL.Read)	    action[3] = 'R';	if (LCALL.Wrote)	    action[4] = 'P';	if (LCALL.Chat)	    action[5] = 'C';	if (LCALL.Olr)	    action[6] = 'O';	if (LCALL.Door)	    action[7] = 'E';	action[8] = '/0';	name = xstrcpy(clencode(LCALL.UserName));	city = xstrcpy(clencode(LCALL.Location));	snprintf(buf, SS_BUFSIZE, "100:9,%s,%s,%d,%s,%s,%d,%d,%s,%s;", name, city,			LCALL.SecLevel, LCALL.Device, LCALL.TimeOn, 			(int)LCALL.CallTime, LCALL.Calls, LCALL.Speed, action);	free(name);	free(city);    }    free(temp);    fclose(fp);    return;}
开发者ID:bbs-io,项目名称:mbse,代码行数:49,


示例14: mdm_dial

int mdm_dial(char *phone,char *port){	int rc;	char s[MAX_STRING],conn[MAX_STRING];	if((rc=tty_openport(port))) {		write_log("can't open port: %s",tty_errs[rc]);		return MC_BAD;	}	reset();	xstrcpy(s,cfgs(CFG_DIALPREFIX),MAX_STRING);	xstrcat(s,phone,MAX_STRING);	xstrcat(s,cfgs(CFG_DIALSUFFIX),MAX_STRING);	tty_local(1);	sline("Dialing %s",s);vidle();	rc=modem_chat(s,cfgsl(CFG_MODEMCONNECT),cfgsl(CFG_MODEMNODIAL),cfgsl(CFG_MODEMERROR),			cfgsl(CFG_MODEMBUSY),cfgs(CFG_MODEMRINGING),cfgi(CFG_MAXRINGS),			cfgi(CFG_WAITCARRIER),conn,MAX_STRING);	sline("Modem said: %s",conn);	xfree(connstr);connstr=xstrdup(conn);	if(rc!=MC_OK) {		write_log("got %s",conn);		if(rc==MC_FAIL)hangup();		tty_close();		if(rc==MC_RING) {			sline("RING found..");			sleep(2);			execsh("killall -USR1 mgetty vgetty >/dev/null 2>&1");		} else sline("Call failed (%s)",mcs[rc]);		return rc;	}	write_log("*** %s",conn);	tty_local(0);	return rc;}
开发者ID:askovpen,项目名称:qico,代码行数:34,


示例15: readalias

void readalias(char *fn){	FILE			*fp;	char			buf[256], *k, *v;	struct aliaslist	*tmp = NULL;	faddr			*ta = NULL;	if ((fp = fopen(fn,"r")) == NULL) {		WriteError("$cannot open system alias file %s", MBSE_SS(fn));		return;	}	while (fgets(buf, sizeof(buf)-1, fp)) {		k = strtok(buf, " /t:");		v = strtok(NULL, " /t/n/r/0:");		if (k && v)			if ((ta = parsefaddr(v))) {				if (alist) {					tmp->next = (struct aliaslist *) xmalloc(sizeof(struct aliaslist));					tmp = tmp->next;				} else {					alist = (struct aliaslist *) xmalloc(sizeof(struct aliaslist));					tmp = alist;				}				tmp->next = NULL;				tmp->addr = ta;				ta = NULL;				tmp->alias = xstrcpy(k);			}	}	fclose(fp);}
开发者ID:bbs-io,项目名称:mbse,代码行数:32,


示例16: init_child_context

static int init_child_context (    TCB                    *tcb,     struct_smtsmtp_message *message,     QID                     reply_to,    event_t                 event_number){    ASSERT (tcb);  START_BODY    tcb-> thread_type = event_number;    tcb-> message = message;    tcb-> reply_to = reply_to;    tcb-> message_boundary = generate_unique_boundary ();    RAISE_EXC_IF (!tcb-> message_boundary, memory_error_event);    tcb-> plain_text_body_header = xstrcpy (        NULL,         "/r/n--",         tcb-> message_boundary,         "/r/n"        "Content-Type: text/plain; charset=US-ASCII/r/n"        "Content-Transfer-Encoding: 7BIT/r/n"        "Content-description: Body of message/r/n/r/n",        NULL      );    RAISE_EXC_IF (!tcb-> plain_text_body_header, memory_error_event);  END_BODY          return 0;}
开发者ID:INNOAUS,项目名称:gsl,代码行数:30,


示例17: MakeArc

void MakeArc(){    char    *cmd;    if (!getarchiver((char *)"ZIP")) {	WriteError("ZIP Archiver not available");	return;    }    cmd = xstrcpy(archiver.farc);    if (cmd == NULL) {	WriteError("ZIP archive command not available");	return;    }    Nopper();    if (!do_quiet)	printf("Creating allfiles.zip/n");    if (!execute_str(cmd, (char *)"allfiles.zip allfiles.txt allfiles.utf", (char *)NULL, (char *)"/dev/null", 			(char *)"/dev/null", (char *)"/dev/null") == 0)	WriteError("Create allfiles.zip failed");    Nopper();    if (!do_quiet)	printf("Creating newfiles.zip/n");    if (!execute_str(cmd, (char *)"newfiles.zip newfiles.txt newfiles.utf", (char *)NULL, (char *)"/dev/null", 			(char *)"/dev/null", (char  *)"/dev/null") == 0)	WriteError("Create newfiles.zip failed");    free(cmd);    cmd = NULL;}
开发者ID:bbs-io,项目名称:mbse,代码行数:33,


示例18: lock

/* * lock: *	Check and lock a file from access by others *	returns	TRUE = files was not locked and now is *		FALSE = file was locked and overridden *		ABORT = file was locked, abort command * * char *fname;		file name to lock */int lock(char *fname){	char *locker;	/* lock error message */	int status;	/* return status */	char msg[NSTRING];	/* message string */	/* attempt to lock the file */	locker = dolock(fname);	if (locker == NULL)	/* we win */		return TRUE;	/* file failed...abort */	if (strncmp(locker, "LOCK", 4) == 0) {		lckerror(locker);		return ABORT;	}	/* someone else has it....override? */	xstrcpy(msg, "File in use by ");	strcat(msg, locker);	strcat(msg, ", override?");	status = mlyesno(msg);	/* ask them */	if (status == TRUE)		return FALSE;	else		return ABORT;}
开发者ID:ytoto,项目名称:uemacs,代码行数:36,


示例19: sys_assert

voidsys_assert (const char *File, unsigned Line){#if (defined (__WINDOWS__))    char        line_str [10],        *buffer;                        /*  Formatted error message          */    MSG        msg;    Bool        quit;    int        rc;                             /*  MessageBox return code           */    snprintf (line_str, sizeof (line_str), "%u", Line);    buffer = xstrcpy (NULL, "Module ", File, ", line ", line_str, NULL);    /*  If WM_QUIT is in the queue the message box won't show                */    quit = PeekMessage (&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);    rc   = MessageBoxA (NULL, buffer, "Assertion failed!",                        MB_TASKMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE);    mem_free (buffer);    if (quit)        PostQuitMessage (msg.wParam);    if (rc != IDABORT)        return;#else    fflush  (stdout);    fprintf (stderr, "/nAssertion failed: %s, line %u/n", File, Line);    fflush  (stderr);#endif    abort   ();}
开发者ID:INNOAUS,项目名称:gsl,代码行数:33,


示例20: boxflist

static int boxflist(flist_t **fl,char *path){	DIR *d;	struct dirent *de;	struct stat sb;	char mn[MAX_PATH],*p;	int len;	DEBUG(('S',2,"Add filebox '%s'",path));	if(!(d=opendir(path)))return 0;	    else {		while((de=readdir(d))) {			len=strlen(path)+2+strlen(de->d_name);			p=xmalloc(len);			snprintf(p,len,"%s/%s",path,de->d_name);			if(!stat(p,&sb)&&(S_ISREG(sb.st_mode)||S_ISLNK(sb.st_mode))) {				xstrcpy(mn,de->d_name,MAX_PATH);				mapname(mn,cfgs(CFG_MAPOUT),MAX_PATH);				addflist(fl,p,xstrdup(mn),'^',0,NULL,0);				totalf+=sb.st_size;totaln++;			} else xfree(p);		}		closedir(d);	}	return 1;}
开发者ID:askovpen,项目名称:qico,代码行数:25,


示例21: irc_get_cmdtype

char* irc_get_cmdtype(char *buf, char *raw) {    char *data;    char *type;    int pos = 0;        if(buf == NULL)        return buf;        data = (char*)callocm(MAX_LEN, sizeof(char));    if(data == NULL)        return NULL;        xstrcpy(data, raw, MAX_LEN);    xstrtok(data, " ", &pos);    type = xstrtok(data, " ", &pos);    if(type == NULL) {        freem(data);        return NULL;    }        strcpy(buf, type);        freem(data);    return buf;}
开发者ID:jameslk,项目名称:xionbot-archive,代码行数:25,


示例22: SetEmailArea

void SetEmailArea(char *box){    char    *p;    if (!exitinfo.Email)	return;    /*     * Use a temp variable because this function can be called line SetEmailArea(sMailbox)     */    p = xstrcpy(box);    snprintf(sMailpath, PATH_MAX, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, p);    snprintf(sMailbox, 21, "%s", p);    free(p);    /*     * Get information from the message base     */    if (Msg_Open(sMailpath)) {	EmailBase.Lowest  = Msg_Lowest();	EmailBase.Highest = Msg_Highest();	EmailBase.Total   = Msg_Number();	Msg_Close();    } else	WriteError("Error open JAM %s", sMailpath);}
开发者ID:bbs-io,项目名称:mbse,代码行数:26,


示例23: tableSet

int tableSet(PTable t,const pchar Name,const pchar Value){  PTablePage p=t->pFirst,q;  int idx0,idx=0,res=0;  p=tableFind(p,&idx,Name);  if(p)  {    q=p;idx0=idx;    while((p=tableFind(p,&idx,Name)))    {      if(t->iFlags&TABLE_FLAG_ALLOCNAME)xfree(p->Values[idx].szName);      if(t->iFlags&TABLE_FLAG_ALLOCVALUE)xfree(p->Values[idx].szValue);      if(idx!=p->iCount-1)memmove(&p->Values[idx],&p->Values[idx+1],sizeof(SAttr)*(p->iCount-idx-1));      p->iCount--;      t->iCount--;      res++;    }    if(res)t->iHoles++;    if(t->iFlags&TABLE_FLAG_ALLOCVALUE)xfree(q->Values[idx].szValue);    if(xstrlen(q->Values[idx0].szValue)>=xstrlen(Value))      xstrcpy(q->Values[idx0].szValue,Value);    else      q->Values[idx0].szValue=xstrdup(t->pPool,Value);    return t->iCount;  }else return tableAdd(t,Name,Value);}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:26,


示例24: xml_escape_l

/* * xml_escape() * *    escapes text to be xml-compliant * *  - text * * allocated buffer */char *xml_escape(const char *text) {	const char *p;	char *res, *q;	int len;	if (!text)		return NULL;	for (p = text, len = 0; *p; p++)		len += xml_escape_l(*p);	q = res = xmalloc((len + 1)*sizeof(char));	for (p = text; *p; p++) {		const char *ent = xml_escape_c(*p);		if (ent)			xstrcpy(q, ent);		else			*q = *p;		q += xml_escape_l(*p);	}	return res;}
开发者ID:11mariom,项目名称:ekg2,代码行数:36,


示例25: add_list

/* * Add the specified entry to the list of files which should be sent * to the remote system. * 1. lst		file list to add entry to * 2. local		local filename * 3. remote		remote filename * 4. disposition	disposition * 5. floff		offset of entry in flo-file (-1 if this is a flo file) * 6. flofp		FILE * of flo file * 7. toend		append to end of list */void add_list(file_list **lst, char *local, char *Remote, int disposition, off_t floff, FILE *flofp, int toend){    file_list **tmpl, *tmp;    Syslog('o', "add_list(/"%s/",/"%s/",%d,%s)", MBSE_SS(local),MBSE_SS(Remote),disposition,toend?"to end":"to beg");    if (toend) 	for (tmpl = lst; *tmpl; tmpl =&((*tmpl)->next));    else 	tmpl = &tmp;    *tmpl = (file_list*)malloc(sizeof(file_list));    if (toend) {	(*tmpl)->next = NULL;    } else {	(*tmpl)->next = *lst;	*lst = *tmpl;    }    (*tmpl)->remote      = xtodos(Remote);    (*tmpl)->local       = xstrcpy(local);    (*tmpl)->disposition = disposition;    (*tmpl)->floff       = floff;    (*tmpl)->flofp       = flofp;    return;}
开发者ID:ftnapps,项目名称:mbsebbs,代码行数:36,


示例26: user_fillmask

unsigned int user_fillmask(struct userNode *user, char *hostmask) {    unsigned int i, x, len, len2, len3;        if((user == NULL) || (blankstr(hostmask)))        return 0;        len = strlen(hostmask);    len2 = strlen(user->nick);    if(len2 >= len)        return 0;        for(i = len2+1, x = 0;x < (len2+MAX_USERLEN);i++, x++) {        if(hostmask[i] == '@')            break;        user->user[x] = hostmask[i];    }    user->user[x] = 0;        len3 = len2+strlen(user->user)+2;    for(x = 0, i++;x < (len3+MAX_MASKLEN);i++, x++) {        if(!hostmask[i])            break;        user->host[x] = hostmask[i];    }    user->host[x] = 0;        xstrcpy(user->hostmask, hostmask, MAX_HOSTMASKLEN);        return 1;}
开发者ID:jameslk,项目名称:xionbot-archive,代码行数:30,


示例27: irc_get_target

char* irc_get_target(char *buf, char *raw) {      char *data;    char *target;    int pos = 0;        if(buf == NULL)        return buf;        data = (char*)callocm(MAX_LEN, sizeof(char));    if(data == NULL)        return NULL;        xstrcpy(data, raw, MAX_LEN);        xstrtok(data, " ", &pos);    xstrtok(data, " ", &pos);    target = xstrtok(data, " ", &pos);    if(target == NULL) {        freem(data);        return NULL;    }        if(*target == ':')        target++;    strcpy(buf, target);        freem(data);    return buf;}
开发者ID:jameslk,项目名称:xionbot-archive,代码行数:29,


示例28: irc_strip_ctrlcodes

unsigned int irc_strip_ctrlcodes(char **bufp, const char *text) {    char *buf;    unsigned int text_len;        *bufp = NULL;        if(blankstr(text))        return 0;        text_len = strlen(text)+1;        buf = (char*)callocm(text_len, sizeof(char*));    if(buf == NULL)        return 0;        xstrcpy(buf, text, text_len);        if(blankstr(strrtok(buf, ctrlcodes))) {        freem(buf);        return 0;    }        *bufp = buf;    return strlen(buf);}
开发者ID:jameslk,项目名称:xionbot-archive,代码行数:25,


示例29: debug

PyObject *ekg_cmd_plugin_get(PyObject * self, PyObject * pyargs){	ekg_pluginObj *pyplugin;	plugin_t *p;	char *name = NULL;	int prio = -1;	if (!PyArg_ParseTuple(pyargs, "s:plugin_get", &name))		return NULL;	debug("[python] checking for plugin '%s'/n", name);	p = plugin_find(name);	if (p) {		prio = p->prio;	}	debug("[python] Building object for plugin '%s'/n", name);	pyplugin = PyObject_New(ekg_pluginObj, &ekg_plugin_type);	pyplugin->loaded = prio < 0 ? 0 : 1;	pyplugin->prio = prio < 0 ? 0 : prio;	pyplugin->name = xmalloc(xstrlen(name)+1);	xstrcpy(pyplugin->name, name);	Py_INCREF(pyplugin);	return (PyObject *)pyplugin;}
开发者ID:dmilith,项目名称:ekg2-bsd,代码行数:26,


示例30: convert

void convert (char *directory, char *filename){#   define BUFMAX  32000    static char        fullname [1024],        bufin  [BUFMAX],        bufout [BUFMAX],        backup [1024],        ch;    int        insize,        outsize,        bufptr;    FILE        *input,        *output;    xstrcpy (fullname, directory, "/", filename, NULL);    if (!file_exists (fullname)) {        printf ("`%s' does not exist", fullname);        exit (1);    }    printf ("Converting %s.../n", fullname);    /*  Check if file contains suspicious binary characters                  */    input = fopen (fullname, "rb");    insize = fread (bufin, 1, 256, input);    for (bufptr = 0; bufptr < insize; bufptr++) {        ch = bufin [bufptr];        if (ch < ' ' && !isspace (ch) && ch != 0x1A) {            printf ("[0x%X at %d] ", bufin [bufptr], bufptr);            printf ("%s is a binary file - skipping/n", fullname);            return;        }    }    fclose (input);    strcpy (backup, fullname);    fixed_extension (backup, fullname, "bak");    file_delete (backup);    file_rename (fullname, backup);    input  = fopen (backup,   "rb");    output = fopen (fullname, "wb");    if (input == NULL || output == NULL) {        printf ("Error: %s/n", strerror (errno));        exit (1);    }    while ((insize = fread (bufin, 1, BUFMAX, input)) > 0) {        outsize = 0;        for (bufptr = 0; bufptr < insize; bufptr++)            if (bufin [bufptr] != '/r'            &&  bufin [bufptr] != 0x1A)                bufout [outsize++] = bufin [bufptr];        ASSERT (fwrite (bufout, 1, outsize, output));    }    fclose (input);    fclose (output);    file_delete (backup);}
开发者ID:cookrn,项目名称:openamq,代码行数:60,



注:本文中的xstrcpy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xstrdup_printf函数代码示例
C++ xstrcmp函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。