On Fri, Jun 01, 2018 at 06:56:13PM -0400, Andrew Gregory wrote: > Sort of. The current --root option is a confusing mess that nobody > actually understands, so it will go away at some point. The > underlying libalpm rootdir setting isn't going anywhere though, and, > in the future, will be configured with a new --rootdir option.
Well looking at the code it actually isn't as complicated as I thought it would be. How about something like this: > case OP_OVERWRITE_FILES: > { > char *i, *root = config->rootdir, *save = NULL; > for(i = strtok_r(optarg, ",", &save); i; i = strtok_r(NULL, > ",", &save)) { > /* strip rootdir if applicable */ > if (root && !memcmp(i, root, strlen(root))) > i += strlen(root); > /* strip remaining leading "/" before adding to option > list */ > i += strspn(i, "/"); > config->overwrite_files = > alpm_list_add(config->overwrite_files, strdup(i)); > } > } which would strip the rootdir and then the leading "/". Although I am not 100% certain config->rootdir would be NULL if no argument is passed; could you confirm that part? -- Cheers, Joey Pabalinas
signature.asc
Description: PGP signature