这篇教程C++ AGALOC函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AGALOC函数的典型用法代码示例。如果您正苦于以下问题:C++ AGALOC函数的具体用法?C++ AGALOC怎么用?C++ AGALOC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AGALOC函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: add_number/** * Associate a name with strtol() value, defaulting to zero. * * @param[in,out] pp argument list to add to * @param[in] name the name of the "suboption" * @param[in] nm_len the length of the name * @param[in] val the numeric value for the suboption * @param[in] d_len the length of the value * * @returns the new value structure */static tOptionValue *add_number(void ** pp, char const * name, size_t nm_len, char const * val, size_t d_len){ size_t sz = nm_len + sizeof(tOptionValue) + 1; tOptionValue * new_val = AGALOC(sz, "int val"); /* * Scan over whitespace is constrained by "d_len" */ while (IS_WHITESPACE_CHAR(*val) && (d_len > 0)) { d_len--; val++; } if (d_len == 0) new_val->v.longVal = 0; else new_val->v.longVal = strtol(val, 0, 0); new_val->valType = OPARG_TYPE_NUMERIC; new_val->pzName = (char *)(new_val + 1); memcpy(new_val->pzName, name, nm_len); new_val->pzName[ nm_len ] = NUL; addArgListEntry(pp, new_val); return new_val;}
开发者ID:gokzy,项目名称:netbsd-src,代码行数:36,
示例2: manageAllocatedDatavoidmanageAllocatedData(void* pd){ static int allocPtrCt = 0; static int usedPtrCt = 0; static void** papAllocData = NULL; if (pd == NULL) { void** pp = papAllocData; if (pp == NULL) return; while (--usedPtrCt >= 0) AGFREE(*(pp++)); AGFREE(papAllocData); papAllocData = NULL; } else { if (++usedPtrCt > allocPtrCt) { allocPtrCt += 16; papAllocData = (usedPtrCt > 1) ? AGREALOC(papAllocData, allocPtrCt * sizeof(void*), "atbl") : AGALOC(allocPtrCt * sizeof(void*), "atbl"); } papAllocData[usedPtrCt-1] = pd; }}
开发者ID:pexip,项目名称:os-autogen,代码行数:28,
示例3: trim_xml_text/** * Find the end marker for the named section of XML. * Trim that text there, trimming trailing white space for all modes * except for OPTION_LOAD_UNCOOKED. */static char *trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode){ static char const fmt[] = "</%s>"; size_t len = strlen(pznm) + sizeof(fmt) - 2 /* for %s */; char * etext; { char z[64], *pz = z; if (len >= sizeof(z)) pz = AGALOC(len, "scan name"); len = (size_t)sprintf(pz, fmt, pznm); *intxt = ' '; etext = strstr(intxt, pz); if (pz != z) AGFREE(pz); } if (etext == NULL) return etext; { char * result = etext + len; if (mode != OPTION_LOAD_UNCOOKED) etext = SPN_WHITESPACE_BACK(intxt, etext); *etext = NUL; return result; }}
开发者ID:Distrotech,项目名称:sharutils,代码行数:36,
示例4: optionTimeDate/*=export_func optionTimeDate * private: * * what: process an option with a time and date. * arg: + tOptions* + pOpts + program options descriptor + * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + * * doc: * Decipher a time and date value.=*/voidoptionTimeDate(tOptions * pOpts, tOptDesc * pOD){#if defined(HAVE_GETDATE_R) && defined(HAVE_PUTENV) if ((! HAS_pzPkgDataDir(pOpts)) || (pOpts->pzPkgDataDir == NULL)) goto default_action; /* * Export the DATEMSK environment variable. getdate_r() uses it to * find the file with the strptime formats. If we cannot find the file * we need ($PKGDATADIR/datemsk), then fall back to just a time duration. */ { static char * envptr = NULL; if (envptr == NULL) { static char const fmt[] = "DATEMSK=%s/datemsk"; envptr = AGALOC(sizeof(fmt) + strlen(pOpts->pzPkgDataDir), fmt); sprintf(envptr, fmt, pOpts->pzPkgDataDir); putenv(envptr); } if (access(envptr+8, R_OK) != 0) goto default_action; } /* * Convert the date to a time since the epoch and stash it in a long int. */ { struct tm stm; time_t tm; if (getdate_r(pOD->optArg.argString, &stm) != 0) { fprintf(stderr, zNotDate, pOpts->pzProgName, pOD->optArg.argString); if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); return; } tm = mktime(&stm); if (pOD->fOptState & OPTST_ALLOC_ARG) { AGFREE(pOD->optArg.argString); pOD->fOptState &= ~OPTST_ALLOC_ARG; } pOD->optArg.argInt = tm; } return;default_action:#endif optionTimeVal(pOpts, pOD); if (pOD->optArg.argInt != BAD_TIME) pOD->optArg.argInt += (unsigned long)time(NULL);}
开发者ID:cooljeanius,项目名称:apple-gdb-1824,代码行数:70,
示例5: Select_Match_Full/*=gfunc string_eqv_match_p * * what: caseless regex match * general_use: * * exparg: text, text to test for pattern * exparg: match, pattern/substring to search for * * string: "~" * * doc: Test to see if a string fully matches a pattern. * Case is not significant, but any character equivalences * must be expressed in your regular expression.=*/static tSuccessSelect_Match_Full(char const * sample, char const * pattern){ regmatch_t m[2]; /* * On the first call for this macro, compile the expression */ if (pCurMacro->funcPrivate == NULL) { void * mat = (void *)pattern; regex_t* pRe = AGALOC(sizeof(*pRe), "select match full re"); if (OPT_VALUE_TRACE > TRACE_EXPRESSIONS) { fprintf(pfTrace, "Compiling ``%s'' with bits 0x%lX/n", pattern, pCurMacro->res); } compile_re(pRe, mat, (int)pCurMacro->res); pCurMacro->funcPrivate = pRe; } if (regexec((regex_t*)pCurMacro->funcPrivate, sample, (size_t)2, m, 0) != 0) return FAILURE; if ( (m[0].rm_eo != strlen( sample )) || (m[0].rm_so != 0)) return FAILURE; return SUCCESS;}
开发者ID:pexip,项目名称:os-autogen,代码行数:43,
示例6: make_quote_str/** * make a name resilient to machinations made by 'make'. * Basically, dollar sign characters are doubled. * * @param str the input string * @returns a newly allocated string with the '$' characters doubled */static char const *make_quote_str(char const * str){ size_t sz = strlen(str) + 1; char const * scan = str; char * res; for (;;) { char * p = strchr(scan, '$'); if (p == NULL) break; sz++; scan = scan + 1; } res = AGALOC(sz, "q name"); scan = res; for (;;) { char * p = strchr(str, '$'); if (p == NULL) break; sz = (size_t)(p - str) + 1; memcpy(res, str, sz); res += sz; str += sz; *(res++) = '$'; } strcpy(res, str); return scan;}
开发者ID:Distrotech,项目名称:autogen,代码行数:40,
示例7: open_tmp_usagestatic FILE *open_tmp_usage(char ** buf){ char * bf; size_t bfsz; { unsigned int my_pid = (unsigned int)getpid(); char const * tmpdir = getenv(TMPDIR); if (tmpdir == NULL) tmpdir = tmp_dir; bfsz = TMP_FILE_FMT_LEN + strlen(tmpdir) + 10; bf = AGALOC(bfsz, "tmp fil"); snprintf(bf, bfsz, TMP_FILE_FMT, tmpdir, my_pid); } { static mode_t const cmask = S_IRWXO | S_IRWXG; mode_t svmsk = umask(cmask); int fd = mkstemp(bf); (void)umask(svmsk); if (fd < 0) { AGFREE(bf); return NULL; } *buf = bf; return fdopen(fd, "w"); }}
开发者ID:enukane,项目名称:netbsd-src,代码行数:30,
示例8: mk_pager_cmdstatic char *mk_pager_cmd(char const * fname){ /* * Page the file and remove it when done. For shell script processing, * we must redirect the output to the current stderr, otherwise stdout. */ fclose(option_usage_fp); option_usage_fp = NULL; { char const * pager = (char const *)getenv(PAGER_NAME); size_t bfsz; char * res; /* * Use the "more(1)" program if "PAGER" has not been defined */ if (pager == NULL) pager = MORE_STR; bfsz = strlen(fname) + strlen(pager) + PAGE_USAGE_FMT_LEN; res = AGALOC(bfsz, "more cmd"); snprintf(res, bfsz, PAGE_USAGE_FMT, pager, fname); AGFREE((void*)(intptr_t)fname); return res; }}
开发者ID:enukane,项目名称:netbsd-src,代码行数:28,
示例9: add_bool/** * Associate a name with a boolean value * * @param[in,out] pp argument list to add to * @param[in] name the name of the "suboption" * @param[in] nm_len the length of the name * @param[in] val the boolean value for the suboption * @param[in] d_len the length of the value * * @returns the new value structure */static tOptionValue *add_bool(void ** pp, char const * name, size_t nm_len, char const * val, size_t d_len){ size_t sz = nm_len + sizeof(tOptionValue) + 1; tOptionValue * new_val = AGALOC(sz, "bool val"); /* * Scan over whitespace is constrained by "d_len" */ while (IS_WHITESPACE_CHAR(*val) && (d_len > 0)) { d_len--; val++; } if (d_len == 0) new_val->v.boolVal = 0; else if (IS_DEC_DIGIT_CHAR(*val)) new_val->v.boolVal = (unsigned)atoi(val); else new_val->v.boolVal = ! IS_FALSE_TYPE_CHAR(*val); new_val->valType = OPARG_TYPE_BOOLEAN; new_val->pzName = (char *)(new_val + 1); memcpy(new_val->pzName, name, nm_len); new_val->pzName[ nm_len ] = NUL; addArgListEntry(pp, new_val); return new_val;}
开发者ID:gokzy,项目名称:netbsd-src,代码行数:40,
示例10: shell_stringifystatic SCMshell_stringify(SCM obj, uint_t qt){ char * pzNew; size_t dtaSize = 3; char * pzDta = ag_scm2zchars(obj, "AG Object"); char * pz = pzDta; for (;;) { char c = *(pz++); switch (c) { case NUL: goto loopDone1; case '"': case '`': case '//': dtaSize += 2; break; default: dtaSize++; } } loopDone1:; pzNew = AGALOC(dtaSize, "shell string"); dtaSize = stringify_for_sh(pzNew, qt, pzDta); { SCM res = AG_SCM_STR2SCM(pzNew, dtaSize); AGFREE(pzNew); return res; }}
开发者ID:Distrotech,项目名称:autogen,代码行数:33,
示例11: prt_set_arg/** * Print the bits set in a bit mask option. * We call the option handling function with a magic value for * the options pointer and it allocates and fills in the string. * We print that with a call to prt_entry(). * * @param[in] fp the file pointer to write to * @param[in] od the option descriptor with a bit mask value type */static voidprt_set_arg(FILE * fp, tOptDesc * od){ char * list = optionMemberList(od); size_t len = strlen(list); char * buf = (char *)AGALOC(len + 3, "dir name"); *buf= '='; memcpy(buf+1, list, len + 1); prt_entry(fp, od, buf); AGFREE(buf); AGFREE(list);}
开发者ID:cernekee,项目名称:ocserv,代码行数:21,
示例12: check_existence/** * Make sure the directory containing the subject file exists and that * the file exists or does not exist, per the option requirements. * * @param ftype file existence type flags * @param pOpts program option descriptor * @param pOD the option descriptor */static voidcheck_existence(teOptFileType ftype, tOptions * pOpts, tOptDesc * pOD){ char const * fname = pOD->optArg.argString; struct stat sb; errno = 0; switch (ftype & FTYPE_MODE_EXIST_MASK) { case FTYPE_MODE_MUST_NOT_EXIST: if ((stat(fname, &sb) == 0) || (errno != ENOENT)) { if (errno == 0) errno = EINVAL; fserr_exit(pOpts->pzProgName, "stat", fname); /* NOTREACHED */ } /* FALLTHROUGH */ default: case FTYPE_MODE_MAY_EXIST: { char * p = strrchr(fname, DIRCH); size_t l; if (p == NULL) /* * The file may or may not exist and its directory is ".". * Assume that "." exists. */ break; l = (size_t)(p - fname); p = AGALOC(l + 1, "fname"); memcpy(p, fname, l); p[l] = NUL; if ((stat(p, &sb) != 0) || (errno = EINVAL, ! S_ISDIR(sb.st_mode))) fserr_exit(pOpts->pzProgName, "stat", p); /* NOTREACHED */ AGFREE(p); break; } case FTYPE_MODE_MUST_EXIST: if ( (stat(fname, &sb) != 0) || (errno = EINVAL, ! S_ISREG(sb.st_mode)) ) fserr_exit(pOpts->pzProgName, "stat", fname); /* NOTREACHED */ break; }}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:61,
示例13: strdupstatic char *strdup( char const *s ){ char *cp; if (s == NULL) return NULL; cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup"); if (cp != NULL) (void) strcpy(cp, s); return cp;}
开发者ID:2asoft,项目名称:freebsd,代码行数:15,
示例14: load_old_output/** * Load the previous shell script output file. We need to preserve any * hand-edited additions outside of the START_MARK and END_MARKs. * * @param[in] fname the output file name */static char *load_old_output(char const * fname){ /* * IF we cannot stat the file, * THEN assume we are creating a new file. * Skip the loading of the old data. */ FILE * fp = fopen(fname, "r" FOPEN_BINARY_FLAG); struct stat stbf; char * text; char * scan; if (fp == NULL) return NULL; /* * If we opened it, we should be able to stat it and it needs * to be a regular file */ if ((fstat(fileno(fp), &stbf) != 0) || (! S_ISREG(stbf.st_mode))) { fprintf(stderr, zNotFile, fname); exit(EXIT_FAILURE); } scan = text = AGALOC(stbf.st_size + 1, "f data"); /* * Read in all the data as fast as our OS will let us. */ for (;;) { int inct = fread((void*)scan, (size_t)1, stbf.st_size, fp); if (inct == 0) break; stbf.st_size -= inct; if (stbf.st_size == 0) break; scan += inct; } *scan = NUL; fclose(fp); return text;}
开发者ID:1and1get2,项目名称:tcpreplay,代码行数:54,
示例15: set_memb_namesstatic voidset_memb_names(tOptions * opts, tOptDesc * od, char const * const * nm_list, unsigned int nm_ct){ char * pz; uintptr_t mask = (1UL << (uintptr_t)nm_ct) - 1UL; uintptr_t bits = (uintptr_t)od->optCookie & mask; unsigned int ix = 0; size_t len = 1; /* * Replace the enumeration value with the name string. * First, determine the needed length, then allocate and fill in. */ while (bits != 0) { if (bits & 1) len += strlen(nm_list[ix]) + PLUS_STR_LEN + 1; if (++ix >= nm_ct) break; bits >>= 1; } od->optArg.argString = pz = AGALOC(len, "enum"); bits = (uintptr_t)od->optCookie & mask; if (bits == 0) { *pz = NUL; return; } for (ix = 0; ; ix++) { size_t nln; int doit = bits & 1; bits >>= 1; if (doit == 0) continue; nln = strlen(nm_list[ix]); memcpy(pz, nm_list[ix], nln); pz += nln; if (bits == 0) break; memcpy(pz, PLUS_STR, PLUS_STR_LEN); pz += PLUS_STR_LEN; } *pz = NUL; (void)opts;}
开发者ID:cemeyer,项目名称:freebsd-base-graphics,代码行数:47,
示例16: optionSaveState/*=export_func optionSaveState * * what: saves the option state to memory * arg: tOptions*, pOpts, program options descriptor * * doc: * * This routine will allocate enough memory to save the current option * processing state. If this routine has been called before, that memory * will be reused. You may only save one copy of the option state. This * routine may be called before optionProcess(3AO). If you do call it * before the first call to optionProcess, then you may also change the * contents of argc/argv after you call optionRestore(3AO) * * In fact, more strongly put: it is safest to only use this function * before having processed any options. In particular, the saving and * restoring of stacked string arguments and hierarchical values is * disabled. The values are not saved. * * err: If it fails to allocate the memory, * it will print a message to stderr and exit. * Otherwise, it will always succeed.=*/voidoptionSaveState(tOptions * pOpts){ tOptions * p = (tOptions*)pOpts->pSavedState; if (p == NULL) { size_t sz = sizeof(*pOpts) + ((size_t)pOpts->optCt * sizeof(tOptDesc)); p = AGALOC(sz, "saved option state"); pOpts->pSavedState = p; } memcpy(p, pOpts, sizeof(*p)); memcpy(p + 1, pOpts->pOptDesc, (size_t)p->optCt * sizeof(tOptDesc)); fixupSavedOptionArgs(pOpts);}
开发者ID:cernekee,项目名称:ocserv,代码行数:41,
示例17: Select_Match/*=gfunc string_has_eqv_match_p * * what: caseless regex contains * general_use: * * exparg: text, text to test for pattern * exparg: match, pattern/substring to search for * * string: "*~*" * * doc: Test to see if a string contains a pattern. * Case is not significant.=*/static tSuccessSelect_Match(char const * sample, char const * pattern){ /* * On the first call for this macro, compile the expression */ if (pCurMacro->funcPrivate == NULL) { void * mat = (void *)pattern; regex_t* pRe = AGALOC(sizeof(*pRe), "select match re"); compile_re(pRe, mat, (int)pCurMacro->res); pCurMacro->funcPrivate = (void*)pRe; } if (regexec((regex_t*)pCurMacro->funcPrivate, sample, (size_t)0, NULL, 0) != 0) return FAILURE; return SUCCESS;}
开发者ID:pexip,项目名称:os-autogen,代码行数:31,
示例18: getEntryLOCAL tDefEntry*getEntry(void){ tDefEntry* pRes = pFreeEntryList; if (pRes != NULL) { pFreeEntryList = pRes->pNext; } else { int ct = ENTRY_ALLOC_CT-1; void* p = AGALOC(ENTRY_ALLOC_SIZE, "definition headers"); manageAllocatedData(p); *((void**)p) = pAllocList; pAllocList = p; pRes = pFreeEntryList = (tDefEntry*)((void**)p + 1); /* * This is a post-loop test loop. It will cycle one fewer times * than there are 'tDefEntry' structs in the memory we just alloced. */ do { tDefEntry* pNxt = pRes+1; pRes->pNext = pNxt; /* * When the loop ends, "pRes" will point to the last allocated * structure instance. That is the one we will return. */ pRes = pNxt; } while (--ct > 0); /* * Unlink the last entry from the chain. The next time this * routine is called, the *FIRST* structure in this list will * be returned. */ pRes[-1].pNext = NULL; } memset((void*)pRes, 0, sizeof(*pRes)); return pRes;}
开发者ID:pexip,项目名称:os-autogen,代码行数:44,
示例19: digest_pseudo_macro/** * Process the stuff in the pseudo macro. */static tTemplate *digest_pseudo_macro(tmap_info_t * minfo, char * real_file){ tTemplate * pRes; /* * Count the number of macros in the template. Compute * the output data size as a function of the number of macros * and the size of the template data. These may get reduced * by comments. */ char const * pzData = loadPseudoMacro((char const *)minfo->txt_data, real_file); size_t macroCt = cnt_macros(pzData); size_t alocSize = (sizeof(*pRes) + (macroCt * sizeof(tMacro)) + minfo->txt_size - (pzData - (char const *)minfo->txt_data) + strlen(real_file) + 0x10) & ~0x0F; pRes = (tTemplate*)AGALOC(alocSize, "main template"); memset((void*)pRes, 0, alocSize); /* * Initialize the values: */ pRes->magic = magicMark; pRes->descSize = alocSize; pRes->macroCt = macroCt; strcpy(pRes->zStartMac, zStartMac); /* must fit */ strcpy(pRes->zEndMac, zEndMac); /* must fit */ load_macs(pRes, real_file, "*template file*", pzData); pRes->pzTplName -= (long)pRes; pRes->pzTemplText -= (long)pRes; pRes = (tTemplate*)AGREALOC((void*)pRes, pRes->descSize, "resize template"); pRes->pzTplName += (long)pRes; pRes->pzTemplText += (long)pRes; return pRes;}
开发者ID:pexip,项目名称:os-autogen,代码行数:46,
示例20: addArgListEntry/* * Put an entry into an argument list. The first argument points to * a pointer to the argument list structure. It gets passed around * as an opaque address. */LOCAL voidaddArgListEntry(void ** ppAL, void * entry){ tArgList* pAL = *(void**)ppAL; /* * IF we have never allocated one of these, * THEN allocate one now */ if (pAL == NULL) { pAL = (tArgList*)AGALOC(sizeof(*pAL), "new option arg stack"); if (pAL == NULL) return; pAL->useCt = 0; pAL->allocCt = MIN_ARG_ALLOC_CT; *ppAL = (void*)pAL; } /* * ELSE if we are out of room * THEN make it bigger */ else if (pAL->useCt >= pAL->allocCt) { size_t sz = sizeof(*pAL); pAL->allocCt += INCR_ARG_ALLOC_CT; /* * The base structure contains space for MIN_ARG_ALLOC_CT * pointers. We subtract it off to find our augment size. */ sz += sizeof(char*) * ((size_t)pAL->allocCt - MIN_ARG_ALLOC_CT); pAL = (tArgList*)AGREALOC((void*)pAL, sz, "expanded opt arg stack"); if (pAL == NULL) return; *ppAL = (void*)pAL; } /* * Insert the new argument into the list */ pAL->apzArgs[ (pAL->useCt)++ ] = entry;}
开发者ID:execunix,项目名称:vinos,代码行数:47,
示例21: add_string/** * Associate a name with either a string or no value. * * @param[in,out] pp argument list to add to * @param[in] name the name of the "suboption" * @param[in] nm_len the length of the name * @param[in] val the string value for the suboption * @param[in] d_len the length of the value * * @returns the new value structure */static tOptionValue *add_string(void ** pp, char const * name, size_t nm_len, char const * val, size_t d_len){ tOptionValue * pNV; size_t sz = nm_len + d_len + sizeof(*pNV); pNV = AGALOC(sz, "option name/str value pair"); if (val == NULL) { pNV->valType = OPARG_TYPE_NONE; pNV->pzName = pNV->v.strVal; } else { pNV->valType = OPARG_TYPE_STRING; if (d_len > 0) { char const * src = val; char * pzDst = pNV->v.strVal; int ct = (int)d_len; do { int ch = *(src++) & 0xFF; if (ch == NUL) goto data_copy_done; if (ch == '&') ch = get_special_char(&src, &ct); *(pzDst++) = (char)ch; } while (--ct > 0); data_copy_done: *pzDst = NUL; } else { pNV->v.strVal[0] = NUL; } pNV->pzName = pNV->v.strVal + d_len + 1; } memcpy(pNV->pzName, name, nm_len); pNV->pzName[ nm_len ] = NUL; addArgListEntry(pp, pNV); return pNV;}
开发者ID:gokzy,项目名称:netbsd-src,代码行数:52,
示例22: Select_Match_End/*=gfunc string_end_eqv_match_p * * what: caseless regex ending * general_use: * * exparg: text, text to test for pattern * exparg: match, pattern/substring to search for * * string: "*~" * * doc: Test to see if a string ends with a pattern. * Case is not significant.=*/static tSuccessSelect_Match_End(char const * sample, char const * pattern){ regmatch_t m[2]; /* * On the first call for this macro, compile the expression */ if (pCurMacro->funcPrivate == NULL) { void * mat = (void *)pattern; regex_t* pRe = AGALOC(sizeof(*pRe), "select match end re"); compile_re(pRe, mat, (int)pCurMacro->res); pCurMacro->funcPrivate = (void*)pRe; } if (regexec((regex_t*)pCurMacro->funcPrivate, sample, (size_t)2, m, 0) != 0) return FAILURE; if (m[0].rm_eo != strlen(sample)) return FAILURE; return SUCCESS;}
开发者ID:pexip,项目名称:os-autogen,代码行数:34,
示例23: aoflags_directive/** * handle AutoOpts mode flags */static char *aoflags_directive(tOptions * pOpts, char * pzText){ char * pz = pzText; while (IS_WHITESPACE_CHAR(*++pz)) ; pzText = strchr(pz, '>'); if (pzText != NULL) { size_t len = pzText - pz; char * ftxt = AGALOC(len + 1, "aoflags"); memcpy(ftxt, pz, len); ftxt[len] = NUL; set_usage_flags(pOpts, ftxt); AGFREE(ftxt); pzText++; } return pzText;}
开发者ID:pexip,项目名称:os-ntp,代码行数:25,
示例24: aoflags_directive/** * handle AutoOpts mode flags. * * @param[in,out] opts program option descriptor * @param[in] txt scanning pointer * @returns the next character to look at */static char *aoflags_directive(tOptions * opts, char * txt){ char * pz; pz = SPN_WHITESPACE_CHARS(txt+1); txt = strchr(pz, '>'); if (txt != NULL) { size_t len = (unsigned)(txt - pz); char * ftxt = AGALOC(len + 1, "aoflags"); memcpy(ftxt, pz, len); ftxt[len] = NUL; set_usage_flags(opts, ftxt); AGFREE(ftxt); txt++; } return txt;}
开发者ID:Distrotech,项目名称:sharutils,代码行数:29,
示例25: program_directive/** * handle program segmentation of config file. * * @param[in,out] opts program option descriptor * @param[in] txt scanning pointer * @returns the next character to look at */static char *program_directive(tOptions * opts, char * txt){ static char const ttlfmt[] = "<?"; size_t ttl_len = sizeof(ttlfmt) + strlen(zCfgProg); char * ttl = AGALOC(ttl_len, "prog title"); size_t name_len = strlen(opts->pzProgName); memcpy(ttl, ttlfmt, sizeof(ttlfmt) - 1); memcpy(ttl + sizeof(ttlfmt) - 1, zCfgProg, ttl_len - (sizeof(ttlfmt) - 1)); do { txt = SPN_WHITESPACE_CHARS(txt+1); if ( (strneqvcmp(txt, opts->pzProgName, (int)name_len) == 0) && (IS_END_XML_TOKEN_CHAR(txt[name_len])) ) { txt += name_len; break; } txt = strstr(txt, ttl); } while (txt != NULL); AGFREE(ttl); if (txt != NULL) for (;;) { if (*txt == NUL) { txt = NULL; break; } if (*(txt++) == '>') break; } return txt;}
开发者ID:Distrotech,项目名称:sharutils,代码行数:43,
注:本文中的AGALOC函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AGESA_TESTPOINT函数代码示例 C++ AF_THROW函数代码示例 |