🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #64285

Re: Help with INN message

#64285
From: Russ Allbery
Date: Thu, 06 Mar 2003 00:31
45 lines
2721 bytes
Russ Allbery <rra@stanford.edu> writes:

> Looks like it's fixed already in 2.4-to-be.  INN 2.3 does this work in
> frontends/innconfval.c, which currently only quotes values that contain
> spaces.  That's obviously insufficient.  I'll look at making it do the
> same thing that INN 2.4 will do.

Fixed thusly:

--- inn/frontends/innconfval.c	2002/02/16 19:49:27	1.17.2.1
+++ inn/frontends/innconfval.c	2003/03/06 00:30:52
@@ -35,14 +35,22 @@ char *upit(char *v)
 void
 printit(char *v, const char *val)
 {
+    const char *letter;
+
     switch (format) {
 	case 0: printf("%s\n", val); break;
 	case 1:   /* sh */
 	    v = upit(v);
-	    if ((strchr(val, ' ') == NULL) && *val)
-	    	printf("%s=%s; export %s;\n", v, val, v);
-	    else
-	    	printf("%s=\"%s\"; export %s;\n", v, val, v);
+            printf("%s='", v);
+            for (letter = val; letter != NULL && *letter != '\0'; letter++) {
+                if (*letter == '\'')
+                    fputs("'\\''", stdout);
+                else if (*letter == '\\')
+                    fputs("\\\\", stdout);
+                else
+                    fputc(*letter, stdout);
+            }
+            printf("'; export %s;\n", v);
 	    break;
 	case 2:   /* csh */
 	    if ((strchr(val, ' ') == NULL) && *val)

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID: <ylfzq1tjx8.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
References: <200303022316.h22NGWs4016132@www.aarg.net> <200303050145.h251jLFS028759@www.aarg.net> <200303051019.h25AJKmH022648@www.aarg.net> <200303051150.h25BoTSM028106@www.aarg.net> <b459h7$cil$1@puck.litech.org> <yl3cm1k85g.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <ylfzq1tjx8.fsf@windlord.stanford.edu>
Subject: Re: Help with INN message
Date: Wed, 05 Mar 2003 16:31:31 -0800
From: Russ Allbery <rra@stanford.edu>
References: <200303022316.h22NGWs4016132@www.aarg.net> <200303050145.h251jLFS028759@www.aarg.net> <200303051019.h25AJKmH022648@www.aarg.net> <200303051150.h25BoTSM028106@www.aarg.net> <b459h7$cil$1@puck.litech.org> <yl3cm1k85g.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
Newsgroups: news.software.nntp
Organization: The Eyrie
Lines: 44
NNTP-Posting-Host: windlord.stanford.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.Stanford.EDU 1046910691 3092 171.64.13.23 (6 Mar 2003 00:31:31 GMT)
X-Complaints-To: news@news.stanford.edu
User-Agent: Gnus/5.090008 (Oort Gnus v0.08) XEmacs/21.4 (Honest Recruiter,
 sparc-sun-solaris2.6)
Cancel-Lock: sha1:DgKrCIzAxj82Qc3El0RjrLKwGXw=