Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Take care that xfer error messages and user prompts always begin at the start of a new line. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
f1ef22136f6e8427e09e8e09add679fc |
| User & Date: | drh 2012-11-28 19:28:04.282 |
Context
|
2012-11-28
| ||
| 20:37 | Add the "fossil cat" command, which is an alias for "fossil finfo -p" check-in: 607ff0855c user: drh tags: trunk | |
| 19:28 | Take care that xfer error messages and user prompts always begin at the start of a new line. check-in: f1ef22136f user: drh tags: trunk | |
| 11:13 | Add a conditional #include in an attempt to get the build working on Cygwin. check-in: b963446708 user: drh tags: trunk | |
Changes
Changes to src/http_transport.c.
| ︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
if( g.urlPort!=g.urlDfltPort ){
#ifdef __MINGW32__
blob_appendf(&zCmd, " -P %d", g.urlPort);
#else
blob_appendf(&zCmd, " -p %d", g.urlPort);
#endif
}
fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
if( g.urlUser && g.urlUser[0] ){
zHost = mprintf("%s@%s", g.urlUser, g.urlName);
#ifdef __MINGW32__
/* Only win32 (and specifically PLINK.EXE) support the -pw option */
if( g.urlPasswd && g.urlPasswd[0] ){
Blob pw;
| > | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
if( g.urlPort!=g.urlDfltPort ){
#ifdef __MINGW32__
blob_appendf(&zCmd, " -P %d", g.urlPort);
#else
blob_appendf(&zCmd, " -p %d", g.urlPort);
#endif
}
fossil_force_newline();
fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */
if( g.urlUser && g.urlUser[0] ){
zHost = mprintf("%s@%s", g.urlUser, g.urlName);
#ifdef __MINGW32__
/* Only win32 (and specifically PLINK.EXE) support the -pw option */
if( g.urlPasswd && g.urlPasswd[0] ){
Blob pw;
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
710 711 712 713 714 715 716 717 718 719 720 721 722 723 |
{
if( g.cgiOutput && once ){
once = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else if( !g.fQuiet ){
char *zOut = mprintf("%s: %s\n", g.argv[0], z);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
free(z);
db_force_rollback();
fossil_exit(rc);
| > | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
{
if( g.cgiOutput && once ){
once = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else if( !g.fQuiet ){
char *zOut = mprintf("%s: %s\n", g.argv[0], z);
fossil_force_newline();
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
free(z);
db_force_rollback();
fossil_exit(rc);
|
| ︙ | ︙ | |||
743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
{
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else if( !g.fQuiet ){
char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
free(z);
db_force_rollback();
fossil_exit(rc);
| > | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
{
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else if( !g.fQuiet ){
char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
fossil_force_newline();
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
free(z);
db_force_rollback();
fossil_exit(rc);
|
| ︙ | ︙ | |||
785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
{
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
db_force_rollback();
fossil_exit(rc);
}
| > | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 |
{
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
fossil_force_newline();
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
db_force_rollback();
fossil_exit(rc);
}
|
| ︙ | ︙ | |||
811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
}else
#endif
{
if( g.cgiOutput ){
cgi_printf("<p class=\"generalError\">%h</p>", z);
}else{
char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
free(z);
}
| > | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 |
}else
#endif
{
if( g.cgiOutput ){
cgi_printf("<p class=\"generalError\">%h</p>", z);
}else{
char *zOut = mprintf("\r%s: %s\n", g.argv[0], z);
fossil_force_newline();
fossil_puts(zOut, 1);
fossil_free(zOut);
}
}
free(z);
}
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 |
}
void fossil_error_reset(void){
free(g.zErrMsg);
g.zErrMsg = 0;
g.iErrPriority = 0;
}
/*
** Write to standard output or standard error.
**
** On windows, transform the output into the current terminal encoding
** if the output is going to the screen. If output is redirected into
** a file, no translation occurs. No translation ever occurs on unix.
*/
void fossil_puts(const char *z, int toStdErr){
#if defined(_WIN32)
| > > > > > > > > > > > | | > > > > > > > > | 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 |
}
void fossil_error_reset(void){
free(g.zErrMsg);
g.zErrMsg = 0;
g.iErrPriority = 0;
}
/* True if the last character standard output cursor is setting at
** the beginning of a blank link. False if a \r has been to move the
** cursor to the beginning of the line or if not at the beginning of
** a line.
** was a \n
*/
static int stdoutAtBOL = 1;
/*
** Write to standard output or standard error.
**
** On windows, transform the output into the current terminal encoding
** if the output is going to the screen. If output is redirected into
** a file, no translation occurs. No translation ever occurs on unix.
*/
void fossil_puts(const char *z, int toStdErr){
int n = (int)strlen(z);
if( n==0 ) return;
if( toStdErr==0 ) stdoutAtBOL = (z[n-1]=='\n');
#if defined(_WIN32)
if( fossil_utf8_to_console(z, n, toStdErr) >= 0 ){
return;
}
#endif
assert( toStdErr==0 || toStdErr==1 );
fwrite(z, 1, n, toStdErr ? stderr : stdout);
fflush(toStdErr ? stderr : stdout);
}
/*
** Force the the standard output cursor to move to the beginning
** of a line, if it is not there already.
*/
void fossil_force_newline(void){
if( g.cgiOutput==0 && stdoutAtBOL==0 ) fossil_puts("\n", 0);
}
/*
** Write output for user consumption. If g.cgiOutput is enabled, then
** send the output as part of the CGI reply. If g.cgiOutput is false,
** then write on standard output.
*/
void fossil_print(const char *zFormat, ...){
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
/*
** Prompt the user to enter a single line of text.
*/
void prompt_user(const char *zPrompt, Blob *pIn){
char *z;
char zLine[1000];
blob_zero(pIn);
fossil_print("%s", zPrompt);
fflush(stdout);
z = fgets(zLine, sizeof(zLine), stdin);
if( z ){
strip_string(pIn, z);
}
}
| > | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
/*
** Prompt the user to enter a single line of text.
*/
void prompt_user(const char *zPrompt, Blob *pIn){
char *z;
char zLine[1000];
blob_zero(pIn);
fossil_force_newline();
fossil_print("%s", zPrompt);
fflush(stdout);
z = fgets(zLine, sizeof(zLine), stdin);
if( z ){
strip_string(pIn, z);
}
}
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1690 1691 1692 1693 1694 1695 1696 |
if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
char *zMsg = blob_terminate(&xfer.aToken[1]);
defossilize(zMsg);
if( (syncFlags & SYNC_PUSH) && zMsg && strglob("pull only *", zMsg) ){
syncFlags &= ~SYNC_PUSH;
zMsg = 0;
}
| > | | 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 |
if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
char *zMsg = blob_terminate(&xfer.aToken[1]);
defossilize(zMsg);
if( (syncFlags & SYNC_PUSH) && zMsg && strglob("pull only *", zMsg) ){
syncFlags &= ~SYNC_PUSH;
zMsg = 0;
}
fossil_force_newline();
fossil_print("Server says: %s\n", zMsg);
}else
/* pragma NAME VALUE...
**
** The server can send pragmas to try to convey meta-information to
** the client. These are informational only. Unknown pragmas are
** silently ignored.
|
| ︙ | ︙ | |||
1802 1803 1804 1805 1806 1807 1808 |
** we have gone at least two rounds. Always go at least two rounds
** on a clone in order to be sure to retrieve the configuration
** information which is only sent on the second round.
*/
if( cloneSeqno<=0 && nCycle>1 ) go = 0;
};
transport_stats(&nSent, &nRcvd, 1);
| | | 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 |
** we have gone at least two rounds. Always go at least two rounds
** on a clone in order to be sure to retrieve the configuration
** information which is only sent on the second round.
*/
if( cloneSeqno<=0 && nCycle>1 ) go = 0;
};
transport_stats(&nSent, &nRcvd, 1);
fossil_force_newline();
fossil_print(
"%s finished with %lld bytes sent, %lld bytes received\n",
zOpType, nSent, nRcvd);
transport_close();
transport_global_shutdown();
db_multi_exec("DROP TABLE onremote");
manifest_crosslink_end();
content_enable_dephantomize(1);
db_end_transaction(0);
return nErr;
}
|