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

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

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

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

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

示例1: open_file

static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, cli_input_opt_t *opt ){    FILE *fh = fopen( psz_filename, "r" );    if( !fh )        return -1;    FAIL_IF_ERROR( !x264_is_regular_file( fh ), "AVS input is incompatible with non-regular file `%s'/n", psz_filename );    fclose( fh );    avs_hnd_t *h = malloc( sizeof(avs_hnd_t) );    if( !h )        return -1;    FAIL_IF_ERROR( x264_avs_load_library( h ), "failed to load avisynth/n" )    h->env = h->func.avs_create_script_environment( AVS_INTERFACE_25 );    FAIL_IF_ERROR( !h->env, "failed to initiate avisynth/n" )    AVS_Value arg = avs_new_value_string( psz_filename );    AVS_Value res;    char *filename_ext = get_filename_extension( psz_filename );    if( !strcasecmp( filename_ext, "avs" ) )    {        res = h->func.avs_invoke( h->env, "Import", arg, NULL );        FAIL_IF_ERROR( avs_is_error( res ), "%s/n", avs_as_string( res ) )        /* check if the user is using a multi-threaded script and apply distributor if necessary.           adapted from avisynth's vfw interface */        AVS_Value mt_test = h->func.avs_invoke( h->env, "GetMTMode", avs_new_value_bool( 0 ), NULL );        int mt_mode = avs_is_int( mt_test ) ? avs_as_int( mt_test ) : 0;        h->func.avs_release_value( mt_test );        if( mt_mode > 0 && mt_mode < 5 )        {            AVS_Value temp = h->func.avs_invoke( h->env, "Distributor", res, NULL );            h->func.avs_release_value( res );            res = temp;        }    }    else /* non script file */    {        /* cycle through known source filters to find one that works */        const char *filter[AVS_MAX_SEQUENCE+1] = { 0 };        avs_build_filter_sequence( filename_ext, filter );        int i;        for( i = 0; filter[i]; i++ )        {            x264_cli_log( "avs", X264_LOG_INFO, "trying %s... ", filter[i] );            if( !h->func.avs_function_exists( h->env, filter[i] ) )            {                x264_cli_printf( X264_LOG_INFO, "not found/n" );                continue;            }            if( !strncasecmp( filter[i], "FFmpegSource", 12 ) )            {                x264_cli_printf( X264_LOG_INFO, "indexing... " );                fflush( stderr );            }            res = h->func.avs_invoke( h->env, filter[i], arg, NULL );            if( !avs_is_error( res ) )            {                x264_cli_printf( X264_LOG_INFO, "succeeded/n" );                break;            }            x264_cli_printf( X264_LOG_INFO, "failed/n" );        }        FAIL_IF_ERROR( !filter[i], "unable to find source filter to open `%s'/n", psz_filename )    }    FAIL_IF_ERROR( !avs_is_clip( res ), "`%s' didn't return a video clip/n", psz_filename )    h->clip = h->func.avs_take_clip( res, h->env );    const AVS_VideoInfo *vi = h->func.avs_get_video_info( h->clip );    FAIL_IF_ERROR( !avs_has_video( vi ), "`%s' has no video data/n", psz_filename )    /* if the clip is made of fields instead of frames, call weave to make them frames */    if( avs_is_field_based( vi ) )    {        x264_cli_log( "avs", X264_LOG_WARNING, "detected fieldbased (separated) input, weaving to frames/n" );        AVS_Value tmp = h->func.avs_invoke( h->env, "Weave", res, NULL );        FAIL_IF_ERROR( avs_is_error( tmp ), "couldn't weave fields into frames/n" )        res = update_clip( h, &vi, tmp, res );        info->interlaced = 1;        info->tff = avs_is_tff( vi );    }#if !HAVE_SWSCALE    /* if swscale is not available, convert CSPs to yv12 */    if( !avs_is_yv12( vi ) )    {        x264_cli_log( "avs", X264_LOG_WARNING, "converting input clip to YV12/n" );        FAIL_IF_ERROR( vi->width&1 || vi->height&1, "input clip width or height not divisible by 2 (%dx%d)/n", vi->width, vi->height )        const char *arg_name[2] = { NULL, "interlaced" };        AVS_Value arg_arr[2] = { res, avs_new_value_bool( info->interlaced ) };        AVS_Value res2 = h->func.avs_invoke( h->env, "ConvertToYV12", avs_new_value_array( arg_arr, 2 ), arg_name );        FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert input clip to YV12/n" )        res = update_clip( h, &vi, res2, res );    }
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:89,


示例2: dt_colorspaces_get_darktable_matrix

intdt_colorspaces_get_darktable_matrix(const char *makermodel, float *matrix){  dt_profiled_colormatrix_t *preset = NULL;  for(int k=0; k<dt_profiled_colormatrix_cnt; k++)  {    if(!strcasecmp(makermodel, dt_profiled_colormatrices[k].makermodel))    {      preset = dt_profiled_colormatrices + k;      break;    }  }  if(!preset) return -1;  const float wxyz = preset->white[0]+ preset->white[1]+ preset->white[2];  const float rxyz = preset->rXYZ[0] + preset->rXYZ[1] + preset->rXYZ[2];  const float gxyz = preset->gXYZ[0] + preset->gXYZ[1] + preset->gXYZ[2];  const float bxyz = preset->bXYZ[0] + preset->bXYZ[1] + preset->bXYZ[2];  const float xn = preset->white[0]/wxyz;  const float yn = preset->white[1]/wxyz;  const float xr = preset->rXYZ[0]/rxyz;  const float yr = preset->rXYZ[1]/rxyz;  const float xg = preset->gXYZ[0]/gxyz;  const float yg = preset->gXYZ[1]/gxyz;  const float xb = preset->bXYZ[0]/bxyz;  const float yb = preset->bXYZ[1]/bxyz;  const float primaries[9] = {xr,         xg,         xb,                              yr,         yg,         yb,                              1.0f-xr-yr, 1.0f-xg-yg, 1.0f-xb-yb                             };  float result[9];  if(mat3inv(result, primaries)) return -1;  const float whitepoint[3] = {xn/yn, 1.0f, (1.0f-xn-yn)/yn};  float coeff[3];  // get inverse primary whitepoint  mat3mulv(coeff, result, whitepoint);  float tmp[9] = { coeff[0]*xr,           coeff[1]*xg,           coeff[2]*xb,                   coeff[0]*yr,           coeff[1]*yg,           coeff[2]*yb,                   coeff[0]*(1.0f-xr-yr), coeff[1]*(1.0f-xg-yg), coeff[2]*(1.0f-xb-yb)                 };  // input whitepoint[] in XYZ with Y normalized to 1.0f  const float dn[3] = { preset->white[0]/(float)preset->white[1], 1.0f, preset->white[2]/(float)preset->white[1]};  const float lam_rigg[9] = { 0.8951,  0.2664, -0.1614,                              -0.7502,  1.7135,  0.0367,                              0.0389, -0.0685,  1.0296                            };  const float d50[3] = { 0.9642, 1.0, 0.8249 };  // adapt to d50  float chad_inv[9];  if(mat3inv(chad_inv, lam_rigg)) return -1;  float cone_src_rgb[3], cone_dst_rgb[3];  mat3mulv(cone_src_rgb, lam_rigg, dn);  mat3mulv(cone_dst_rgb, lam_rigg, d50);  const float cone[9] = { cone_dst_rgb[0]/cone_src_rgb[0], 0.0f, 0.0f,                          0.0f, cone_dst_rgb[1]/cone_src_rgb[1], 0.0f,                          0.0f, 0.0f, cone_dst_rgb[2]/cone_src_rgb[2]                        };  float tmp2[9];  float bradford[9];  mat3mul(tmp2, cone, lam_rigg);  mat3mul(bradford, chad_inv, tmp2);  mat3mul(matrix, bradford, tmp);  return 0;}
开发者ID:josefwells,项目名称:darktable,代码行数:78,


示例3: scontrol_update_node

/* * scontrol_update_node - update the slurm node configuration per the supplied *	arguments * IN argc - count of arguments * IN argv - list of arguments * RET 0 if no slurm error, errno otherwise. parsing error prints *			error message and returns 0 */extern intscontrol_update_node (int argc, char *argv[]){	int i, j, rc = 0, update_cnt = 0;	uint16_t state_val;	update_node_msg_t node_msg;	char *reason_str = NULL;	char *tag, *val;	int tag_len, val_len;	slurm_init_update_node_msg(&node_msg);	for (i=0; i<argc; i++) {		tag = argv[i];		val = strchr(argv[i], '=');		if (val) {			tag_len = val - argv[i];			val++;			val_len = strlen(val);		} else {			exit_code = 1;			error("Invalid input: %s  Request aborted", argv[i]);			return -1;		}		if (strncasecmp(tag, "NodeAddr", MAX(tag_len, 5)) == 0) {			node_msg.node_addr = val;			update_cnt++;		} else if (strncasecmp(tag, "NodeHostName", MAX(tag_len, 5))			   == 0) {			node_msg.node_hostname = val;			update_cnt++;		} else if (strncasecmp(tag, "NodeName", MAX(tag_len, 1)) == 0) {			node_msg.node_names = val;		} else if (strncasecmp(tag, "Features", MAX(tag_len, 1)) == 0) {			node_msg.features = val;			update_cnt++;		} else if (strncasecmp(tag, "Gres", MAX(tag_len, 1)) == 0) {			node_msg.gres = val;			update_cnt++;		} else if (strncasecmp(tag, "Weight", MAX(tag_len,1)) == 0) {			/* Logic borrowed from function _handle_uint32 */			char *endptr;			unsigned long num;			errno = 0;			num = strtoul(val, &endptr, 0);			if ((endptr[0] == 'k') || (endptr[0] == 'K')) {				num *= 1024;				endptr++;			}			if ((num == 0 && errno == EINVAL)        		            || (*endptr != '/0')) {				if ((strcasecmp(val, "UNLIMITED") == 0) ||				    (strcasecmp(val, "INFINITE")  == 0)) {					num = (uint32_t) INFINITE;				} else {					error("Weight value (%s) is not a "					      "valid number", val);					break;				}			} else if (errno == ERANGE) {				error("Weight value (%s) is out of range",				      val);				break;			} else if (val[0] == '-') {				error("Weight value (%s) is less than zero",				      val);				break;			} else if (num > 0xfffffff0) {				error("Weight value (%s) is greater than %u",					val, 0xfffffff0);				break;			}			node_msg.weight = num;			update_cnt++;		} else if (strncasecmp(tag, "Reason", MAX(tag_len, 1)) == 0) {			int len = strlen(val);			reason_str = xmalloc(len+1);			if (*val == '"')				strcpy(reason_str, val+1);			else				strcpy(reason_str, val);			len = strlen(reason_str) - 1;			if ((len >= 0) && (reason_str[len] == '"'))				reason_str[len] = '/0';			node_msg.reason = reason_str;			if ((getlogin() == NULL) ||			    (uid_from_string(getlogin(),					     &node_msg.reason_uid) < 0)) {				node_msg.reason_uid = getuid();			}//.........这里部分代码省略.........
开发者ID:beninim,项目名称:slurm_simulator,代码行数:101,


示例4: main

int main(int argc, char** argv){   unsigned int cmd = 0;   unsigned int attr = ATTR_NONE;   int ret = 0;   int fd = 0;   if (argc < 4)   {      fprintf(stderr,"usage: %s [get|set] filename [BASE_10_VALUE]/n",argv[0]);      return -1;   }	   fd = open(argv[2], 0);   if (fd < 0)   {      fprintf(stderr,"can't open file: %s/n", argv[2]);      return -1;   }   else   {      printf("opened file: %s/n", argv[2]);   }   if (strcasecmp(argv[1],"set") == 0)   {      attr = atoi(argv[3]);      cmd = FAT_IOCTL_SET_ATTRIBUTES;   }   else if (strcasecmp(argv[1],"get") == 0)   {      cmd = FAT_IOCTL_GET_ATTRIBUTES;   }   else   {      fprintf(stderr,"unknown option %s/n",argv[1]);      goto quit;   }   if ((ret = ioctl(fd,cmd,(unsigned long)&attr)) != 0)   {      fprintf(stderr,"ioctl: %s/n",strerror(errno));   }   if (ret > -1)   {      if (argv[1][0] == 's')      {	 printf("set file attributes to ");      }      else if (argv[1][0] == 'g')      {	 printf("file attributes are ");      }		      hex_print((char*)&attr,1);      printf("/n");   } quit:   close(fd);	   return ret;}
开发者ID:digitalpeer,项目名称:fatattr,代码行数:66,


示例5: _mangoIndexStart

static void _mangoIndexStart (OracleEnv &env, MangoFetchContext &context,                              const char *oper, const Array<char> &query_buf,                              OCINumber *p_strt, OCINumber *p_stop,                              int flags, const char *params){    MangoShadowFetch &shadow_fetch = context.shadow_fetch.ref();    MangoFastIndex   &fast_index   = context.fast_index.ref();    if (strcasecmp(oper, "SUB") == 0)    {        if (context.substructure.parse(params))        {            context.substructure.loadQuery(query_buf);            int right = bingoGetExactRightPart(env, p_strt, p_stop, flags);            if (right == 1)            {                fast_index.prepareSubstructure(env);                context.fetch_engine = &fast_index;            }            else // right == 0            {                shadow_fetch.prepareNonSubstructure(env);                context.fetch_engine = &shadow_fetch;            }        }        else if (context.tautomer.parseSub(params))        {            context.tautomer.loadQuery(query_buf);            int right = bingoGetExactRightPart(env, p_strt, p_stop, flags);            if (right == 1)            {                fast_index.prepareTautomerSubstructure(env);                context.fetch_engine = &fast_index;            }            else // right == 0            {                shadow_fetch.prepareNonTautomerSubstructure(env);                context.fetch_engine = &shadow_fetch;            }        }        else            throw BingoError("can't parse parameters: '%s'", params);    }    else if (strcasecmp(oper, "SMARTS") == 0)    {        context.substructure.loadSMARTS(query_buf);        int right = bingoGetExactRightPart(env, p_strt, p_stop, flags);        if (right == 1)        {            fast_index.prepareSubstructure(env);            context.fetch_engine = &fast_index;        }        else // right == 0        {            shadow_fetch.prepareNonSubstructure(env);            context.fetch_engine = &shadow_fetch;        }    }    else if (strcasecmp(oper, "EXACT") == 0)    {        if (context.tautomer.parseExact(params))        {            context.tautomer.loadQuery(query_buf);            int right = bingoGetExactRightPart(env, p_strt, p_stop, flags);            shadow_fetch.prepareTautomer(env, right);            context.fetch_engine = &shadow_fetch;        }        else if (context.exact.parse(params))        {            context.exact.loadQuery(query_buf);            int right = bingoGetExactRightPart(env, p_strt, p_stop, flags);            shadow_fetch.prepareExact(env, right);            context.fetch_engine = &shadow_fetch;        }        else            throw BingoError("can't parse parameters: '%s'", params);    }    else if (strcasecmp(oper, "SIM") == 0)    {        context.similarity.setMetrics(params);        context.similarity.loadQuery(query_buf);        float bottom = -0.1f;        float top = 1.1f;        if (p_strt == 0 && p_stop == 0)            throw BingoError("no bounds for similarity search");        if (p_strt != 0)            bottom = OracleUtil::numberToFloat(env, p_strt);//.........这里部分代码省略.........
开发者ID:equilion,项目名称:indigo,代码行数:101,


示例6: accept_request

static void* accept_request(void *arg)		//static{	int sock = (int)arg;	char buf[SIZE];	int len = sizeof(buf)/sizeof(*buf);	char method[SIZE/10];	char url[SIZE];	char path[SIZE];	int ret = -1;	int i = 0;	int j = 0;	char *query_string = NULL;    //aim at val(can shu)	int cgi = 0;#ifdef _DEBUG_//	do//	{//		ret = get_line(sock, buf, len);//		printf("%s", buf);//		fflush(stdout);//	}while(ret > 0 && (strcmp(buf, "/n") != 0) );#endif	memset(buf, '/0', sizeof(buf));	memset(method, '/0', sizeof(method));	memset(url, '/0', sizeof(url));	memset(path, '/0', sizeof(buf));	//Request Line	ret = get_line(sock, buf, len);	if(ret <= 0)	{		echo_errno(sock);		return (void*)1;	}	i = 0;	//method index	j = 0;	//buf index	while((i < (sizeof(method)/sizeof(*method) - 1)) && (j < sizeof(buf)/sizeof(*buf) - 1) && (!isspace(buf[j]) ) )	{		method[i] = buf[j];		++i;		++j;	}	method[i] = '/0';	if((strcasecmp(method, "GET") != 0) && (strcasecmp(method, "POST")) )	{		//echo_errno(sock);		return (void*)2;	}	//URL	while(isspace(buf[j]))	//Remove Space	{		++j;	}	i = 0;	while( ( i < sizeof(url)/sizeof(*url)-1 ) && (j < sizeof(buf)/sizeof(*buf)) && (!isspace(buf[j])) )	{		url[i] = buf[j];		++i;		++j;	}	url[i] = '/0';	if( strcasecmp(method, "POST") == 0 )	{		cgi = 1;		sprintf(path, "%s", url+1);	}	if( strcasecmp(method, "GET") == 0 )	{		query_string = url;		while( *query_string != '/0' && *query_string != '?' )		{			query_string++;		}		if(*query_string == '?')		{			cgi = 1;			*query_string = '/0';			++query_string;		}	}	if( strcasecmp(method, "GET") == 0 )	{		sprintf(path, "htdoc%s", url);		if( path[strlen(path)-1] == '/' )		{			strcat(path, "index.html");		}	}	struct stat st;	if( stat(path, &st) < 0 )	{		//echo_errno();	//404			return (void*)3;//.........这里部分代码省略.........
开发者ID:HonestFox,项目名称:HTTP_Server,代码行数:101,


示例7: get_new_tickets

static krb5_error_codeget_new_tickets(krb5_context context,		krb5_principal principal,		krb5_ccache ccache,		krb5_deltat ticket_life,		int interactive){    krb5_error_code ret;    krb5_get_init_creds_opt *opt;    krb5_creds cred;    char passwd[256];    krb5_deltat start_time = 0;    krb5_deltat renew = 0;    const char *renewstr = NULL;    krb5_enctype *enctype = NULL;    krb5_ccache tempccache;    krb5_init_creds_context icc;    krb5_keytab kt = NULL;    int need_prompt;    int will_use_keytab =  (use_keytab || keytab_str);    passwd[0] = '/0';    if (password_file) {	FILE *f;	if (strcasecmp("STDIN", password_file) == 0)	    f = stdin;	else	    f = fopen(password_file, "r");	if (f == NULL)	    krb5_errx(context, 1, "Failed to open the password file %s",		      password_file);	if (fgets(passwd, sizeof(passwd), f) == NULL)	    krb5_errx(context, 1,		      N_("Failed to read password from file %s", ""),		      password_file);	if (f != stdin)	    fclose(f);	passwd[strcspn(passwd, "/n")] = '/0';    }#if defined(__APPLE__) && !defined(__APPLE_TARGET_EMBEDDED__)    if (passwd[0] == '/0' && !will_use_keytab && home_directory_flag) {	const char *realm;	OSStatus osret;	UInt32 length;	void *buffer;	char *name;	realm = krb5_principal_get_realm(context, principal);	ret = krb5_unparse_name_flags(context, principal,				      KRB5_PRINCIPAL_UNPARSE_NO_REALM, &name);	if (ret)	    goto nopassword;	osret = SecKeychainFindGenericPassword(NULL, (UInt32)strlen(realm), realm,					       (UInt32)strlen(name), name,					       &length, &buffer, &passwordItem);	free(name);	if (osret != noErr)	    goto nopassword;	if (length < sizeof(passwd) - 1) {	    memcpy(passwd, buffer, length);	    passwd[length] = '/0';	}	SecKeychainItemFreeContent(NULL, buffer);    nopassword:	do { } while(0);    }#endif    memset(&cred, 0, sizeof(cred));    ret = krb5_get_init_creds_opt_alloc (context, &opt);    if (ret)	krb5_err(context, 1, ret, "krb5_get_init_creds_opt_alloc");    krb5_get_init_creds_opt_set_default_flags(context, "kinit",	krb5_principal_get_realm(context, principal), opt);    if(forwardable_flag != -1)	krb5_get_init_creds_opt_set_forwardable (opt, forwardable_flag);    if(proxiable_flag != -1)	krb5_get_init_creds_opt_set_proxiable (opt, proxiable_flag);    if(anonymous_flag)	krb5_get_init_creds_opt_set_anonymous (opt, anonymous_flag);    if (pac_flag != -1)	krb5_get_init_creds_opt_set_pac_request(context, opt,						pac_flag ? TRUE : FALSE);    if (canonicalize_flag)	krb5_get_init_creds_opt_set_canonicalize(context, opt, TRUE);    if (pk_enterprise_flag || enterprise_flag || canonicalize_flag || windows_flag)	krb5_get_init_creds_opt_set_win2k(context, opt, TRUE);    if (pk_user_id || ent_user_id || anonymous_flag) {	ret = krb5_get_init_creds_opt_set_pkinit(context, opt,//.........这里部分代码省略.........
开发者ID:alexzhang2015,项目名称:osx-10.9,代码行数:101,


示例8: main

//.........这里部分代码省略.........			break;		case 'O':			Oflag = 0;			break;		case 'p':			++pflag;			break;		case 'q':			++qflag;			break;		case 'r':			RFileName = optarg;			break;		case 's':			snaplen = atoi(optarg);			if (snaplen <= 0)				error("invalid snaplen %s", optarg);			break;		case 'S':			++Sflag;			break;		case 't':			--tflag;			break;		case 'T':			if (strcasecmp(optarg, "vat") == 0)				packettype = PT_VAT;			else if (strcasecmp(optarg, "wb") == 0)				packettype = PT_WB;			else if (strcasecmp(optarg, "rpc") == 0)				packettype = PT_RPC;			else if (strcasecmp(optarg, "rtp") == 0)				packettype = PT_RTP;			else if (strcasecmp(optarg, "rtcp") == 0)				packettype = PT_RTCP;			else				error("unknown packet type `%s'", optarg);			break;		case 'v':			++vflag;			break;		case 'w':			WFileName = optarg;			break;#ifdef YYDEBUG		case 'Y':			{			/* Undocumented flag */			extern int yydebug;			yydebug = 1;			}			break;#endif		case 'x':			++xflag;			break;
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:67,


示例9: parse_channels

static void parse_channels(tvi_handle_t *tvh){    char** channels = tvh->tv_param->channels;    mp_tmsg(MSGT_TV, MSGL_INFO, "TV channel names detected./n");    tv_channel_list = malloc(sizeof(tv_channels_t));    tv_channel_list->index=1;    tv_channel_list->next=NULL;    tv_channel_list->prev=NULL;    tv_channel_current = tv_channel_list;    tv_channel_current->norm = tvh->norm;    while (*channels) {        char* tmp = *(channels++);        char* sep = strchr(tmp,'-');        int i;        struct CHANLIST cl;        if (!sep) continue; // Wrong syntax, but mplayer should not crash        av_strlcpy(tv_channel_current->name, sep + 1,                        sizeof(tv_channel_current->name));        sep[0] = '/0';        strncpy(tv_channel_current->number, tmp, 5);        tv_channel_current->number[4]='/0';        while ((sep=strchr(tv_channel_current->name, '_')))            sep[0] = ' ';        // if channel number is a number and larger than 1000 threat it as frequency        // tmp still contain pointer to null-terminated string with channel number here        if (atoi(tmp)>1000){            tv_channel_current->freq=atoi(tmp);        }else{            tv_channel_current->freq = 0;            for (i = 0; i < chanlists[tvh->chanlist].count; i++) {                cl = tvh->chanlist_s[i];                if (!strcasecmp(cl.name, tv_channel_current->number)) {                    tv_channel_current->freq=cl.freq;                    break;                }            }        }        if (tv_channel_current->freq == 0)            mp_tmsg(MSGT_TV, MSGL_ERR, "Couldn't find frequency for channel %s (%s)/n",                            tv_channel_current->number, tv_channel_current->name);        else {          sep = strchr(tv_channel_current->name, '-');          if ( !sep ) sep = strchr(tv_channel_current->name, '+');          if ( sep ) {            i = atoi (sep+1);            if ( sep[0] == '+' ) tv_channel_current->freq += i * 100;            if ( sep[0] == '-' ) tv_channel_current->freq -= i * 100;            sep[0] = '/0';          }          sep = strchr(tv_channel_current->name, '=');          if ( sep ) {            tv_channel_current->norm = norm_from_string(tvh, sep+1);            sep[0] = '/0';          }        }        /*mp_msg(MSGT_TV, MSGL_INFO, "-- Detected channel %s - %s (%5.3f)/n",                        tv_channel_current->number, tv_channel_current->name,                        (float)tv_channel_current->freq/1000);*/        tv_channel_current->next = malloc(sizeof(tv_channels_t));        tv_channel_current->next->index = tv_channel_current->index + 1;        tv_channel_current->next->prev = tv_channel_current;        tv_channel_current->next->next = NULL;        tv_channel_current = tv_channel_current->next;        tv_channel_current->norm = tvh->norm;    }    if (tv_channel_current->prev)        tv_channel_current->prev->next = NULL;    free(tv_channel_current);}
开发者ID:ronin13,项目名称:MplayerMt,代码行数:79,


示例10: Authenticate

int Authenticate(HTTPSession *Session){int result=0;char *Token=NULL, *ptr;int PAMAccount=FALSE;//struct group *grent;AuthenticationsTried=CopyStr(AuthenticationsTried,"");if (! CheckServerAllowDenyLists(Session->UserName)) {	LogToFile(Settings.LogPath,"AUTH: Authentication failed for UserName '%s'. User not allowed to log in",Session->UserName);	return(FALSE);}//check for this as it changes behavior of other auth typesptr=GetToken(Settings.AuthMethods,",",&Token,0);while (ptr){  if (strcasecmp(Token,"pam-account")==0) PAMAccount=TRUE;  ptr=GetToken(ptr,",",&Token,0);}ptr=GetToken(Settings.AuthMethods,",",&Token,0);while (ptr){	if (Settings.Flags & FLAG_LOG_VERBOSE) LogToFile(Settings.LogPath,"AUTH: Try to authenticate '%s' via '%s'. Remaining authentication types: %s",Session->UserName, Token, ptr);	if (strcasecmp(Token,"open")==0) result=TRUE;	else if (strcasecmp(Token,"native")==0) result=AuthNativeFile(Session,FALSE, &Session->RealUser, &Session->HomeDir, &Session->UserSettings);	else if (strcasecmp(Token,"digest")==0) result=AuthNativeFile(Session,TRUE, &Session->RealUser, &Session->HomeDir, &Session->UserSettings);	else if (strcasecmp(Token,"passwd")==0) result=AuthPasswdFile(Session, &Session->RealUser, &Session->HomeDir);	else if (strcasecmp(Token,"shadow")==0) result=AuthShadowFile(Session);	else if (strcasecmp(Token,"cert")==0) result=CheckSSLAuthentication(Session, Session->UserName);	else if (strcasecmp(Token,"certificate")==0) result=CheckSSLAuthentication(Session, Session->UserName);	else if (strcasecmp(Token,"accesstoken")==0) result=AuthAccessToken(Session, Session->Password);	else if (strcasecmp(Token,"cookie")==0) result=AccessTokenAuthCookie(Session);	#ifdef HAVE_LIBPAM	else if (strcasecmp(Token,"pam")==0) 	{		result=AuthPAM(Session);		if (result==TRUE) PAMAccount=TRUE;	}	#endif	else if (strcasecmp(Token,"none")==0) 	{		result=FALSE;		break;	}	else if (strcasecmp(Token,"deny")==0) 	{		result=FALSE;		break;	}	if (result==TRUE)  {    LogToFile(Settings.LogPath,"AUTH: Client Authenticated with %s for %[email
C++ strcasecomp函数代码示例
C++ strbuf_value函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。