Index: /trunk/src/kmk/kmkbuiltin/append.c
===================================================================
--- /trunk/src/kmk/kmkbuiltin/append.c	(revision 2014)
+++ /trunk/src/kmk/kmkbuiltin/append.c	(revision 2015)
@@ -1,9 +1,9 @@
 /* $Id$ */
 /** @file
- *
  * kMk Builtin command - append text to file.
- *
- * Copyright (c) 2005-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
- *
+ */
+
+/*
+ * Copyright (c) 2005-2008 knut st. osmundsen <bird-kBuild-spam@anduin.net>
  *
  * This file is part of kBuild.
@@ -42,5 +42,5 @@
 {
     fprintf(pf,
-            "usage: %s [-dcntv] file [string ...]\n"
+            "usage: %s [-dcnNtv] file [string ...]\n"
             "   or: %s --version\n"
             "   or: %s --help\n"
@@ -51,4 +51,5 @@
             "  -c  Output the command for specified target(s). [builtin only]\n"
             "  -n  Insert a new line between the strings.\n"
+            "  -N  Suppress the trailing new line.\n"
             "  -t  Truncate the file instead of appending\n"
             "  -v  Output the value(s) for specified variable(s). [builtin only]\n"
@@ -69,4 +70,5 @@
     FILE *pFile;
     int fNewLine = 0;
+    int fNoTrailingNewLine = 0;
     int fTruncate = 0;
     int fDefine = 0;
@@ -83,5 +85,5 @@
        &&  argv[i][0] == '-'
        &&  argv[i][1] != '\0' /* '-' is a file */
-       &&  strchr("-cdntv", argv[i][1]) /* valid option char */
+       &&  strchr("-cdnNtv", argv[i][1]) /* valid option char */
        )
     {
@@ -116,4 +118,7 @@
                     case 'n':
                         fNewLine = 1;
+                        break;
+                    case 'N':
+                        fNoTrailingNewLine = 1;
                         break;
                     case 't':
@@ -222,13 +227,20 @@
     }
 
-    /* 
-     * Add the newline, closing the define if needed, and close the file.
-     */
-    if (    (  fDefine
-             ? fwrite(fFirst ?        "endef\n"      :        "\nendef\n", 
-                      1, 
-                      fFirst ? sizeof("endef\n") - 1 : sizeof("\nendef\n") - 1, 
-                      pFile) < sizeof("endef\n")
-             : fputc('\n', pFile) == EOF)
+    /*
+     * End the define?
+     */
+    if (fDefine)
+    {
+        if (fFirst)
+            fwrite("\nendef", 1, sizeof("\nendef") - 1, pFile);
+        else
+            fwrite("endef", 1, sizeof("endef") - 1, pFile);
+    }
+
+    /*
+     * Add the final newline (unless supressed) and close the file.
+     */
+    if (    (   !fNoTrailingNewLine
+             && fputc('\n', pFile) == EOF)
         ||  ferror(pFile))
     {
