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

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

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

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

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

示例1: ReadTRSPass2

static int ReadTRSPass2(FILE *f, TRSData *TRSs)	{	rewind(f);	GFFLineNr = 0;	int TRSCount = 0;	GFFRecord Rec;	while (GetNextGFFRecord(f, Rec))		{		if (0 != strcmp(Rec.Feature, "trs"))			continue;		if (Rec.Start <= 0 || Rec.End <= 0 || Rec.Start > Rec.End)			Warning("GFF line %d: invalid start %d / end %d",			  GFFLineNr, Rec.Start, Rec.End);		static char *Fam = GetFam(Rec);		int FamIndex = 0;		int SuperFamIndex = 0;		int n = sscanf(Fam, "%d.%d", &FamIndex, &SuperFamIndex);		if (n != 2)			Quit("Invalid Family %s", Fam);		TRSData &TRS = TRSs[TRSCount];		const int Length = Rec.End - Rec.Start + 1;		TRS.ContigLabel = strsave(Rec.SeqName);		TRS.ContigFrom = Rec.Start - 1;		TRS.ContigTo = TRS.ContigFrom + Length - 1;		TRS.FamIndex = FamIndex;		TRS.SuperFamIndex = SuperFamIndex;		if (Rec.Strand == '+')			TRS.Rev = false;		else if (Rec.Strand == '-')			TRS.Rev = true;		else			Quit("GFF line %d, Invalid strand %c", GFFLineNr, Rec.Strand);		++TRSCount;		}	return TRSCount;	}
开发者ID:DobzhanskyCenter,项目名称:piler,代码行数:44,


示例2: strsave

// Search NAME along PATHP with the elements of PATHEXT in turn added.char *searchpathext(const char *name, const char *pathext, const char *pathp){  char *found = 0;  char *tmpathext = strsave(pathext);	// strtok modifies this string,					// so make a copy  char *ext = strtok(tmpathext, PATH_SEP);  while (ext) {    char *namex = new char[strlen(name) + strlen(ext) + 1];    strcpy(namex, name);    strcat(namex, ext);    found = searchpath(namex, pathp);    a_delete namex;    if (found)       break;    ext = strtok(0, PATH_SEP);  }  a_delete tmpathext;  return found;}
开发者ID:tizenorg,项目名称:toolchains.groff,代码行数:20,


示例3: strsave

/* * Extract Message-ID from ^AORIGID/^AORIGREF with special handling for * split messages (appended " i/n"). Returns NULL for invalid ^AORIGID. */char *s_msgid_convert_origid(char *origid, int part_flag){    char *s, *p, *id, *part;    TmpS *tmps;    s    = strsave(origid);    id   = s;    part = NULL;    p    = strrchr(s, '>');    if(!p)    {	xfree(s);	debug(1, "Invalid ^AORIGID: %s", origid);	return NULL;    }    p++;    if(is_space(*p))    {	/*	 * Indication of splitted message " p/n" follows ...	 */	*p++ = 0;	while(is_space(*p)) p++;	part = p;    }    /*     * Message-IDs must NOT contain white spaces     */    if(strchr(id, ' ') || strchr(id, '/t'))    {	xfree(s);	debug(1, "Invalid ^AORIGID: %s", origid);	return NULL;    }    tmps = tmps_copy(id);    xfree(s);    return tmps->s;}
开发者ID:oldprogs,项目名称:fidogate,代码行数:46,


示例4: regex_new

/* * Create new Regex struct for string */static Regex *regex_parse_line(char *s){    Regex *p;    int err;    /* New regex entry */    p = regex_new();    p->re_s = strsave(s);    err = regcomp(&p->re_c, p->re_s, REG_EXTENDED|REG_ICASE);    if(err) {	fglog("WARNING: error compiling regex %s", p->re_s);	xfree(p);	return NULL;    }    debug(15, "regex: pattern=%s", p->re_s);        return p;}
开发者ID:oldprogs,项目名称:fidogate-ds-sta,代码行数:23,


