Index: libcfa/src/parseargs.cfa
===================================================================
--- libcfa/src/parseargs.cfa	(revision 38cc59fdd761fd9cccb2a07463860b60e64df28f)
+++ libcfa/src/parseargs.cfa	(revision f82f07ec30baf11cb5f8e4a153505ce9d7180c63)
@@ -17,4 +17,5 @@
 #include "parseargs.hfa"
 
+#include <assert.h>
 #include <ctype.h>
 #include <stdint.h>
@@ -162,23 +163,60 @@
 }
 
+static inline int next_newline(const char * str) {
+	int ret;
+	const char * ptr = strstr(str, "\n");
+	if(!ptr) return MAX;
+
+	/* paranoid */ verify( str <= ptr);
+	intptr_t low = (intptr_t)str;
+	intptr_t hi  = (intptr_t)ptr;
+	ret = hi - low;
+
+	return ret;
+}
+
 //-----------------------------------------------------------------------------
 // Print usage
 static void printopt(FILE * out, int width, int max, char sn, const char * ln, const char * help) {
+	// check how wide we should be printing
+	// this includes all options and the help message
 	int hwidth = max - (11 + width);
 	if(hwidth <= 0) hwidth = max;
 
-	char sname[4] = { ' ', ' ', ' ', '\0' };
-	if(sn != '\0') {
-		sname[0] = '-';
-		sname[1] = sn;
-		sname[2] = ',';
-	}
-
-	fprintf(out, "  %s --%-*s   %.*s\n", sname, width, ln, hwidth, help);
-	for() {
-		help += min(strlen(help), hwidth);
-		if('\0' == *help) break;
-		fprintf(out, "%*s%.*s\n", width + 11, "", hwidth, help);
-	}
+	// check which pieces we have
+	bool has_ln = ln && strcmp("", ln);
+	bool has_help = help && strcmp("", help);
+
+	// print the small name if present
+	if(sn != '\0') fprintf(out, "  -%c", sn);
+	else fprintf(out, "    ");
+
+	// print a comma if we have both short and long names
+	if(sn != '\0' && has_ln) fprintf(out, ", ");
+	else fprintf(out, "  ");
+
+	// print the long name if present
+	if(has_ln)        fprintf(out, "--%-*s", width, ln);
+	else if(has_help) fprintf(out, "  %-*s", width, "");
+
+	if(has_help) {
+		// print the help
+		// We need to wrap at the max width, and also indent newlines so everything is nice and pretty
+
+		// for each line to print
+		for() {
+			//find out if there is a newline
+			int nextnl = next_newline(help);
+			int real = min(min(strlen(help), hwidth), nextnl);
+
+			fprintf(out, "   %.*s", real, help);
+			// printf("%d %d\n", real, nextnl);
+			help += real;
+			if( nextnl == real ) help++;
+			if('\0' == *help) break;
+			fprintf(out, "\n%*s", width + 8, "");
+		}
+	}
+	fprintf(out, "\n");
 }
 
