From 7b2175f323dec66df67634da921a53208624b076 Mon Sep 17 00:00:00 2001
From: Robert Pengelly <robertapengelly@hotmail.com>
Date: Sat, 5 Apr 2025 21:39:51 +0100
Subject: [PATCH] Bug fixes

---
 lib.c | 5 +++--
 rm.c  | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib.c b/lib.c
index 6a276f6..54c239e 100644
--- a/lib.c
+++ b/lib.c
@@ -72,12 +72,13 @@ void parse_args (int argc, char **argv, int optind) {
     
     }
     
-    r = argv[optind++];
+    r = argv[optind];
     
 check_options:
     
-    if (r[0] == '-') {
+    if (*r == '-') {
     
+        optind++;
         r++;
         
         while (*r != '\0') {
diff --git a/rm.c b/rm.c
index c568f5c..13e22c0 100644
--- a/rm.c
+++ b/rm.c
@@ -115,7 +115,7 @@ static void rm (const char *path) {
     
     } else {
     
-        if (!state->fflag && remove (p2)) {
+        if (remove (p2) && !state->fflag) {
             report_at (program_name, 0, REPORT_ERROR, "unable to remove %s", p2);
         }
     
-- 
2.34.1