diff options
Diffstat (limited to 'src/bvrcommands.c')
-rw-r--r-- | src/bvrcommands.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/bvrcommands.c b/src/bvrcommands.c index f160731..cbff95f 100644 --- a/src/bvrcommands.c +++ b/src/bvrcommands.c @@ -7,7 +7,6 @@ #include <tape.c> #include <bvrvar.c> #include <inarray.c> -#include <uuid/uuid.h> int bvr_commands_check_for_command(char * input_char, char ** value, int *i, FILE * input, int * value_size) { if((*input_char) == LINE_COMMAND_CHAR) { @@ -279,14 +278,15 @@ int bvr_handle_move(FILE * input, FILE * output) { } int bvr_handle_string(FILE * input, FILE * output) { char * item = bvr_commands_get_string(input); - uuid_t binuuid; - uuid_generate_random(binuuid); - char uuid[37]; - uuid_unparse(binuuid, uuid); + char * uuid = randstring(37); + strcpy(uuid, "BVR_STRING"); + uuid[10] = '_'; int return_value = bvr_var_set(uuid, item); free(item); item = NULL; fprintf(output, "%s", uuid); + free(uuid); + uuid = NULL; fflush(output); return return_value; } @@ -298,19 +298,13 @@ int bvr_handle_equals(FILE * input, FILE * output) { int return_value = 0; char * string1 = bvr_var_get(item); char * string2 = bvr_var_get(value); - uuid_t binuuid; - uuid_generate_random(binuuid); - char uuid[37]; - char outputst[2]; - outputst[1] = '\0'; - uuid_unparse(binuuid, uuid); + char out; if(strcmp(string1, string2) == 0) { - outputst[0] = '1'; + out = '1'; } else { - outputst[0] = '0'; + out = '0'; } - return_value = bvr_var_set(uuid, outputst); - fprintf(output, "%s", uuid); + fprintf(output, "?\"%c\"", out); free(item); free(value); item = NULL; @@ -538,6 +532,18 @@ int bvr_handle_explode(FILE * input, FILE * output) { } int bvr_handle_info(FILE * input, FILE * output) { // fprintf(stderr, "[bvrcommands.c] bvr_handle_info: bvr bVerbose HTPCMS %d.%d.%d\n", BVR_VER_MAJOR, BVR_VER_MINOR, BVR_VER_PATCH); - fprintf(output, "\nbvr bVerbose HTPCMS %d.%d.%d\n", BVR_VER_MAJOR, BVR_VER_MINOR, BVR_VER_PATCH); + char chars_to_break_value[69] = " "; + strlcat(chars_to_break_value, BVR_CHARS_TO_BREAK_VALUE, sizeof(chars_to_break_value)); + char * item = bvr_commands_get_value(input, chars_to_break_value); + switch(item[0]) { + case 'c': + fprintf(output, "%lu", bvr_variables_count); + break; + default: + fprintf(output, "\nbvr bVerbose HTPCMS %d.%d.%d\n", BVR_VER_MAJOR, BVR_VER_MINOR, BVR_VER_PATCH); + break; + } + free(item); + item = NULL; return SUCCESS; } |