Index: trunk/src/bldprogs/VBoxCPP.cpp
===================================================================
--- trunk/src/bldprogs/VBoxCPP.cpp	(revision 57072)
+++ trunk/src/bldprogs/VBoxCPP.cpp	(revision 57353)
@@ -26,7 +26,7 @@
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <VBox/VBoxTpG.h>
 
@@ -49,7 +49,7 @@
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** The bitmap type. */
 #define VBCPP_BITMAP_TYPE                   uint64_t
@@ -66,7 +66,7 @@
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 /** Pointer to the C preprocessor instance data. */
 typedef struct VBCPP *PVBCPP;
@@ -519,7 +519,7 @@
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Internal Functions                                                                                                           *
+*********************************************************************************************************************************/
 static PVBCPPMACRO  vbcppMacroLookup(PVBCPP pThis, const char *pszDefine, size_t cchDefine);
 static RTEXITCODE   vbcppMacroExpandIt(PVBCPP pThis, PVBCPPMACROEXP pExp, size_t offMacro, PVBCPPMACRO pMacro, size_t offParameters);
Index: trunk/src/bldprogs/VBoxCmp.cpp
===================================================================
--- trunk/src/bldprogs/VBoxCmp.cpp	(revision 57072)
+++ trunk/src/bldprogs/VBoxCmp.cpp	(revision 57353)
@@ -17,7 +17,7 @@
 
 
-/*******************************************************************************
-*  Header Files                                                                *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <sys/types.h>
 #include <sys/stat.h>
Index: trunk/src/bldprogs/VBoxCompilerPlugInsGcc.cpp
===================================================================
--- trunk/src/bldprogs/VBoxCompilerPlugInsGcc.cpp	(revision 57072)
+++ trunk/src/bldprogs/VBoxCompilerPlugInsGcc.cpp	(revision 57353)
@@ -15,4 +15,5 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
+
 
 /*********************************************************************************************************************************
Index: trunk/src/bldprogs/VBoxDef2LazyLoad.cpp
===================================================================
--- trunk/src/bldprogs/VBoxDef2LazyLoad.cpp	(revision 57072)
+++ trunk/src/bldprogs/VBoxDef2LazyLoad.cpp	(revision 57353)
@@ -18,7 +18,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <ctype.h>
 #include <stdio.h>
@@ -28,7 +29,7 @@
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 typedef struct MYEXPORT
 {
@@ -42,7 +43,7 @@
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** @name Options
  * @{ */
Index: trunk/src/bldprogs/VBoxPeSetVersion.cpp
===================================================================
--- trunk/src/bldprogs/VBoxPeSetVersion.cpp	(revision 57072)
+++ trunk/src/bldprogs/VBoxPeSetVersion.cpp	(revision 57353)
@@ -17,7 +17,7 @@
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <Windows.h>
 #include <stdio.h>
Index: trunk/src/bldprogs/VBoxTpG.cpp
===================================================================
--- trunk/src/bldprogs/VBoxTpG.cpp	(revision 57072)
+++ trunk/src/bldprogs/VBoxTpG.cpp	(revision 57353)
@@ -17,7 +17,7 @@
 
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <VBox/VBoxTpG.h>
 
@@ -42,7 +42,7 @@
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 
 typedef struct VTGATTRS
@@ -118,7 +118,7 @@
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 /** The string space organizing the string table strings. Each node is a VTGSTRING. */
 static RTSTRSPACE       g_StrSpace = NULL;
Index: trunk/src/bldprogs/bin2c.c
===================================================================
--- trunk/src/bldprogs/bin2c.c	(revision 57072)
+++ trunk/src/bldprogs/bin2c.c	(revision 57353)
@@ -16,7 +16,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <ctype.h>
 #include <stdio.h>
