Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-o isn't optional #28

Open
luebking opened this issue Apr 8, 2024 · 0 comments
Open

-o isn't optional #28

luebking opened this issue Apr 8, 2024 · 0 comments

Comments

@luebking
Copy link

luebking commented Apr 8, 2024

The parameter wasn't set optional so "-o -f" would fail for "-f" not being an integer.
I took the "2" from the comments.
(Stumbled over that when writing the bool parser ;)

diff --git a/find-cursor.c b/find-cursor.c
index 2caaf51..bce509e 100644
--- a/find-cursor.c
+++ b/find-cursor.c
@@ -157,7 +157,7 @@ int main(int argc, char* argv[]) {
 
 	extern int optopt;
 	int ch;
-	while ((ch = getopt_long(argc, argv, ":hs:d:w:l:c:r:ft::go:O:", longopts, NULL)) != -1)
+	while ((ch = getopt_long(argc, argv, ":hs:d:w:l:c:r:ft::go::O:", longopts, NULL)) != -1)
 		switch (ch) {
 		case 's':
 			size = parse_num(ch, optarg, argv[0]);
@@ -187,7 +187,7 @@ int main(int argc, char* argv[]) {
 			grow = 1;
 			break;
 		case 'o':
-			outline = parse_num(ch, optarg, argv[0]);
+			outline = optarg ? parse_num(ch, optarg, argv[0]) : 2;
 			break;
 		case 'O':
 			strncpy(ocolor_name, optarg, sizeof(ocolor_name));
dnebauer pushed a commit to dnebauer/find-cursor that referenced this issue Jan 11, 2025

Verified

This commit was signed with the committer’s verified signature.
JonGilmore Jon Gilmore
As per github issue arp242#28 (<arp242#28>) the
-o parameter was not set optional, meaning "-o -f" fails because "-f" is not an
integer. The changes in this commit are taken from this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant