X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fdriver.c;h=f2d581cfe4558d5e1171b937f7f7ad72eb12bbeb;hb=6706543a7b6222b4ce0802e898d48cdb581af7c5;hp=653aa8d9c30031e86d271ce6d7734738aad9024e;hpb=5d626fa11b736925983b615d4e3fba000a0ce75b;p=pspp diff --git a/src/output/driver.c b/src/output/driver.c index 653aa8d9c3..f2d581cfe4 100644 --- a/src/output/driver.c +++ b/src/output/driver.c @@ -38,6 +38,7 @@ #include "output/output-item.h" #include "output/text-item.h" +#include "gl/error.h" #include "gl/xalloc.h" #include "gl/xmemdup0.h" @@ -403,3 +404,25 @@ output_driver_create (struct string_map *options) return driver; } + +void +output_driver_parse_option (const char *option, struct string_map *options) +{ + const char *equals = strchr (option, '='); + if (equals == NULL) + { + error (0, 0, _("%s: output option missing `='"), option); + return; + } + + char *key = xmemdup0 (option, equals - option); + if (string_map_contains (options, key)) + { + error (0, 0, _("%s: output option specified more than once"), key); + free (key); + return; + } + + char *value = xmemdup0 (equals + 1, strlen (equals + 1)); + string_map_insert_nocopy (options, key, value); +}