/usr/include/ClearSilver/util/neo_str.h is in clearsilver-dev 0.10.5-1.6build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | /*
* Copyright 2001-2004 Brandon Long
* All Rights Reserved.
*
* ClearSilver Templating System
*
* This code is made available under the terms of the ClearSilver License.
* http://www.clearsilver.net/license.hdf
*
*/
#ifndef __NEO_STR_H_
#define __NEO_STR_H_ 1
__BEGIN_DECLS
#include <stdarg.h>
#include <stdio.h>
#include "util/neo_misc.h"
/* This modifies the string its called with by replacing all the white
* space on the end with \0, and returns a pointer to the first
* non-white space character in the string
*/
char *neos_strip (char *s);
void neos_lower (char *s);
char *sprintf_alloc (const char *fmt, ...) ATTRIBUTE_PRINTF(1,2);
char *nsprintf_alloc (int start_size, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3);
char *vsprintf_alloc (const char *fmt, va_list ap);
char *vnsprintf_alloc (int start_size, const char *fmt, va_list ap);
/* Versions of the above which actually return a length, necessary if
* you expect embedded NULLs */
int vnisprintf_alloc (char **buf, int start_size, const char *fmt, va_list ap);
int visprintf_alloc (char **buf, const char *fmt, va_list ap);
int isprintf_alloc (char **buf, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3);
typedef struct _string
{
char *buf;
int len;
int max;
} STRING;
typedef struct _string_array
{
char **entries;
int count;
int max;
} STRING_ARRAY;
/* At some point, we should add the concept of "max len" to these so we
* can't get DoS'd by someone sending us a line without an end point,
* etc. */
void string_init (STRING *str);
NEOERR *string_set (STRING *str, const char *buf);
NEOERR *string_append (STRING *str, const char *buf);
NEOERR *string_appendn (STRING *str, const char *buf, int l);
NEOERR *string_append_char (STRING *str, char c);
NEOERR *string_appendf (STRING *str, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3);
NEOERR *string_appendvf (STRING *str, const char *fmt, va_list ap);
NEOERR *string_readline (STRING *str, FILE *fp);
void string_clear (STRING *str);
/* typedef struct _ulist ULIST; */
#include "util/ulist.h"
/* s is not const because we actually temporarily modify the string
* during split */
NEOERR *string_array_split (ULIST **list, char *s, const char *sep,
int max);
BOOL reg_search (const char *re, const char *str);
/* NEOS_ESCAPE details the support escape contexts/modes handled
* by various NEOS helper methods and reused in CS itself. */
typedef enum
{
NEOS_ESCAPE_UNDEF = 0, /* Used to force eval-time checking */
NEOS_ESCAPE_NONE = 1<<0,
NEOS_ESCAPE_HTML = 1<<1,
NEOS_ESCAPE_SCRIPT = 1<<2,
NEOS_ESCAPE_URL = 1<<3,
NEOS_ESCAPE_FUNCTION = 1<<4 /* Special case used to override the others */
} NEOS_ESCAPE;
NEOERR* neos_escape(UINT8 *buf, int buflen, char esc_char, const char *escape,
char **esc);
UINT8 *neos_unescape (UINT8 *s, int buflen, char esc_char);
char *repr_string_alloc (const char *s);
/* This is the "super" escape call which will call the proper helper
* variable escape function based on the passed in context. */
NEOERR *neos_var_escape (NEOS_ESCAPE context,
const char *in,
char **esc);
/* Generic data escaping helper functions used by neos_contextual_escape
* and cs built-ins. */
NEOERR *neos_url_escape (const char *in, char **esc,
const char *other);
NEOERR *neos_js_escape (const char *in, char **esc);
NEOERR *neos_html_escape (const char *src, int slen,
char **out);
NEOERR *neos_url_validate (const char *in, char **esc);
__END_DECLS
#endif /* __NEO_STR_H_ */
|