当前位置: 首页>>代码示例>>C++>>正文


C++ skipspace函数代码示例

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


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

示例1:

char *cValidityRange::Parse3(char *s)
{
  bool log=true;
  s=skipspace(s);
  char *e=index(s,'}');
  if(e && *s++=='{') {
    *e=0; e=skipspace(e+1);
    char *p;
    if((p=index(s,':'))) {
      *p=0;
      if(ParseCaidRange(s)) {
        s=p+1;
        if((p=index(s,':'))) {
          *p=0;
          if(s==p || ParseSourceRange(s)) {
            s=p+1;
            if(!*s || ParseFreqRange(s)) return e;
            }
          log=false;
          }
        }
      else log=false;
      }
    }
  if(log) PRINTF(L_CORE_LOAD,"override: RANGE format error");
  return 0;
}
开发者ID:3PO,项目名称:vdr-plugin-sc,代码行数:27,代码来源:override.c

示例2: debug16

size_t cSatipRtsp::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP)
{
  cSatipRtsp *obj = reinterpret_cast<cSatipRtsp *>(dataP);
  size_t len = sizeP * nmembP;
  debug16("%s len=%zu", __PRETTY_FUNCTION__, len);

  char *s, *p = (char *)ptrP;
  char *r = strtok_r(p, "\r\n", &s);

  while (obj && r) {
        debug16("%s (%zu): %s", __PRETTY_FUNCTION__, len, r);
        r = skipspace(r);
        if (strstr(r, "com.ses.streamID")) {
           int streamid = -1;
           if (sscanf(r, "com.ses.streamID:%11d", &streamid) == 1)
              obj->tunerM.SetStreamId(streamid);
           }
        else if (strstr(r, "Session:")) {
           int timeout = -1;
           char *session = NULL;
           if (sscanf(r, "Session:%m[^;];timeout=%11d", &session, &timeout) == 2)
              obj->tunerM.SetSessionTimeout(skipspace(session), timeout * 1000);
           else if (sscanf(r, "Session:%m[^;]", &session) == 1)
              obj->tunerM.SetSessionTimeout(skipspace(session), -1);
           FREE_POINTER(session);
           }
        r = strtok_r(NULL, "\r\n", &s);
        }

  return len;
}
开发者ID:nafets227,项目名称:vdr-plugin-satip,代码行数:31,代码来源:rtsp.c

示例3: getAddress

static Bit16 getAddress(Bool *hasSecond ){
  /* Read the hex address from stdin */
  int c;
  int max = 5;
  char buf[] = {'\0','\0','\0','\0','\0'};
  unsigned int n = 0;

  skipspace();
  while((c = getchar()) != EOF && n < max){
    if (c == '\n' || c == ',' || c == ' ') {
      if (c == ' '){
	skipspace();
	c = getchar();
      }
      *hasSecond = (c == ',');	
      break;
    }
    if (ishexdigit(c)){
      buf[n++] = c;
    }
    else {
      fprintf(stderr,"Invalid character only hex address are allowed.\n");
      return 0;
    }
  }
  if (n == max){
    fprintf(stderr,"The memory address is to large. The maximum memory address is $FFFF\n");
    return 0;
  }
  return strtol(buf,NULL,16);
}
开发者ID:jeng,项目名称:asm6502,代码行数:31,代码来源:debug6502.c

示例4: processfile

int processfile(FILE *srcfile, int start, int flags) {
    char srctemp[80];
    char *srcline;
    int thispass;

    for(thispass=0; thispass<=1; thispass++) {
        asmpass=flags+(thispass<<1);
        rewind(srcfile);
        destadr=start;
        lineno=1;
        while(fgets(srctemp, 80, srcfile) != NULL) {
            srcline=srctemp;
            skipspace(srcline);
            if(*srcline=='.') {
                srcline=checklabel(srcline+1, codeorig+destadr);
                skipspace(srcline);
            }
            if(*srcline=='#')
                asmdirect(srcline);
            else if(*srcline!='/')
                assemble(srcline);
            lineno++;
        }
    }
    return(destadr);
}
开发者ID:ncc25,项目名称:crossasm,代码行数:26,代码来源:crossasm.c

示例5: if

