commit 1157be852f7a057d87db412cbc30fd5b8850f44d
Author:     Laslo Hunhold <[email protected]>
AuthorDate: Sun Aug 28 15:02:17 2022 +0200
Commit:     Laslo Hunhold <[email protected]>
CommitDate: Sun Aug 28 15:02:17 2022 +0200

    Fix a few small things in the manual-generators
    
    Namely, add spaces to avoid mangling and properly escape backslashes.
    
    Signed-off-by: Laslo Hunhold <[email protected]>

diff --git a/man/grapheme_decode_utf8.sh b/man/grapheme_decode_utf8.sh
index 88685c9..a6fd932 100644
--- a/man/grapheme_decode_utf8.sh
+++ b/man/grapheme_decode_utf8.sh
@@ -77,7 +77,7 @@ print_cps(const char *str, size_t len)
                         */
                        break;
                }
-               printf("%"PRIxLEAST32"\\n", cp);
+               printf("%"PRIxLEAST32"\\\\n", cp);
        }
 }
 
@@ -90,7 +90,7 @@ print_cps_nul_terminated(const char *str)
        for (off = 0; (ret = grapheme_decode_utf8(str + off,
                                                  SIZE_MAX, &cp)) > 0 &&
             cp != 0; off += ret) {
-               printf("%"PRIxLEAST32"\\n", cp);
+               printf("%"PRIxLEAST32"\\\\n", cp);
        }
 }
 .Ed
diff --git a/man/grapheme_encode_utf8.sh b/man/grapheme_encode_utf8.sh
index 0c9b0be..d57a129 100644
--- a/man/grapheme_encode_utf8.sh
+++ b/man/grapheme_encode_utf8.sh
@@ -90,7 +90,7 @@ cps_to_utf8_alloc(const uint_least32_t *cp, size_t cplen)
                        break;
                }
        }
-       str[off] = '\\0';
+       str[off] = '\\\\0';
 
        return str;
 }
diff --git a/man/grapheme_to_lowercase.sh b/man/grapheme_to_lowercase.sh
index 7b90734..635e617 100644
--- a/man/grapheme_to_lowercase.sh
+++ b/man/grapheme_to_lowercase.sh
@@ -1,2 +1,2 @@
-CASE="lowercase"\
+CASE="lowercase" \
        $SH man/template/to_case.sh
diff --git a/man/grapheme_to_titlecase.sh b/man/grapheme_to_titlecase.sh
index 38096dd..e0a42f1 100644
--- a/man/grapheme_to_titlecase.sh
+++ b/man/grapheme_to_titlecase.sh
@@ -1,2 +1,2 @@
-CASE="titlecase"\
+CASE="titlecase" \
        $SH man/template/to_case.sh
diff --git a/man/grapheme_to_uppercase.sh b/man/grapheme_to_uppercase.sh
index d451ea5..7f3f3a0 100644
--- a/man/grapheme_to_uppercase.sh
+++ b/man/grapheme_to_uppercase.sh
@@ -1,2 +1,2 @@
-CASE="uppercase"\
+CASE="uppercase" \
        $SH man/template/to_case.sh
diff --git a/man/template/to_case.sh b/man/template/to_case.sh
index 30951bb..5fbfbfb 100644
--- a/man/template/to_case.sh
+++ b/man/template/to_case.sh
@@ -1,6 +1,6 @@
 cat << EOF
 .Dd 2022-08-26
-.Dt GRAPHEME_TO_$(echo $CASE | tr [:lower:] [:upper:]) 3
+.Dt GRAPHEME_TO_$(printf $CASE | tr [:lower:] [:upper:]) 3
 .Os suckless.org
 .Sh NAME
 .Nm grapheme_to_$CASE

Reply via email to