示例5: erl_alloc_eterm

/*  * Create an empty VARIABLE.  */ETERM *erl_mk_var(const char *s){    ETERM *ep;    if (!s) return NULL;        /* ASSERT(s != NULL); */    ep = erl_alloc_eterm(ERL_VARIABLE);    ERL_COUNT(ep) = 1;    ERL_VAR_LEN(ep) = strlen(s);        if ((ERL_VAR_NAME(ep) = strsave(s)) == NULL)    {	erl_free_term(ep);	erl_errno = ENOMEM;	return NULL;    }       ERL_VAR_VALUE(ep) = (ETERM *) NULL;    return ep;}
开发者ID:billysvensson,项目名称:otp,代码行数:23,


示例6: get_default_emulator

static char*get_default_emulator(char* progname){    char sbuf[MAXPATHLEN];    char* s;    if (strlen(progname) >= sizeof(sbuf))        return ERL_NAME;    strcpy(sbuf, progname);    for (s = sbuf+strlen(sbuf); s >= sbuf; s--) {	if (IS_DIRSEP(*s)) {	    strcpy(s+1, ERL_NAME);	    if(file_exists(sbuf))		return strsave(sbuf);	    break;	}    }    return ERL_NAME;}
开发者ID:Dasudian,项目名称:otp,代码行数:20,


示例7: include

void include(void){	char name[100];	FILE *fin;	int c;	extern int errno;	while ((c = input()) == ' ')		;	unput(c);	cstr(name, c == '"', sizeof(name));	/* gets it quoted or not */	if ((fin = fopen(name, "r")) == NULL)		ERROR "can't open file %s", name FATAL;	errno = 0;	curfile++;	curfile->fin = fin;	curfile->fname = strsave(name);	curfile->lineno = 0;	printf(".lf 1 %s/n", curfile->fname);	pushsrc(File, curfile->fname);}
开发者ID:99years,项目名称:plan9,代码行数:21,


示例8: fprintf

// Strip the installation prefix and replace it// with the current installation prefix; return the relocated path.char *relocatep(const char *path){#if DEBUG  fprintf(stderr, "relocatep: path = %s/n", path);  fprintf(stderr, "relocatep: INSTALLPATH = %s/n", INSTALLPATH);  fprintf(stderr, "relocatep: INSTALLPATHLEN = %d/n", INSTALLPATHLEN);#endif  if (!curr_prefix)    set_current_prefix();  if (strncmp(INSTALLPATH, path, INSTALLPATHLEN))    return strsave(path);  char *relative_path = (char *)path + INSTALLPATHLEN;  size_t relative_path_len = strlen(relative_path);  char *relocated_path = new char[curr_prefix_len + relative_path_len + 1];  strcpy(relocated_path, curr_prefix);  strcat(relocated_path, relative_path);#if DEBUG  fprintf(stderr, "relocated_path: %s/n", relocated_path);#endif /* DEBUG */  return relocated_path;}
开发者ID:tizenorg,项目名称:toolchains.groff,代码行数:23,


示例9: AddHit

static void AddHit(int PileIndex, const char *Label, int QueryFrom, int QueryTo,  int TargetFrom, int TargetTo, bool Rev)	{	TouchPiles(PileIndex);	TanPile &Pile = Piles[PileIndex];	if (0 == Pile.HitCount)		{		Pile.Label = strsave(Label);		Pile.From = min(QueryFrom, TargetFrom);		Pile.To = max(QueryTo, TargetTo);		}	else		{		if (0 != strcmp(Label, Pile.Label))			Quit("Labels disagree");		Pile.From = min3(Pile.From, QueryFrom, TargetFrom);		Pile.To = max3(Pile.To, QueryTo, TargetTo);		}	++(Pile.HitCount);	}
开发者ID:DobzhanskyCenter,项目名称:piler,代码行数:21,


示例10: get_set_var_name_int