bool cSmartCardDataVideoGuard2::Parse(const char *line)
{
  line=skipspace(line);
  if(!strncasecmp(line,"BOXID",5))     { type=dtBoxId; line+=5; }
  else if(!strncasecmp(line,"SEED",4)) { type=dtSeed; line+=4; }
  else {
    PRINTF(L_CORE_LOAD,"smartcarddatavideoguard2: format error: datatype");
    return false;
    }
  line=skipspace(line);
  switch(type) {
    case dtBoxId:
      if(GetHex(line,boxid,sizeof(boxid))!=sizeof(boxid)) {
        PRINTF(L_CORE_LOAD,"smartcarddatavideoguard2: format error: boxid");
        return false;
        }
      break;
    case dtSeed:
      if(GetHex(line,seed0,sizeof(seed0))!=sizeof(seed0)) {
        PRINTF(L_CORE_LOAD,"smartcarddatacryptoworks: format error: seed0");
        return false;
        }
      line=skipspace(line);
      if(GetHex(line,seed1,sizeof(seed1))!=sizeof(seed1)) {
        PRINTF(L_CORE_LOAD,"smartcarddatacryptoworks: format error: seed1");
        return false;
        }
      break;
    }
  return true;
}
开发者ID:3PO,项目名称:vdr-plugin-sc,代码行数:31,代码来源:sc-videoguard2.c

示例6: debug1

void cSatipRtsp::ParseHeader(void)
{
  debug1("%s [device %d]", __PRETTY_FUNCTION__, tunerM.GetId());
  char *s, *p = headerBufferM.Data();
  char *r = strtok_r(p, "\r\n", &s);

  while (r) {
        debug16("%s (%zu): %s", __PRETTY_FUNCTION__, headerBufferM.Size(), r);
        r = skipspace(r);
        if (strstr(r, "com.ses.streamID")) {
           int streamid = -1;
           if (sscanf(r, "com.ses.streamID:%11d", &streamid) == 1)
              tunerM.SetStreamId(streamid);
           }
        else if (strstr(r, "Session:")) {
           int timeout = -1;
           char *session = NULL;
           if (sscanf(r, "Session:%m[^;];timeout=%11d", &session, &timeout) == 2)
              tunerM.SetSessionTimeout(skipspace(session), timeout * 1000);
           else if (sscanf(r, "Session:%m[^;]", &session) == 1)
              tunerM.SetSessionTimeout(skipspace(session), -1);
           FREE_POINTER(session);
           }
        r = strtok_r(NULL, "\r\n", &s);
        }
}
开发者ID:paluseb,项目名称:vdr-plugin-satip,代码行数:26,代码来源:rtsp.c

示例7: while

bool cPendingNotification::Read(FILE *f)
{
    cPendingNotification *p = NULL;
    char *s;
    cReadLine ReadLine;
    while ((s = ReadLine.Read(f)) != NULL) {
	char *t = skipspace(s + 1);
	switch (*s) {
	    case 'N': if (!p) {
		tEventID EventID;
		int Type, TimerMod, SearchID;
		time_t Start;
		int n = sscanf(t, "%d %u %d %d %ld", &Type, &EventID, &TimerMod, &SearchID, &Start);
		if (n == 5) {
		    p = new cPendingNotification;
		    if (p)
		    {
		        p->type = Type;
			p->eventID = EventID;
			p->timerMod = TimerMod;
			p->searchID = SearchID;
			p->start = Start;

			PendingNotifications.Add(p);
		    }
		}
	    }
		break;
	    case 'C':
	    {
		s = skipspace(s + 1);
		char *pC = strchr(s, ' ');
		if (pC)
		    *pC = 0; // strips optional channel name
		if (*s) {
		    tChannelID channelID = tChannelID::FromString(s);
		    if (channelID.Valid()) {
			if (p)
			    p->channelID = channelID;
                    }
		    else {
			LogFile.Log(3, "ERROR: illegal channel ID: %s", s);
			return false;
                    }
		}
	    }
	    break;
	    case 'n':
		p = NULL;
		break;
	    default:  if (p && !p->Parse(s))
	    {
		LogFile.Log(1,"ERROR: parsing %s", s);
		return false;
	    }
	}
    }
    return true;
}
开发者ID:mhop,项目名称:vdr-plugin-epgsearch,代码行数:59,代码来源:pending_notifications.c

示例8: while

