Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
STRING_ENQUOTE(3)      FreeBSD Library Functions Manual	     STRING_ENQUOTE(3)

NAME
     string_enquote, string_dequote -- doubly quoted string conversion rou-
     tines

LIBRARY
     PDEL Library (libpdel, -lpdel)

SYNOPSIS
     #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);

DESCRIPTION
     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 point-
     ing at the	character after	the opening double quote character.  Upon re-
     turn, 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 er-
     rors.  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; how-
     ever, it will successfully	parse any input	string.

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

SEE ALSO
     string_fp(3), libpdel(3), typed_mem(3)

HISTORY
     The PDEL library was developed at Packet Design, LLC.
     http://www.packetdesign.com/

AUTHORS
     Archie Cobbs <archie@freebsd.org>

FreeBSD	13.0			April 22, 2002			  FreeBSD 13.0

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | RETURN VALUES | SEE ALSO | HISTORY | AUTHORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=string_enquote&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help