Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
STRING_ENQUOTE(3) FreeBSD Library Functions Manual STRING_ENQUOTE(3)

string_enquote, string_dequote
doubly quoted string conversion routines

PDEL Library (libpdel, -lpdel)

#include <stdio.h>
#include <pdel/util/string_quote.h>
char *
string_enquote(const char *str, const char *mtype);
char *
string_dequote(FILE *input, const char *mtype);

These routines handle converting strings to and from a printable form, namely, doubly-quoted strings with C backslash escapes.
string_enquote() encodes the string str using only printable characters and returns the result, which will begin and end with a double quote character. The returned string is allocated with typed_mem(3) type mtype and must be freed by the caller.
string_dequote() reads and parses a doubly-quoted string from input and returns the result, allocated with typed_mem(3) type mtype. The caller must free the returned string. The input stream is assumed to be pointing at the character after the opening double quote character. Upon return, it will be pointing to the character after the closing double quote character.
string_dequote() parses in a liberal manner and does not detect parse errors. Any malformed backslash escapes are passed through unchanged. In other words, if string_dequote() is passed a string that was produced by string_enquote(), it guarantees to reproduce the original string; however, it will successfully parse any input string.

If there was a system error, string_enquote() and string_dequote() return NULL with errno set to the appropriate value. string_dequote() also returns NULL if the end of file is encountered before the closing quote character, in which case errno is set to EINVAL.

string_fp(3), libpdel(3), typed_mem(3)

The PDEL library was developed at Packet Design, LLC.

Archie Cobbs ⟨⟩
April 22, 2002 FreeBSD 12.0-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.