summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/pngo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/pngo.c b/bin/pngo.c
index 0e13a7ec..ef4ded36 100644
--- a/bin/pngo.c
+++ b/bin/pngo.c
@@ -670,11 +670,11 @@ int main(int argc, char *argv[]) {
         }
     }
 
-    if (optind < argc) {
-        if (output || stdio) {
-            optimize(argv[optind], output);
-        } else {
-            optimize(argv[optind], argv[optind]);
+    if (argc - optind == 1 && (output || stdio)) {
+        optimize(argv[optind], output);
+    } else if (optind < argc) {
+        for (int i = optind; i < argc; ++i) {
+            optimize(argv[i], argv[i]);
         }
     } else {
         optimize(NULL, output);