source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Allow arbitrary argument delimiters for \C, like groff does.
@ 2022-06-06 12:10 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2022-06-06 12:10 UTC (permalink / raw)
  To: source

Log Message:
-----------
Allow arbitrary argument delimiters for \C, like groff does.
The restriction of only allowing ' as the delimiter was introduced
by kristaps@ on 2011/04/09 when he first supported \C.
For most other escape sequences, similar restrictions were relaxed
later on, but for the rarely used \C, it was apparently forgotten.

While here, reject empty character names: they are never valid.

Modified Files:
--------------
    mandoc:
        roff_escape.c

Revision Data
-------------
Index: roff_escape.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff_escape.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lroff_escape.c -Lroff_escape.c -u -p -r1.10 -r1.11
--- roff_escape.c
+++ roff_escape.c
@@ -206,10 +206,6 @@ roff_escape(const char *buf, const int l
 		term = '\b';
 		break;
 	case 'C':
-		if (buf[iarg] != '\'') {
-			rval = ESCAPE_ERROR;
-			goto out;
-		}
 		rval = ESCAPE_SPECIAL;
 		term = '\b';
 		break;
@@ -391,6 +387,11 @@ roff_escape(const char *buf, const int l
 		break;
 
 	case ESCAPE_SPECIAL:
+		if (argl == 0) {
+			err = MANDOCERR_ESC_BADCHAR;
+			rval = ESCAPE_ERROR;
+			break;
+		}
 
 		/*
 		 * The file chars.c only provides one common list of
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-06 12:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 12:10 mandoc: Allow arbitrary argument delimiters for \C, like groff does schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).