Index: uspace/lib/fmtutil/fmtutil.c
===================================================================
--- uspace/lib/fmtutil/fmtutil.c	(revision 19d007e60984057110b3464a5f87d49e0786d9e0)
+++ uspace/lib/fmtutil/fmtutil.c	(revision f737c1d5a5e7b7a8af265dba32d9ba938b30c6a5)
@@ -60,18 +60,15 @@
 }
 
-static int print_line(wchar_t *wstr, size_t chars, void *data)
-{
-	//char *line = wstr_to_astr(wstr);
+/** Line consumer that prints the lines aligned according to spec
+ *
+ **/
+static int print_line(wchar_t *wstr, size_t chars, bool last, void *data)
+{
 	printmode_t *pm = (printmode_t *) data;
-	//if (line == NULL) {
-	//	return ENOMEM;
-	//}
+	wchar_t old_char = wstr[chars];
 	wstr[chars] = 0;
-	return print_aligned_w(wstr, pm->width, pm->alignment);
-	//printf("%s", line);
-	//if (pm->newline_always || chars < pm->width)
-	//	printf("\n");
-	//free(line);
-	//return EOK;
+	int rc = print_aligned_w(wstr, pm->width, last, pm->alignment);
+	wstr[chars] = old_char;
+	return rc;
 }
 
@@ -91,9 +88,10 @@
 }
 
-int print_aligned_w(const wchar_t *wstr, size_t width, align_mode_t mode)
+int print_aligned_w(const wchar_t *wstr, size_t width, bool last,
+    align_mode_t mode)
 {
 	size_t i;
 	size_t len = wstr_length(wstr);
-	if (mode == ALIGN_LEFT) {
+	if (mode == ALIGN_LEFT || (mode == ALIGN_JUSTIFY && last)) {
 		for (i = 0; i < width; i++) {
 			if (i < len)
@@ -171,5 +169,5 @@
 	return EOK;
 }
-int print_aligned(const char *str, size_t width, align_mode_t mode)
+int print_aligned(const char *str, size_t width, bool last, align_mode_t mode)
 {
 	wchar_t *wstr = str_to_awstr(str);
@@ -177,11 +175,9 @@
 		return ENOMEM;
 	}
-	int rc = print_aligned_w(wstr, width, mode);
+	int rc = print_aligned_w(wstr, width, last, mode);
 	free(wstr);
 	return rc;
 }
 
-/**
- */
 int wrap(wchar_t *wstr, size_t width, line_consumer_fn consumer, void *data)
 {
@@ -202,5 +198,6 @@
 		while (wstr[pos] == ' ' || wstr[pos] == '\n') {
 			if (wstr[pos] == '\n') {
-				consumer(wstr + line_start, line_len, data);
+				consumer(wstr + line_start, line_len, true,
+				    data);
 				last_word_end = line_start = pos + 1;
 				line_len = 0;
@@ -213,8 +210,10 @@
 		    wstr[pos] != '\n')
 			pos++;
+		bool last = wstr[pos] == 0;
 		/* Check if the line still fits width */
 		if (pos - line_start > width) {
 			if (line_len > 0)
-				consumer(wstr + line_start, line_len, data);
+				consumer(wstr + line_start, line_len, last,
+				    data);
 			line_start = last_word_end = word_start;
 			line_len = 0;
@@ -222,5 +221,5 @@
 		/* Check if we need to force wrap of long word*/
 		if (pos - word_start > width) {
-			consumer(wstr + word_start, width, data);
+			consumer(wstr + word_start, width, last, data);
 			pos = line_start = last_word_end = word_start + width;
 			line_len = 0;
@@ -233,5 +232,5 @@
 	 */
 	if (pos - line_start > 0)
-		consumer(wstr + line_start, pos - line_start, data);
+		consumer(wstr + line_start, pos - line_start, true, data);
 
 	return EOK;
Index: uspace/lib/fmtutil/fmtutil.h
===================================================================
--- uspace/lib/fmtutil/fmtutil.h	(revision 19d007e60984057110b3464a5f87d49e0786d9e0)
+++ uspace/lib/fmtutil/fmtutil.h	(revision f737c1d5a5e7b7a8af265dba32d9ba938b30c6a5)
@@ -39,12 +39,13 @@
  * @param content pointer to line data (note: this is NOT null-terminated)
  * @param size number of characters in line
+ * @param end_of_para true if the line is the last line of the paragraph
  * @param data user data
  * 
  * @returns EOK on success or error code on failure
  */
-typedef int (*line_consumer_fn)(wchar_t *, size_t, void *);
+typedef int (*line_consumer_fn)(wchar_t *, size_t, bool, void *);
 
-extern int print_aligned_w(const wchar_t *, size_t, align_mode_t);
-extern int print_aligned(const char *, size_t, align_mode_t);
+extern int print_aligned_w(const wchar_t *, size_t, bool, align_mode_t);
+extern int print_aligned(const char *, size_t, bool, align_mode_t);
 extern int print_wrapped(const char *, size_t, align_mode_t);
 extern int print_wrapped_console(const char *, align_mode_t);
