actube/src/wtp/enum2array.php
7u83@mail.ru 8a19989b7e Working ...
FossilOrigin-Name: 76683772133379e4ebd35973998048a7dfc1f5ff63deb2182f849c1390c67a92
2014-09-22 04:57:50 +00:00

48 lines
731 B
PHP

<?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");
$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);