i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
commit 0be11444bc64804ee7e3fd125e701046336704b7
parent ebf3428f102d8641751d9870b95daddaed24c378
Author: Martin Dørum <martid0311@gmail.com>
Date:   Fri, 24 May 2019 01:07:51 +0200

Remove shortopt from --raw (#232)


Diffstat:
Mi3lock.1 | 2+-
Mi3lock.c | 11+++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/i3lock.1 b/i3lock.1
@@ -77,7 +77,7 @@ verified or whether it is wrong).
 Display the given PNG image instead of a blank screen.
 
 .TP
-.BI \-r\  format \fR,\ \fB\-\-raw= format
+.BI \fB\-\-raw= format
 Read the image given by \-\-image as a raw image instead of PNG. The argument is the image's format
 as <width>x<height>:<pixfmt>. The supported pixel formats are 'native' and 'rgb'.
 The "rgb" pixel format expects a pixel to be three bytes; red, green, and blue.
diff --git a/i3lock.c b/i3lock.c
@@ -1004,7 +1004,7 @@ int main(int argc, char *argv[]) {
         {"help", no_argument, NULL, 'h'},
         {"no-unlock-indicator", no_argument, NULL, 'u'},
         {"image", required_argument, NULL, 'i'},
-        {"raw", required_argument, NULL, 'r'},
+        {"raw", required_argument, NULL, 0},
         {"tiling", no_argument, NULL, 't'},
         {"ignore-empty-password", no_argument, NULL, 'e'},
         {"inactivity-timeout", required_argument, NULL, 'I'},
@@ -1017,7 +1017,7 @@ int main(int argc, char *argv[]) {
     if ((username = pw->pw_name) == NULL)
         errx(EXIT_FAILURE, "pw->pw_name is NULL.");
 
-    char *optstring = "hvnbdc:p:ui:r:teI:fl";
+    char *optstring = "hvnbdc:p:ui:teI:fl";
     while ((o = getopt_long(argc, argv, optstring, longopts, &longoptind)) != -1) {
         switch (o) {
             case 'v':
@@ -1050,9 +1050,6 @@ int main(int argc, char *argv[]) {
             case 'u':
                 unlock_indicator = false;
                 break;
-            case 'r':
-                image_raw_format = strdup(optarg);
-                break;
             case 'i':
                 image_path = strdup(optarg);
                 break;
@@ -1074,6 +1071,8 @@ int main(int argc, char *argv[]) {
             case 0:
                 if (strcmp(longopts[longoptind].name, "debug") == 0)
                     debug_mode = true;
+                else if (strcmp(longopts[longoptind].name, "raw") == 0)
+                    image_raw_format = strdup(optarg);
                 break;
             case 'f':
                 show_failed_attempts = true;
@@ -1087,7 +1086,7 @@ int main(int argc, char *argv[]) {
                 break;
             default:
                 errx(EXIT_FAILURE, "Syntax: i3lock [-v] [-n] [-b] [-d] [-c color] [-u] [-p win|default]"
-                                   " [-i image.png] [-r format] [-t] [-e] [-I timeout] [-f] [-l]");
+                                   " [-i image.png] [-t] [-e] [-I timeout] [-f] [-l]");
         }
     }