Index: libcfa/src/parseargs.cfa
===================================================================
--- libcfa/src/parseargs.cfa	(revision 5951956fbc88b6219582b5d4c85e8ca5be8aacf4)
+++ libcfa/src/parseargs.cfa	(revision 4af5396caad4605b138ead74b53857a746688724)
@@ -1,4 +1,21 @@
+//
+// 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.
+//
+// parseargs.cfa
+// implementation of arguments parsing (argc, argv)
+//
+// Author           : Thierry Delisle
+// Created On       : Wed Oct 12 15:28:01 2022
+// Last Modified By :
+// Last Modified On :
+// Update Count     :
+//
+
 #include "parseargs.hfa"
 
+#include <assert.h>
 #include <ctype.h>
 #include <stdint.h>
@@ -146,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: libcfa/src/parseargs.hfa
===================================================================
--- libcfa/src/parseargs.hfa	(revision 5951956fbc88b6219582b5d4c85e8ca5be8aacf4)
+++ libcfa/src/parseargs.hfa	(revision 4af5396caad4605b138ead74b53857a746688724)
@@ -1,2 +1,17 @@
+//
+// 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.
+//
+// parseargs.cfa -- PUBLIC
+// API for arguments parsing (argc, argv)
+//
+// Author           : Thierry Delisle
+// Created On       : Wed Oct 12 15:28:01 2022
+// Last Modified By :
+// Last Modified On :
+// Update Count     :
+//
 #pragma once
 