char *  get_set_var_name_int (char * s, int index, char * file, int line){    char var_buf [VAR_SIZE+1];    char fmt_buf [VAR_SIZE+1];    char * p;    char * fmt;    int  index_found = 0;    if (strlen (s) >= VAR_SIZE)    {        fatal_exit ("Variable name too long/n");    }    for (p = fmt_buf, fmt=s; *fmt; fmt++)    {        *p++ = *fmt;        if (*fmt == '%')        {            if (!index_found)            {                index_found = 1;                *p++ = 'd';            }            else            {                *p++ = '%';            }        }    }    *p = '/0';    sprintf (var_buf, fmt_buf, index);    if (strlen (var_buf) >= VAR_SIZE)    {        fatal_exit ("Variable name too long/n");    }    return strsave (var_buf);}
开发者ID:LeSpocky,项目名称:eis,代码行数:40,


示例11: value_to_list

/*============================================= * value_to_list -- Convert string to word list *  str:     [IN]  input string to split up *  list:    [OUT] list of strings in name *  plen:    [OUT] #entries in list *  dlm:     [IN]  delimiter upon which to split str *===========================================*/LISTvalue_to_list (STRING str, INT *plen, STRING dlm){	static STRING buf = NULL;	static INT len0 = 0;	STRING p, q, n;	INT len, c, i, j;	LIST list = create_list2(LISTDOFREE);	if (!str || *str == 0)		return list;	if ((len = strlen(str)) > len0 - 2) {		if (buf) stdfree(buf);		buf = (STRING) stdalloc(len0 = len + 80);	}	strcpy(buf, str);	buf[len + 1] = 0;	p = buf;	j = 1;	while ((c = *p++)) {		if (in_string(c, dlm)) {			*(p - 1) = 0;			j++;		}	}	p = buf;	for (i = 1;  i <= j;  i++) {		n = p + strlen(p) + 1;		while (chartype(c = *p++) == WHITE)			;		p--;		q = p + strlen(p) - 1;		while (q > p && chartype(*q) == WHITE)			*q-- = 0;		set_list_element(list, i, strsave(p), NULL);		p = n;	}	*plen = j;	return list;}
开发者ID:MarcNo,项目名称:lifelines,代码行数:47,


示例12: llrpt_addtoset

/*==================================+ * llrpt_addtoset -- Add person to INDISEQ * usage: addtoset(SET, INDI, ANY) -> VOID *=================================*/PVALUEllrpt_addtoset (PNODE node, SYMTAB stab, BOOLEAN *eflg){	NODE indi=0;	STRING key=0;	INDISEQ seq=0;	PNODE arg1 = builtin_args(node), arg2 = inext(arg1),	    arg3 = inext(arg2);	PVALUE val1 = eval_and_coerce(PSET, arg1, stab, eflg);	PVALUE val2=0;	if (*eflg) {		prog_var_error(node, stab, arg1, val1, nonsetx, "addtoset", "1");		return NULL;	}	ASSERT(seq = pvalue_to_seq(val1));	indi = eval_indi(arg2, stab, eflg, NULL);	if (*eflg) {		prog_var_error(node, stab, arg2, NULL, nonindx, "addtoset","2");		goto ats_exit;	}	if (!indi) goto ats_exit;	*eflg = TRUE;	if (!(key = strsave(rmvat(nxref(indi))))) {		prog_error(node, "major error in addtoset.");		goto ats_exit;	}	*eflg = FALSE;	val2 = evaluate(arg3, stab, eflg);	if (*eflg) {		prog_error(node, "3rd arg to addtoset is in error.");		goto ats_exit;	}	append_indiseq_pval(seq, key, NULL, val2, FALSE);ats_exit:	if (key) strfree(&key); /* append made its own copy */	/* delay to last minute val1 cleanup lest it is a temp owning seq,	    eg, addtoset(ancestorset(i),j) */	if (val1) delete_pvalue(val1);	return NULL;}
开发者ID:MarcNo,项目名称:lifelines,代码行数:44,


