aboutsummaryrefslogtreecommitdiff
path: root/mktpl
diff options
context:
space:
mode:
Diffstat (limited to 'mktpl')
-rw-r--r--mktpl/mktpl.lex12
1 files changed, 10 insertions, 2 deletions
diff --git a/mktpl/mktpl.lex b/mktpl/mktpl.lex
index f0674b7..e184c0e 100644
--- a/mktpl/mktpl.lex
+++ b/mktpl/mktpl.lex
@@ -65,12 +65,20 @@ eval()
void
text()
{
- int i;
+ int i, ofs;
if(!len) return;
printf("printf(\"");
- for(i = 0; i < len; i++){
+ for(i = ofs = 0; i < len; i++){
+ /*
+ * C89 compilers need only support 509-length
+ * string literals.
+ */
+ if(i-ofs >= 509){
+ printf("\");\nprintf(\"");
+ ofs = i;
+ }
if(buf[i] == '\\') printf("\\\\");
else if(buf[i] == '"') printf("\\\"");
else if(buf[i] == '\n') printf("\\n");