X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fgenskel%2Fgenskel.c;h=62dfe3f4bc72d68b5c10a53b6827888423404f45;hb=9ece61d2cbda88878b9f1e6a6e62d3d42cbdef00;hp=a2ed3e628804e7f89314aa97450ef93d77877a6e;hpb=017a0f3080978c1de1c1ed2342c10878be1614aa;p=src%2Fapp-framework-binder.git diff --git a/src/genskel/genskel.c b/src/genskel/genskel.c index a2ed3e62..62dfe3f4 100644 --- a/src/genskel/genskel.c +++ b/src/genskel/genskel.c @@ -34,7 +34,7 @@ * "b": "int" * } * } - * + * * Invocation: program [file|-]... * * without arguments, it reads the input. @@ -72,6 +72,7 @@ const char *api = NULL; const char *scope = NULL; const char *prefix = NULL; const char *postfix = NULL; +char *capi = NULL; int priv = -1; int noconc = -1; @@ -94,7 +95,7 @@ struct json_object *search(const char *path) d = strtok(d, "/"); while(i && d) { if (!json_object_object_get_ex(i, d, &i)) - return NULL; + return NULL; d = strtok(NULL, "/"); } return i; @@ -108,7 +109,7 @@ struct json_object *expand_$ref(struct path path) struct path *p; struct json_object *o, *x; int n, i; - struct json_object_iterator ji, jn; + struct json_object_iterator ji, jn; /* expansion depends of the type of the node */ switch (json_object_get_type(path.object)) { @@ -283,7 +284,7 @@ void print_perms() n = a_perms ? json_object_array_length(a_perms) : 0; if (n) { - printf("static const struct afb_auth _afb_auths_v2_%s[] = {\n" , api); + printf("static const struct afb_auth _afb_auths_v2_%s[] = {\n" , capi); i = 0; while (i < n) { printf("\t{ %s }", json_object_get_string(json_object_array_get_idx(a_perms, i))); @@ -304,9 +305,9 @@ struct json_object *new_perm(struct json_object *obj, const char *desc) if (!d_perms) { d_perms = json_object_new_object(); a_perms = json_object_new_array(); - } + } - asprintf(&b, "&_afb_auths_v2_%s[%d]", api, json_object_array_length(a_perms)); + asprintf(&b, "&_afb_auths_v2_%s[%d]", capi, json_object_array_length(a_perms)); x = json_object_new_string(desc); y = json_object_new_string(b); json_object_array_add(a_perms, x); @@ -592,7 +593,6 @@ void process(char *filename) { char *desc; const char *info; - char *capi; /* translate - */ if (!strcmp(filename, "-")) @@ -651,7 +651,13 @@ void process(char *filename) ); enum_verbs(print_struct_verb); printf( - " { .verb = NULL }\n" + " {\n" + " .verb = NULL,\n" + " .callback = NULL,\n" + " .auth = NULL,\n" + " .info = NULL,\n" + " .session = 0\n" + " }\n" "};\n" ); printf( @@ -692,7 +698,7 @@ int main(int ac, char **av) process("-"); else { do { process(*av); } while(*++av); - } + } return 0; }