int i_env = 0;
char **ppsz_env = NULL;
char *psz_tmp;
- char sep;
size_t i_buffer;
char *p_buffer;
char *psz_cwd, *psz_file = NULL;
int i_ret;
-#ifdef WIN32
- sep = '\\';
-#else
- sep = '/';
-#endif
-
/* Create environment for the CGI */
TAB_APPEND( i_env, ppsz_env, strdup("GATEWAY_INTERFACE=CGI/1.1") );
TAB_APPEND( i_env, ppsz_env, strdup("SERVER_PROTOCOL=HTTP/1.1") );
}
}
- psz_file = strrchr( p_args->file.file, sep );
+ psz_file = strrchr( p_args->file.file, DIR_SEP_CHAR );
if( psz_file != NULL )
{
psz_file++;
NULL );
psz_tmp = strdup( p_args->file.file );
- p = strrchr( psz_tmp, sep );
+ p = strrchr( psz_tmp, DIR_SEP_CHAR );
if( p != NULL )
{
*p = '\0';
int i_dirlen;
- char sep;
-
-#if defined( WIN32 )
- sep = '\\';
-#else
- sep = '/';
-#endif
-
if( ( p_dir = utf8_opendir( psz_dir ) ) == NULL )
{
if( errno != ENOENT && errno != ENOTDIR )
msg_Dbg( p_intf, "dir=%s", psz_dir );
- snprintf( dir, sizeof( dir ), "%s%c.access", psz_dir, sep );
+ snprintf( dir, sizeof( dir ), "%s"DIR_SEP".access", psz_dir );
if( ( file = utf8_fopen( dir, "r" ) ) != NULL )
{
char line[1024];
fclose( file );
}
- snprintf( dir, sizeof( dir ), "%s%c.hosts", psz_dir, sep );
+ snprintf( dir, sizeof( dir ), "%s"DIR_SEP".hosts", psz_dir );
p_acl = ACL_Create( p_intf, false );
if( ACL_LoadFile( p_acl, dir ) )
{
continue;
}
- snprintf( dir, sizeof( dir ), "%s%c%s", psz_dir, sep, psz_filename );
+ snprintf( dir, sizeof( dir ), "%s"DIR_SEP"%s", psz_dir, psz_filename );
free( psz_filename );
if( ParseDirectory( p_intf, psz_root, dir ) )
char *psz_dir;
char *p;
int i_len = strlen(psz_src);
- const char sep = DIR_SEP_CHAR;
psz_dir = malloc( i_len + 2 );
strcpy( psz_dir, psz_src );
/* Add a trailing sep to ease the .. step */
- psz_dir[i_len] = sep;
+ psz_dir[i_len] = DIR_SEP_CHAR;
psz_dir[i_len + 1] = '\0';
#if (DIR_SEP_CHAR != '/')
p = psz_dir;
while( (p = strchr( p, '/' )) != NULL )
{
- *p = sep;
+ *p = DIR_SEP_CHAR;
}
#endif
/* FIXME: this could be O(N) rather than O(N²)... */
/* Remove multiple separators and /./ */
p = psz_dir;
- while( (p = strchr( p, sep )) != NULL )
+ while( (p = strchr( p, DIR_SEP_CHAR )) != NULL )
{
- if( p[1] == sep )
+ if( p[1] == DIR_SEP_CHAR )
memmove( &p[1], &p[2], strlen(&p[2]) + 1 );
- else if( p[1] == '.' && p[2] == sep )
+ else if( p[1] == '.' && p[2] == DIR_SEP_CHAR )
memmove( &p[1], &p[3], strlen(&p[3]) + 1 );
else
p++;
{
/* Fix all .. dir */
p = psz_dir + 3;
- while( (p = strchr( p, sep )) != NULL )
+ while( (p = strchr( p, DIR_SEP_CHAR )) != NULL )
{
- if( p[-1] == '.' && p[-2] == '.' && p[-3] == sep )
+ if( p[-1] == '.' && p[-2] == '.' && p[-3] == DIR_SEP_CHAR )
{
char *q;
p[-3] = '\0';
- if( (q = strrchr( psz_dir, sep )) != NULL )
+ if( (q = strrchr( psz_dir, DIR_SEP_CHAR )) != NULL )
{
memmove( q + 1, p + 1, strlen(p + 1) + 1 );
p = q + 1;
/* Remove trailing sep if there are at least 2 sep in the string
* (handles the C:\ stuff) */
- p = strrchr( psz_dir, sep );
- if( p != NULL && p[1] == '\0' && p != strchr( psz_dir, sep ) )
+ p = strrchr( psz_dir, DIR_SEP_CHAR );
+ if( p != NULL && p[1] == '\0' && p != strchr( psz_dir, DIR_SEP_CHAR ) )
*p = '\0';
return psz_dir;