Working ...
FossilOrigin-Name: 76683772133379e4ebd35973998048a7dfc1f5ff63deb2182f849c1390c67a92
This commit is contained in:
		@ -1,22 +1,47 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function enum2_array($data,$arrayname,$comment)
 | 
			
		||||
{
 | 
			
		||||
	$str = "";
 | 
			
		||||
	$values = explode(",",$data);
 | 
			
		||||
 | 
			
		||||
	$str.=$comment;
 | 
			
		||||
	$str.= "char * $arrayname"."[] = {\n";
 | 
			
		||||
 | 
			
		||||
	$c="";
 | 
			
		||||
	foreach($values as $val){
 | 
			
		||||
		$str.= $c.'"'.trim($val).'"';
 | 
			
		||||
		$c=",\n";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$str.= "\n};";
 | 
			
		||||
	return $str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$data = file_get_contents("nl80211attr.txt");
 | 
			
		||||
 | 
			
		||||
$values = explode(",",$data);
 | 
			
		||||
 | 
			
		||||
echo "/*
 | 
			
		||||
 Generated by php
 | 
			
		||||
$arrayname="nlt_attrnames";
 | 
			
		||||
$comment = "/*
 | 
			
		||||
 Generated by enum2array.php
 | 
			
		||||
 Do not modify
 | 
			
		||||
*/
 | 
			
		||||
";
 | 
			
		||||
 | 
			
		||||
$r = enum2_array($data,$arrayname,$comment);
 | 
			
		||||
file_put_contents('nlt_attrnames.c',$r);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$data = file_get_contents("nl80211cmd.txt");
 | 
			
		||||
$arrayname="nlt_cmdnames";
 | 
			
		||||
$comment = "/*
 | 
			
		||||
 Generated by enum2array.php
 | 
			
		||||
 Do not modify
 | 
			
		||||
*/
 | 
			
		||||
";
 | 
			
		||||
 | 
			
		||||
$r = enum2_array($data,$arrayname,$comment);
 | 
			
		||||
file_put_contents('nlt_cmdnames.c',$r);
 | 
			
		||||
 | 
			
		||||
echo "char nlt_attrname[] = {\n";
 | 
			
		||||
$c="";
 | 
			
		||||
foreach($values as $val){
 | 
			
		||||
	echo $c.'"'.trim($val).'"';
 | 
			
		||||
	$c=",\n";
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
echo "\n};";
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user