Index: trunk/src/bldprogs/filesplitter.cpp
===================================================================
--- trunk/src/bldprogs/filesplitter.cpp	(revision 57072)
+++ trunk/src/bldprogs/filesplitter.cpp	(revision 57353)
@@ -17,7 +17,7 @@
 
 
-/*******************************************************************************
-*  Header Files                                                                *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -30,7 +30,7 @@
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifndef S_ISDIR
 # define S_ISDIR(a_fMode)       ( (S_IFMT & (a_fMode)) == S_IFDIR )
Index: trunk/src/bldprogs/preload.cpp
===================================================================
--- trunk/src/bldprogs/preload.cpp	(revision 57072)
+++ trunk/src/bldprogs/preload.cpp	(revision 57353)
@@ -16,7 +16,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef RT_OS_WINDOWS
 # include <Windows.h>
Index: trunk/src/bldprogs/scm.cpp
===================================================================
--- trunk/src/bldprogs/scm.cpp	(revision 57072)
+++ trunk/src/bldprogs/scm.cpp	(revision 57353)
@@ -16,7 +16,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include <iprt/ctype.h>
@@ -39,14 +40,14 @@
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 /** The name of the settings files. */
 #define SCM_SETTINGS_FILENAME           ".scm-settings"
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 
 /**
@@ -72,4 +73,7 @@
     SCMOPT_STRIP_TRAILING_LINES,
     SCMOPT_NO_STRIP_TRAILING_LINES,
+    SCMOPT_FIX_FLOWER_BOX_MARKERS,
+    SCMOPT_NO_FIX_FLOWER_BOX_MARKERS,
+    SCMOPT_MIN_BLANK_LINES_BEFORE_FLOWER_BOX_MARKERS,
     SCMOPT_ONLY_SVN_DIRS,
     SCMOPT_NOT_ONLY_SVN_DIRS,
@@ -83,4 +87,5 @@
     SCMOPT_DONT_SET_SVN_KEYWORDS,
     SCMOPT_TAB_SIZE,
+    SCMOPT_WIDTH,
     SCMOPT_FILTER_OUT_DIRS,
     SCMOPT_FILTER_FILES,
@@ -102,8 +107,16 @@
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 const char          g_szTabSpaces[16+1]     = "                ";
+const char          g_szAsterisks[255+1]    =
+"****************************************************************************************************"
+"****************************************************************************************************"
+"*******************************************************";
+const char          g_szSpaces[255+1]       =
+"                                                                                                    "
+"                                                                                                    "
+"                                                       ";
 static const char   g_szProgName[]          = "scm";
 static const char  *g_pszChangedSuff        = "";
@@ -118,19 +131,22 @@
 static SCMSETTINGSBASE const g_Defaults =
 {
-    /* .fConvertEol = */            true,
-    /* .fConvertTabs = */           true,
-    /* .fForceFinalEol = */         true,
-    /* .fForceTrailingLine = */     false,
-    /* .fStripTrailingBlanks = */   true,
-    /* .fStripTrailingLines = */    true,
-    /* .fOnlySvnFiles = */          false,
-    /* .fOnlySvnDirs = */           false,
-    /* .fSetSvnEol = */             false,
-    /* .fSetSvnExecutable = */      false,
-    /* .fSetSvnKeywords = */        false,
-    /* .cchTab = */                 8,
-    /* .pszFilterFiles = */         (char *)"",
-    /* .pszFilterOutFiles = */      (char *)"*.exe|*.com|20*-*-*.log",
-    /* .pszFilterOutDirs = */       (char *)".svn|.hg|.git|CVS",
+    /* .fConvertEol = */                            true,
+    /* .fConvertTabs = */                           true,
+    /* .fForceFinalEol = */                         true,
+    /* .fForceTrailingLine = */                     false,
+    /* .fStripTrailingBlanks = */                   true,
+    /* .fStripTrailingLines = */                    true,
+    /* .fFixFlowerBoxMarkers = */                   true,
+    /* .cMinBlankLinesBeforeFlowerBoxMakers = */    2,
+    /* .fOnlySvnFiles = */                          false,
+    /* .fOnlySvnDirs = */                           false,
+    /* .fSetSvnEol = */                             false,
+    /* .fSetSvnExecutable = */                      false,
+    /* .fSetSvnKeywords = */                        false,
+    /* .cchTab = */                                 8,
+    /* .cchWidth = */                               130,
+    /* .pszFilterFiles = */                         (char *)"",
+    /* .pszFilterOutFiles = */                      (char *)"*.exe|*.com|20*-*-*.log",
+    /* .pszFilterOutDirs = */                       (char *)".svn|.hg|.git|CVS",
 };
 
