/*++ /* NAME /* mystrtok 3 /* SUMMARY /* safe tokenizer /* SYNOPSIS /* #include <stringops.h> /* /* char *mystrtok(bufp, delimiters) /* char **bufp; /* const char *delimiters; /* /* char *mystrtokq(bufp, delimiters, parens) /* char **bufp; /* const char *delimiters; /* const char *parens; /* /* char *mystrtokdq(bufp, delimiters) /* char **bufp; /* const char *delimiters; /* /* char *mystrtok_cw(bufp, delimiters, blame) /* char **bufp; /* const char *delimiters; /* const char *blame; /* /* char *mystrtokq_cw(bufp, delimiters, parens, blame) /* char **bufp; /* const char *delimiters; /* const char *parens; /* const char *blame; /* /* char *mystrtokdq_cw(bufp, delimiters, blame) /* char **bufp; /* const char *delimiters; /* const char *blame; /* DESCRIPTION /* mystrtok() splits a buffer on the specified \fIdelimiters\fR. /* Tokens are delimited by runs of delimiters, so this routine /* cannot return zero-length tokens. /* /* mystrtokq() is like mystrtok() but will not split text /* between balanced parentheses. \fIparens\fR specifies the /* opening and closing parenthesis (one of each). The set of /* \fIparens\fR must be distinct from the set of \fIdelimiters\fR. /* /* mystrtokdq() is like mystrtok() but will not split text /* between double quotes. The backslash character may be used /* to escape characters. The double quote and backslash /* character must not appear in the set of \fIdelimiters\fR. /* /* The \fIbufp\fR argument specifies the start of the search; it /* is updated with each call. The input is destroyed. /* /* The result value is the next token, or a null pointer when the /* end of the buffer was reached. /* /* mystrtok_cw(), mystrtokq_cw(), and mystrtokdq_cw, log a /* warning and return null when the result would look like /* comment. The \fBblame\fR argument provides context for /* warning messages. Specify a null pointer to disable the /* comment check. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
/* System library. */
#include <sys_defs.h> #include <string.h>
/* Utility library. */
#include <msg.h> #include <stringops.h>
/* mystrtok_warn - warn for #comment after other text */
staticvoid mystrtok_warn(constchar *start, constchar *bufp, constchar *blame)
{
msg_warn("%s: #comment after other text is not allowed: %s %.20s...",
blame, start, bufp);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.