* Take a series of KEY='VALUE' lines where VALUE part is * sq-quoted, and append at the end of the string list */
| 917 | * sq-quoted, and append <KEY, VALUE> at the end of the string list |
| 918 | */ |
| 919 | static int parse_key_value_squoted(char *buf, struct string_list *list) |
| 920 | { |
| 921 | while (*buf) { |
| 922 | struct string_list_item *item; |
| 923 | char *np; |
| 924 | char *cp = strchr(buf, '='); |
| 925 | if (!cp) { |
| 926 | np = strchrnul(buf, '\n'); |
| 927 | return error(_("no key present in '%.*s'"), |
| 928 | (int) (np - buf), buf); |
| 929 | } |
| 930 | np = strchrnul(cp, '\n'); |
| 931 | *cp++ = '\0'; |
| 932 | item = string_list_append(list, buf); |
| 933 | |
| 934 | buf = np + (*np == '\n'); |
| 935 | *np = '\0'; |
| 936 | cp = sq_dequote(cp); |
| 937 | if (!cp) |
| 938 | return error(_("unable to dequote value of '%s'"), |
| 939 | item->string); |
| 940 | item->util = xstrdup(cp); |
| 941 | } |
| 942 | return 0; |
| 943 | } |
| 944 | |
| 945 | /** |
| 946 | * Reads and parses the state directory's "author-script" file, and sets name, |
no test coverage detected