Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Move the file-specific definitions of the isatty() and fileno() macros into util.c's fossil_isatty() and fossil_fileno() in prep for an upcoming change which needs isatty(). |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
898a70ce82a524ca054ed77dfab897b9 |
| User & Date: | stephan 2024-08-27 11:06:50.579 |
References
|
2024-08-27
| ||
| 19:38 | Fix one mis-changed line in [898a70ce82a5] which would have broken builds on OS/2. check-in: 94c8af02ea user: stephan tags: trunk | |
Context
|
2024-08-27
| ||
| 11:19 | When stdout is not a tty, avoid doing the carriage-return-to-reuse-the-console-line trick for emiting metrics while syncing, and instead emit the stats after the end of the loop. This means that log files from cron jobs no longer contain the carriage-return clutter. check-in: f8800f3464 user: stephan tags: trunk | |
| 11:06 | Move the file-specific definitions of the isatty() and fileno() macros into util.c's fossil_isatty() and fossil_fileno() in prep for an upcoming change which needs isatty(). check-in: 898a70ce82 user: stephan tags: trunk | |
|
2024-08-24
| ||
| 08:52 | Update the built-in SQLite to the latest version 3.47.0 alpha. check-in: e17b8da855 user: stephan tags: trunk | |
Changes
Changes to src/cgi.c.
| ︙ | ︙ | |||
2120 2121 2122 2123 2124 2125 2126 |
cgi_setenv("REQUEST_URI", zToken);
cgi_setenv("SCRIPT_NAME", "");
for(i=0; zToken[i] && zToken[i]!='?'; i++){}
if( zToken[i] ) zToken[i++] = 0;
cgi_setenv("PATH_INFO", zToken);
cgi_setenv("QUERY_STRING", &zToken[i]);
if( zIpAddr==0 ){
| | | 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 |
cgi_setenv("REQUEST_URI", zToken);
cgi_setenv("SCRIPT_NAME", "");
for(i=0; zToken[i] && zToken[i]!='?'; i++){}
if( zToken[i] ) zToken[i++] = 0;
cgi_setenv("PATH_INFO", zToken);
cgi_setenv("QUERY_STRING", &zToken[i]);
if( zIpAddr==0 ){
zIpAddr = cgi_remote_ip(fossil_fileno(g.httpIn));
}
if( zIpAddr ){
cgi_setenv("REMOTE_ADDR", zIpAddr);
g.zIpAddr = fossil_strdup(zIpAddr);
}
|
| ︙ | ︙ |
Changes to src/http.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 | */ #include "config.h" #include "http.h" #include <assert.h> #ifdef _WIN32 #include <io.h> | < < < < < < | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | */ #include "config.h" #include "http.h" #include <assert.h> #ifdef _WIN32 #include <io.h> #endif #if INTERFACE /* ** Bits of the mHttpFlags parameter to http_exchange() */ |
| ︙ | ︙ | |||
204 205 206 207 208 209 210 |
*/
char *prompt_for_httpauth_creds(void){
Blob x;
char *zUser;
char *zPw;
char *zPrompt;
char *zHttpAuth = 0;
| | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
*/
char *prompt_for_httpauth_creds(void){
Blob x;
char *zUser;
char *zPw;
char *zPrompt;
char *zHttpAuth = 0;
if( !fossil_isatty(fossil_fileno(stdin)) ) return 0;
zPrompt = mprintf("\n%s authorization required by\n%s\n",
g.url.isHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.url.canonical);
fossil_print("%s", zPrompt);
free(zPrompt);
if ( g.url.user && g.url.passwd && use_fossil_creds_for_httpauth_prompt() ){
zHttpAuth = mprintf("%s:%s", g.url.user, g.url.passwd);
}else{
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 | ** program is invoked. */ #include "VERSION.h" #include "config.h" #if defined(_WIN32) # include <windows.h> # include <io.h> | < | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** program is invoked. */ #include "VERSION.h" #include "config.h" #if defined(_WIN32) # include <windows.h> # include <io.h> # define GETPID (int)GetCurrentProcessId #endif /* BUGBUG: This (PID_T) does not work inside of INTERFACE block. */ #if USE_SEE #if defined(_WIN32) typedef DWORD PID_T; |
| ︙ | ︙ | |||
703 704 705 706 707 708 709 |
const char *zCmdName = "unknown";
const CmdOrPage *pCmd = 0;
int rc;
g.zPhase = "init";
#if !defined(_WIN32_WCE)
if( fossil_getenv("FOSSIL_BREAK") ){
| | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
const char *zCmdName = "unknown";
const CmdOrPage *pCmd = 0;
int rc;
g.zPhase = "init";
#if !defined(_WIN32_WCE)
if( fossil_getenv("FOSSIL_BREAK") ){
if( fossil_isatty(0) && fossil_isatty(2) ){
fprintf(stderr,
"attach debugger to process %d and press any key to continue.\n",
GETPID());
fgetc(stdin);
}else{
#if defined(_WIN32) || defined(WIN32)
DebugBreak();
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
1267 1268 1269 1270 1271 1272 1273 |
** argument. This is a no-op on unix but is necessary on windows.
*/
void fossil_binary_mode(FILE *p){
#if defined(_WIN32)
_setmode(_fileno(p), _O_BINARY);
#endif
#ifdef __EMX__ /* OS/2 */
| | | 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 |
** argument. This is a no-op on unix but is necessary on windows.
*/
void fossil_binary_mode(FILE *p){
#if defined(_WIN32)
_setmode(_fileno(p), _O_BINARY);
#endif
#ifdef __EMX__ /* OS/2 */
fossil_setmode(fossil_fileno(p), O_BINARY);
#endif
}
|
Changes to src/url.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 | */ #include "config.h" #include "url.h" #include <stdio.h> #ifdef _WIN32 #include <io.h> | < < < < < < | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | */ #include "config.h" #include "url.h" #include <stdio.h> #ifdef _WIN32 #include <io.h> #endif #if INTERFACE /* ** Flags for url_parse() */ #define URL_PROMPT_PW 0x0001 /* Prompt for password if needed */ |
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
pUrlData->name = mprintf("%b", &cfile);
pUrlData->canonical = mprintf("file://%T", pUrlData->name);
blob_reset(&cfile);
}else if( pUrlData->user!=0 && pUrlData->passwd==0
&& (urlFlags & URL_PROMPT_PW)!=0 ){
url_prompt_for_password_local(pUrlData);
}else if( pUrlData->user!=0 && ( urlFlags & URL_ASK_REMEMBER_PW ) ){
| > | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
pUrlData->name = mprintf("%b", &cfile);
pUrlData->canonical = mprintf("file://%T", pUrlData->name);
blob_reset(&cfile);
}else if( pUrlData->user!=0 && pUrlData->passwd==0
&& (urlFlags & URL_PROMPT_PW)!=0 ){
url_prompt_for_password_local(pUrlData);
}else if( pUrlData->user!=0 && ( urlFlags & URL_ASK_REMEMBER_PW ) ){
if( fossil_isatty(fossil_fileno(stdin))
&& ( urlFlags & URL_REMEMBER_PW )==0 ){
if( save_password_prompt(pUrlData->passwd) ){
pUrlData->flags = urlFlags |= URL_REMEMBER_PW;
}else{
pUrlData->flags = urlFlags &= ~URL_REMEMBER_PW;
}
}
}
|
| ︙ | ︙ | |||
733 734 735 736 737 738 739 |
/*
** Prompt the user for the password that corresponds to the "user" member of
** the provided UrlData structure. Store the result into the "passwd" member
** of the provided UrlData structure.
*/
void url_prompt_for_password_local(UrlData *pUrlData){
if( pUrlData->isSsh || pUrlData->isFile ) return;
| | | 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 |
/*
** Prompt the user for the password that corresponds to the "user" member of
** the provided UrlData structure. Store the result into the "passwd" member
** of the provided UrlData structure.
*/
void url_prompt_for_password_local(UrlData *pUrlData){
if( pUrlData->isSsh || pUrlData->isFile ) return;
if( fossil_isatty(fossil_fileno(stdin))
&& (pUrlData->flags & URL_PROMPT_PW)!=0
&& (pUrlData->flags & URL_PROMPTED)==0
){
pUrlData->flags |= URL_PROMPTED;
pUrlData->passwd = prompt_for_user_password(pUrlData->canonical);
if( pUrlData->passwd[0]
&& (pUrlData->flags & (URL_REMEMBER|URL_ASK_REMEMBER_PW))!=0
|
| ︙ | ︙ | |||
794 795 796 797 798 799 800 |
/* Preemptively prompt for a password if a username is given in the
** URL but no password.
*/
void url_get_password_if_needed(void){
if( (g.url.user && g.url.user[0])
&& (g.url.passwd==0 || g.url.passwd[0]==0)
| | | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
/* Preemptively prompt for a password if a username is given in the
** URL but no password.
*/
void url_get_password_if_needed(void){
if( (g.url.user && g.url.user[0])
&& (g.url.passwd==0 || g.url.passwd[0]==0)
&& fossil_isatty(fossil_fileno(stdin))
){
url_prompt_for_password();
}
}
/*
** Given a URL for a remote repository clone point, try to come up with a
|
| ︙ | ︙ |
Changes to src/util.c.
| ︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
#include <math.h>
/*
** For the fossil_timer_xxx() family of functions...
*/
#ifdef _WIN32
# include <windows.h>
#else
# include <sys/time.h>
# include <sys/resource.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
# include <fcntl.h>
# include <errno.h>
#endif
/*
** Exit. Take care to close the database first.
*/
NORETURN void fossil_exit(int rc){
db_close(1);
#ifndef _WIN32
| > > > > > > > > > > > > > > > > > > > > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
#include <math.h>
/*
** For the fossil_timer_xxx() family of functions...
*/
#ifdef _WIN32
# include <windows.h>
# include <io.h>
#else
# include <sys/time.h>
# include <sys/resource.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
# include <fcntl.h>
# include <errno.h>
#endif
/*
** Returns the same as the platform's isatty() or _isatty() function.
*/
int fossil_isatty(int fd){
#ifdef _WIN32
return _isatty(fd);
#else
return isatty(fd);
#endif
}
/*
** Returns the same as the platform's fileno() or _fileno() function.
*/
int fossil_fileno(FILE *p){
#ifdef _WIN32
return _fileno(p);
#else
return fileno(p);
#endif
}
/*
** Exit. Take care to close the database first.
*/
NORETURN void fossil_exit(int rc){
db_close(1);
#ifndef _WIN32
|
| ︙ | ︙ |