bool cRecDone::Read(FILE *f)
{
    cRecDone *recDone = NULL;
    char *s;
    cReadLine ReadLine;
    while ((s = ReadLine.Read(f)) != NULL) {
	char *t = skipspace(s + 1);
	switch (*s) {
	    case 'R': if (!recDone) {
		time_t StartTime;
		int Duration, SearchID;
		int n = sscanf(t, "%ld %d %d", &StartTime, &Duration, &SearchID);
		if (n == 3) {
		    recDone = new cRecDone;
		    if (recDone)
		    {
			recDone->searchID = SearchID;
			recDone->startTime = StartTime;
			recDone->duration = Duration;
			RecsDone.Add(recDone);
		    }
		}
	    }
		break;
	    case 'C':
	    {
		s = skipspace(s + 1);
		char *p = strchr(s, ' ');
		if (p)
		    *p = 0; // strips optional channel name
		if (*s) {
		    tChannelID channelID = tChannelID::FromString(s);
		    if (channelID.Valid()) {
			if (recDone)
			    recDone->channelID = channelID;
                    }
		    else {
			LogFile.Log(3, "ERROR: illegal channel ID: %s", s);
			return false;
                    }
		}
	    }
	    break;
	    case 'r':
		recDone = NULL;
		break;
	    default:  if (recDone && !recDone->Parse(s))
	    {
		LogFile.Log(1,"ERROR: parsing %s", s);
		return false;
	    }
	}
    }
    return true;
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:55,代码来源:recdone.c

示例9: BN_set_word

bool cSmartCardDataNagra::Parse(const char *line)
{
  bool isSK=false;
  int dlen=64;
  BN_set_word(exp,3);
  line=skipspace(line);
  unsigned char id[4];
  if(GetHex(line,id,sizeof(id))!=sizeof(id)) {
    PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: card id");
    return false;
    }
  cardid=UINT32_BE(id);
  line=skipspace(line);
  if(!strncasecmp(line,"SK",2)) { isSK=true; dlen=96; line+=2; }
  else {
    if(GetHex(line,bk,sizeof(bk))!=sizeof(bk)) {
      PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: boxkey");
      return false;
      }
    line=skipspace(line);
    if(!strncasecmp(line,"IRDMOD",6)) { isIrdMod=true; line+=6; }
    else if(!strncasecmp(line,"CARDMOD",7)) { isIrdMod=false; line+=7; }
    else {
      PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: IRDMOD/CARDMOD");
      return false;
      }
    }
  line=skipspace(line);

  unsigned char *buff=AUTOMEM(dlen);
  if(GetHex(line,buff,dlen)!=dlen) {
    PRINTF(L_CORE_LOAD,"smartcarddatanagra: format error: data block");
    return false;
    }
  if(!isSK) {
    mod.Get(buff,64);
    }
  else {
    struct SecondaryKey *sk=(struct SecondaryKey *)buff;
    if(UINT16_BE(sk->cs)!=CRC16(buff,sizeof(*sk)-sizeof(sk->cs),false)) {
      PRINTF(L_CORE_LOAD,"smartcarddatanagra: secondary key CRC failed");
      return false;
      }
    unsigned short e=UINT16_BE(sk->exp);
    if(e!=0x0003 && e!=CRC16(buff,12,false)) BN_set_word(exp,e);
    xxor(bk,sizeof(bk),sk->y1,sk->y2);
    mod.Get(sk->mod,sizeof(sk->mod));
    }
  return true;
}
开发者ID:3PO,项目名称:vdr-plugin-sc,代码行数:50,代码来源:sc-nagra.c

示例10: strlen

bool cNoepgChannelID::Parse(const char *s)
{
  comment = NULL;
  if (strncmp(s, "mode=w", 6) == 0) {
     mode = enemWhitelist;
     return true;
     }
  if (strncmp(s, "mode=b", 6) == 0) {
     mode = enemBlacklist;
     return true;
     }
  // allow comments after first space
  int spos = 0;
  int slen = strlen(s);
  while ((spos < slen) && (s[spos] != ' '))
        spos++;
  if (spos < slen) {
     char *tmp = new char[spos + 1];
     memcpy(tmp, s, spos);
     tmp[spos] = 0;
     id = tChannelID::FromString(tmp);
     delete tmp;
     tmp = skipspace(s + spos);
     if ((tmp != NULL) && (strlen(tmp) > 0)) {
        if ((strlen(tmp) <= 3) || !startswith(tmp, "//="))
           comment = new cString(tmp);
        }
     }
  else
     id = tChannelID::FromString(s);
  return id.Valid();
}
开发者ID:herrlado,项目名称:vdr-plugin-noepg,代码行数:32,代码来源:config.c

示例11: skipspace

void cPluginSatip::ParsePortRange(const char *paramP)
{
  char *s, *p = skipspace(paramP);
  char *r = strtok_r(p, "-", &s);
  unsigned int rangeStart = 0;
  unsigned int rangeStop = 0;
  if (r) {
     rangeStart = strtol(r, NULL, 0);
     r = strtok_r(NULL, "-", &s);
     }
  if (r)
     rangeStop = strtol(r, NULL, 0);
  else {
     error("Port range argument not valid '%s'", paramP);
     rangeStart = 0;
     rangeStop = 0;
     }
  if (rangeStart % 2) {
     error("The given range start port must be even!");
     rangeStart = 0;
     rangeStop = 0;
     }
  else if (rangeStop - rangeStart + 1 < deviceCountM * 2) {
     error("The given port range is to small: %d < %d!", rangeStop - rangeStart + 1, deviceCountM * 2);
     rangeStart = 0;
     rangeStop = 0;
     }
  SatipConfig.SetPortRangeStart(rangeStart);
  SatipConfig.SetPortRangeStop(rangeStop);
}
开发者ID:rofafor,项目名称:vdr-plugin-satip,代码行数:30,代码来源:satip.c

示例12: readlabel

/*
  read label, colon and associated weight
  Params: fp - the input stream
          weight - return for weight
          error - return for error
  Returns: the label
  Notes: a null label is not an error
 */
static char *readlabelandweight(FILE *fp, double *weight, int *error)
{
  char *answer;
  int ch;

  *weight = 0;
  answer = readlabel(fp);
  if(!answer)
  {
    *error = -1;
    return 0;
  }
  skipspace(fp);
  ch = fgetc(fp);
  if(ch == ':')
  {
    if( fscanf(fp, "%lf", weight) != 1)
    {
      *error = -2;
      free(answer);
      return 0;
    }
  }
  else
    ungetc(ch, fp);

  if(*answer == 0)
  {
    free(answer);
    answer = 0;
  }
  *error = 0;
  return answer;
}
开发者ID:cgvarela,项目名称:mrsrf,代码行数:42,代码来源:newick.c

示例13: IniLine

// process a single INI directive
int IniLine(LPTSTR szBuffer, INIFILE *InitData, int fSectionOnly, int fLiveMod, TCHAR **errmsg)
{
	register int i, nTokenLength;
	unsigned int ptype, fPath;
	int fg, bg, bc;
	int j, toknum, tokdata, defval, context;
	int path_len, min_path_len;
	TCHAR szPathName[MAXFILENAME], szPathTest[MAXFILENAME];
	unsigned char *dataptr;
	void *vdata;
	LPTSTR pszToken, delims;

	// be sure the line is double-null terminated
	szBuffer[ strlen( szBuffer ) + 1 ] = '\0';

	// get first token, skip line if empty or all comment
	pszToken = skipspace( szBuffer );

	// handle section name 
	if (*pszToken == _TEXT('[')) {

		strip_trailing( ++pszToken, _TEXT(" \t]") );
		if ( toklist( pszToken, &SectionNames, &toknum ) != 1 )
			return -0x100;

		// legitimate section name, return corresponding bit
		return (-(0x80 >> toknum));
	}
开发者ID:CivilPol,项目名称:sdcboot,代码行数:29,代码来源:iparse.c

示例14: resolveHeader

int resolveHeader(sds buf, struct request *prot)
{
    char *n;
    char *t;
    char *tmp[3];
    n = strstr(buf, "\r\n");
    *n = 0;
    n += 2;
    prot->waiting = 0;
    if (sizeof(tmp)/sizeof(char *) != 
            csplit(buf, ' ', tmp, sizeof(tmp)/sizeof(char *)))
    {
        return -1;
    }

    prot->method  = tmp[0];
    prot->url     = tmp[1];
    prot->version = tmp[2];

    t = strstr(n, "length:");
    if (NULL == t)  return  -1;//error 

    t = (char *)skiptospace(t);
    if (NULL == t)  return  -1;//error 

    t = (char *)skipspace(t);
    if (NULL == t)  return  -1;//error 

    prot->lenght = atoi(t);
    prot->hlenght = sdslen(buf);
    return 0;
}
开发者ID:ChellsChen,项目名称:wind,代码行数:32,代码来源:client.c

示例15: while

bool cSchedule::Read(FILE *f, cSchedules *Schedules)
{
  if (Schedules) {
     cReadLine ReadLine;
     char *s;
     while ((s = ReadLine.Read(f)) != NULL) {
           if (*s == 'C') {
              s = skipspace(s + 1);
              char *p = strchr(s, ' ');
              if (p)
                 *p = 0; // strips optional channel name
              if (*s) {
                 tChannelID channelID = tChannelID::FromString(s);
                 if (channelID.Valid()) {
                    if (cSchedule *p = Schedules->AddSchedule(channelID)) {
                       if (!cEvent::Read(f, p))
                          return false;
                       p->Sort();
                       }
                    }
                 else {
                    esyslog("ERROR: invalid channel ID: %s", s);
                    return false;
                    }
                 }
              }
           else {
              esyslog("ERROR: unexpected tag while reading EPG data: %s", s);
              return false;
              }
           }
     return true;
     }
  return false;
}
开发者ID:flensrocker,项目名称:vdr,代码行数:35,代码来源:epg.c


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