示例13: ReadRepsPass2

static int ReadRepsPass2(FILE *f, RepData *Reps)	{	rewind(f);	GFFLineNr = 0;	int RepCount = 0;	GFFRecord Rec;	while (GetNextGFFRecord(f, Rec))		{		if (0 != strcmp(Rec.Feature, "repeat"))			continue;		static char *Repeat = GetRepeat(Rec);		RepData &Rep = Reps[RepCount];		ParseRepeat(Repeat, Rep);		if (Rec.Start <= 0 || Rec.End <= 0 || Rec.Start > Rec.End)			Warning("GFF line %d: invalid start %d / end %d",			  GFFLineNr, Rec.Start, Rec.End);		const int Length = Rec.End - Rec.Start + 1;		Rep.ContigLabel = strsave(Rec.SeqName);		Rep.ContigFrom = Rec.Start - 1;		Rep.ContigTo = Rep.ContigFrom + Length - 1;		if (Rec.Strand == '+')			Rep.Rev = false;		else if (Rec.Strand == '-')			Rep.Rev = true;		else			Quit("GFF line %d, Invalid strand %c", GFFLineNr, Rec.Strand);		++RepCount;		}	return RepCount;	}
开发者ID:eernst,项目名称:piler-64,代码行数:38,


示例14: llrpt_inset

/*====================================+ * llrpt_inset -- See if person is in INDISEQ * usage: inset(SET, INDI) -> BOOL *==========================================*/PVALUEllrpt_inset (PNODE node, SYMTAB stab, BOOLEAN *eflg){	NODE indi;	STRING key=0;	INDISEQ seq;	BOOLEAN rel;	PNODE arg1 = builtin_args(node), arg2 = inext(arg1);	PVALUE val1 = eval_and_coerce(PSET, arg1, stab, eflg);	PVALUE valr=0;	if (*eflg ||!val1 || !(seq = pvalue_to_seq(val1))) {		*eflg = TRUE;		prog_var_error(node, stab, arg1, val1, nonsetx, "inset", "1");		goto inset_exit;	}	indi = eval_indi(arg2, stab, eflg, NULL);	if (*eflg) {		prog_var_error(node, stab, arg2, NULL, nonindx, "inset", "2");		goto inset_exit;	}	if (!indi) {		rel = FALSE;        } else { 		if (!(key = strsave(rmvat(nxref(indi))))) {			*eflg = TRUE;			prog_error(node, "major error in inset.");			goto inset_exit;		}		rel = in_indiseq(seq, key);	}	valr = create_pvalue_from_bool(rel);inset_exit:	/* delay delete of val1 to last minute lest it is a temp owning seq,	    eg, inset(ancestorset(i),j) */	if (val1) delete_pvalue(val1);	if (key) strfree(&key);	return valr;}
开发者ID:MarcNo,项目名称:lifelines,代码行数:42,


示例15: check_indi

/*===================================== * check_indi -- check indi record *  and record any records needing fixing *  in tofix list *===================================*/static BOOLEANcheck_indi (CNSTRING key, RECORD rec){    static char prevkey[MAXKEYWIDTH+1];    CACHEEL icel1=0;    RECORD recx=0;    if (eqstr(key, prevkey)) {        report_error(ERR_DUPINDI, _("Duplicate individual for %s"), key);    }    icel1 = indi_to_cacheel(rec);    lock_cache(icel1);    recx = get_record_for_cel(icel1);    ASSERT(todo.pass == 1);    process_indi(recx);    unlock_cache(icel1);    check_pointers(key, rec);    append_indiseq_null(seq_indis, strsave(key), NULL, TRUE, TRUE);    release_record(recx);    return TRUE;}
开发者ID:MarcNo,项目名称:lifelines,代码行数:28,


示例16: check_fam

