Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:When "fossil set editor" is unset and when there is no EDITOR or VISUAL environment variable set, then gather the check-in comment from standard input (with appropriate prompting) rather than trying to run "ed" or "notepad".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:aa929c4d1e8e9e9a7e27ae81088d347c054460c8
User & Date: drh 2010-12-17 12:41:50
Context
2010-12-17
21:06
In the check-in property editor, change the bgcolor tag even if the only change is to toggle color propagation on or off. Ticket [fcadf658ed282b3a2]. check-in: 2080d521 user: drh tags: trunk
12:41
When "fossil set editor" is unset and when there is no EDITOR or VISUAL environment variable set, then gather the check-in comment from standard input (with appropriate prompting) rather than trying to run "ed" or "notepad". check-in: aa929c4d user: drh tags: trunk
12:13
Issue a warning to the user before using "ed" or "notepad" if no default text editor is set. check-in: 115d90d8 user: drh tags: trunk
Changes

Changes to src/checkin.c.

409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434

435
436
437
438
439
440
441








442
443
444
445
446
447
448
  if( zEditor==0 ){
    zEditor = getenv("VISUAL");
  }
  if( zEditor==0 ){
    zEditor = getenv("EDITOR");
  }
  if( zEditor==0 ){
#if defined(_WIN32)
    zEditor = "notepad";
    fossil_warning(
       "no default text editor selected using \"fossil set editor\"\n"
       "or the EDITOR or VISUAL environment variables - using \"notepad\"");
#else
    zEditor = "ed";
    fossil_warning(
       "no default text editor selected using \"fossil set editor\"\n"
       "or the EDITOR or VISUAL environment variables - using \"ed\" -\n"
       "enter \"q\" to quit.");
#endif
  }
  zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'",
                   g.zLocalRoot);
#if defined(_WIN32)
  blob_add_cr(&text);
#endif
  blob_write_to_file(&text, zFile);

  zCmd = mprintf("%s \"%s\"", zEditor, zFile);
  printf("%s\n", zCmd);
  if( fossil_system(zCmd) ){
    fossil_panic("editor aborted");
  }
  blob_reset(&text);
  blob_read_from_file(&text, zFile);








  blob_remove_cr(&text);
  unlink(zFile);
  free(zFile);
  blob_zero(pComment);
  while( blob_line(&text, &line) ){
    int i, n;
    char *z;







|
|
|
|
|
|
|
|
|
|
|
|
|
<
<




>
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>







409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428


429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
  if( zEditor==0 ){
    zEditor = getenv("VISUAL");
  }
  if( zEditor==0 ){
    zEditor = 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"
       "# or \"-M\" command-line options, you will need to enter the\n"
       "# check-in comment below.  Type \".\" on a line by itself when\n"
       "# you are done:\n", -1);
    zFile = mprintf("-");
  }else{
    zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'",
                    g.zLocalRoot);
  }


#if defined(_WIN32)
  blob_add_cr(&text);
#endif
  blob_write_to_file(&text, zFile);
  if( zEditor ){
    zCmd = mprintf("%s \"%s\"", zEditor, zFile);
    printf("%s\n", zCmd);
    if( fossil_system(zCmd) ){
      fossil_panic("editor aborted");
    }
    blob_reset(&text);
    blob_read_from_file(&text, zFile);
  }else{
    char zIn[300];
    blob_reset(&text);
    while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
      if( zIn[0]=='.' && (zIn[1]==0 || zIn[1]=='\r' || zIn[1]=='\n') ) break;
      blob_append(&text, zIn, -1);
    }
  }
  blob_remove_cr(&text);
  unlink(zFile);
  free(zFile);
  blob_zero(pComment);
  while( blob_line(&text, &line) ){
    int i, n;
    char *z;