@@ -150,4 +166,7 @@
     { "--strip-trailing-lines",             SCMOPT_STRIP_TRAILING_LINES,            RTGETOPT_REQ_NOTHING },
     { "--strip-no-trailing-lines",          SCMOPT_NO_STRIP_TRAILING_LINES,         RTGETOPT_REQ_NOTHING },
+    { "--fix-flower-box-markers",           SCMOPT_FIX_FLOWER_BOX_MARKERS,          RTGETOPT_REQ_NOTHING },
+    { "--min-blank-lines-before-flower-box-makers", SCMOPT_FIX_FLOWER_BOX_MARKERS,  RTGETOPT_REQ_UINT8 },
+    { "--no-fix-flower-box-markers",        SCMOPT_NO_FIX_FLOWER_BOX_MARKERS,       RTGETOPT_REQ_NOTHING },
     { "--only-svn-dirs",                    SCMOPT_ONLY_SVN_DIRS,                   RTGETOPT_REQ_NOTHING },
     { "--not-only-svn-dirs",                SCMOPT_NOT_ONLY_SVN_DIRS,               RTGETOPT_REQ_NOTHING },
@@ -161,4 +180,5 @@
     { "--dont-set-svn-keywords",            SCMOPT_DONT_SET_SVN_KEYWORDS,           RTGETOPT_REQ_NOTHING },
     { "--tab-size",                         SCMOPT_TAB_SIZE,                        RTGETOPT_REQ_UINT8   },
+    { "--width",                            SCMOPT_WIDTH,                           RTGETOPT_REQ_UINT8   },
     { "--filter-out-dirs",                  SCMOPT_FILTER_OUT_DIRS,                 RTGETOPT_REQ_STRING  },
     { "--filter-files",                     SCMOPT_FILTER_FILES,                    RTGETOPT_REQ_STRING  },
@@ -193,4 +213,5 @@
     rewrite_SvnNoExecutable,
     rewrite_SvnKeywords,
+    rewrite_FixFlowerBoxMarkers,
     rewrite_C_and_CPP
 };
@@ -328,6 +349,6 @@
     if (pSettings)
     {
-        Assert(pSettings->cchTab != ~(unsigned)0);
-        pSettings->cchTab = ~(unsigned)0;
+        Assert(pSettings->cchTab != UINT8_MAX);
+        pSettings->cchTab = UINT8_MAX;
 
         RTStrFree(pSettings->pszFilterFiles);
@@ -386,4 +407,5 @@
             return VINF_SUCCESS;
 
+
         case SCMOPT_STRIP_TRAILING_BLANKS:
             pSettings->fStripTrailingBlanks = true;
@@ -393,4 +415,9 @@
             return VINF_SUCCESS;
 
+        case SCMOPT_MIN_BLANK_LINES_BEFORE_FLOWER_BOX_MARKERS:
+            pSettings->cMinBlankLinesBeforeFlowerBoxMakers = pValueUnion->u8;
+            return VINF_SUCCESS;
+
+
         case SCMOPT_STRIP_TRAILING_LINES:
             pSettings->fStripTrailingLines = true;
@@ -398,4 +425,11 @@
         case SCMOPT_NO_STRIP_TRAILING_LINES:
             pSettings->fStripTrailingLines = false;
+            return VINF_SUCCESS;
+
+        case SCMOPT_FIX_FLOWER_BOX_MARKERS:
+            pSettings->fFixFlowerBoxMarkers = true;
+            return VINF_SUCCESS;
+        case SCMOPT_NO_FIX_FLOWER_BOX_MARKERS:
+            pSettings->fFixFlowerBoxMarkers = false;
             return VINF_SUCCESS;
 
@@ -444,4 +478,13 @@
             }
             pSettings->cchTab = pValueUnion->u8;