/*===================================== * check_fam -- check family record *  and record any records needing fixing *  in tofix list *===================================*/static BOOLEANcheck_fam (CNSTRING key, RECORD rec){    static char prevkey[MAXKEYWIDTH+1]="";    CACHEEL fcel1=0;    RECORD recx=0;    if (eqstr(key, prevkey)) {        report_error(ERR_DUPFAM, _("Duplicate family for %s"), key);    }    fcel1 = fam_to_cacheel(rec);    lock_cache(fcel1);    recx = get_record_for_cel(fcel1);    ASSERT(todo.pass == 1);    process_fam(recx);    unlock_cache(fcel1);    check_pointers(key, rec);    append_indiseq_null(seq_fams, strsave(key), NULL, TRUE, TRUE);    return TRUE;}
开发者ID:MarcNo,项目名称:lifelines,代码行数:28,


示例17: put_sym

/* *	add symbol to symbol table symtab, or modify existing symbol * *	Input: sym_name pointer to string with symbol name *	       sym_val  value of symbol * *	Output: 0 symbol added/modified *		1 out of memory */int put_sym(char *sym_name, int sym_val){	struct sym *get_sym();	register int hashval;	register struct sym *np;	char *strsave(char *);	if (!gencode)		return(0);	if ((np = get_sym(sym_name)) == NULL) {		np = (struct sym *) malloc(sizeof (struct sym));		if (np == NULL)			return(1);		if ((np->sym_name = strsave(sym_name)) == NULL)			return(1);		hashval = hash(sym_name);		np->sym_next = symtab[hashval];		symtab[hashval] = np;	}	np->sym_val = sym_val;	return(0);}
开发者ID:cassini232,项目名称:Emulator,代码行数:32,


示例18: do_definition

void do_definition(int is_simple){  int t = get_token();  if (t != TEXT) {    lex_error("bad definition");    return;  }  token_buffer += '/0';  const char *name = token_buffer.contents();  definition *def = macro_table.lookup(name);  if (def == 0) {    def = new definition[1];    macro_table.define(name, def);  }  else if (def->is_macro) {    a_delete def->contents;  }  get_delimited_text();  token_buffer += '/0';  def->is_macro = 1;  def->contents = strsave(token_buffer.contents());  def->is_simple = is_simple;}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:23,


示例19: set_date_pic

/*============================= * set_date_pic -- Set a custom ymd date picture *  NULL or empty string will clear any existing custom pic * Created: 2001/12/30 (Perry Rapp) *===========================*/voidset_date_pic (STRING pic){	if (date_pic) {		stdfree(date_pic);		date_pic = 0;	}	if (pic && pic[0]) {		STRING p;		date_pic = strsave(pic);		/* convert %y %m %d format to %1 %2 %3 */		for (p = date_pic; *p; ++p) {			if (p[0]=='%') {				if (p[1]=='y')					p[1]='1';				else if (p[1]=='m')					p[1]='2';				else if (p[1]=='d')					p[1]='3';			}		}	}}
开发者ID:MarcNo,项目名称:lifelines,代码行数:28,


示例20: file_open_error

/*--------------------------------------------------------------- Routine : file_open_error Purpose : This routine is called if a file open error is detected.---------------------------------------------------------------*/static void file_open_error(fstruct *client_data, int called_from ){	char *error_message;	error_message = strsave( client_data->file_error_string );	error_message = 		strgrow( error_message, filename_from_pathname( client_data->filename ) );	client_data->file_dialog_title = 		strgrow( client_data->file_dialog_title, "Open " );	client_data->file_dialog_title = 		strgrow( client_data->file_dialog_title, client_data->title );	printf("FileDialogs: file_open_error/n");	if(called_from == FD_FTA) {		/* routine called from FTA code */		FTAFramePostError(error_message, client_data->file_dialog_title);	} else if(called_from == FD_PED) {		/* routine called from PED code */		PEDFramePostError(error_message, client_data->file_dialog_title);	}} /* file_open_error */
开发者ID:JoseEnrique04,项目名称:OpenFTA,代码行数:28,


