bug-gnu-pspp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PSPP-BUG: [bug #18860] Need a quoting function and/or conversion .


From: John Darrington
Subject: PSPP-BUG: [bug #18860] Need a quoting function and/or conversion .
Date: Wed, 24 Jan 2007 08:28:42 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060830 Firefox/1.5.0.7 (Debian-1.5.dfsg+1.5.0.7-2)

URL:
  <http://savannah.gnu.org/bugs/?18860>

                 Summary: Need a quoting function and/or conversion .
                 Project: PSPP
            Submitted by: jmd
            Submitted on: Wednesday 01/24/2007 at 16:28
                Category: Graphical User Interface
                Severity: 3 - Ordinary
                  Status: None
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
                  Effort: 0.00

    _______________________________________________________

Details:


>From pspp-dev:

Ben Pfaff address@hidden writes: 
 I'd suggest adding a function, analogous to the "quote" function in gnulib,
that returns its argument as a quoted string in syntax format. It could
return it in single quotes if it doesn't contain a single quote, in double
quotes if it doesn't contain a double quote, or in single quotes with doubled
single quotes otherwise.

John Darrington <address@hidden> writes:

> I was thinking that an alternative approach would be to implement a
> special conversion specification within the
> create_syntax_string_source function.  Then we could simply write
> something like:
>
>  create_syntax_string_source ("EXPORT OUTFILE=%q.", de->file_name);
>
> This way, there's no need for the caller to worry about buffers or
> dealloction at all.

Yes, that's a good idea.

However, I'd propose a slightly different syntax:
        create_syntax_string_source ("EXPORT OUTFILE=%sq.",
                                     de->file_name);
If you make the full specification %sq, then you can still get
GCC to check that a "char *" argument is present by telling it
that it's a printf-like function.  There'd need to be a suffix
character for unquoted strings too, e.g. %su, but all in all the
slight inconvenience of using 2-character conversions is vastly
outweighed (in my opinion) by having compile-time checking.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?18860>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]