⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.c

📁 Bluezan implementation of the Bluetooth&#8482 wireless standards specifications for Linux. The code
💻 C
📖 第 1 页 / 共 3 页
字号:
  case 7:#line 88 "parser.y"    {			yyclearin; yyerrok;		}    break;  case 8:#line 94 "parser.y"    {				parser_device = &default_device;			}    break;  case 9:#line 98 "parser.y"    {				parser_device = alloc_device_opts(yyvsp[0].str);			}    break;  case 10:#line 102 "parser.y"    {				parser_device = alloc_device_opts(yyvsp[0].str);			}    break;  case 16:#line 110 "parser.y"    {				hcid.auto_init = yyvsp[0].num;			}    break;  case 17:#line 114 "parser.y"    {				hcid.security = yyvsp[0].num;			}    break;  case 18:#line 118 "parser.y"    {				hcid.pairing = yyvsp[0].num;			}    break;  case 19:#line 122 "parser.y"    {				if (hcid.pin_helper)					free(hcid.pin_helper);				hcid.pin_helper = strdup(yyvsp[0].str);				hcid.dbus_pin_helper = 0;			}    break;  case 20:#line 129 "parser.y"    {				if (hcid.pin_helper)					free(hcid.pin_helper);				hcid.pin_helper = NULL;				hcid.dbus_pin_helper = 1;			}    break;  case 21:#line 136 "parser.y"    {				cfg_error("Unknown option '%s'", yyvsp[0].str);			}    break;  case 22:#line 142 "parser.y"    {			int opt = find_keyword(sec_param, yyvsp[0].str);			if (opt < 0) {				cfg_error("Unknown security mode '%s'", yyvsp[0].str);				yyval.num = 0;			} else				yyval.num = opt;		}    break;  case 23:#line 151 "parser.y"    {			yyval.num = HCID_SEC_NONE;		}    break;  case 24:#line 157 "parser.y"    {			int opt = find_keyword(pair_param, yyvsp[0].str);			if (opt < 0) {				cfg_error("Unknown pairing mode '%s'", yyvsp[0].str);				yyval.num = 0;			} else				yyval.num = opt;		}    break;  case 30:#line 171 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_PTYPE);				parser_device->pkt_type = yyvsp[0].num;			}    break;  case 31:#line 176 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_LM);				parser_device->link_mode = yyvsp[0].num;			}    break;  case 32:#line 181 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_LP);				parser_device->link_policy = yyvsp[0].num;			}    break;  case 33:#line 186 "parser.y"    {				if (parser_device->name)					free(parser_device->name);				parser_device->flags |= (1 << HCID_SET_NAME);				parser_device->name = strdup(yyvsp[0].str);			}    break;  case 34:#line 193 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_CLASS);				parser_device->class = yyvsp[0].num;			}    break;  case 35:#line 198 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_VOICE);				parser_device->voice = yyvsp[0].num;			}    break;  case 36:#line 203 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_INQMODE);				parser_device->inqmode = yyvsp[0].num;			}    break;  case 37:#line 208 "parser.y"    {				parser_device->flags |= (1 << HCID_SET_PAGETO);				parser_device->pageto = yyvsp[0].num;			}    break;  case 38:#line 213 "parser.y"    {				parser_device->auth = yyvsp[0].num;			}    break;  case 39:#line 217 "parser.y"    {				 parser_device->encrypt = yyvsp[0].num;			}    break;  case 40:#line 221 "parser.y"    {				if (yyvsp[0].num)					parser_device->scan |=  SCAN_INQUIRY;				else					parser_device->scan &= ~SCAN_INQUIRY;			}    break;  case 41:#line 228 "parser.y"    {				if (yyvsp[0].num)					parser_device->scan |=  SCAN_PAGE;				else					parser_device->scan &= ~SCAN_PAGE;			}    break;  case 42:#line 235 "parser.y"    {				cfg_error("Unknown option '%s'",yyvsp[0].str);				YYABORT;			}    break;  case 43:#line 242 "parser.y"    {			yyval.str = strdup(yyvsp[0].str);		}    break;  case 44:#line 246 "parser.y"    {			yyval.str = strdup(yyvsp[0].str);		}    break;  case 45:#line 252 "parser.y"    {			yyval.str = strdup(yyvsp[0].str);		}    break;  case 46:#line 258 "parser.y"    {			yyval.str = strdup(yyvsp[0].str);		}    break;  case 47:#line 264 "parser.y"    {			int opt;			if (!hci_strtoptype(yyvsp[0].str, &opt))				cfg_error("Unknown packet type '%s'", yyvsp[0].str);			yyval.num = opt;		}    break;  case 48:#line 271 "parser.y"    {			int opt;			if (!hci_strtoptype(yyvsp[0].str, &opt))				cfg_error("Unknown packet type '%s'", yyvsp[0].str);			yyval.num = opt;		}    break;  case 49:#line 280 "parser.y"    {			int opt;			if (!hci_strtolm(yyvsp[0].str, &opt))				cfg_error("Unknown link mode '%s'", yyvsp[0].str);			yyval.num = opt;		}    break;  case 50:#line 287 "parser.y"    {			int opt;			if (!hci_strtolm(yyvsp[0].str, &opt))				cfg_error("Unknown link mode '%s'", yyvsp[0].str);			yyval.num = opt;		}    break;  case 51:#line 296 "parser.y"    {			int opt;			if (!hci_strtolp(yyvsp[0].str, &opt))				cfg_error("Unknown link policy '%s'", yyvsp[0].str);			yyval.num = opt;		}    break;  case 52:#line 303 "parser.y"    {			int opt;			if (!hci_strtolp(yyvsp[0].str, &opt))				cfg_error("Unknown link policy '%s'", yyvsp[0].str);			yyval.num = opt;		}    break;  case 53:#line 311 "parser.y"    { yyval.num = 1; }    break;  case 54:#line 311 "parser.y"    { yyval.num = 0; }    break;    }/* Line 1010 of yacc.c.  */#line 1489 "parser.c"  yyvsp -= yylen;  yyssp -= yylen;  YY_STACK_PRINT (yyss, yyssp);  *++yyvsp = yyval;  /* Now `shift' the result of the reduction.  Determine what state     that goes to, based on the state we popped back to and the rule     number reduced by.  */  yyn = yyr1[yyn];  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)    yystate = yytable[yystate];  else    yystate = yydefgoto[yyn - YYNTOKENS];  goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/yyerrlab:  /* If not already recovering from an error, report this error.  */  if (!yyerrstatus)    {      ++yynerrs;#if YYERROR_VERBOSE      yyn = yypact[yystate];      if (YYPACT_NINF < yyn && yyn < YYLAST)	{	  YYSIZE_T yysize = 0;	  int yytype = YYTRANSLATE (yychar);	  const char* yyprefix;	  char *yymsg;	  int yyx;	  /* Start YYX at -YYN if negative to avoid negative indexes in	     YYCHECK.  */	  int yyxbegin = yyn < 0 ? -yyn : 0;	  /* Stay within bounds of both yycheck and yytname.  */	  int yychecklim = YYLAST - yyn;	  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;	  int yycount = 0;	  yyprefix = ", expecting ";	  for (yyx = yyxbegin; yyx < yyxend; ++yyx)	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)	      {		yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);		yycount += 1;		if (yycount == 5)		  {		    yysize = 0;		    break;		  }	      }	  yysize += (sizeof ("syntax error, unexpected ")		     + yystrlen (yytname[yytype]));	  yymsg = (char *) YYSTACK_ALLOC (yysize);	  if (yymsg != 0)	    {	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");	      yyp = yystpcpy (yyp, yytname[yytype]);	      if (yycount < 5)		{		  yyprefix = ", expecting ";		  for (yyx = yyxbegin; yyx < yyxend; ++yyx)		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)		      {			yyp = yystpcpy (yyp, yyprefix);			yyp = yystpcpy (yyp, yytname[yyx]);			yyprefix = " or ";		      }		}	      yyerror (yymsg);	      YYSTACK_FREE (yymsg);	    }	  else	    yyerror ("syntax error; also virtual memory exhausted");	}      else#endif /* YYERROR_VERBOSE */	yyerror ("syntax error");    }  if (yyerrstatus == 3)    {      /* If just tried and failed to reuse lookahead token after an	 error, discard it.  */      if (yychar <= YYEOF)        {          /* If at end of input, pop the error token,	     then the rest of the stack, then return failure.  */	  if (yychar == YYEOF)	     for (;;)	       {		 YYPOPSTACK;		 if (yyssp == yyss)		   YYABORT;		 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);		 yydestruct (yystos[*yyssp], yyvsp);	       }        }      else	{	  YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);	  yydestruct (yytoken, &yylval);	  yychar = YYEMPTY;	}    }  /* Else will try to reuse lookahead token after shifting the error     token.  */  goto yyerrlab1;/*---------------------------------------------------.| yyerrorlab -- error raised explicitly by YYERROR.  |`---------------------------------------------------*/yyerrorlab:#ifdef __GNUC__  /* Pacify GCC when the user code never invokes YYERROR and the label     yyerrorlab therefore never appears in user code.  */  if (0)     goto yyerrorlab;#endif  yyvsp -= yylen;  yyssp -= yylen;  yystate = *yyssp;  goto yyerrlab1;/*-------------------------------------------------------------.| yyerrlab1 -- common code for both syntax error and YYERROR.  |`-------------------------------------------------------------*/yyerrlab1:  yyerrstatus = 3;	/* Each real token shifted decrements this.  */  for (;;)    {      yyn = yypact[yystate];      if (yyn != YYPACT_NINF)	{	  yyn += YYTERROR;	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)	    {	      yyn = yytable[yyn];	      if (0 < yyn)		break;	    }	}      /* Pop the current state because it cannot handle the error token.  */      if (yyssp == yyss)	YYABORT;      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);      yydestruct (yystos[yystate], yyvsp);      YYPOPSTACK;      yystate = *yyssp;      YY_STACK_PRINT (yyss, yyssp);    }  if (yyn == YYFINAL)    YYACCEPT;  YYDPRINTF ((stderr, "Shifting error token, "));  *++yyvsp = yylval;  yystate = yyn;  goto yynewstate;/*-------------------------------------.| yyacceptlab -- YYACCEPT comes here.  |`-------------------------------------*/yyacceptlab:  yyresult = 0;  goto yyreturn;/*-----------------------------------.| yyabortlab -- YYABORT comes here.  |`-----------------------------------*/yyabortlab:  yyresult = 1;  goto yyreturn;#ifndef yyoverflow/*----------------------------------------------.| yyoverflowlab -- parser overflow comes here.  |`----------------------------------------------*/yyoverflowlab:  yyerror ("parser stack overflow");  yyresult = 2;  /* Fall through.  */#endifyyreturn:#ifndef yyoverflow  if (yyss != yyssa)    YYSTACK_FREE (yyss);#endif  return yyresult;}#line 313 "parser.y"int yyerror(char *s) {	syslog(LOG_ERR, "%s line %d", s, lineno);	return 0;}int cfg_error(const char *fmt, ...){	char buf[255];	va_list ap;	va_start(ap, fmt);	vsnprintf(buf,sizeof(buf),fmt,ap);	va_end(ap);	yyerror(buf);	return 0;}/*  * Read config file.  */ int read_config(char *file) {	extern FILE *yyin;	if (!(yyin = fopen(file, "r"))) {		syslog(LOG_ERR,"Can not open %s", file);		return -1;	}	lineno = 1;	yyparse();	fclose(yyin);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -