GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
cstrc(l) BEGEMOT Library cstrc(l)

cstrc, cstrd - convert between ANSI C-strings and strings

# include <begemot.h>

char * cstrc(char **pstr, char delim, size_t *plen);

char * cstrd(const char *str, char delim, size_t len);

int cstrwarn;

The cstrc function converts a string as specified in the ANSI C-standard to the usual internal representation. All escape sequences are (hopefully) recognized. Setting cstrwarn to any non-zero value enables some warning messages, which are emitted via warn(l). Pstr is the address of a pointer to the string to be parsed. Delim is the character at which the parsing should stop. It should be a single or a double quote character. Parsing stops also if a NUL character is found. * pstr is left pointing to the terminating character. At entry to the function * pstr should point behind the initial delimiter. * plen will hold the number of bytes in the output string. The string will be NUL termninated, but note, that it may contain embedded NULs.

Cstrd prints a string with non-printable characters converted to escape sequences. delim is escaped in the output string (usually '\'' or '"').

The user is responsible the deallocate the memory returned by cstrc and cstrd. Both functions call xalloc(l) and xrealloc(l) and therefor end in panic(l) if not enough memory is available.

Both functions return allocated memory that must be freed by the caller. They may never return NULL.

panic(l), xalloc(l), xrealloc(3b)

Certainly.
9 Oct 1996 BEGEMOT

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

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