+            return VINF_SUCCESS;
+
+        case SCMOPT_WIDTH:
+            if (pValueUnion->u8 < 20 || pValueUnion->u8 > 200)
+            {
+                RTMsgError("Invalid width size: %u - must be in {20..200} range\n", pValueUnion->u8);
+                return VERR_OUT_OF_RANGE;
+            }
+            pSettings->cchWidth = pValueUnion->u8;
             return VINF_SUCCESS;
 
@@ -1537,4 +1580,6 @@
                         case SCMOPT_STRIP_TRAILING_BLANKS:  RTPrintf("      Default: %RTbool\n", g_Defaults.fStripTrailingBlanks); break;
                         case SCMOPT_STRIP_TRAILING_LINES:   RTPrintf("      Default: %RTbool\n", g_Defaults.fStripTrailingLines); break;
+                        case SCMOPT_FIX_FLOWER_BOX_MARKERS: RTPrintf("      Default: %RTbool\n", g_Defaults.fFixFlowerBoxMarkers); break;
+                        case SCMOPT_MIN_BLANK_LINES_BEFORE_FLOWER_BOX_MARKERS: RTPrintf("      Default: %u\n", g_Defaults.cMinBlankLinesBeforeFlowerBoxMakers); break;
                         case SCMOPT_ONLY_SVN_DIRS:          RTPrintf("      Default: %RTbool\n", g_Defaults.fOnlySvnDirs); break;
                         case SCMOPT_ONLY_SVN_FILES:         RTPrintf("      Default: %RTbool\n", g_Defaults.fOnlySvnFiles); break;
@@ -1543,7 +1588,9 @@
                         case SCMOPT_SET_SVN_KEYWORDS:       RTPrintf("      Default: %RTbool\n", g_Defaults.fSetSvnKeywords); break;
                         case SCMOPT_TAB_SIZE:               RTPrintf("      Default: %u\n", g_Defaults.cchTab); break;
+                        case SCMOPT_WIDTH:                  RTPrintf("      Default: %u\n", g_Defaults.cchWidth); break;
                         case SCMOPT_FILTER_OUT_DIRS:        RTPrintf("      Default: %s\n", g_Defaults.pszFilterOutDirs); break;
                         case SCMOPT_FILTER_FILES:           RTPrintf("      Default: %s\n", g_Defaults.pszFilterFiles); break;
                         case SCMOPT_FILTER_OUT_FILES:       RTPrintf("      Default: %s\n", g_Defaults.pszFilterOutFiles); break;
+                        default: AssertFailed();
                     }
                     i += fAdvanceTwo;
Index: trunk/src/bldprogs/scm.h
===================================================================
--- trunk/src/bldprogs/scm.h	(revision 57072)
+++ trunk/src/bldprogs/scm.h	(revision 57353)
@@ -106,4 +106,5 @@
 FNSCMREWRITER rewrite_Makefile_kup;
 FNSCMREWRITER rewrite_Makefile_kmk;
+FNSCMREWRITER rewrite_FixFlowerBoxMarkers;
 FNSCMREWRITER rewrite_C_and_CPP;
 
@@ -141,4 +142,10 @@
     bool            fStripTrailingBlanks;
     bool            fStripTrailingLines;
