41 lines
917 B
C
41 lines
917 B
C
#ifndef _UTIL_H
|
|
#define _UTIL_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
/* Various utility functions for the gallery */
|
|
|
|
/* Sanitise a given name. Names may only contain alpha-numeric
|
|
* characters, hyphens, underscores and full stop characters.
|
|
*
|
|
* This function sanitises in-place, invalid characters get replaced with
|
|
* underscores.
|
|
*/
|
|
void sanitise_name( char* name );
|
|
|
|
/* Cross-compatibility hack */
|
|
#ifndef PATHSEP
|
|
# ifdef WIN32
|
|
# define PATHSEP "\\"
|
|
# else
|
|
# define PATHSEP "/"
|
|
# endif
|
|
#endif
|
|
|
|
/* Construct a path from given directory names. */
|
|
char* construct_path( const char** segments, size_t count );
|
|
|
|
/* Obtain the CGI filesystem directory */
|
|
char* get_cgidir();
|
|
|
|
/* Obtain the CGI directory URI */
|
|
char* get_cgiuri();
|
|
|
|
/* Local versions of dirname and basename. These allocate and return copies of
|
|
* the strings passed to them.
|
|
*/
|
|
char* get_basename( char* path );
|
|
char* get_dirname( char* path );
|
|
|
|
#endif
|