This commit was generated by cvs2svn to compensate for changes in r1538,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://10.65.10.50/trunk@1539 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a4626341ed
commit
8e035e517d
116
cb5/u4name.c
116
cb5/u4name.c
@ -1,4 +1,12 @@
|
|||||||
/* u4name.c (c)Copyright Sequiter Software Inc., 1990-1994. All rights reserved. */
|
/* u4name.c (c)Copyright Sequiter Software Inc., 1990-1994. All rights reserved. */
|
||||||
|
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* Soragna 20 Giugno 1995. Modificate le funzioni che discriminavano tra UNIX e DOS!.*/
|
||||||
|
/* In alcuni casi si eccedeva la dimensione delle stringhe di copia a causa della */
|
||||||
|
/* differenza tra / e \ che riscontrano queste funzioni. Siccome le applicazioni */
|
||||||
|
/* PR.A.S.S.I. non sono sensibili a tali differenze, e' meglio adeguare il qui */
|
||||||
|
/* presente file. Sostanzialmente tutti i controlli su / e \ vengono unificati. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
#include "d4all.h"
|
#include "d4all.h"
|
||||||
#ifndef S4UNIX
|
#ifndef S4UNIX
|
||||||
@ -29,11 +37,14 @@ void S4FUNCTION u4name_ext( char *name, int len_result, char *new_ext, int do_re
|
|||||||
ext_pos = on_pos ;
|
ext_pos = on_pos ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
#ifdef S4UNIX
|
/* Soragna 20 Giugno 1995. Questa discriminazione provoca danni.
|
||||||
if ( name[on_pos] == '/' ) break ;
|
#ifdef S4UNIX
|
||||||
#else
|
if ( name[on_pos] == '/' ) break ;
|
||||||
if ( name[on_pos] == '\\' ) break ;
|
#else
|
||||||
#endif
|
if ( name[on_pos] == '\\' ) break ;
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
if ( name[on_pos] == '/' || name[on_pos] == '\\' ) break ;
|
||||||
if ( on_pos == 0 ) break ;
|
if ( on_pos == 0 ) break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,45 +95,66 @@ void S4FUNCTION u4name_make( char *buf, int buf_len, char *default_drive, char *
|
|||||||
else
|
else
|
||||||
default_directory_len = 0 ;
|
default_directory_len = 0 ;
|
||||||
|
|
||||||
|
/* Soragn 20 Giugno 1995. May cause improper assigns.
|
||||||
|
#ifdef S4UNIX
|
||||||
|
if ( file_name[0] != '/' && default_directory_len > 0 )
|
||||||
|
#else
|
||||||
|
if ( file_name[0] != '\\' && default_directory_len > 0 )
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
if ( (file_name[0] != '/' || file_name[0] != '\\') && default_directory_len > 0 )
|
||||||
|
{
|
||||||
|
if ( pos+2 >= buf_len )
|
||||||
|
return ;
|
||||||
|
/* Soragna 20 Giugno 1995. Anche questo controllo deve essere cambiato
|
||||||
|
#ifdef S4UNIX
|
||||||
|
buf[pos++] = '/' ;
|
||||||
|
if ( default_directory[0] == '/' )
|
||||||
|
#else
|
||||||
|
buf[pos++] = '\\' ;
|
||||||
|
if ( default_directory[0] == '\\' )
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
#ifdef S4UNIX
|
#ifdef S4UNIX
|
||||||
if ( file_name[0] != '/' && default_directory_len > 0 )
|
buf[pos++] = '/' ;
|
||||||
#else
|
#else
|
||||||
if ( file_name[0] != '\\' && default_directory_len > 0 )
|
buf[pos++] = '\\' ;
|
||||||
#endif
|
#endif
|
||||||
{
|
if ( default_directory[0] == '/' || default_directory[0] == '\\' )
|
||||||
if ( pos+2 >= buf_len )
|
default_directory++ ;
|
||||||
return ;
|
|
||||||
#ifdef S4UNIX
|
|
||||||
buf[pos++] = '/' ;
|
|
||||||
if ( default_directory[0] == '/' )
|
|
||||||
#else
|
|
||||||
buf[pos++] = '\\' ;
|
|
||||||
if ( default_directory[0] == '\\' )
|
|
||||||
#endif
|
|
||||||
default_directory++ ;
|
|
||||||
|
|
||||||
default_directory_len = strlen(default_directory) ;
|
default_directory_len = strlen(default_directory) ;
|
||||||
|
|
||||||
u4ncpy( buf+pos, default_directory, buf_len - pos ) ;
|
u4ncpy( buf+pos, default_directory, buf_len - pos ) ;
|
||||||
pos += default_directory_len ;
|
pos += default_directory_len ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pos >= buf_len )
|
if ( pos >= buf_len )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if ( pos > 0 )
|
if ( pos > 0 )
|
||||||
{
|
{
|
||||||
|
/* Soragna 20 Giugno 1995. Pure questo non sfugge.
|
||||||
|
#ifdef S4UNIX
|
||||||
|
if ( buf[pos-1] != '/' )
|
||||||
|
buf[pos++] = '/' ;
|
||||||
|
if ( file_name[0] == '/' )
|
||||||
|
file_name++ ;
|
||||||
|
#else
|
||||||
|
if ( buf[pos-1] != '\\' )
|
||||||
|
buf[pos++] = '\\' ;
|
||||||
|
if ( file_name[0] == '\\' )
|
||||||
|
file_name++ ;
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
if ( buf[pos-1] != '/' && buf[pos-1] != '\\' )
|
||||||
#ifdef S4UNIX
|
#ifdef S4UNIX
|
||||||
if ( buf[pos-1] != '/' )
|
|
||||||
buf[pos++] = '/' ;
|
buf[pos++] = '/' ;
|
||||||
if ( file_name[0] == '/' )
|
|
||||||
file_name++ ;
|
|
||||||
#else
|
#else
|
||||||
if ( buf[pos-1] != '\\' )
|
buf[pos++] = '\\' ;
|
||||||
buf[pos++] = '\\' ;
|
|
||||||
if ( file_name[0] == '\\' )
|
|
||||||
file_name++ ;
|
|
||||||
#endif
|
#endif
|
||||||
|
if ( file_name[0] == '/' || file_name[0] == '\\' )
|
||||||
|
file_name++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
u4ncpy( buf+pos, file_name, buf_len-pos ) ;
|
u4ncpy( buf+pos, file_name, buf_len-pos ) ;
|
||||||
@ -146,11 +178,16 @@ void S4FUNCTION u4name_piece( char *result, int len_result, char *from, int giv
|
|||||||
{
|
{
|
||||||
switch ( from[on_pos] )
|
switch ( from[on_pos] )
|
||||||
{
|
{
|
||||||
#ifdef S4UNIX
|
/*
|
||||||
|
Soragna 20 Giugno 1995. Questo era quello che faceva piu' danni.
|
||||||
|
#ifdef S4UNIX
|
||||||
|
case '/':
|
||||||
|
#else
|
||||||
|
case '\\':
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
case '/':
|
case '/':
|
||||||
#else
|
|
||||||
case '\\':
|
case '\\':
|
||||||
#endif
|
|
||||||
case ':':
|
case ':':
|
||||||
if (name_pos == 0) name_pos = on_pos + 1 ;
|
if (name_pos == 0) name_pos = on_pos + 1 ;
|
||||||
are_past_ext = 1 ;
|
are_past_ext = 1 ;
|
||||||
@ -268,11 +305,14 @@ int S4FUNCTION u4name_path( char *result, int len_result, char *from )
|
|||||||
for( on_pos = 0 ; result[on_pos] != 0 ; on_pos++ ) ;
|
for( on_pos = 0 ; result[on_pos] != 0 ; on_pos++ ) ;
|
||||||
|
|
||||||
for( ; on_pos >= 0 ; on_pos-- )
|
for( ; on_pos >= 0 ; on_pos-- )
|
||||||
#ifdef S4UNIX
|
/* Soragna 20 Giugno 1995. Anche questo puo' causare gravi macelli.
|
||||||
if( result[on_pos] == '/' || result[on_pos] == ':' ) break ; /* end of path */
|
#ifdef S4UNIX
|
||||||
#else
|
if( result[on_pos] == '/' || result[on_pos] == ':' ) break ;
|
||||||
if( result[on_pos] == '\\' || result[on_pos] == ':' ) break ; /* end of path */
|
#else
|
||||||
#endif
|
if( result[on_pos] == '\\' || result[on_pos] == ':' ) break ;
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
if( result[on_pos] == '/' || result[on_pos] == '\\' || result[on_pos] == ':' ) break ; /* end of path */
|
||||||
|
|
||||||
if( on_pos < len_result )
|
if( on_pos < len_result )
|
||||||
result[++on_pos] = '\0' ;
|
result[++on_pos] = '\0' ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user