+
+    /** Whether to fix C/C++ flower box section markers. */
+    bool            fFixFlowerBoxMarkers;
+    /** The minimum number of blank lines we want before flowerbox markers. */
+    uint8_t         cMinBlankLinesBeforeFlowerBoxMakers;
+
     /** Only process files that are part of a SVN working copy. */
     bool            fOnlySvnFiles;
@@ -151,6 +158,8 @@
     /** Set svn:keyword if completely or partially missing. */
     bool            fSetSvnKeywords;
-    /**  */
-    unsigned        cchTab;
+    /** Tab size. */
+    uint8_t         cchTab;
+    /** Optimal source code width. */
+    uint8_t         cchWidth;
     /** Only consider files matching these patterns.  This is only applied to the
      *  base names. */
@@ -220,4 +229,6 @@
 
 extern const char g_szTabSpaces[16+1];
+extern const char g_szAsterisks[255+1];
+extern const char g_szSpaces[255+1];
 
 RT_C_DECLS_END
Index: trunk/src/bldprogs/scmdiff.cpp
===================================================================
--- trunk/src/bldprogs/scmdiff.cpp	(revision 57072)
+++ trunk/src/bldprogs/scmdiff.cpp	(revision 57353)
@@ -16,7 +16,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include <iprt/ctype.h>
@@ -28,7 +29,7 @@
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 static const char   g_szTabSpaces[16+1]     = "                ";
 
Index: trunk/src/bldprogs/scmrw.cpp
===================================================================
--- trunk/src/bldprogs/scmrw.cpp	(revision 57072)
+++ trunk/src/bldprogs/scmrw.cpp	(revision 57353)
@@ -16,7 +16,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include <iprt/ctype.h>
@@ -37,4 +38,46 @@
 #include "scm.h"
 
