coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-08-28 11:01:02
Commit30cf081fc83e87553e77b61ad0a885a0a36f0ad5
Parentc6f1b8a880f833db48ef7b59b6fbf08451a9e33e

lib: Update optget to version 1.6.0

Diffstat

M CMakeLists.txt | 3 ---
R ext/optget.h -> src/lib/optget.c | 86 ++++++++++++++++++++-----------------------------------------------------------
M src/basename.c | 39 +++++++++++++++++----------------------
M src/cat.c | 37 +++++++++++++++++--------------------
M src/cksum.c | 16 ++++++++--------
M src/dirname.c | 40 ++++++++++++++++++----------------------
M src/env.c | 41 ++++++++++++++++++++---------------------
M src/head.c | 36 ++++++++++++++++--------------------
M src/id.c | 51 +++++++++++++++++++++++++++++----------------------
A src/lib/optget.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
M src/link.c | 38 +++++++++++++++++---------------------
M src/mkdir.c | 36 ++++++++++++++++++------------------
M src/nice.c | 42 ++++++++++++++++++------------------------
M src/od.c | 26 +++++++++++---------------
M src/orphan.c | 26 ++++++++++----------------
M src/pwd.c | 41 +++++++++++++++++------------------------
M src/rand.c | 37 +++++++++++++++++--------------------
M src/realpath.c | 41 ++++++++++++++++++-----------------------
M src/rmdir.c | 39 +++++++++++++++++----------------------
M src/sleep.c | 40 ++++++++++++++++++----------------------
M src/sum.c | 18 +++++++++---------
M src/tee.c | 42 ++++++++++++++++++------------------------
M src/time.c | 41 +++++++++++++++++++----------------------
M src/touch.c | 33 ++++++++++++++++-----------------
M src/uname.c | 37 +++++++++++++++++--------------------
M src/unlink.c | 38 +++++++++++++++++---------------------

26 files changed, 459 insertions, 520 deletions

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5968c6..1a008c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,9 +8,6 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
 SET(CMAKE_STATIC_LIBRARY_PREFIX "")
 
-INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/ext)
-INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/lib)
-
 FILE(GLOB LIBSRC ${PROJECT_SOURCE_DIR}/src/lib/*)
 
 ADD_LIBRARY(lib STATIC ${LIBSRC})
diff --git a/src/basename.c b/src/basename.c
index d4dd717..1b93e9c 100644
--- a/src/basename.c
+++ b/src/basename.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,28 +30,27 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <stdio.h>
 
 #define VERSION "1.0.1"
 
-static void help(void);
-static void version(void);
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -78,7 +74,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("basename - return the non-directory portion of a path\n");
 	puts("usage: basename string [suffix]\n");
 	puts("options:");
@@ -87,7 +83,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils basename, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/cat.c b/src/cat.c
index 46a4c8c..5808bc9 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,32 +30,31 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <stdbool.h>
 #include <stdio.h>
 
 #define VERSION "1.0.4"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static inline int cat(const char *file);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "u"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "u"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'u': { break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -86,7 +82,7 @@ static inline int cat(const char *file) {
 	if (fi != stdin) { fclose(fi); } return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("cat - concatenate and print files\n");
 	puts("usage: cat [-u] [file...]\n");
 	puts("options:");
@@ -96,7 +92,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils cat, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/cksum.c b/src/cksum.c
index 7f14156..e1a6920 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
 #include "lib/error.h"
-#include "optget.h"
+#include "lib/optget.h"
 
 #include <stdbool.h>
 #include <stdint.h>
@@ -39,6 +39,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.4"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static const uint32_t CRC[];
 
 static inline int cksum(const char *file);
@@ -47,14 +53,8 @@ static void hlp(void);
 static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 256: { hlp(); return 0; }
 	case 257: { ver(); return 0; }
 	default: { return 1; }
diff --git a/src/dirname.c b/src/dirname.c
index 1700a3d..94e229e 100644
--- a/src/dirname.c
+++ b/src/dirname.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,28 +30,27 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <stdio.h>
 
 #define VERSION "1.0.1"
 
-static void help(void);
-static void version(void);
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -76,7 +72,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("dirname - return the directory portion of a path\n");
 	puts("usage: dirname string\n");
 	puts("options:");
@@ -85,7 +81,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils dirname, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/env.c b/src/env.c
index 11afa76..6f57f13 100644
--- a/src/env.c
+++ b/src/env.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,35 +30,35 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define VERSION "1.0.2"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 extern char **environ;
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { (void)ac; A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "i"; opt.lops = lops; int o;
-	while((o = optget(&opt, av, 0)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "i"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 0)) != -1;) switch (o) {
 	case 'i': { environ = NULL; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -79,7 +76,7 @@ int main(int ac, char *av[]) { (void)ac; A0 = av[0];
 	return errno = ENOENT ? 127 : 126;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("env - execute with an altered enviroment\n");
 	puts("usage: env [-i] [name=value]... [command [argument...]]\n");
 	puts("options:");
@@ -89,7 +86,7 @@ static void help(void) {
 	return;
 }
 
-static void version() {
+static void ver(void) {
 	puts("OMKOV coreutils env, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/head.c b/src/head.c
index ee30493..cb8c13c 100644
--- a/src/head.c
+++ b/src/head.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <stdbool.h>
 #include <stdint.h>
@@ -43,23 +39,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.3"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static uintmax_t limit = 10;
 static bool      label;
 
 static inline int head(const char *path);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "n:"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "n:"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'n': {
 		register uintmax_t d; register char *p = opt.arg;
 		for (limit = 0; *p >= '0' && *p <= '9'; ++p) {
@@ -71,8 +67,8 @@ int main(int ac, char *av[]) { A0 = av[0];
 		if (*p) { error(1, "%s: invalid line count", opt.arg); }
 		break;
 	}
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -111,7 +107,7 @@ end:
 	if (fi != stdin) { fclose(fi); } return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("head - output the first part of files\n");
 	puts("usage: head [-n number] [file...]\n");
 	puts("options:");
@@ -121,7 +117,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils head, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/id.c b/src/id.c
index 26a013c..39b0008 100644
--- a/src/id.c
+++ b/src/id.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -37,9 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 	TODO Fix memory leak when listing supplementary groups (may be unfixable)
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <grp.h>
 #include <pwd.h>
@@ -47,13 +43,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #include <unistd.h>
 
 #include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define VERSION "0.1.1"
 
 typedef struct passwd pwd_t;
 typedef struct group  grp_t;
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static char mode;
 static bool nflag;
 static bool rflag;
@@ -61,26 +65,20 @@ static bool rflag;
 static inline void id(uid_t uid, uid_t euid, gid_t gid, gid_t egid);
 static inline void groups(const char *user, gid_t gid, gid_t egid);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "Ggnru"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "Ggnru"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'G': case 'g': case 'u': {
 		if (mode) { error(1, "invalid option combination"); }
 		else { mode = (char)o; } break;
 	}
 	case 'n': { nflag = true; break; }
 	case 'r': { rflag = true; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -170,7 +168,7 @@ static inline void groups(const char *user, gid_t gid, gid_t egid) {
 	return;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("id - return user identity\n");
 	puts("usage: id [-G|-g|-u] [-nr] [user...]\n");
 	puts("options:");
@@ -184,7 +182,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils id, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/ext/optget.h b/src/lib/optget.c
similarity index 65%
rename from ext/optget.h
rename to src/lib/optget.c
index cc9ed90..da61ebd 100644
--- a/ext/optget.h
+++ b/src/lib/optget.c
@@ -1,14 +1,11 @@
-// optget.h, version 1.5.1
-// OMKOV optget library
+// optget.h, version 1.6.0
+// optget source file for OMKOV lib
 // Copyright (C) 2020, Jakob Wakeling
 // All rights reserved.
 
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,41 +30,20 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#ifndef OMKOV_OPTGET_H_W3LIZK1S
-#define OMKOV_OPTGET_H_W3LIZK1S
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
+#include "error.h"
+#include "optget.h"
 
+#include <stddef.h>
 #include <stdio.h>
 #include <string.h>
 
-#define ARG_NUL 0
-#define ARG_REQ 1
-#define ARG_OPT 2
-
-typedef struct {
-	char *str;
-	int arg, val;
-} lop_t;
-
-typedef struct {
-	int ind, opt, pos, nop;
-	char *arg, *lop, *str;
-	lop_t *lops;
-} opt_t;
+#define cur av[opt->ind]
 
-static const opt_t OPTGET_INIT = { 1, 0, 1, 0, NULL, NULL, NULL, NULL };
+const struct opt OPTGET_INIT = { 1, 0, 1, 0, NULL, NULL, NULL, NULL };
 
-static inline void _permute(char *argv[], int ind, int n);
+static inline void permute(char **av, int i, int n);
 
-#define cur argv[opt->ind]
-
-/*
-	Parse the next command line argument
-*/
-static inline int optget(opt_t *opt, char *argv[], int flags) {
+int optget(struct opt *opt, char *av[], int flags) {
 	if (flags & 1) {
 		for (; cur && (cur[0] != '-' || cur[1] == 0); ++opt->ind, ++opt->nop);
 		if (!cur) { opt->ind -= opt->nop; opt->nop = 0; return -1; }
@@ -78,27 +54,26 @@ static inline int optget(opt_t *opt, char *argv[], int flags) {
 
 	if (cur[1] == '-') {
 		if (cur[2] == 0) { if (opt->nop) {
-				_permute(argv, opt->ind++, opt->nop);
+				permute(av, opt->ind++, opt->nop);
 				opt->ind -= opt->nop; opt->nop = 0;
 			} else { ++opt->ind; } return -1;
 		}
 
 		int optend, lop; optret = '?'; opt->opt = 0; opt->lop = cur;
 		if (!opt->lops) { goto nol; }
-		for (optend = 2; cur[optend] != '=' && cur[optend] != 0; ++optend) {}
+		for (optend = 2; cur[optend] != '=' && cur[optend] != 0; ++optend);
 
 		for (lop = 0; opt->lops[lop].str; ++lop) {
 			if (strncmp(&cur[2], opt->lops[lop].str, (size_t)optend - 2) == 0) {
 				if (!opt->lops[lop].str[optend - 2]) {
-					optret = opt->opt = opt->lops[lop].val;
-					break;
+					optret = opt->opt = opt->lops[lop].val; break;
 				}
 			}
 		}
 
 		if (opt->lops[lop].arg > ARG_NUL) {
 			if (cur[optend]) { opt->arg = &cur[optend + 1]; }
-			else if (argv[opt->ind + 1]) { opt->arg = argv[++opt->ind]; }
+			else if (av[opt->ind + 1]) { opt->arg = av[++opt->ind]; }
 			else {
 				if (opt->lops[lop].arg == ARG_REQ) { optret = ':'; }
 				opt->arg = NULL;
@@ -115,7 +90,7 @@ nol:	opt->pos = 0;
 		if (!optchr) { optret = '?'; }
 		else if (optchr[1] == ':') {
 			if (cur[opt->pos]) { opt->arg = &cur[opt->pos]; }
-			else if (argv[opt->ind + 1]) { opt->arg = argv[++opt->ind]; }
+			else if (av[opt->ind + 1]) { opt->arg = av[++opt->ind]; }
 			else { opt->arg = NULL; optret = ':'; }
 			opt->pos = 0;
 		}
@@ -125,45 +100,23 @@ nol:	opt->pos = 0;
 	if (!opt->pos || !cur[opt->pos]) {
 		++opt->ind; opt->pos = 1;
 		if (opt->nop) for (; optind < opt->ind; ++optind) {
-			_permute(argv, optind, opt->nop);
+			permute(av, optind, opt->nop);
 		}
 	}
 
 	if (optret == '?' && opt->str[0] != ':') {
-		if (opt->opt) {
-			fprintf(stderr, "%s: invalid option -- '%c'\n", argv[0], opt->opt);
-		}
-		else if (opt->lop) {
-			fprintf(stderr, "%s: invalid option '%s'\n", argv[0], opt->lop);
-		}
+		if (opt->opt) { warn("%c: invalid option", opt->opt); }
+		else if (opt->lop) { warn("%s: invalid option", opt->lop); }
 	}
 	if (optret == ':' && opt->str[0] != ':') {
-		if (opt->opt) {
-			fprintf(stderr, "%s: option requires argument -- '%c'\n", argv[0],
-					opt->opt);
-		}
-		else if (opt->lop) {
-			fprintf(stderr, "%s: option requires argument '%s'\n", argv[0],
-					opt->lop);
-		}
+		if (opt->opt) { warn("%c: option requires argument", opt->opt); }
+		else if (opt->lop) { warn("%s: option requires argument", opt->lop); }
 	}
 
 	return optret;
 }
 
-/*
-	Permute arguments
-*/
-static inline void _permute(char *argv[], int ind, int n) {
-	char *arg = argv[ind];
-	for (int i = ind; i > ind - n; --i) { argv[i] = argv[i - 1]; }
-	argv[ind - n] = arg;
-	return;
-}
-
-#undef cur // argv[opt->ind]
-
-#ifdef __cplusplus
+static inline void permute(char **av, int i, int n) {
+	char *a = av[i]; memmove(&av[i - n + 1], &av[i - n], n * sizeof (av));
+	av[i - n] = a; return;
 }
-#endif // __cplusplus
-#endif // OMKOV_OPTGET_H_W3LIZK1S
diff --git a/src/lib/optget.h b/src/lib/optget.h
new file mode 100644
index 0000000..f83d132
--- /dev/null
+++ b/src/lib/optget.h
@@ -0,0 +1,55 @@
+// optget.h, version 1.6.0
+// optget header file for OMKOV lib
+// Copyright (C) 2020, Jakob Wakeling
+// All rights reserved.
+
+/*
+OMKOV Permissive Licence, version 1.0
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimers.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimers in the documentation and/or
+  other materials provided with the distribution.
+* Neither the names of the copyright holders, nor the names of its contributors
+  may be used to endorse or promote products derived from this Software without
+  specific prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT
+HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+*/
+
+#ifndef OMKOV_LIB_OPTGET_H_W3LIZK1S
+#define OMKOV_LIB_OPTGET_H_W3LIZK1S
+
+#define ARG_NUL 0
+#define ARG_REQ 1
+#define ARG_OPT 2
+
+struct lop {
+	char *str;
+	int arg, val;
+};
+
+struct opt {
+	int ind, opt, pos, nop;
+	char *arg, *lop, *str;
+	struct lop *lops;
+};
+
+extern const struct opt OPTGET_INIT;
+
+extern int optget(struct opt *opt, char *av[], int flags);
+
+#endif // OMKOV_LIB_OPTGET_H_W3LIZK1S
diff --git a/src/link.c b/src/link.c
index 7049b9d..e212a56 100644
--- a/src/link.c
+++ b/src/link.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
@@ -43,20 +39,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
-static void help(void);
-static void version(void);
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -67,7 +63,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("link - create a link to a file\n");
 	puts("usage: link file1 file2\n");
 	puts("options:");
@@ -76,7 +72,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils link, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/mkdir.c b/src/mkdir.c
index 5e6844c..ef2fb10 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <sys/stat.h>
 
@@ -57,6 +53,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #define ID  06000
 #define ST  01000
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static char  *mopt;
 static bool   pflag;
 
@@ -68,22 +70,16 @@ static inline mode_t getref(char **mstr);
 static inline int    getop(char **mstr);
 static inline mode_t getmod(char **mstr);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "m:p"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "m:p"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'm': { mopt = opt.arg; break; }
 	case 'p': { pflag = true; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -181,7 +177,7 @@ static inline mode_t getmod(char **mstr) {
 	}
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("mkdir - make directories\n");
 	puts("usage: mkdir [-p] [-m mode] dir...\n");
 	puts("options:");
@@ -192,7 +188,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils mkdir, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/nice.c b/src/nice.c
index 6e48675..7d00b2d 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
@@ -46,20 +42,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static int n = 10;
 
-static inline void help(void);
-static inline void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "n:"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 0)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "n:"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 0)) != -1;) switch (o) {
 	case 'n': {
 		register int d; register char *p = opt.arg; bool neg = false;
 		if (*p == '-') { neg = true; ++p; } else if (*p == '+') { ++p; }
@@ -72,8 +68,8 @@ int main(int ac, char *av[]) { A0 = av[0];
 		if (*p) { error(1, "%s: invalid nice value", opt.arg); }
 		if (neg) { n = -n; } break;
 	}
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -87,7 +83,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return errno = ENOENT ? 127 : 126;
 }
 
-static inline void help(void) {
+static void hlp(void) {
 	puts("nice - execute with an altered nice value\n");
 	puts("usage: nice [-n increment] [command [argument...]]\n");
 	puts("options:");
@@ -97,7 +93,7 @@ static inline void help(void) {
 	return;
 }
 
-static inline void version() {
+static void ver(void) {
 	puts("OMKOV coreutils nice, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/od.c b/src/od.c
index 5a3da6b..bbf6ecd 100644
--- a/src/od.c
+++ b/src/od.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -40,9 +37,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 	TODO Fix segfault when using standard input.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <errno.h>
 #include <limits.h>
@@ -50,9 +46,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define VERSION "0.8.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 typedef struct {
 	union {
 		uint8_t  i8[16]; uint16_t i16[8];
@@ -129,15 +132,9 @@ static void help(void);
 static void version(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.lops = lops; int o, ret = 0;
+	struct opt opt = OPTGET_INIT; opt.lops = lops; int ret = 0;
 	opt.str = "A:bcdj:N:ost:vx"; tlist = linit();
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'A': switch(opt.arg[0]) {
 		case 'd': { aprint = aprint_generic; Aform[4] = 'u'; continue; }
 		case 'o': { aprint = aprint_generic; Aform[4] = 'o'; continue; }
diff --git a/src/orphan.c b/src/orphan.c
index bca633d..a9aae53 100644
--- a/src/orphan.c
+++ b/src/orphan.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -34,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
 #include "lib/error.h"
-#include "optget.h"
+#include "lib/optget.h"
 
 #include <fcntl.h>
 #include <unistd.h>
@@ -44,18 +41,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.0"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static void hlp(void);
 static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 0)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 0)) != -1;) switch (o) {
 	case 256: { hlp(); return 0; }
 	case 257: { ver(); return 0; }
 	default: { return 1; }
diff --git a/src/pwd.c b/src/pwd.c
index d8f72c5..434a99c 100644
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
@@ -44,24 +40,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static int mode = 0;
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { (void)ac; A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "LP"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "LP"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'L': { mode = 0; break; }
 	case 'P': { mode = 1; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -75,7 +71,7 @@ pwd:;
 	if (mode) { free(cwd); } return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("pwd - print working directory name\n");
 	puts("usage: pwd [-L|-P]\n");
 	puts("options:");
@@ -86,7 +82,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils pwd, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/rand.c b/src/rand.c
index df876b9..1e00d5f 100644
--- a/src/rand.c
+++ b/src/rand.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,13 +30,13 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define VERSION "1.0.1"
 
@@ -48,6 +45,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #define nSIZE (sizeof (nset) - 1)
 #define sSIZE (sizeof (sset) - 1)
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static const char aset[] = "abcdefghijklmnopqrstuvwxyz";
 static const char Aset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 static const char nset[] = "0123456789";
@@ -56,24 +59,18 @@ static const char sset[] = "!@#$%^&*";
 static int       mode;
 static uintmax_t len;
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "aAns"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "aAns"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'a': { mode |= 1; break; }
 	case 'A': { mode |= 2; break; }
 	case 'n': { mode |= 4; break; }
 	case 's': { mode |= 8; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -117,7 +114,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	fclose(rand); free(set); return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("rand - generate random string\n");
 	puts("usage: rand [-aAns] [length]\n");
 	puts("options:");
@@ -130,7 +127,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils rand, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/realpath.c b/src/realpath.c
index 69e8109..8fe0d56 100644
--- a/src/realpath.c
+++ b/src/realpath.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <stdbool.h>
 #include <stdio.h>
@@ -43,22 +39,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static inline int rpath(const char *path);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while((o = optget(&opt, av, 1)) != -1) switch (o) {
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -81,7 +77,7 @@ static inline int rpath(const char *file) {
 	free(path); return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("realpath - resolve an absolute pathname\n");
 	puts("usage: realpath [file...]\n");
 	puts("options:");
@@ -90,7 +86,7 @@ static void help(void) {
 	return;
 }
 
-static void version() {
+static void ver() {
 	puts("OMKOV coreutils realpath, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/rmdir.c b/src/rmdir.c
index da6eb9e..d06101f 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
@@ -44,23 +40,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static bool pflag;
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "p"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "p"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'p': { pflag = true; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -81,7 +77,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("rmdir - remove directories\n");
 	puts("usage: rmdir [-p] dir...\n");
 	puts("options:");
@@ -91,7 +87,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils rmdir, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/sleep.c b/src/sleep.c
index c92135e..92f9411 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
@@ -44,20 +40,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.2"
 
-static void help(void);
-static void version(void);
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -75,7 +71,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return (int)sleep(n);
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("sleep - suspend execution for an interval\n");
 	puts("usage: sleep time\n");
 	puts("options:");
@@ -84,7 +80,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils sleep, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/sum.c b/src/sum.c
index b654b6e..f5f9e95 100644
--- a/src/sum.c
+++ b/src/sum.c
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
 #include "lib/error.h"
-#include "optget.h"
+#include "lib/optget.h"
 
 #include <stdbool.h>
 #include <stdint.h>
@@ -39,6 +39,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static inline int sum(const char *file);
 
 static inline uint32_t bsd(FILE *fi, size_t *fl);
@@ -50,14 +56,8 @@ static void hlp(void);
 static void ver(void);
 
 int main(int ac, char *av[]) {
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "rs"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "rs"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'r': { fn = bsd; break; }
 	case 's': { fn = sysv; break; }
 	case 256: { hlp(); return 0; }
diff --git a/src/tee.c b/src/tee.c
index a904714..e28e8a9 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <signal.h>
 #include <stdbool.h>
@@ -44,24 +40,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.3"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static bool aflag;
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "ai"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "ai"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'a': { aflag = true; break; }
 	case 'i': { signal(SIGINT, SIG_IGN); break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -88,7 +84,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	free(files); return warned;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("tee - duplicate standard input");
 	puts("usage: tee [-ai] [file...]\n");
 	puts("options:");
@@ -99,7 +95,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils tee, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/time.c b/src/time.c
index 9cd63b9..e869331 100644
--- a/src/time.c
+++ b/src/time.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <sys/times.h>
 #include <sys/wait.h>
@@ -48,23 +44,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static bool pflag;
 
-static inline void help(void);
-static inline void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { (void)ac; A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "p"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 0)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "p"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 0)) != -1;) switch (o) {
 	case 'p': { pflag = true; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -100,7 +96,7 @@ int main(int ac, char *av[]) { (void)ac; A0 = av[0];
 	return WEXITSTATUS(status);
 }
 
-static inline void help(void) {
+static void hlp(void) {
 	puts("time - time a simple command\n");
 	puts("usage: time [-p] command [argument...]\n");
 	puts("options:");
@@ -110,7 +106,7 @@ static inline void help(void) {
 	return;
 }
 
-static inline void version() {
+static void ver(void) {
 	puts("OMKOV coreutils time, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/touch.c b/src/touch.c
index 8e3590f..3c7c567 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -39,9 +36,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define _XOPEN_SOURCE 700
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -51,9 +47,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
+#include <string.h>
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static bool aflag, cflag, mflag;
 static bool rflag, notnow;
 
@@ -65,17 +68,11 @@ static inline void rparse(const char *str);
 
 static inline int touch(const char *file);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "acd:mr:t:"; opt.lops = lops; int o;
+	struct opt opt = OPTGET_INIT; opt.str = "acd:mr:t:"; opt.lops = lops; int o;
 	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
 	case 'a': { aflag = true; break; }
 	case 'c': { cflag = true; break; }
@@ -83,8 +80,8 @@ int main(int ac, char *av[]) { A0 = av[0];
 	case 'm': { mflag = true; break; }
 	case 'r': { if (notnow) { goto invalid; } rparse(opt.arg); break; }
 	case 't': { if (notnow) { goto invalid; } tparse(opt.arg); break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	invalid: { error(1, "invalid option combination"); }
 	}
@@ -153,7 +150,7 @@ static inline int touch(const char *file) {
 	} return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("touch - change file access and modify times\n");
 	puts("usage: touch [-acm] [-d time|-r file|-t time] file...\n");
 	puts("options:");
@@ -168,7 +165,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils touch, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/uname.c b/src/uname.c
index 374d2e2..4a59ad5 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,7 +30,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
+#include "lib/optget.h"
 
 #include <sys/utsname.h>
 #include <unistd.h>
@@ -43,30 +40,30 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
 static int mode;
 
 static inline void print(char *string);
 
-static void help(void);
-static void version(void);
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { (void)(ac);
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = "amnrsv"; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
+	struct opt opt = OPTGET_INIT; opt.str = "amnrsv"; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
 	case 'a': { mode |= 31; break; }
 	case 'm': { mode |=  1; break; }
 	case 'n': { mode |=  2; break; }
 	case 'r': { mode |=  4; break; }
 	case 's': { mode |=  8; break; }
 	case 'v': { mode |= 16; break; }
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -89,7 +86,7 @@ static inline void print(char *string) {
 	fputs(string, stdout); return;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("uname - return system name\n");
 	puts("usage: uname [-amnrsv]\n");
 	puts("options:");
@@ -104,7 +101,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils uname, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");
diff --git a/src/unlink.c b/src/unlink.c
index 1ba9f5d..fa361a8 100644
--- a/src/unlink.c
+++ b/src/unlink.c
@@ -6,9 +6,6 @@
 /*
 OMKOV Permissive Licence, version 1.0
 
-Copyright (C) 2020, Jakob Wakeling
-All rights reserved.
-
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal with
 the Software without restriction, including without limitation the rights to
@@ -33,9 +30,8 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "optget.h"
-
-#include <error.h>
+#include "lib/error.h"
+#include "lib/optget.h"
 
 #include <unistd.h>
 
@@ -43,20 +39,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 
 #define VERSION "1.0.1"
 
-static void help(void);
-static void version(void);
+static struct lop lops[] = {
+	{ "help",    ARG_NUL, 256 },
+	{ "version", ARG_NUL, 257 },
+	{ NULL, 0, 0 }
+};
+
+static void hlp(void);
+static void ver(void);
 
 int main(int ac, char *av[]) { A0 = av[0];
-	lop_t lops[] = {
-		{ "help",    ARG_NUL, 256 },
-		{ "version", ARG_NUL, 257 },
-		{ NULL, 0, 0 }
-	};
-	
-	opt_t opt = OPTGET_INIT; opt.str = ""; opt.lops = lops; int o;
-	while ((o = optget(&opt, av, 1)) != -1) switch (o) {
-	case 256: { help(); return 0; }
-	case 257: { version(); return 0; }
+	struct opt opt = OPTGET_INIT; opt.str = ""; opt.lops = lops;
+	for (int o; (o = optget(&opt, av, 1)) != -1;) switch (o) {
+	case 256: { hlp(); return 0; }
+	case 257: { ver(); return 0; }
 	default: { return 1; }
 	}
 
@@ -67,7 +63,7 @@ int main(int ac, char *av[]) { A0 = av[0];
 	return 0;
 }
 
-static void help(void) {
+static void hlp(void) {
 	puts("unlink - remove a file using the unlink function\n");
 	puts("usage: unlink file\n");
 	puts("options:");
@@ -76,7 +72,7 @@ static void help(void) {
 	return;
 }
 
-static void version(void) {
+static void ver(void) {
 	puts("OMKOV coreutils unlink, version " VERSION);
 	puts("Copyright (C) 2020, Jakob Wakeling");
 	puts("All rights reserved.");