From 2e6ff7df917fc8f261268e752f84986ed3c683c5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 22 Feb 2026 14:17:32 +0100 Subject: m fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 11 +++++++---- info/argparser.texinfo | 38 +++++++++++++++++++------------------- src/Test.java | 4 ++-- src/argparser.bash | 2 +- src/argparser.c | 2 +- src/argparser.h | 2 +- src/argparser.py | 4 ++-- src/argparser/ArgParser.java | 4 ++-- src/libargparser/argparser.c | 2 +- src/libargparser/argparser.h | 2 +- src/test.bash | 4 ++-- src/test.c | 4 ++-- src/test.py | 4 ++-- 13 files changed, 43 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index dfbc2f6..ff1e3b5 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ # notice and this notice are preserved. This file is offered as-is, # without any warranty. +.POSIX: + PREFIX = /usr DATA = /share LIB = /lib @@ -26,6 +28,8 @@ JAVA_OPTIMISE = -O JAVAC = javac +CC = gcc -std=gnu99 + WARN = -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ -Wtrampolines -Wfloat-equal -Wshadow -Wmissing-prototypes -Wmissing-declarations \ @@ -81,9 +85,9 @@ bin/ArgParser.jar: src/argparser/ArgParser.java c: bin/argparser.so bin/argparser.so: src/argparser.c src/argparser.h @mkdir -p bin - $(CC) $(C_OPTIMISE) -std=gnu99 $(WARN) -fPIC -c src/argparser.c -o bin/argparser.o - $(CC) $(C_OPTIMISE) -std=gnu99 $(WARN) -shared bin/argparser.o -o bin/argparser.so - $(CC) $(C_OPTIMISE) -std=gnu99 $(WARN) src/test.c bin/argparser.o -o bin/test + $(CC) $(C_OPTIMISE) $(WARN) -fPIC -c src/argparser.c -o bin/argparser.o + $(CC) $(C_OPTIMISE) $(WARN) -shared bin/argparser.o -o bin/argparser.so + $(CC) $(C_OPTIMISE) $(WARN) src/test.c bin/argparser.o -o bin/test @@ -161,4 +165,3 @@ uninstall-info: .PHONY: clean clean: -rm -r -- bin - diff --git a/info/argparser.texinfo b/info/argparser.texinfo index 355e3e4..311b7eb 100644 --- a/info/argparser.texinfo +++ b/info/argparser.texinfo @@ -124,9 +124,9 @@ of the option and may span multiple lines but should only do so if the lines below the first is just extra details. When you have populated your @code{ArgParser} with options, it is time -to parse arguments, it is done with the method @code{parse} that optional -takes and list of arguments. If you choose to use a list of arguments -rather than letting @code{ArgParser} use arguments used to start the +to parse arguments; this is done with the method @code{parse} that optionally +takes a list of arguments. If you choose to use a list of arguments +rather than letting @code{ArgParser} use the arguments used to start the program, the first element will not be parsed as it is assumed to be the executable. If you want long options with just one dash or plus, which disables short options, you can pass @code{True}, as the second (option) @@ -136,35 +136,35 @@ If you now want to use any option alternative rather than just the primary (using just the primary is good to keep your code consistent) invoke the nulladic method @code{support_alternatives}. -Before using your options you should so some checks that the combination -of options and arguments are valid. There are some methods provided to do -this. @code{test_exclusiveness} checks that no confliction options are -used, as the first argument, a set of options provided from which at most -one may be used; as a optional second argument, a return code can be provided +Before using your options you should do some checks to ensure that the combination +of options and arguments is valid. There are some methods provided to do +this. @code{test_exclusiveness} checks that no conflicting options are +used; as the first argument, a set of options is provided from which at most +one may be used. As an optional second argument, a return code can be provided if you want the program to exit if there are option conflicts. -@code{test_allowed} checks that only allowed options are used, as the first -argument, a set of options provided in which all used arguments must exist; -as a optional second argument, a return code can be provided if you want the -program to exit if there are out of context option. +@code{test_allowed} checks that only allowed options are used; as the first +argument, a set of options is provided in which all used arguments must exist. +As an optional second argument, a return code can be provided if you want the +program to exit if there are out of context options. @code{test_files} checks that the number of arguments not associated with -an option is within an acccepted range, it takes three option arguments, +an option is within an accepted range; it takes three optional arguments, @code{min}, @code{max} and @code{exit_value}. @code{min} is the minimum count, @code{max} is the maximum count, @code{None} if unlimited, and @code{exit_value} -is a return code can be provided if you want the program to exit if there -are out of context option. Remember that you should also check that the +is a return code that can be provided if you want the program to exit if there +are out of context options. Remember that you should also check that the number of times an option is used is acceptable. After running @code{parse}, your @code{ArgParser} has five attributes: @code{unrecognisedCount}, the number of unrecognised options; and -@code{message}, the join of @code{files} which is all arguments not +@code{message}, the concatenation of @code{files}, which is all arguments not associated with an option, @code{arguments} the parsed arguments, and @code{argcount}, the number of arguments in @code{arguments}. -All valid options are stored in your @code{ArgParser}'s @code{opts}, +All valid options are stored in your @code{ArgParser}'s @code{opts}; it is a dictionary from the option to either @code{None} if the option has not been used, or a list of all used values, in order. A variadic -option without any argumnt will have a empty list and a argumentless -option will have list filled with @code{None}. +option without any argument will have an empty list and an argumentless +option will have a list filled with @code{None}. To print a help page based on the constructor arguments and populated options invoke the nulladic method @code{help}. diff --git a/src/Test.java b/src/Test.java index c9c04a2..fe4da66 100644 --- a/src/Test.java +++ b/src/Test.java @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -26,7 +26,7 @@ public class Test System.out.println("Parent: " + ArgParser.parentName()); ArgParser parser = new ArgParser.Abbreviations("A test for argparser", "test [options] [files]", - "Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)\n" + + "Copyright © 2013 Mattias Andrée (m@maandree.se)\n" + "\n" + "This library is free software: you can redistribute it and/or modify\n" + "it under the terms of the GNU Affero General Public License as published by\n" + diff --git a/src/argparser.bash b/src/argparser.bash index 99711c3..5afa3b6 100644 --- a/src/argparser.bash +++ b/src/argparser.bash @@ -2,7 +2,7 @@ ## # argparser – command line argument parser library # -# Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) +# Copyright © 2013 Mattias Andrée (m@maandree.se) # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by diff --git a/src/argparser.c b/src/argparser.c index ed1a64d..1d21fad 100644 --- a/src/argparser.c +++ b/src/argparser.c @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/src/argparser.h b/src/argparser.h index 9503737..6c62a65 100644 --- a/src/argparser.h +++ b/src/argparser.h @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/src/argparser.py b/src/argparser.py index f9160da..44a82bb 100644 --- a/src/argparser.py +++ b/src/argparser.py @@ -3,7 +3,7 @@ ''' argparser – command line argument parser library -Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) +Copyright © 2013 Mattias Andrée (m@maandree.se) This library is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -26,7 +26,7 @@ class ArgParser(): ''' Simple argument parser - @author Mattias Andrée, maandree@member.fsf.org + @author Mattias Andrée, m@maandree.se ''' diff --git a/src/argparser/ArgParser.java b/src/argparser/ArgParser.java index b2b56a1..088c4cb 100644 --- a/src/argparser/ArgParser.java +++ b/src/argparser/ArgParser.java @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -25,7 +25,7 @@ import java.io.*; /** * Simple argument parser * - * @author Mattias Andrée, maandree@member.fsf.org + * @author Mattias Andrée, m@maandree.se */ public class ArgParser { diff --git a/src/libargparser/argparser.c b/src/libargparser/argparser.c index ba3d606..2004420 100644 --- a/src/libargparser/argparser.c +++ b/src/libargparser/argparser.c @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013, 2014 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/src/libargparser/argparser.h b/src/libargparser/argparser.h index 51feace..0691ffe 100644 --- a/src/libargparser/argparser.h +++ b/src/libargparser/argparser.h @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013, 2014 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013, 2014 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/src/test.bash b/src/test.bash index fc44eec..94c8eba 100755 --- a/src/test.bash +++ b/src/test.bash @@ -2,7 +2,7 @@ ## # argparser – command line argument parser library # -# Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) +# Copyright © 2013 Mattias Andrée (m@maandree.se) # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -25,7 +25,7 @@ echo "Parent: $(args_parent_name)" long=$(cat <<. argparser – command line argument parser library -Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) +Copyright © 2013 Mattias Andrée (m@maandree.se) This library is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by diff --git a/src/test.c b/src/test.c index 8fdbe8b..737ba60 100644 --- a/src/test.c +++ b/src/test.c @@ -1,7 +1,7 @@ /** * argparser – command line argument parser library * - * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) + * Copyright © 2013 Mattias Andrée (m@maandree.se) * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -28,7 +28,7 @@ int main(int argc, char** argv) free(pname); args_init("A test for argparser", "test [options] [files]", - "Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)\n" + "Copyright © 2013 Mattias Andrée (m@maandree.se)\n" "\n" "This library is free software: you can redistribute it and/or modify\n" "it under the terms of the GNU Affero General Public License as published by\n" diff --git a/src/test.py b/src/test.py index 0cfd242..998a10a 100755 --- a/src/test.py +++ b/src/test.py @@ -3,7 +3,7 @@ ''' argparser – command line argument parser library -Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) +Copyright © 2013 Mattias Andrée (m@maandree.se) This library is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by @@ -24,7 +24,7 @@ from argparser import * print('Parent: ' + ArgParser.parent_name()) parser = ArgParser('A test for argparser', 'test [options] [files]', - 'Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)\n' + 'Copyright © 2013 Mattias Andrée (m@maandree.se)\n' '\n' 'This library is free software: you can redistribute it and/or modify\n' 'it under the terms of the GNU Affero General Public License as published by\n' -- cgit v1.2.3-70-g09d2