示例21: interpolate_macro_with_args

void interpolate_macro_with_args(const char *body){  char *argv[9];  int argc = 0;  int i;  for (i = 0; i < 9; i++)    argv[i] = 0;  int level = 0;  int c;  do {    token_buffer.clear();    for (;;) {      c = get_char();      if (c == EOF) {	lex_error("end of input while scanning macro arguments");	break;      }      if (level == 0 && (c == ',' || c == ')')) {	if (token_buffer.length() > 0) {	  token_buffer +=  '/0';	  argv[argc] = strsave(token_buffer.contents());	}	// for `foo()', argc = 0	if (argc > 0 || c != ')' || i > 0)	  argc++;	break;      }      token_buffer += char(c);      if (c == '(')	level++;      else if (c == ')')	level--;    }  } while (c != ')' && c != EOF);  current_input = new argument_macro_input(body, argc, argv, current_input);}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:36,


示例22: advedit_expand_traverse

/*================================================================= * advedit_expand_traverse -- Traverse routine called when expanding record *===============================================================*/static BOOLEANadvedit_expand_traverse (NODE node, VPTR param){	LIST subs = (LIST)param;	STRING key = value_to_xref(nval(node));	if (!key) return TRUE;	key = strsave(key);#ifdef DEBUG	llwprintf("expand_traverse: %s %s/n", ntag(node), nval(node));#endif /* DEBUG */	FORLIST(subs, el)#ifdef DEBUG	llwprintf("expand_traverse: %s %s/n", key, rmvat(nval((NODE) el)));#endif /* DEBUG */		if (eqstr(key, rmvat(nval((NODE) el)))) {			STOPLIST			stdfree(key);			return TRUE;		}	ENDLIST	enqueue_list(subs, node);	stdfree(key);	return TRUE;}
开发者ID:MarcNo,项目名称:lifelines,代码行数:27,


示例23: read_list

/************************************************************************* *  R E A D   L I S T * *							Read a list of strings from a file.  Return the string list to the *							caller. *************************************************************************/LIST read_list(const char *filename) {  FILE *infile;  char s[CHARS_PER_LINE];  LIST list;  char *chopAt250();  if ((infile = open_file (filename, "r")) == NULL)    return (NIL_LIST);  list = NIL_LIST;  while (fgets (s, CHARS_PER_LINE, infile) != NULL) {    s[CHARS_PER_LINE - 1] = '/0';    if (strlen (s) > 0) {      if (s[strlen (s) - 1] == '/n')        s[strlen (s) - 1] = '/0';      if (strlen (s) > 0) {        list = push (list, (LIST) strsave (s));      }    }  }  fclose(infile);  return (reverse_d (list));}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:30,


示例24: yylex

yylex(){	int k;	STRING strsave();	STRING getstring(),getword();	float getnum();	while(iswhite(c=lexgetc()));	if ( (isalpha(c)||c=='@') && c!=EOF ) { s = getword(c);				      if ((k=keyfind(s))!=NKEYWORDS && cconst)				       {  yylval.strg = keywords[k].keyname;					  cconst=false;					  return(keywords[k].keyret);  }				      yylval.strg = s;				      return(WORD); }	if ( isdigit(c)||c=='~' ){ yylval.numb=(float)getnum(c);				   return(NUMB);}	if ( c=='`') { c = lexgetc();			yylval.strg=getstring(c);			return(STRING_QUOTED); }	if ( c == '[' ) cconst=true;	return(c);}
开发者ID:mpw,项目名称:pLucid-osx,代码行数:24,


示例25: main

int main(int argc, char **argv){  setlocale(LC_NUMERIC, "C");  program_name = argv[0];  string env;  static char stderr_buf[BUFSIZ];  setbuf(stderr, stderr_buf);  int c;  static const struct option long_options[] = {    { "help", no_argument, 0, CHAR_MAX + 1 },    { "version", no_argument, 0, 'v' },    { NULL, 0, 0, 0 }  };  while ((c = getopt_long(argc, argv, "b:c:F:gI:lmp:P:vw:", long_options, NULL))	 != EOF)    switch(c) {    case 'b':      // XXX check this      broken_flags = atoi(optarg);      bflag = 1;      break;    case 'c':      if (sscanf(optarg, "%d", &ncopies) != 1 || ncopies <= 0) {	error("bad number of copies `%s'", optarg);	ncopies = 1;      }      break;    case 'F':      font::command_line_font_dir(optarg);      break;    case 'g':      guess_flag = 1;      break;    case 'I':      include_search_path.command_line_dir(optarg);      break;    case 'l':      landscape_flag = 1;      break;    case 'm':      manual_feed_flag = 1;      break;    case 'p':      if (!font::scan_papersize(optarg, 0,				&user_paper_length, &user_paper_width))	error("invalid custom paper size `%1' ignored", optarg);      break;    case 'P':      env = "GROPS_PROLOGUE";      env += '=';      env += optarg;      env += '/0';      if (putenv(strsave(env.contents())))	fatal("putenv failed");      break;    case 'v':      printf("GNU grops (groff) version %s/n", Version_string);      exit(0);      break;    case 'w':      if (sscanf(optarg, "%d", &linewidth) != 1 || linewidth < 0) {	error("bad linewidth `%1'", optarg);	linewidth = -1;      }      break;    case CHAR_MAX + 1: // --help      usage(stdout);      exit(0);      break;    case '?':      usage(stderr);      exit(1);      break;    default:      assert(0);    }  font::set_unknown_desc_command_handler(handle_unknown_desc_command);  SET_BINARY(fileno(stdout));  if (optind >= argc)    do_file("-");  else {    for (int i = optind; i < argc; i++)      do_file(argv[i]);  }  return 0;}
开发者ID:DemonFang,项目名称:groff,代码行数:86,


示例26: do_picture

void do_picture(FILE *fp){  flyback_flag = 0;  int c;  a_delete graphname;  graphname = strsave("graph");		// default picture name in TeX mode  while ((c = getc(fp)) == ' ')    ;  if (c == '<') {    string filename;    while ((c = getc(fp)) == ' ')      ;    while (c != EOF && c != ' ' && c != '/n') {      filename += char(c);      c = getc(fp);    }    if (c == ' ') {      do {	c = getc(fp);      } while (c != EOF && c != '/n');    }    if (c == '/n')       current_lineno++;    if (filename.length() == 0)      error("missing filename after `<'");    else {      filename += '/0';      const char *old_filename = current_filename;      int old_lineno = current_lineno;      // filenames must be permanent      do_file(strsave(filename.contents()));      current_filename = old_filename;      current_lineno = old_lineno;    }    out->set_location(current_filename, current_lineno);  }  else {    out->set_location(current_filename, current_lineno);    string start_line;    while (c != EOF) {      if (c == '/n') {	current_lineno++;	break;      }      start_line += c;      c = getc(fp);    }    if (c == EOF)      return;    start_line += '/0';    double wid, ht;    switch (sscanf(&start_line[0], "%lf %lf", &wid, &ht)) {    case 1:      ht = 0.0;      break;    case 2:      break;    default:      ht = wid = 0.0;      break;    }    out->set_desired_width_height(wid, ht);    out->set_args(start_line.contents());    lex_init(new top_input(fp));    if (yyparse()) {      had_parse_error = 1;      lex_error("giving up on this picture");    }    parse_cleanup();    lex_cleanup();    // skip the rest of the .PF/.PE line    while ((c = getc(fp)) != EOF && c != '/n')      ;    if (c == '/n')      current_lineno++;    out->set_location(current_filename, current_lineno);  }}
开发者ID:0xffffffRabbit,项目名称:NextBSD-1,代码行数:79,



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


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