- Commit
a25c3c7bac95ab7eb55f0ecf0b8793d8da341611 removed what was
supposedly a non-supported method of passing files as arguments
(instead of the normal stdin method) to rpmdeps. Turns out
rpmdeps is even documented to take files as cli args, and that's
how Fedora's %filter_setup macros are calling it...
- Allow files as arguments again, but in a way that doesn't cause
argvFoo() vs popt crash-n-burn.
if (optCon == NULL)
goto exit;
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- char *be = buf + strlen(buf) - 1;
- while (strchr("\r\n", *be) != NULL)
- *be-- = '\0';
- argvAdd(&av, buf);
+ /* normally files get passed through stdin but also accept files as args */
+ if (poptPeekArg(optCon)) {
+ const char *arg;
+ while ((arg = poptGetArg(optCon)) != NULL) {
+ argvAdd(&av, arg);
+ }
+ } else {
+ while (fgets(buf, sizeof(buf), stdin) != NULL) {
+ char *be = buf + strlen(buf) - 1;
+ while (strchr("\r\n", *be) != NULL)
+ *be-- = '\0';
+ argvAdd(&av, buf);
+ }
}
/* Make sure file names are sorted. */
argvSort(av, NULL);