Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | merge trunk |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | eclipse-project |
| Files: | files | file ages | folders |
| SHA1: |
2050646c9f2fec763c019e809e6a0b33 |
| User & Date: | jan.nijtmans 2012-09-04 12:36:26.814 |
Context
|
2012-09-05
| ||
| 06:32 | merge trunk check-in: 1393a9107b user: jan.nijtmans tags: eclipse-project | |
|
2012-09-04
| ||
| 12:36 | merge trunk check-in: 2050646c9f user: jan.nijtmans tags: eclipse-project | |
| 08:14 | memory allocated with mprintf should be freed with fossil_free(), not free() <p>use _wsystem() in stead of system() on Windows. <p>Use g.argv[0] in stead of fossil_nameofexec() when the full path is not necessary, e.g for "Usage" prints. check-in: 06ba3ace24 user: jan.nijtmans tags: trunk | |
| 07:00 | merge trunk check-in: 56f6e9f3b9 user: jan.nijtmans tags: eclipse-project | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
163 164 165 166 167 168 169 |
if( g.argc==3 ){
fossil_print(
"\n"
"Note: the local check-out has not been updated to the new\n"
" branch. To begin working on the new branch, do this:\n"
"\n"
" %s update %s\n",
| | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
if( g.argc==3 ){
fossil_print(
"\n"
"Note: the local check-out has not been updated to the new\n"
" branch. To begin working on the new branch, do this:\n"
"\n"
" %s update %s\n",
g.argv[0], zBranch
);
}
/* Commit */
db_end_transaction(0);
|
| ︙ | ︙ |
Changes to src/configure.c.
| ︙ | ︙ | |||
911 912 913 914 915 916 917 |
}else if( fossil_strcmp(zName,"@reportfmt")==0 ){
db_multi_exec("DELETE FROM reportfmt");
}
}
db_end_transaction(0);
fossil_print("Configuration reset to factory defaults.\n");
fossil_print("To recover, use: %s %s import %s\n",
| | | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
}else if( fossil_strcmp(zName,"@reportfmt")==0 ){
db_multi_exec("DELETE FROM reportfmt");
}
}
db_end_transaction(0);
fossil_print("Configuration reset to factory defaults.\n");
fossil_print("To recover, use: %s %s import %s\n",
g.argv[0], g.argv[1], zBackup);
}else
{
fossil_fatal("METHOD should be one of:"
" export import merge pull push reset");
}
}
|
Changes to src/db.c.
| ︙ | ︙ | |||
90 91 92 93 94 95 96 |
}
else if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<h1>Database Error</h1>\n"
"<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
cgi_reply();
}else{
| | > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
}
else if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<h1>Database Error</h1>\n"
"<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
cgi_reply();
}else{
char *zOut = mprintf("%s: %s\n\n%s", g.argv[0], z, zRebuildMsg);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
free(z);
db_force_rollback();
fossil_exit(rc);
}
/*
|
| ︙ | ︙ |
Changes to src/json.c.
| ︙ | ︙ | |||
346 347 348 349 350 351 352 |
int const rc = cson_array_append( g.json.gc.a, v );
assert( NULL != g.json.gc.a );
if( 0 != rc ){
cson_value_free( v );
}
assert( (0==rc) && "Adding item to GC failed." );
if(0!=rc){
| | | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
int const rc = cson_array_append( g.json.gc.a, v );
assert( NULL != g.json.gc.a );
if( 0 != rc ){
cson_value_free( v );
}
assert( (0==rc) && "Adding item to GC failed." );
if(0!=rc){
fprintf(stderr,"%s: FATAL: alloc error.\n", g.argv[0])
/* reminder: allocation error is the only reasonable cause of
error here, provided g.json.gc.a and v are not NULL.
*/
;
fossil_exit(1)/*not fossil_panic() b/c it might land us somewhere
where this function is called again.
*/;
|
| ︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 |
FILE * inFile = NULL;
char const * jfile = find_option("json-input",NULL,1);
if(!jfile || !*jfile){
break;
}
inFile = (0==strcmp("-",jfile))
? stdin
| | | 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 |
FILE * inFile = NULL;
char const * jfile = find_option("json-input",NULL,1);
if(!jfile || !*jfile){
break;
}
inFile = (0==strcmp("-",jfile))
? stdin
: fopen(jfile,"rb");
if(!inFile){
g.json.resultCode = FSL_JSON_E_FILE_OPEN_FAILED;
fossil_fatal("Could not open JSON file [%s].",jfile)
/* Does not return. */
;
}
cgi_parse_POST_JSON(inFile, 0);
|
| ︙ | ︙ | |||
1626 1627 1628 1629 1630 1631 1632 |
}
resp = json_create_response(rc, msg, NULL);
if(!resp){
/* about the only error case here is out-of-memory. DO NOT
call fossil_panic() here because that calls this function.
*/
fprintf(stderr, "%s: Fatal error: could not allocate "
| | | 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 |
}
resp = json_create_response(rc, msg, NULL);
if(!resp){
/* about the only error case here is out-of-memory. DO NOT
call fossil_panic() here because that calls this function.
*/
fprintf(stderr, "%s: Fatal error: could not allocate "
"response object.\n", g.argv[0]);
fossil_exit(1);
}
if( g.isHTTP ){
if(alsoOutput){
json_send_response(resp);
}else{
/* almost a duplicate of json_send_response() :( */
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
581 582 583 584 585 586 587 |
#endif
{
if( g.cgiOutput && once ){
once = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else if( !g.fQuiet ){
| | > | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
#endif
{
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);
}
|
| ︙ | ︙ | |||
613 614 615 616 617 618 619 |
#endif
{
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else if( !g.fQuiet ){
| | > | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
#endif
{
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);
}
|
| ︙ | ︙ | |||
654 655 656 657 658 659 660 |
#endif
{
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
| | | | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
#endif
{
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);
}
|
| ︙ | ︙ | |||
680 681 682 683 684 685 686 |
json_warn( FSL_JSON_W_UNKNOWN, z );
}else
#endif
{
if( g.cgiOutput ){
cgi_printf("<p class=\"generalError\">%h</p>", z);
}else{
| | | | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
json_warn( FSL_JSON_W_UNKNOWN, z );
}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);
}
/*
** Malloc and free routines that cannot fail
|
| ︙ | ︙ | |||
715 716 717 718 719 720 721 |
int fossil_system(const char *zOrigCmd){
int rc;
#if defined(_WIN32)
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
| | | > > > > | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 |
int fossil_system(const char *zOrigCmd){
int rc;
#if defined(_WIN32)
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
if( g.fSystemTrace ) {
char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
rc = _wsystem(zUnicode);
fossil_mbcs_free(zUnicode);
free(zNewCmd);
#else
/* On unix, evaluate the command directly.
*/
if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
rc = system(zOrigCmd);
#endif
|
| ︙ | ︙ | |||
788 789 790 791 792 793 794 |
fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg);
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
| | | 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 |
fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg);
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
fossil_fatal("Usage: %s %s %s\n", g.argv[0], g.argv[1], zFormat);
}
/*
** Remove n elements from g.argv beginning with the i-th element.
*/
void remove_from_argv(int i, int n){
int j;
|
| ︙ | ︙ | |||
949 950 951 952 953 954 955 |
** %fossil help --test Show test commands only
** %fossil help --aux Show auxiliary commands only
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc<3 ){
| | | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 |
** %fossil help --test Show test commands only
** %fossil help --aux Show auxiliary commands only
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc<3 ){
z = g.argv[0];
fossil_print(
"Usage: %s help COMMAND\n"
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
z, z);
command_list(0, CMDFLAG_1ST_TIER);
version_cmd();
return;
|
| ︙ | ︙ | |||
988 989 990 991 992 993 994 |
z = aCmdHelp[idx];
if( z==0 ){
fossil_fatal("no help available for the %s command",
aCommand[idx].zName);
}
while( *z ){
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
| | | 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 |
z = aCmdHelp[idx];
if( z==0 ){
fossil_fatal("no help available for the %s command",
aCommand[idx].zName);
}
while( *z ){
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
fossil_print("%s", g.argv[0]);
z += 7;
}else{
putchar(*z);
z++;
}
}
putchar('\n');
|
| ︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 |
*d++ = *s++;
}
}
*d = 0;
@ <blockquote><pre>
@ %h(z)
@ </pre></blockquote>
| | | 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 |
*d++ = *s++;
}
}
*d = 0;
@ <blockquote><pre>
@ %h(z)
@ </pre></blockquote>
fossil_free(z);
}
}
}else{
int i, j, n;
@ <h1>Available commands:</h1>
@ <table border="0"><tr>
|
| ︙ | ︙ | |||
1694 1695 1696 1697 1698 1699 1700 |
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);
bExists = file_access(zFull, X_OK);
| | | 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 |
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);
bExists = file_access(zFull, X_OK);
fossil_free(zFull);
if( bExists==0 ) return 1;
zPath += i;
}
return 0;
}
#endif
#endif
|
| ︙ | ︙ |