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

FreeBSD Manual Pages

  
 
  

home | help
STRING_ENQUOTE(3)	    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
       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  pro-
       duced  by  string_enquote(),  it	 guarantees  to	reproduce the original
       string; however,	it will	successfully parse any input string.

RETURN VALUES
       If there	was a system error, string_enquote() and string_dequote()  re-
       turn  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.

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	ports 15.0		April 22, 2002		     STRING_ENQUOTE(3)

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

home | help