+
+/**
+ * Worker for isBlankLine.
+ *
+ * @returns true if blank, false if not.
+ * @param   pchLine     Pointer to the start of the line.
+ * @param   cchLine     The (encoded) length of the line, excluding EOL char.
+ */
+static bool isBlankLineSlow(const char *pchLine, size_t cchLine)
+{
+    /*
+     * From the end, more likely to hit a non-blank char there.
+     */
+    while (cchLine-- > 0)
+        if (!RT_C_IS_BLANK(pchLine[cchLine]))
+            return false;
+    return true;
+}
+
+/**
+ * Helper for checking whether a line is blank.
+ *
+ * @returns true if blank, false if not.
+ * @param   pchLine     Pointer to the start of the line.
+ * @param   cchLine     The (encoded) length of the line, excluding EOL char.
+ */
+DECLINLINE(bool) isBlankLine(const char *pchLine, size_t cchLine)
+{
+    if (cchLine == 0)
+        return true;
+    /*
+     * We're more likely to fine a non-space char at the end of the line than
+     * at the start, due to source code indentation.
+     */
+    if (pchLine[cchLine - 1])
+        return false;
+
+    /*
+     * Don't bother inlining loop code.
+     */
+    return isBlankLineSlow(pchLine, cchLine);
+}
 
 
@@ -420,4 +463,179 @@
 {
     return false;
+}
+
+
+static bool isFlowerBoxSectionMarker(PSCMSTREAM pIn, const char *pchLine, size_t cchLine,
+                                     const char **ppchText, size_t *pcchText)
+{
+    *ppchText = NULL;
+    *pcchText = 0;
+
+    /*
+     * The first line.
+     */
+    if (pchLine[0] != '/')
+        return false;
+    size_t offLine = 1;
+    while (offLine < cchLine && pchLine[offLine] == '*')
+        offLine++;
+    if (offLine < 20)
+        return false;
+    while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine]))
+        offLine++;
+    if (offLine != cchLine)
+        return false;
+
+    size_t const cchBox = cchLine;
+
+    /*
+     * The next line, extracting the text.
+     */
+    SCMEOL enmEol;
+    pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol);
+    if (cchLine < cchBox - 3)
+        return false;
+
+    offLine = 0;
+    while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine]))
+        offLine++;
+    if (offLine + 5 > cchLine)
+        return false;
+    if (pchLine[offLine] != '*')
+        return false;
+    offLine++;
+    if (!RT_C_IS_BLANK(pchLine[offLine + 1]))
+        return false;
+    offLine++;
+    while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine]))
+        offLine++;
+    if (offLine >= cchLine)
+        return false;
+    if (!RT_C_IS_UPPER(pchLine[offLine]))
+        return false;
+
+    *ppchText = &pchLine[offLine];
+    size_t const offText = offLine;
+
+    /* From the end now. */
+    offLine = cchLine - 1;
+    while (RT_C_IS_BLANK(pchLine[offLine]))
+        offLine--;
+
+    if (pchLine[offLine] != '*')
+        return false;
+    offLine--;
+    if (!RT_C_IS_BLANK(pchLine[offLine]))
+        return false;
+    offLine--;
+    while (RT_C_IS_BLANK(pchLine[offLine]))
+        offLine--;
+    *pcchText = offLine - offText + 1;
+
+    /*
+     * Third line closes the box.
+     */
+    pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol);
+    if (cchLine < cchBox - 3)
+        return false;
+
+    offLine = 0;
+    while (offLine < cchLine && pchLine[offLine] == '*')
+        offLine++;
+    if (offLine < cchBox - 4)
+        return false;
+
+    if (pchLine[offLine] != '/')
+        return false;
+    offLine++;
+
+    while (offLine < cchLine && RT_C_IS_BLANK(pchLine[offLine]))
+        offLine++;
+    if (offLine != cchLine)
+        return false;
+
+    return true;
+}
+
+
+/**
+ * Flower box marker comments in C and C++ code.
+ *
+ * @returns true if modifications were made, false if not.
+ * @param   pIn                 The input stream.
+ * @param   pOut                The output stream.
+ * @param   pSettings           The settings.
+ */
+bool rewrite_FixFlowerBoxMarkers(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings)
+{
+    if (!pSettings->fFixFlowerBoxMarkers)
+        return false;
+
+    /*
+     * Work thru the file line by line looking for flower box markers.
+     */
+    bool        fModified = false;
+    size_t      cBlankLines = 0;
+    SCMEOL      enmEol;
+    size_t      cchLine;
+    const char *pchLine;
+    while ((pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol)) != NULL)
+    {
+        /*
+         * Get a likely match for a first line.
+         */
+        if (   pchLine[0] == '/'
+            && cchLine > 20
+            && pchLine[1] == '*'
+            && pchLine[2] == '*'
+            && pchLine[3] == '*')
+        {
+            size_t const offSaved = ScmStreamTell(pIn);
+            char const  *pchText;
+            size_t       cchText;
+            if (isFlowerBoxSectionMarker(pIn, pchLine, cchLine, &pchText, &cchText))
+            {
+                while (cBlankLines < pSettings->cMinBlankLinesBeforeFlowerBoxMakers)
+                {
+                    ScmStreamPutEol(pOut, enmEol);
+                    cBlankLines++;
+                }
+
+                ScmStreamPutCh(pOut, '/');
+                ScmStreamWrite(pOut, g_szAsterisks, pSettings->cchWidth - 1);
+                ScmStreamPutEol(pOut, enmEol);
+
+                static const char s_szLead[] = "*   ";
+                ScmStreamWrite(pOut, s_szLead, sizeof(s_szLead) - 1);
+                ScmStreamWrite(pOut, pchText, cchText);
+                size_t offCurPlus1 = sizeof(s_szLead) - 1 + cchText + 1;
+                ScmStreamWrite(pOut, g_szSpaces, offCurPlus1 < pSettings->cchWidth ? pSettings->cchWidth - offCurPlus1 : 1);
+                ScmStreamPutCh(pOut, '*');
+                ScmStreamPutEol(pOut, enmEol);
+
+                ScmStreamWrite(pOut, g_szAsterisks, pSettings->cchWidth - 1);
+                ScmStreamPutCh(pOut, '/');
+                ScmStreamPutEol(pOut, enmEol);
+
+                fModified = true;
+                cBlankLines = 0;
+                continue;
+            }
+        }
+
+        int rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
+        if (RT_FAILURE(rc))
+            return false;
+
+        /* Do blank line accounting so we can ensure at least two blank lines
+           before each section marker. */
+        if (!isBlankLine(pchLine, cchLine))
+            cBlankLines = 0;
+        else
+            cBlankLines++;
+    }
+    if (fModified)
+        ScmVerbose(pState, 2, " * Converted EOL markers\n");
+    return fModified;
 }
 
