Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Always convert the result of getenv() into UTF8. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
57152086b87f9ab8c62b6834dd836b7d |
| User & Date: | drh 2012-02-16 01:03:37.421 |
Context
|
2012-02-16
| ||
| 03:15 | Fix typo in the new fossil_getenv() function for windows. ... (check-in: 6c835ea8c7 user: drh tags: trunk) | |
| 01:03 | Always convert the result of getenv() into UTF8. ... (check-in: 57152086b8 user: drh tags: trunk) | |
|
2012-02-14
| ||
| 01:48 | Improved description of tag changes in the EVENT table, and hence on the timeline. ... (check-in: 7367cec4c8 user: drh tags: trunk) | |
Changes
Changes to src/cgi.c.
| ︙ | ︙ | |||
912 913 914 915 916 917 918 |
}
/* If no match is found and the name begins with an upper-case
** letter, then check to see if there is an environment variable
** with the given name.
*/
if( fossil_isupper(zName[0]) ){
| | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 |
}
/* If no match is found and the name begins with an upper-case
** letter, then check to see if there is an environment variable
** with the given name.
*/
if( fossil_isupper(zName[0]) ){
const char *zValue = fossil_getenv(zName);
if( zValue ){
cgi_set_parameter_nocopy(zName, zValue);
CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
return zValue;
}
}
CGIDEBUG(("no-match [%s]\n", zName));
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
454 455 456 457 458 459 460 |
"# repositories.\n"
"#\n", -1
);
}
status_report(&text, "# ", 1, 0);
zEditor = db_get("editor", 0);
if( zEditor==0 ){
| | | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
"# repositories.\n"
"#\n", -1
);
}
status_report(&text, "# ", 1, 0);
zEditor = db_get("editor", 0);
if( zEditor==0 ){
zEditor = fossil_getenv("VISUAL");
}
if( zEditor==0 ){
zEditor = fossil_getenv("EDITOR");
}
if( zEditor==0 ){
blob_append(&text,
"#\n"
"# Since no default text editor is set using EDITOR or VISUAL\n"
"# environment variables or the \"fossil set editor\" command,\n"
"# and because no check-in comment was specified using the \"-m\"\n"
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
659 660 661 662 663 664 665 |
** connection. An error results in process abort.
*/
static sqlite3 *openDatabase(const char *zDbName){
int rc;
const char *zVfs;
sqlite3 *db;
| | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 |
** connection. An error results in process abort.
*/
static sqlite3 *openDatabase(const char *zDbName){
int rc;
const char *zVfs;
sqlite3 *db;
zVfs = fossil_getenv("FOSSIL_VFS");
rc = sqlite3_open_v2(
zDbName, &db,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
zVfs
);
if( rc!=SQLITE_OK ){
db_err(sqlite3_errmsg(db));
|
| ︙ | ︙ | |||
707 708 709 710 711 712 713 |
** case, invoke this routine with useAttach as 1.
*/
void db_open_config(int useAttach){
char *zDbName;
const char *zHome;
if( g.configOpen ) return;
#if defined(_WIN32)
| | | | | < | | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
** case, invoke this routine with useAttach as 1.
*/
void db_open_config(int useAttach){
char *zDbName;
const char *zHome;
if( g.configOpen ) return;
#if defined(_WIN32)
zHome = fossil_getenv("LOCALAPPDATA");
if( zHome==0 ){
zHome = fossil_getenv("APPDATA");
if( zHome==0 ){
char *zDrive = fossil_getenv("HOMEDRIVE");
zHome = fossil_getenv("HOMEPATH");
if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
}
}
if( zHome==0 ){
fossil_fatal("cannot locate home directory - "
"please set the LOCALAPPDATA or APPDATA or HOMEPATH "
"environment variables");
}
#else
zHome = fossil_getenv("HOME");
if( zHome==0 ){
fossil_fatal("cannot locate home directory - "
"please set the HOME environment variable");
}
#endif
if( file_isdir(zHome)!=1 ){
fossil_fatal("invalid home directory: %s", zHome);
|
| ︙ | ︙ | |||
1141 1142 1143 1144 1145 1146 1147 |
void db_create_default_users(int setupUserOnly, const char *zDefaultUser){
const char *zUser = zDefaultUser;
if( zUser==0 ){
zUser = db_get("default-user", 0);
}
if( zUser==0 ){
#if defined(_WIN32)
| | | | 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 |
void db_create_default_users(int setupUserOnly, const char *zDefaultUser){
const char *zUser = zDefaultUser;
if( zUser==0 ){
zUser = db_get("default-user", 0);
}
if( zUser==0 ){
#if defined(_WIN32)
zUser = fossil_getenv("USERNAME");
#else
zUser = fossil_getenv("USER");
#endif
}
if( zUser==0 ){
zUser = "root";
}
db_multi_exec(
"INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser
|
| ︙ | ︙ |
Changes to src/file.c.
| ︙ | ︙ | |||
959 960 961 962 963 964 965 966 967 968 969 970 971 972 |
#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
}
/*
** Translate UTF8 to MBCS for display on the console. 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_console(const char *zUtf8){
| > > > > > > > > > > > | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 |
#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.
*/
char *fossil_getenv(const char *zName){
char *zValue = getenv(zName);
#ifdef _WIN32
if( zValue ) zValue = fossil_msbc_to_utf8(zValue);
#endif
return zValue;
}
/*
** Translate UTF8 to MBCS for display on the console. 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_console(const char *zUtf8){
|
| ︙ | ︙ |
Changes to src/json.c.
| ︙ | ︙ | |||
433 434 435 436 437 438 439 |
}else{
char const * cv = PD(zKey,NULL);
if(!cv && !g.isHTTP){
/* reminder to self: in CLI mode i'd like to try
find_option(zKey,NULL,XYZ) here, but we don't have a sane
default for the XYZ param here.
*/
| | | 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
}else{
char const * cv = PD(zKey,NULL);
if(!cv && !g.isHTTP){
/* reminder to self: in CLI mode i'd like to try
find_option(zKey,NULL,XYZ) here, but we don't have a sane
default for the XYZ param here.
*/
cv = fossil_getenv(zKey);
}
if(cv){/*transform it to JSON for later use.*/
/* use sscanf() to figure out if it's an int,
and transform it to JSON int if it is.
FIXME: use strtol(), since it has more accurate
error handling.
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
437 438 439 440 441 442 443 | g.json.outOpt.addNewline = 1; g.json.outOpt.indentation = 1 /* in CGI/server mode this can be configured */; #endif /* FOSSIL_ENABLE_JSON */ expand_args_option(); argc = g.argc; argv = g.argv; for(i=0; i<argc; i++) g.argv[i] = fossil_mbcs_to_utf8(argv[i]); | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
g.json.outOpt.addNewline = 1;
g.json.outOpt.indentation = 1 /* in CGI/server mode this can be configured */;
#endif /* FOSSIL_ENABLE_JSON */
expand_args_option();
argc = g.argc;
argv = g.argv;
for(i=0; i<argc; i++) g.argv[i] = fossil_mbcs_to_utf8(argv[i]);
if( fossil_getenv("GATEWAY_INTERFACE")!=0 && !find_option("nocgi", 0, 0)){
zCmdName = "cgi";
g.isHTTP = 1;
}else if( argc<2 ){
fossil_print(
"Usage: %s COMMAND ...\n"
" or: %s help -- for a list of common commands\n"
" or: %s help COMMMAND -- for help with the named command\n"
|
| ︙ | ︙ | |||
1627 1628 1629 1630 1631 1632 1633 |
#if !defined(_WIN32)
#if !defined(__DARWIN__) && !defined(__APPLE__)
/*
** Search for an executable on the PATH environment variable.
** Return true (1) if found and false (0) if not found.
*/
static int binaryOnPath(const char *zBinary){
| | | 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 |
#if !defined(_WIN32)
#if !defined(__DARWIN__) && !defined(__APPLE__)
/*
** Search for an executable on the PATH environment variable.
** Return true (1) if found and false (0) if not found.
*/
static int binaryOnPath(const char *zBinary){
const char *zPath = fossil_getenv("PATH");
char *zFull;
int i;
int bExists;
while( zPath && zPath[0] ){
while( zPath[0]==':' ) zPath++;
for(i=0; zPath[i] && zPath[i]!=':'; i++){}
zFull = mprintf("%.*s/%s", i, zPath, zBinary);
|
| ︙ | ︙ |
Changes to src/report.c.
| ︙ | ︙ | |||
1139 1140 1141 1142 1143 1144 1145 |
report_restrict_sql(&zErr1);
sqlite3_exec_readonly(g.db, zSql, output_separated_file, &count, &zErr2);
report_unrestrict_sql();
if( zFilter ){
free(zSql);
}
}
| < | 1139 1140 1141 1142 1143 1144 1145 |
report_restrict_sql(&zErr1);
sqlite3_exec_readonly(g.db, zSql, output_separated_file, &count, &zErr2);
report_unrestrict_sql();
if( zFilter ){
free(zSql);
}
}
|
Changes to src/url.c.
| ︙ | ︙ | |||
263 264 265 266 267 268 269 |
*/
void url_enable_proxy(const char *zMsg){
const char *zProxy;
zProxy = zProxyOpt;
if( zProxy==0 ){
zProxy = db_get("proxy", 0);
if( zProxy==0 || zProxy[0]==0 || is_truth(zProxy) ){
| | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
*/
void url_enable_proxy(const char *zMsg){
const char *zProxy;
zProxy = zProxyOpt;
if( zProxy==0 ){
zProxy = db_get("proxy", 0);
if( zProxy==0 || zProxy[0]==0 || is_truth(zProxy) ){
zProxy = fossil_getenv("http_proxy");
}
}
if( zProxy && zProxy[0] && !is_false(zProxy) ){
char *zOriginalUrl = g.urlCanonical;
char *zOriginalHost = g.urlHostname;
char *zOriginalUser = g.urlUser;
char *zOriginalPasswd = g.urlPasswd;
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
}
}
if( g.localOpen && attempt_user(db_lget("default-user",0)) ) return;
if( attempt_user(db_get("default-user", 0)) ) return;
| | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
}
}
if( g.localOpen && attempt_user(db_lget("default-user",0)) ) return;
if( attempt_user(db_get("default-user", 0)) ) return;
if( attempt_user(fossil_getenv("USER")) ) return;
db_prepare(&s,
"SELECT uid, login FROM user"
" WHERE login NOT IN ('anonymous','nobody','reader','developer')"
);
if( db_step(&s)==SQLITE_ROW ){
g.userUid = db_column_int(&s, 0);
|
| ︙ | ︙ |