Fossil

Check-in [3a7e3e427d]
Login

Check-in [3a7e3e427d]

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

Overview
Comment:On unix with the "fossil ui" command, try to open the webbrowser with "xdg-open" and "gnome-open" prior to resorting to "firefox". Ticket [8bc2549cedcd599556bbaf131f03b96588701f20]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3a7e3e427d19e9b1ab1c4d8017d53c5a58122091
User & Date: drh 2009-07-29 13:09:22.000
References
2009-07-29
13:10 Fixed ticket [8bc2549ced]: "fossil ui" expects firefox to exist plus 2 other changes ... (artifact: fc591da97f user: drh)
Context
2009-08-01
12:59
Always store g.urlCanonical as the last-sync-url value. Fix for ticket [045f23be750d93c0bd91f179f39c5c829ed01bc6]. ... (check-in: 47d8fc4944 user: drh tags: trunk)
2009-07-29
13:09
On unix with the "fossil ui" command, try to open the webbrowser with "xdg-open" and "gnome-open" prior to resorting to "firefox". Ticket [8bc2549cedcd599556bbaf131f03b96588701f20] ... (check-in: 3a7e3e427d user: drh tags: trunk)
2009-07-24
03:57
correct typo in error msg ... (check-in: ce5eb40702 user: bch tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
700
701
702
703
704
705
706
























707
708
709
710
711
712
713
** Works like the http command but gives setup permission to all users.
*/
void cmd_test_http(void){
  login_set_capabilities("s");
  cmd_http();
}

























/*
** COMMAND: server
** COMMAND: ui
**
** Usage: %fossil server ?-P|--port TCPPORT? ?REPOSITORY?
**    Or: %fossil ui ?-P|--port TCPPORT? ?REPOSITORY?
**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
** Works like the http command but gives setup permission to all users.
*/
void cmd_test_http(void){
  login_set_capabilities("s");
  cmd_http();
}


#if !defined(__DARWIN__) && !defined(__APPLE__)
/*
** Search for an executable on the PATH environment variable.
** Return true (1) if found and false (0) if not found.
*/
static int binaryOnPath(const char *zBinary){
  const char *zPath = getenv("PATH");
  char *zFull;
  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 = access(zFull, X_OK);
    free(zFull);
    if( bExists==0 ) return 1;
    zPath += i;
  }
  return 0;
}
#endif

/*
** COMMAND: server
** COMMAND: ui
**
** Usage: %fossil server ?-P|--port TCPPORT? ?REPOSITORY?
**    Or: %fossil ui ?-P|--port TCPPORT? ?REPOSITORY?
**
743
744
745
746
747
748
749
750











751
752
753
754
755
756
757
    iPort = db_get_int("http-port", 8080);
    mxPort = iPort+100;
  }
#ifndef __MINGW32__
  /* Unix implementation */
  if( g.argv[1][0]=='u' ){
#if !defined(__DARWIN__) && !defined(__APPLE__)
    zBrowser = db_get("web-browser", "firefox");











#else
    zBrowser = db_get("web-browser", "open");
#endif
    zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
  }
  db_close();
  if( cgi_http_server(iPort, mxPort, zBrowserCmd) ){







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







767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
    iPort = db_get_int("http-port", 8080);
    mxPort = iPort+100;
  }
#ifndef __MINGW32__
  /* Unix implementation */
  if( g.argv[1][0]=='u' ){
#if !defined(__DARWIN__) && !defined(__APPLE__)
    zBrowser = db_get("web-browser", 0);
    if( zBrowser==0 ){
      static char *azBrowserProg[] = { "xdg-open", "gnome-open", "firefox" };
      int i;
      zBrowser = "echo";
      for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){
        if( binaryOnPath(azBrowserProg[i]) ){
          zBrowser = azBrowserProg[i];
          break;
        }
      }
    }
#else
    zBrowser = db_get("web-browser", "open");
#endif
    zBrowserCmd = mprintf("%s http://localhost:%%d/ &", zBrowser);
  }
  db_close();
  if( cgi_http_server(iPort, mxPort, zBrowserCmd) ){