Index: trunk/src/bldprogs/scmstream.cpp
===================================================================
--- trunk/src/bldprogs/scmstream.cpp	(revision 57072)
+++ trunk/src/bldprogs/scmstream.cpp	(revision 57353)
@@ -16,7 +16,8 @@
  */
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include <iprt/ctype.h>
@@ -1161,4 +1162,22 @@
 
 /**
+ * Puts an EOL marker to the stream.
+ *
+ * @returns IPRt status code.
+ * @param   pStream             The stream.  Must be in write mode.
+ * @param   enmEol              The end-of-line marker to write.
+ */
+int ScmStreamPutEol(PSCMSTREAM pStream, SCMEOL enmEol)
+{
+    if (enmEol == SCMEOL_LF)
+        return ScmStreamWrite(pStream, "\n", 1);
+    if (enmEol == SCMEOL_CRLF)
+        return ScmStreamWrite(pStream, "\r\n", 2);
+    if (enmEol == SCMEOL_NONE)
+        return VINF_SUCCESS;
+    AssertFailedReturn(VERR_INVALID_PARAMETER);
+}
+
+/**
  * Formats a string and writes it to the SCM stream.
  *
Index: trunk/src/bldprogs/scmstream.h
===================================================================
--- trunk/src/bldprogs/scmstream.h	(revision 57072)
+++ trunk/src/bldprogs/scmstream.h	(revision 57353)
@@ -123,4 +123,5 @@
 int         ScmStreamWrite(PSCMSTREAM pStream, const char *pchBuf, size_t cchBuf);
 int         ScmStreamPutCh(PSCMSTREAM pStream, char ch);
+int         ScmStreamPutEol(PSCMSTREAM pStream, SCMEOL enmEol);
 ssize_t     ScmStreamPrintf(PSCMSTREAM pStream, const char *pszFormat, ...);
 ssize_t     ScmStreamPrintfV(PSCMSTREAM pStream, const char *pszFormat, va_list va);
Index: trunk/src/bldprogs/scmsubversion.cpp
===================================================================
--- trunk/src/bldprogs/scmsubversion.cpp	(revision 57072)
+++ trunk/src/bldprogs/scmsubversion.cpp	(revision 57353)
@@ -18,7 +18,8 @@
 #define SCM_WITH_DYNAMIC_LIB_SVN
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
 #include <iprt/assert.h>
 #include <iprt/ctype.h>
@@ -48,7 +49,7 @@
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Defined Constants And Macros                                                                                                 *
+*********************************************************************************************************************************/
 #ifdef SCM_WITH_DYNAMIC_LIB_SVN
 # if defined(RT_OS_WINDOWS) && defined(RT_ARCH_X86)
@@ -66,7 +67,7 @@
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Structures and Typedefs                                                                                                      *
+*********************************************************************************************************************************/
 #if defined(SCM_WITH_DYNAMIC_LIB_SVN) && !defined(SCM_WITH_SVN_HEADERS)
 typedef int                         apr_status_t;
@@ -124,7 +125,7 @@
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
 static char g_szSvnPath[RTPATH_MAX];
 static enum
