Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add query support to protocol (GH-31)

  • Loading branch information...
commit 17fe107f5f3dabffcdcfe1a02a62df8e8e299fc8 1 parent 71c877a
@Lekensteyn Lekensteyn authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/bumblebeed.c
View
20 src/bumblebeed.c
@@ -208,6 +208,26 @@ static void handle_socket(struct clientsocket * C) {
case 'D'://done, close the socket.
socketClose(&C->sock);
break;
+ case 'Q': /* query for configuration details */
+ /* required since labels can only be attached on statements */;
+ char *conf_key = strchr(buffer, ' ');
+ if (conf_key) {
+ conf_key++;
+ if (strcmp(conf_key, "VirtualDisplay") == 0) {
+ snprintf(buffer, BUFFER_SIZE, "Value: %s\n", bb_config.x_display);
+ } else if (strcmp(conf_key, "LibraryPath") == 0) {
+ snprintf(buffer, BUFFER_SIZE, "Value: %s\n", bb_config.ld_path);
+ } else if (strcmp(conf_key, "Driver") == 0) {
+ /* note: this is not the auto-detected value, but the actual one */
+ snprintf(buffer, BUFFER_SIZE, "Value: %s\n", bb_config.driver);
+ } else {
+ snprintf(buffer, BUFFER_SIZE, "Unknown key requested.\n");
+ }
+ } else {
+ snprintf(buffer, BUFFER_SIZE, "Error: invalid protocol message.\n");
+ }
+ socketWrite(&C->sock, buffer, strlen(buffer) + 1);
+ break;
default:
bb_log(LOG_WARNING, "Unhandled message received: %*s\n", r, buffer);
break;
Please sign in to comment.
Something went wrong with that request. Please try again.