Skip to content

Instantly share code, notes, and snippets.

@denen99
Created July 6, 2013 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denen99/5940754 to your computer and use it in GitHub Desktop.
Save denen99/5940754 to your computer and use it in GitHub Desktop.
const char *activevcl = NULL ;
char *vclentry = NULL ;
char *result = NULL;
if (!strcmp(request->url, "/vclactive") || !strcmp(request->url,"/vclactive/")) {
ipc_run(vcl->vadmin,&vret,"vcl.list");
if (vret.status == 400) {
send_response_fail(request->connection, vret.answer);
} else {
vclentry = malloc(sizeof(vret.answer) + 1);
strcpy(vclentry,vret.answer);
result = strtok(vclentry,"\n");
while (result != NULL) {
if ( !strncmp("active",result,6) ) {
activevcl = strtok(result," ");
activevcl = strtok(NULL," ");
activevcl = strtok(NULL," ");
printf("FOUND ACTIVE \n");
break ;
}
result = strtok(NULL,"\n");
}
send_response_ok(request->connection, activevcl);
}
free(vret.answer);
return 0;
} else if (!strcmp(request->url, "/vcl") || !strcmp(request->url,"/vcl/")) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment