669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
|
blob_zero(&x);
for(i=2; i<g.argc; i++){
char zBuf[100];
const char *zName = g.argv[i];
file_canonical_name(zName, &x, 0);
fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x));
blob_reset(&x);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName));
fossil_print(" file_size = %s\n", zBuf);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName));
fossil_print(" file_mtime = %s\n", zBuf);
fossil_print(" file_isfile = %d\n", file_wd_isfile(zName));
fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zName));
fossil_print(" file_islink = %d\n", file_wd_islink(zName));
fossil_print(" file_isexe = %d\n", file_wd_isexe(zName));
fossil_print(" file_isdir = %d\n", file_wd_isdir(zName));
}
|
|
|
|
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
|
blob_zero(&x);
for(i=2; i<g.argc; i++){
char zBuf[100];
const char *zName = g.argv[i];
file_canonical_name(zName, &x, 0);
fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x));
blob_reset(&x);
sqlite4_snprintf(zBuf, sizeof(zBuf), "%lld", file_wd_size(zName));
fossil_print(" file_size = %s\n", zBuf);
sqlite4_snprintf(zBuf, sizeof(zBuf), "%lld", file_wd_mtime(zName));
fossil_print(" file_mtime = %s\n", zBuf);
fossil_print(" file_isfile = %d\n", file_wd_isfile(zName));
fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zName));
fossil_print(" file_islink = %d\n", file_wd_islink(zName));
fossil_print(" file_isexe = %d\n", file_wd_isexe(zName));
fossil_print(" file_isdir = %d\n", file_wd_isdir(zName));
}
|
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
|
*/
if( (strlen(zDir) + 17) >= (size_t)nBuf ){
fossil_fatal("insufficient space for temporary filename");
}
do{
if( cnt++>20 ) fossil_panic("cannot generate a temporary filename");
sqlite3_snprintf(nBuf-17, zBuf, "%s/", zDir);
j = (int)strlen(zBuf);
sqlite3_randomness(15, &zBuf[j]);
for(i=0; i<15; i++, j++){
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
}
zBuf[j] = 0;
}while( file_size(zBuf)>=0 );
#if defined(_WIN32)
|
|
|
|
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
|
*/
if( (strlen(zDir) + 17) >= (size_t)nBuf ){
fossil_fatal("insufficient space for temporary filename");
}
do{
if( cnt++>20 ) fossil_panic("cannot generate a temporary filename");
sqlite4_snprintf(zBuf, nBuf-17, "%s/", zDir);
j = (int)strlen(zBuf);
sqlite4_randomness(0, 15, &zBuf[j]);
for(i=0; i<15; i++, j++){
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
}
zBuf[j] = 0;
}while( file_size(zBuf)>=0 );
#if defined(_WIN32)
|
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
|
/*
** Translate MBCS to UTF8. Return a pointer to the translated text.
** Call fossil_mbcs_free() to deallocate any memory used to store the
** returned pointer when done.
*/
char *fossil_mbcs_to_utf8(const char *zMbcs){
#ifdef _WIN32
extern char *sqlite3_win32_mbcs_to_utf8(const char*);
return sqlite3_win32_mbcs_to_utf8(zMbcs);
#else
return (char*)zMbcs; /* No-op on unix */
#endif
}
/*
** Translate UTF8 to MBCS for use in system calls. Return a pointer to the
** translated text.. Call fossil_mbcs_free() to deallocate any memory
** used to store the returned pointer when done.
*/
char *fossil_utf8_to_mbcs(const char *zUtf8){
#ifdef _WIN32
extern char *sqlite3_win32_utf8_to_mbcs(const char*);
return sqlite3_win32_utf8_to_mbcs(zUtf8);
#else
return (char*)zUtf8; /* No-op on unix */
#endif
}
/*
** Return the value of an environment variable as UTF8.
|
|
|
|
|
|
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
|
/*
** Translate MBCS to UTF8. Return a pointer to the translated text.
** Call fossil_mbcs_free() to deallocate any memory used to store the
** returned pointer when done.
*/
char *fossil_mbcs_to_utf8(const char *zMbcs){
#ifdef _WIN32
extern char *sqlite4_win32_mbcs_to_utf8(const char*);
return sqlite4_win32_mbcs_to_utf8(zMbcs);
#else
return (char*)zMbcs; /* No-op on unix */
#endif
}
/*
** Translate UTF8 to MBCS for use in system calls. Return a pointer to the
** translated text.. Call fossil_mbcs_free() to deallocate any memory
** used to store the returned pointer when done.
*/
char *fossil_utf8_to_mbcs(const char *zUtf8){
#ifdef _WIN32
extern char *sqlite4_win32_utf8_to_mbcs(const char*);
return sqlite4_win32_utf8_to_mbcs(zUtf8);
#else
return (char*)zUtf8; /* No-op on unix */
#endif
}
/*
** Return the value of an environment variable as UTF8.
|
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
|
/*
** Translate MBCS to UTF8. Return a pointer. Call fossil_mbcs_free()
** to deallocate any memory used to store the returned pointer when done.
*/
void fossil_mbcs_free(char *zOld){
#ifdef _WIN32
extern void sqlite3_free(void*);
sqlite3_free(zOld);
#else
/* No-op on unix */
#endif
}
/*
** Like fopen() but always takes a UTF8 argument.
|
|
|
|
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
|
/*
** Translate MBCS to UTF8. Return a pointer. Call fossil_mbcs_free()
** to deallocate any memory used to store the returned pointer when done.
*/
void fossil_mbcs_free(char *zOld){
#ifdef _WIN32
extern void sqlite4_free(void*);
sqlite4_free(0, zOld);
#else
/* No-op on unix */
#endif
}
/*
** Like fopen() but always takes a UTF8 argument.
|