Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F4512148
config.l
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
config.l
View Options
%{
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include "config-stack.h"
#include "y.tab.h"
#include "simpleconfig.h"
/* Some distributions can't use the output from flex without help */
#define ECHO if(fwrite( yytext, yyleng, 1, yyout ))
struct value *val_list = NULL;
struct node *node_list = NULL;
struct parser_context *context_stack = NULL;
int _line_count = 1;
%}
%%
[\n] {
++_line_count;
}
[ \t]* {}
\#[^\n]* {}
"{" {
struct parser_context *c = NULL;
//printf("obrace\n");
c = malloc(sizeof(*c));
assert(c);
c->next = context_stack;
c->val_list = val_list;
c->node_list = node_list;
context_stack = c;
val_list = NULL;
node_list = NULL;
return T_OBRACE;
}
"}" {
return T_CBRACE;
}
";" {
return T_SEMI;
}
"=" {
return T_EQ;
}
[^ \t{};=\"\n]+ {
yylval.sval = strdup(yytext);
return T_ID;
}
\"[^\"]+\" {
yylval.sval = strdup(yytext+1);
yylval.sval[strlen(yytext)-2] = 0;
return T_VAL;
}
%%
int
yywrap(void)
{
return 1;
}
#ifdef STANDALONE
int
main(int argc, char *argv[])
{
char value[80];
config_object_t *c = NULL;
yyout = fopen("/dev/null","w");
c = sc_init();
sc_parse(c, NULL);
sc_dump(c, stdout);
if (argc == 2) {
if (sc_get(c, argv[1], value, sizeof(value)) == 0)
printf("%s = %s\n", argv[1], value);
else
printf("Not found\n");
} else if (argc == 3) {
printf("---------\n");
if (sc_set(c, argv[1], argv[2]) == 0)
sc_dump(c, stdout);
}
sc_release(c);
return 0;
}
#endif
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Wed, Jun 25, 4:23 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1952133
Default Alt Text
config.l (1 KB)
Attached To
Mode
rF Fence Agents
Attached
Detach File
Event Timeline
Log In to Comment