Index: tests/configs/.expect/usage.txt
===================================================================
--- tests/configs/.expect/usage.txt	(revision f82f07ec30baf11cb5f8e4a153505ce9d7180c63)
+++ tests/configs/.expect/usage.txt	(revision f82f07ec30baf11cb5f8e4a153505ce9d7180c63)
@@ -0,0 +1,66 @@
+No args, no errors
+Usage:
+  ./usage Test usage
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
+
+No args, with errors
+Usage:
+  ./usage Test usage
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 1, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 1, IFCONTINUED: 0
+
+Args with short names only:
+Usage:
+  ./usage Test usage
+  -a       First arg
+  -b       Second arg
+  -c       Third arg
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
+
+Args with long names only:
+Usage:
+  ./usage Test usage
+      --AA   First arg
+      --BB   Second arg
+      --CC   Third arg
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
+
+Mix of short and long args:
+Usage:
+  ./usage Test usage
+  -a           First arg
+  -b, --BBBB   Second arg
+      --CC     Third arg
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
+
+Mix of short and long and some missing description:
+Usage:
+  ./usage Test usage
+  -a           First arg
+  -b, --BBBB
+      --CC     Third arg
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
+
+Mix of short and long and some long description:
+Usage:
+  ./usage Test usage
+  -a           First arg
+               The description has multiple lines,
+               ...for some reason
+  -b, --BBBB   12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+      --CC     Third arg
+  -h, --help   print this help message
+Child status:
+IFEXITED   : 1, EXITSTATUS : 0, IFSIGNALED : 0, TERMSIG    : 0, COREDUMP   : 0, IFSTOPPED  : 0, STOPSIG    : 0, IFCONTINUED: 0
+
Index: tests/configs/usage.cfa
===================================================================
--- tests/configs/usage.cfa	(revision f82f07ec30baf11cb5f8e4a153505ce9d7180c63)
+++ tests/configs/usage.cfa	(revision f82f07ec30baf11cb5f8e4a153505ce9d7180c63)
@@ -0,0 +1,122 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2022 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// configs/usage.cfa
+// Testing printing of usage for arguments
+//
+// Author           : Thierry Delisle
+// Created On       : Wed Oct 12 15:28:01 2022
+// Last Modified By :
+// Last Modified On :
+// Update Count     :
+//
+
+#include <parseargs.hfa>
+#include <fstream.hfa>
+
+#include "../meta/fork+exec.hfa"
+
+int main() {
+	char * fake_argv[] = { "./usage" };
+
+	sout | "No args, no errors";
+	if(pid_t child = strict_fork(); child == 0) {
+		cfa_option opts[0];
+		print_args_usage(1, fake_argv, opts, 0, "Test usage", false);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+
+	sout | "No args, with errors";
+	if(pid_t child = strict_fork(); child == 0) {
+		cfa_option opts[0];
+		print_args_usage(1, fake_argv, opts, 0, "Test usage", true);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+
+	sout | "Args with short names only:";
+	if(pid_t child = strict_fork(); child == 0) {
+		int a, b, c;
+		cfa_option opts[] = {
+			{'a', "", "First arg", a },
+			{'b', "", "Second arg", b },
+			{'c', "", "Third arg", c },
+		};
+		print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+
+	sout | "Args with long names only:";
+	if(pid_t child = strict_fork(); child == 0) {
+		int a, b, c;
+		cfa_option opts[] = {
+			{'\0', "AA", "First arg", a },
+			{'\0', "BB", "Second arg", b },
+			{'\0', "CC", "Third arg", c },
+		};
+		print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+
+	sout | "Mix of short and long args:";
+	if(pid_t child = strict_fork(); child == 0) {
+		int a, b, c;
+		cfa_option opts[] = {
+			{'a', "", "First arg", a },
+			{'b', "BBBB", "Second arg", b },
+			{'\0', "CC", "Third arg", c },
+		};
+		print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+
+	sout | "Mix of short and long and some missing description:";
+	if(pid_t child = strict_fork(); child == 0) {
+		int a, b, c;
+		cfa_option opts[] = {
+			{'a', "", "First arg", a },
+			{'b', "BBBB", "", b },
+			{'\0', "CC", "Third arg", c },
+		};
+		print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+
+	sout | "Mix of short and long and some long description:";
+	if(pid_t child = strict_fork(); child == 0) {
+		int a, b, c;
+		cfa_option opts[] = {
+			{'a', "", "First arg\nThe description has multiple lines,\n...for some reason", a },
+			{'b', "BBBB", "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", b },
+			{'\0', "CC", "Third arg", c },
+		};
+		print_args_usage(1, fake_argv, opts, 3, "Test usage", false);
+	}
+	else {
+		int status = do_wait(child);
+		print_status(status);
+	}
+}
+
+// no used
+static int true_main(const char * path, char * env[]) { return 0; }
