Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the fossil_nameofexe() function to use in place of g.argv[0]. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a04a6508708f78ce2b80f7d3369f5082 |
| User & Date: | drh 2010-11-12 21:51:35.000 |
Context
|
2010-11-12
| ||
| 22:12 | Wait to record the sync password until after the user has actually entered the sync password. Ticket [8b46db87f1bfa942b] ... (check-in: 328fc92ceb user: drh tags: trunk) | |
| 21:51 | Add the fossil_nameofexe() function to use in place of g.argv[0]. ... (check-in: a04a650870 user: drh tags: trunk) | |
| 20:57 | Fixed typos reported by ticket [a3336458f6864db0404b6d45b144be0b17526fb0]. ... (check-in: 03b53ca4ca user: aku tags: trunk) | |
Changes
Changes to src/allrepo.c.
| ︙ | ︙ | |||
114 115 116 117 118 119 120 |
}
db_end_transaction(0);
return;
}else{
fossil_fatal("\"all\" subcommand should be one of: "
"ignore list ls push pull rebuild sync");
}
| | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
}
db_end_transaction(0);
return;
}else{
fossil_fatal("\"all\" subcommand should be one of: "
"ignore list ls push pull rebuild sync");
}
zFossil = quoteFilename(fossil_nameofexe());
nMissing = 0;
db_prepare(&q,
"SELECT DISTINCT substr(name, 6) COLLATE nocase"
" FROM global_config"
" WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"
);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
153 154 155 156 157 158 159 |
if( g.argc==3 ){
printf(
"\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",
| | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
if( g.argc==3 ){
printf(
"\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",
fossil_nameofexe(), zBranch
);
}
/* Commit */
db_end_transaction(0);
|
| ︙ | ︙ |
Changes to src/configure.c.
| ︙ | ︙ | |||
493 494 495 496 497 498 499 |
}else if( strcmp(zName,"@reportfmt")==0 ){
db_multi_exec("DELETE FROM reportfmt");
}
}
db_end_transaction(0);
printf("Configuration reset to factory defaults.\n");
printf("To recover, use: %s %s import %s\n",
| | | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
}else if( strcmp(zName,"@reportfmt")==0 ){
db_multi_exec("DELETE FROM reportfmt");
}
}
db_end_transaction(0);
printf("Configuration reset to factory defaults.\n");
printf("To recover, use: %s %s import %s\n",
fossil_nameofexe(), g.argv[1], zBackup);
}else
{
fossil_fatal("METHOD should be one of:"
" export import merge pull push reset");
}
}
|
Changes to src/db.c.
| ︙ | ︙ | |||
71 72 73 74 75 76 77 |
}
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<h1>Database Error</h1>\n"
"<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
cgi_reply();
}else{
| | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
}
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<h1>Database Error</h1>\n"
"<pre>%h</pre><p>%s</p>", z, zRebuildMsg);
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n\n%s", fossil_nameofexe(), z, zRebuildMsg);
}
db_force_rollback();
fossil_exit(1);
}
static int nBegin = 0; /* Nesting depth of BEGIN */
static int isNewRepo = 0; /* True if the repository is newly created */
|
| ︙ | ︙ |
Changes to src/deltacmd.c.
| ︙ | ︙ | |||
47 48 49 50 51 52 53 |
**
** Given two input files, create and output a delta that carries
** the first file into the second.
*/
void delta_create_cmd(void){
Blob orig, target, delta;
if( g.argc!=5 ){
| | < | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
**
** Given two input files, create and output a delta that carries
** the first file into the second.
*/
void delta_create_cmd(void){
Blob orig, target, delta;
if( g.argc!=5 ){
usage("ORIGIN TARGET DELTA");
}
if( blob_read_from_file(&orig, g.argv[2])<0 ){
fprintf(stderr,"cannot read %s\n", g.argv[2]);
fossil_exit(1);
}
if( blob_read_from_file(&target, g.argv[3])<0 ){
fprintf(stderr,"cannot read %s\n", g.argv[3]);
|
| ︙ | ︙ | |||
110 111 112 113 114 115 116 |
**
** Given an input files and a delta, apply the delta to the input file
** and write the result.
*/
void delta_apply_cmd(void){
Blob orig, target, delta;
if( g.argc!=5 ){
| | < | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
**
** Given an input files and a delta, apply the delta to the input file
** and write the result.
*/
void delta_apply_cmd(void){
Blob orig, target, delta;
if( g.argc!=5 ){
usage("ORIGIN DELTA TARGET");
}
if( blob_read_from_file(&orig, g.argv[2])<0 ){
fprintf(stderr,"cannot read %s\n", g.argv[2]);
fossil_exit(1);
}
if( blob_read_from_file(&delta, g.argv[3])<0 ){
fprintf(stderr,"cannot read %s\n", g.argv[3]);
|
| ︙ | ︙ |
Changes to src/http_transport.c.
| ︙ | ︙ | |||
292 293 294 295 296 297 298 |
void transport_flip(void){
if( g.urlIsSsh ){
fprintf(sshOut, "\n\n");
}else if( g.urlIsFile ){
char *zCmd;
fclose(transport.pFile);
zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1",
| | | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
void transport_flip(void){
if( g.urlIsSsh ){
fprintf(sshOut, "\n\n");
}else if( g.urlIsFile ){
char *zCmd;
fclose(transport.pFile);
zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1",
fossil_nameofexe(), g.urlName, transport.zOutFile, transport.zInFile
);
fossil_system(zCmd);
free(zCmd);
transport.pFile = fopen(transport.zInFile, "rb");
}
}
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
/*
** The following variable becomes true while processing a fatal error
** or a panic. If additional "recursive-fatal" errors occur while
** shutting down, the recursive errors are silently ignored.
*/
static int mainInFatalError = 0;
/*
** Exit. Take care to close the database first.
*/
void fossil_exit(int rc){
db_close();
exit(rc);
| > > > > > > > > > > > | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
/*
** The following variable becomes true while processing a fatal error
** or a panic. If additional "recursive-fatal" errors occur while
** shutting down, the recursive errors are silently ignored.
*/
static int mainInFatalError = 0;
/*
** Return the name of the current executable.
*/
const char *fossil_nameofexe(void){
#ifdef _WIN32
return _pgmptr;
#else
return g.argv[0];
#endif
}
/*
** Exit. Take care to close the database first.
*/
void fossil_exit(int rc){
db_close();
exit(rc);
|
| ︙ | ︙ | |||
292 293 294 295 296 297 298 |
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput && once ){
once = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
| | | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput && once ){
once = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
}
db_force_rollback();
fossil_exit(1);
}
void fossil_fatal(const char *zFormat, ...){
char *z;
va_list ap;
mainInFatalError = 1;
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
}
db_force_rollback();
fossil_exit(1);
}
/* This routine works like fossil_fatal() except that if called
** recursively, the recursive call is a no-op.
|
| ︙ | ︙ | |||
337 338 339 340 341 342 343 |
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
| | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput ){
g.cgiOutput = 0;
cgi_printf("<p class=\"generalError\">%h</p>", z);
cgi_reply();
}else{
fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
}
db_force_rollback();
fossil_exit(1);
}
/* Print a warning message */
void fossil_warning(const char *zFormat, ...){
char *z;
va_list ap;
va_start(ap, zFormat);
z = vmprintf(zFormat, ap);
va_end(ap);
if( g.cgiOutput ){
cgi_printf("<p class=\"generalError\">%h</p>", z);
}else{
fprintf(stderr, "%s: %s\n", fossil_nameofexe(), z);
}
}
/*
** Malloc and free routines that cannot fail
*/
void *fossil_malloc(size_t n){
|
| ︙ | ︙ | |||
441 442 443 444 445 446 447 |
fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg);
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
| | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
fossil_warning("%s: %s", sqlite_error_code_name(iCode), zErrmsg);
}
/*
** Print a usage comment and quit
*/
void usage(const char *zFormat){
fprintf(stderr, "Usage: %s %s %s\n", fossil_nameofexe(), g.argv[1], zFormat);
fossil_exit(1);
}
/*
** Remove n elements from g.argv beginning with the i-th element.
*/
void remove_from_argv(int i, int n){
|
| ︙ | ︙ | |||
601 602 603 604 605 606 607 |
**
** Display information on how to use COMMAND
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc!=3 ){
| | > | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
**
** Display information on how to use COMMAND
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc!=3 ){
printf("Usage: %s help COMMAND.\nAvailable COMMANDs:\n",
fossil_nameofexe());
cmd_cmd_list();
version_cmd();
return;
}
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
if( rc==1 ){
fossil_fatal("unknown command: %s", g.argv[2]);
}else if( rc==2 ){
fossil_fatal("ambiguous command prefix: %s", g.argv[2]);
}
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 ){
printf("%s", fossil_nameofexe());
z += 7;
}else{
putchar(*z);
z++;
}
}
putchar('\n');
|
| ︙ | ︙ |
Changes to src/merge3.c.
| ︙ | ︙ | |||
300 301 302 303 304 305 306 |
**
** Combine change in going from PIVOT->VERSION1 with the change going
** from PIVOT->VERSION2 and write the combined changes into MERGED.
*/
void delta_3waymerge_cmd(void){
Blob pivot, v1, v2, merged;
if( g.argc!=6 ){
| | < | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
**
** Combine change in going from PIVOT->VERSION1 with the change going
** from PIVOT->VERSION2 and write the combined changes into MERGED.
*/
void delta_3waymerge_cmd(void){
Blob pivot, v1, v2, merged;
if( g.argc!=6 ){
usage("PIVOT V1 V2 MERGED");
}
if( blob_read_from_file(&pivot, g.argv[2])<0 ){
fprintf(stderr,"cannot read %s\n", g.argv[2]);
fossil_exit(1);
}
if( blob_read_from_file(&v1, g.argv[3])<0 ){
fprintf(stderr,"cannot read %s\n", g.argv[3]);
|
| ︙ | ︙ |
Changes to src/winhttp.c.
| ︙ | ︙ | |||
104 105 106 107 108 109 110 |
break;
}
wanted -= got;
}
fclose(out);
out = 0;
sprintf(zCmd, "\"%s\" http \"%s\" %s %s %s%s",
| | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
break;
}
wanted -= got;
}
fclose(out);
out = 0;
sprintf(zCmd, "\"%s\" http \"%s\" %s %s %s%s",
fossil_nameofexe(), g.zRepositoryName, zRequestFName, zReplyFName,
inet_ntoa(p->addr.sin_addr), p->zNotFound
);
fossil_system(zCmd);
in = fopen(zReplyFName, "rb");
if( in ){
while( (got = fread(zHdr, 1, sizeof(zHdr), in))>0 ){
send(p->s, zHdr, got, 0);
|
| ︙ | ︙ |