Fossil SCM

update branch before making changes

venkat 2011-08-16 18:35 UTC venks-emacs merge
Commit 84e6f172af56c6fd863e541f096af1362d880357
83 files changed +38 -16 -3 +3 +9 +1 +2 +35 +1 +31 +63 +30 +314 +307 +1 +9 +144 +2 +130 +21 +3 +74 -21 +51 -32 +1 -1 +13 -3 +92 -15 +1 +17 -3 +5 -1 +1 +180 -52 +35 +8 -7 +22 -16 +161 -39 +35 -7 +9 +4 -4 +2 -1 +61 -1 +30 -6 +14 -8 +10 -4 +16 -7 +1 -1 +38 -31 +4 -5 +10 -2 +1 -6 +5 +1 -1 +1 -1 +1 -1 +11 -2 +5173 -2758 +48 -15 +1 +2 -1 +2 -1 +280 -29 +76 -15 +1 -1 +57 +8 -20 +644 -9 +7 -1 +3 -3 +4 -4 +5 -5 +93 -8 -10 +63 -26 +1 +73 -16 +60 +4 +21 -15 +11 -6 +11 -1 +15 -7 +3 +6 +21
+38 -16
--- BUILD.txt
+++ BUILD.txt
@@ -1,41 +1,60 @@
1
-All of the source code for fossil is contained in the src/ subdirectory.
2
-But there is a lot of generated code, so you will probably want to
3
-use the Makefile. To do a complete build on unix, just type:
1
+To do a complete build, just type:
2
+
3
+ ./configure; make
4
+
5
+The ./configure script builds Makefile from Makefile.in based on
6
+your system and any options you select (run "./configure --help"
7
+for a listing of the available options.)
8
+
9
+If you wish to use the original Makefile with no configuration, you can
10
+instead use:
411
5
- make
12
+ make -f Makefile.classic
613
714
On a windows box, use one of the Makefiles in the win/ subdirectory,
8
-according to your compiler and environment. For example:
15
+according to your compiler and environment. If you have GCC and MSYS
16
+installed on your system, then consider:
17
+
18
+ make -f win/Makefile.mingw
19
+
20
+If you have VC++ installed on your system, then consider:
921
10
- make -f win/Makefile.w32
22
+ cd win; nmake /f Makefile.msc
1123
1224
If you have trouble, or you want to do something fancy, just look at
13
-top level makefile. There are 6 configuration options that are all well
14
-commented. Instead of editing the Makefile, consider copying the Makefile
15
-to an alternative name such as "GNUMakefile", "BSDMakefile", or "makefile"
16
-and editing the copy.
25
+Makefile.classic. There are 6 configuration options that are all well
26
+commented. Instead of editing the Makefile.classic, consider copying
27
+Makefile.classic to an alternative name such as "GNUMakefile",
28
+"BSDMakefile", or "makefile" and editing the copy.
1729
1830
1931
BUILDING OUTSIDE THE SOURCE TREE
2032
2133
An out of source build is pretty easy:
2234
23
- 1. Make a new directory to do the builds in.
24
- 2. Copy "Makefile" from the source into the build directory and
25
- modify the SRCDIR macro along the lines of:
35
+ 1. Make and change to a new directory to do the builds in.
36
+ 2. Run the "configure" script from this directory.
37
+ 3. Type: "make"
38
+
39
+For example:
2640
27
- SRCDIR=../src
28
-
29
- 3. type: "make"
41
+ mkdir build
42
+ cd build
43
+ ../configure
44
+ make
3045
3146
This will now keep all generates files seperate from the maintained
3247
source code.
3348
3449
--------------------------------------------------------------------------
3550
3651
Here are some notes on what is happening behind the scenes:
52
+
53
+* The configure script (if used) examines the options given
54
+ and runs various tests with the C compiler to create Makefile
55
+ from the Makefile.in template as well as autoconfig.h
3756
3857
* The Makefile just sets up a few macros and then invokes the
3958
real makefile in src/main.mk. The src/main.mk makefile is
4059
automatically generated by a TCL script found at src/makemake.tcl.
4160
Do not edit src/main.mk directly. Update src/makemake.tcl and
@@ -51,5 +70,8 @@
5170
A header comment in src/translate.c explains in detail what it does.
5271
5372
* The src/mkindex.c program generates some C code that implements
5473
static lookup tables. See the header comment in the source code
5574
for details on what it does.
75
+
76
+Additional information on the build process is available from
77
+http://www.fossil-scm.org/fossil/doc/trunk/www/makefile.wiki
5678
5779
DELETED Makefile
5880
ADDED Makefile.classic
5981
ADDED Makefile.in
6082
ADDED VERSION
6183
ADDED auto.def
6284
ADDED autosetup/LICENSE
6385
ADDED autosetup/README.autosetup
6486
ADDED autosetup/autosetup
6587
ADDED autosetup/cc-lib.tcl
6688
ADDED autosetup/cc-shared.tcl
6789
ADDED autosetup/cc.tcl
6890
ADDED autosetup/config.guess
6991
ADDED autosetup/config.sub
7092
ADDED autosetup/find-tclsh
7193
ADDED autosetup/jimsh0.c
7294
ADDED autosetup/local.tcl
7395
ADDED autosetup/system.tcl
7496
ADDED autosetup/test-tclsh
7597
ADDED configure
--- BUILD.txt
+++ BUILD.txt
@@ -1,41 +1,60 @@
1 All of the source code for fossil is contained in the src/ subdirectory.
2 But there is a lot of generated code, so you will probably want to
3 use the Makefile. To do a complete build on unix, just type:
 
 
 
 
 
 
 
4
5 make
6
7 On a windows box, use one of the Makefiles in the win/ subdirectory,
8 according to your compiler and environment. For example:
 
 
 
 
 
9
10 make -f win/Makefile.w32
11
12 If you have trouble, or you want to do something fancy, just look at
13 top level makefile. There are 6 configuration options that are all well
14 commented. Instead of editing the Makefile, consider copying the Makefile
15 to an alternative name such as "GNUMakefile", "BSDMakefile", or "makefile"
16 and editing the copy.
17
18
19 BUILDING OUTSIDE THE SOURCE TREE
20
21 An out of source build is pretty easy:
22
23 1. Make a new directory to do the builds in.
24 2. Copy "Makefile" from the source into the build directory and
25 modify the SRCDIR macro along the lines of:
 
 
26
27 SRCDIR=../src
28
29 3. type: "make"
 
30
31 This will now keep all generates files seperate from the maintained
32 source code.
33
34 --------------------------------------------------------------------------
35
36 Here are some notes on what is happening behind the scenes:
 
 
 
 
37
38 * The Makefile just sets up a few macros and then invokes the
39 real makefile in src/main.mk. The src/main.mk makefile is
40 automatically generated by a TCL script found at src/makemake.tcl.
41 Do not edit src/main.mk directly. Update src/makemake.tcl and
@@ -51,5 +70,8 @@
51 A header comment in src/translate.c explains in detail what it does.
52
53 * The src/mkindex.c program generates some C code that implements
54 static lookup tables. See the header comment in the source code
55 for details on what it does.
 
 
 
56
57 ELETED Makefile
58 DDED Makefile.classic
59 DDED Makefile.in
60 DDED VERSION
61 DDED auto.def
62 DDED autosetup/LICENSE
63 DDED autosetup/README.autosetup
64 DDED autosetup/autosetup
65 DDED autosetup/cc-lib.tcl
66 DDED autosetup/cc-shared.tcl
67 DDED autosetup/cc.tcl
68 DDED autosetup/config.guess
69 DDED autosetup/config.sub
70 DDED autosetup/find-tclsh
71 DDED autosetup/jimsh0.c
72 DDED autosetup/local.tcl
73 DDED autosetup/system.tcl
74 DDED autosetup/test-tclsh
75 DDED configure
--- BUILD.txt
+++ BUILD.txt
@@ -1,41 +1,60 @@
1 To do a complete build, just type:
2
3 ./configure; make
4
5 The ./configure script builds Makefile from Makefile.in based on
6 your system and any options you select (run "./configure --help"
7 for a listing of the available options.)
8
9 If you wish to use the original Makefile with no configuration, you can
10 instead use:
11
12 make -f Makefile.classic
13
14 On a windows box, use one of the Makefiles in the win/ subdirectory,
15 according to your compiler and environment. If you have GCC and MSYS
16 installed on your system, then consider:
17
18 make -f win/Makefile.mingw
19
20 If you have VC++ installed on your system, then consider:
21
22 cd win; nmake /f Makefile.msc
23
24 If you have trouble, or you want to do something fancy, just look at
25 Makefile.classic. There are 6 configuration options that are all well
26 commented. Instead of editing the Makefile.classic, consider copying
27 Makefile.classic to an alternative name such as "GNUMakefile",
28 "BSDMakefile", or "makefile" and editing the copy.
29
30
31 BUILDING OUTSIDE THE SOURCE TREE
32
33 An out of source build is pretty easy:
34
35 1. Make and change to a new directory to do the builds in.
36 2. Run the "configure" script from this directory.
37 3. Type: "make"
38
39 For example:
40
41 mkdir build
42 cd build
43 ../configure
44 make
45
46 This will now keep all generates files seperate from the maintained
47 source code.
48
49 --------------------------------------------------------------------------
50
51 Here are some notes on what is happening behind the scenes:
52
53 * The configure script (if used) examines the options given
54 and runs various tests with the C compiler to create Makefile
55 from the Makefile.in template as well as autoconfig.h
56
57 * The Makefile just sets up a few macros and then invokes the
58 real makefile in src/main.mk. The src/main.mk makefile is
59 automatically generated by a TCL script found at src/makemake.tcl.
60 Do not edit src/main.mk directly. Update src/makemake.tcl and
@@ -51,5 +70,8 @@
70 A header comment in src/translate.c explains in detail what it does.
71
72 * The src/mkindex.c program generates some C code that implements
73 static lookup tables. See the header comment in the source code
74 for details on what it does.
75
76 Additional information on the build process is available from
77 http://www.fossil-scm.org/fossil/doc/trunk/www/makefile.wiki
78
79 ELETED Makefile
80 DDED Makefile.classic
81 DDED Makefile.in
82 DDED VERSION
83 DDED auto.def
84 DDED autosetup/LICENSE
85 DDED autosetup/README.autosetup
86 DDED autosetup/autosetup
87 DDED autosetup/cc-lib.tcl
88 DDED autosetup/cc-shared.tcl
89 DDED autosetup/cc.tcl
90 DDED autosetup/config.guess
91 DDED autosetup/config.sub
92 DDED autosetup/find-tclsh
93 DDED autosetup/jimsh0.c
94 DDED autosetup/local.tcl
95 DDED autosetup/system.tcl
96 DDED autosetup/test-tclsh
97 DDED configure
D Makefile
-3
--- a/Makefile
+++ b/Makefile
@@ -1,3 +0,0 @@
1
-#!/usr/bin/make
2
-#
3
-# This is tg the build. This is used
--- a/Makefile
+++ b/Makefile
@@ -1,3 +0,0 @@
1 #!/usr/bin/make
2 #
3 # This is tg the build. This is used
--- a/Makefile
+++ b/Makefile
@@ -1,3 +0,0 @@
 
 
 

No diff available

--- a/Makefile.classic
+++ b/Makefile.classic
@@ -0,0 +1,3 @@
1
+#!/usr/bin/make
2
+#
3
+# This is tg the build. This is used
--- a/Makefile.classic
+++ b/Makefile.classic
@@ -0,0 +1,3 @@
 
 
 
--- a/Makefile.classic
+++ b/Makefile.classic
@@ -0,0 +1,3 @@
1 #!/usr/bin/make
2 #
3 # This is tg the build. This is used
--- a/Makefile.in
+++ b/Makefile.in
@@ -0,0 +1,9 @@
1
+ -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzzSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssitclsh -DFOSSIL_ENABLE_LEGACY_MV_RM=1@CFLAGS@@CFLAGS@Rdi make source
2
+#
3
+#
4
+OBJDIR = ./@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSILendif
5
+ifeq ($(findstriSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE$(MAKE) reconfig
6
+endif
7
+@AUTOREMAKE@ && $(MAKE)
8
+endif
9
+FOSSIL_ENABLE_M +
--- a/Makefile.in
+++ b/Makefile.in
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
--- a/Makefile.in
+++ b/Makefile.in
@@ -0,0 +1,9 @@
1 -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzzSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssitclsh -DFOSSIL_ENABLE_LEGACY_MV_RM=1@CFLAGS@@CFLAGS@Rdi make source
2 #
3 #
4 OBJDIR = ./@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSILendif
5 ifeq ($(findstriSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE$(MAKE) reconfig
6 endif
7 @AUTOREMAKE@ && $(MAKE)
8 endif
9 FOSSIL_ENABLE_M +
+1
--- a/VERSION
+++ b/VERSION
@@ -0,0 +1 @@
1
+1.19
--- a/VERSION
+++ b/VERSION
@@ -0,0 +1 @@
 
--- a/VERSION
+++ b/VERSION
@@ -0,0 +1 @@
1 1.19
+2
--- a/auto.def
+++ b/auto.def
@@ -0,0 +1,2 @@
1
+D markdown=0 => {Build with markdown enginemarkdown]} {
2
+MARKDOWMARKDOWipv6=1 =>
--- a/auto.def
+++ b/auto.def
@@ -0,0 +1,2 @@
 
 
--- a/auto.def
+++ b/auto.def
@@ -0,0 +1,2 @@
1 D markdown=0 => {Build with markdown enginemarkdown]} {
2 MARKDOWMARKDOWipv6=1 =>
--- a/autosetup/LICENSE
+++ b/autosetup/LICENSE
@@ -0,0 +1,35 @@
1
+Unless explicitly stated, all files which form part of autosetup
2
+are released under the following license:
3
+
4
+---------------------------------------------------------------------
5
+autosetup - A build environment "autoconfigurator"
6
+
7
+Copyright (c) 2010-2011, WorkWare Systems <http://workware.net.au/>
8
+
9
+Redistribution and use in source and binary forms, with or without
10
+modification, are permitted provided that the following conditions
11
+are met:
12
+
13
+1. Redistributions of source code must retain the above copyright
14
+ notice, this list of conditions and the following disclaimer.
15
+2. Redistributions in binary form must reproduce the above
16
+ copyright notice, this list of conditions and the following
17
+ disclaimer in the documentation and/or other materials
18
+ provided with the distribution.
19
+
20
+THIS SOFTWARE IS PROVIDED BY THE WORKWARE SYSTEMS ``AS IS'' AND ANY
21
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WORKWARE
24
+SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+
33
+The views and conclusions contained in the software and documentation
34
+are those of the authors and should not be interpreted as representing
35
+official policies, either expressed or implied, of WorkWare Systems.
--- a/autosetup/LICENSE
+++ b/autosetup/LICENSE
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/LICENSE
+++ b/autosetup/LICENSE
@@ -0,0 +1,35 @@
1 Unless explicitly stated, all files which form part of autosetup
2 are released under the following license:
3
4 ---------------------------------------------------------------------
5 autosetup - A build environment "autoconfigurator"
6
7 Copyright (c) 2010-2011, WorkWare Systems <http://workware.net.au/>
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 1. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above
16 copyright notice, this list of conditions and the following
17 disclaimer in the documentation and/or other materials
18 provided with the distribution.
19
20 THIS SOFTWARE IS PROVIDED BY THE WORKWARE SYSTEMS ``AS IS'' AND ANY
21 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WORKWARE
24 SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 The views and conclusions contained in the software and documentation
34 are those of the authors and should not be interpreted as representing
35 official policies, either expressed or implied, of WorkWare Systems.
--- a/autosetup/README.autosetup
+++ b/autosetup/README.autosetup
@@ -0,0 +1 @@
1
+This is autosetup v0.6.2. S
--- a/autosetup/README.autosetup
+++ b/autosetup/README.autosetup
@@ -0,0 +1 @@
 
--- a/autosetup/README.autosetup
+++ b/autosetup/README.autosetup
@@ -0,0 +1 @@
1 This is autosetup v0.6.2. S
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -0,0 +1,31 @@
1
+#!/bin/sh
2
+4 => "create an initial 'confbool init]$source#!/bin/sh
3
+parray define
4
+ } else {
5
+ return $alias
6
+ }[error-location $msg]use cc cc-sharedupleve`"$dir/find-tclsh" || echo false`eduplevel #0#!/bin/sh
7
+${m}.tcl
8
+uplevel #0 [list source $source]put2put3 "Looking for $source"![string m 2>/dev/null} {
9
+ set create_configure 1Use --initset cre#!/bin/sh
10
+4 => "creat # Jim uses system() for exec under mingw, so
11
+ # we need to fetch the output ourselves
12
+ set tmpfile auto[format %04x [rand 10000]].tmp
13
+ set rc [catch [list exec {*}$readfile $tmpfile]
14
+ file delete $tmpfile
15
+ return -code $rc $result breakn/sh
16
+4 => "create an in"create an initial 'c[lrange $argv $i end]`"$dir/find-tclsh" || echo false`autoconf-hsh
17
+4 => "create an initial 'confbool init]$source#!/bin/sh
18
+parray define
19
+ } else {
20
+ return $alias
21
+ }[error-location $msg]use cc cc-shareduplevel #0#!/bin/sh
22
+${m}.tcl
23
+uplevel #0 [list source $source]put2put3 "Looking for $source"![string m 2>/dev/null} {
24
+ set create_configure 1Use --initset cre#!/bin/sh
25
+4 => "creat # Jim uses system() for exec under mingw, so
26
+ # we need to fetch the output ourselves
27
+ set tmpfile auto[format %04x [rand 10000]].tmp
28
+ set rc [catch [list exec {*}$readfile $tmpfile]
29
+ file delete $tmpfile
30
+ return -code $rc $result!/bin/sh
31
+4 => "create an
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -0,0 +1,31 @@
1 #!/bin/sh
2 4 => "create an initial 'confbool init]$source#!/bin/sh
3 parray define
4 } else {
5 return $alias
6 }[error-location $msg]use cc cc-sharedupleve`"$dir/find-tclsh" || echo false`eduplevel #0#!/bin/sh
7 ${m}.tcl
8 uplevel #0 [list source $source]put2put3 "Looking for $source"![string m 2>/dev/null} {
9 set create_configure 1Use --initset cre#!/bin/sh
10 4 => "creat # Jim uses system() for exec under mingw, so
11 # we need to fetch the output ourselves
12 set tmpfile auto[format %04x [rand 10000]].tmp
13 set rc [catch [list exec {*}$readfile $tmpfile]
14 file delete $tmpfile
15 return -code $rc $result breakn/sh
16 4 => "create an in"create an initial 'c[lrange $argv $i end]`"$dir/find-tclsh" || echo false`autoconf-hsh
17 4 => "create an initial 'confbool init]$source#!/bin/sh
18 parray define
19 } else {
20 return $alias
21 }[error-location $msg]use cc cc-shareduplevel #0#!/bin/sh
22 ${m}.tcl
23 uplevel #0 [list source $source]put2put3 "Looking for $source"![string m 2>/dev/null} {
24 set create_configure 1Use --initset cre#!/bin/sh
25 4 => "creat # Jim uses system() for exec under mingw, so
26 # we need to fetch the output ourselves
27 set tmpfile auto[format %04x [rand 10000]].tmp
28 set rc [catch [list exec {*}$readfile $tmpfile]
29 file delete $tmpfile
30 return -code $rc $result!/bin/sh
31 4 => "create an
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,63 @@
1
+# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
2
+# All rights reserved
3
+
4
+# @synopsis:
5
+#
6
+# Provides a library of common tests on top ofmodule-options {}of the 'cc' module.
7
+
8
+use cc
9
+
10
+# @cc-check-lfsAC_SYS_LARGEFILE macro
11
+#
12
+# defines 'HAVE_LFS' if L S is available,
13
+# and defines '_FILE_OFFSET_BITS=64' if necessary
14
+#
15
+# Returns 1 if 'LFS' is available or 0 otherwise
16
+#
17
+proc cc-check-lfs {} {
18
+ cc-check-includes sys/types.h
19
+ msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..."
20
+ set lfs 1
21
+ if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} {
22
+ msg-result no
23
+ } elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} {
24
+ define _FILE_OFFSET_BITS 64
25
+ msg-result yes
26
+ } else {
27
+ set lfs 0
28
+ msg-result none
29
+ }
30
+ define-feature lfs $lfs
31
+ return $lfs
32
+}
33
+
34
+# @cc-check-endian
35
+#
36
+# The equivalent of th eAC_C_BIGENDIAN macroth e 'AC_C_BIGENDIAN' macro.
37
+#
38
+# defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
39
+# or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
40
+#
41
+# Returns 1 if determined, or 0 if not.
42
+#
43
+proc cc-check-endian {} {
44
+ cc-check-includes sys/types.h sys/param.h
45
+ set rc 0
46
+ msg-checking "Checking endian..."
47
+ cc-with {-includes {sys/types.h sys/param.h}} {
48
+ if {[cctest -code {
49
+ #if! ! defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
50
+ #error unknown
51
+ #elif BYTE_ORDER != LITTLE_ENDIAN
52
+ #error big
53
+ #endif
54
+ }]} {
55
+ define-feature little-endian
56
+ msg-result "little"
57
+ set rc 1
58
+ } else {
59
+ msg-result "unknown"
60
+ }
61
+ }
62
+ return $rc
63
+}
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,63 @@
1 # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
2 # All rights reserved
3
4 # @synopsis:
5 #
6 # Provides a library of common tests on top ofmodule-options {}of the 'cc' module.
7
8 use cc
9
10 # @cc-check-lfsAC_SYS_LARGEFILE macro
11 #
12 # defines 'HAVE_LFS' if L S is available,
13 # and defines '_FILE_OFFSET_BITS=64' if necessary
14 #
15 # Returns 1 if 'LFS' is available or 0 otherwise
16 #
17 proc cc-check-lfs {} {
18 cc-check-includes sys/types.h
19 msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..."
20 set lfs 1
21 if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} {
22 msg-result no
23 } elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} {
24 define _FILE_OFFSET_BITS 64
25 msg-result yes
26 } else {
27 set lfs 0
28 msg-result none
29 }
30 define-feature lfs $lfs
31 return $lfs
32 }
33
34 # @cc-check-endian
35 #
36 # The equivalent of th eAC_C_BIGENDIAN macroth e 'AC_C_BIGENDIAN' macro.
37 #
38 # defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
39 # or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
40 #
41 # Returns 1 if determined, or 0 if not.
42 #
43 proc cc-check-endian {} {
44 cc-check-includes sys/types.h sys/param.h
45 set rc 0
46 msg-checking "Checking endian..."
47 cc-with {-includes {sys/types.h sys/param.h}} {
48 if {[cctest -code {
49 #if! ! defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
50 #error unknown
51 #elif BYTE_ORDER != LITTLE_ENDIAN
52 #error big
53 #endif
54 }]} {
55 define-feature little-endian
56 msg-result "little"
57 set rc 1
58 } else {
59 msg-result "unknown"
60 }
61 }
62 return $rc
63 }
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -0,0 +1,30 @@
1
+# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2
+# All rights reserved
3
+
4
+# @synopsis:
5
+#
6
+# The 'cc-shared' module provides support for shared libraries and shared objects.
7
+# It defines the following variables:
8
+#
9
+## SH_CFLAGS Flags to use compiling sources destined for a shared library
10
+## SH_LDFLAGS Flags to use linking t the soname when cread libs - %s = version
11
+## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object
12
+## ll symbols table, %s = path
13
+## SH_LINKFLAGS Flags to use linking an executable which will load shared objects
14
+## LD_LIBRARY_PATH Environment variable which specifie
15
+module-options {}
16
+
17
+foreach i {SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LLD_LIBRARY_PATH define SHOBJ_LDFLAGS_R -bobject
18
+## SHOBJ_LDFLAGS Flags to are System# Copyright ( Flags to usDYLD_LIBRARY_PATH
19
+ }
20
+ *-*-ming* {sharedOBJ_LDFLAGSshared}
21
+ *-*-solaris* {
22
+# Copyright (c) 20mwed
23
+## SHOBJ_LD-Kpic Flags to us-Kpic"-G"
24
+define LD_LIBthe toolch-strip-unneeded
25
+
26
+# Note: Thiain
27
+# http://sourceforge sparc* {
28
+AGS SHOBJ_LDFLAGS_rdynamicference for identify-fPICshared Flags to us-fPIC}
29
+ * {
30
+ # Generic Unix settingsstems http://www.workwa# Copyrigference for identifying PICmicference for idCtify-fPfPICicference for identify-f
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -0,0 +1,30 @@
1 # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2 # All rights reserved
3
4 # @synopsis:
5 #
6 # The 'cc-shared' module provides support for shared libraries and shared objects.
7 # It defines the following variables:
8 #
9 ## SH_CFLAGS Flags to use compiling sources destined for a shared library
10 ## SH_LDFLAGS Flags to use linking t the soname when cread libs - %s = version
11 ## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object
12 ## ll symbols table, %s = path
13 ## SH_LINKFLAGS Flags to use linking an executable which will load shared objects
14 ## LD_LIBRARY_PATH Environment variable which specifie
15 module-options {}
16
17 foreach i {SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LLD_LIBRARY_PATH define SHOBJ_LDFLAGS_R -bobject
18 ## SHOBJ_LDFLAGS Flags to are System# Copyright ( Flags to usDYLD_LIBRARY_PATH
19 }
20 *-*-ming* {sharedOBJ_LDFLAGSshared}
21 *-*-solaris* {
22 # Copyright (c) 20mwed
23 ## SHOBJ_LD-Kpic Flags to us-Kpic"-G"
24 define LD_LIBthe toolch-strip-unneeded
25
26 # Note: Thiain
27 # http://sourceforge sparc* {
28 AGS SHOBJ_LDFLAGS_rdynamicference for identify-fPICshared Flags to us-fPIC}
29 * {
30 # Generic Unix settingsstems http://www.workwa# Copyrigference for identifying PICmicference for idCtify-fPfPICicference for identify-f
--- a/autosetup/cc.tcl
+++ b/autosetup/cc.tcl
@@ -0,0 +1,314 @@
1
+# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2
+# All rights reserved
3
+
4
+# @synopsis:
5
+#
6
+# The 'cc' module supports checking various 'features' of the C or C++
7
+# compiler/linker environment. Common commands are ,
8
+# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set:
9
+#
10
+## CC - C compiler
11
+## CXX - C++ compiler
12
+## CPP - C preprocessor
13
+##CACHE - Set to "none" to disable automatic use of ccache
14
+## Ciler flags
15
+## CXXFLAGS - Additional C++ compiler flags
16
+## LDFLAGS - Additional compiler flags during linking
17
+## LINKFLAGS - ?How is this diffes to use (for all tests)
18
+## CROSS - Tool prefix for cross compilation
19
+#
20
+# The following variables are defined from the corresponding
21
+# environment variables if set.
22
+#
23
+## CC_FOR_BUILD
24
+## LD
25
+
26
+use systPPFLAGS
27
+## LINKFLAGSmodule-options {}
28
+
29
+# Checks for the existence of the giveNote that the return code is not meaningful
30
+proc cc-check-something {name code} {
31
+ uplevel 1 $codee given type/strunction {function} {
32
+ cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
33
+}
34
+
35
+# Checks for the existence of the given type by compiling
36
+proc cctest_type {type} {
37
+ cctest -code "$type _x;"
38
+}
39
+
40
+# Checks for the existence of the given type/structure member.
41
+# e.g. "struct stat.st_mtime"
42
+proc cctest_member {struct_member} {
43
+ # split at the first dot
44
+ regexp {^([^.]+)[.](.*)$} $lassign me;\n#endif"
45
+}
46
+
47
+# @cc-ch
48
+# e.g. "struct stypeses a variable with the 4 8 1 2 16 32} {
49
+ if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
50
+ set size $i
51
+ break
52
+ }
53
+ }
54
+ msg-result $size
55
+ set define [feature-define-name $type SIZEOF_]
56
+ define $define $size
57
+ }
58
+ # Return the last result
59
+ get-define $define
60
+}
61
+
62
+# Checks for each feature in $list by using the given script.
63
+#
64
+# When the script is evaluated, $each is set to the feature
65
+# being checked, and $extra is set to any additional cctest args.
66
+#
67
+# Returns 1 if all features were found, or 0 otherwise.
68
+proc cc-check-some-feature {list script} {
69
+ set ret 1
70
+ foreach each $list {
71
+ if {![check-feature $each $script]} {
72
+ set ret 0
73
+ }
74
+ }
75
+ return $ret
76
+}
77
+
78
+# @cc-check-includes includes ...
79
+#
80
+# Checks that the given include files can be used.
81
+proc cc-check-includes {args} {
82
+ c
83
+procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member
84
+ cctest -code "static $struct _s; return sizeof(_s.$member);"
85
+}
86
+
87
+# Checks for the existence of the given define by compiling
88
+#
89
+proc cctest_define {name} {
90
+ cctest -code "#ifndef $name\n#error not defined\n#endif"
91
+}
92
+
93
+# Checks forcks that the given include files can be used.
94
+proc cc-check-includes {args} {
95
+ cc-check-some-feature $args {
96
+ set with {}
97
+ if {[dict exists $::autosetup(cc-include-deps) $each]} {
98
+ set deps! cc-check-include$exeecks tha]} {
99
+ cc-with [list -includes $w }
100
+ define $TOOL $exeed if set:
101
+#
102
+## CC
103
+# @synopsis:
104
+#
105
+# The 'cc' module supports checking various 'features' of the C or C++
106
+# compiler/linker environment. Common commands are ,
107
+# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set:
108
+#
109
+## CC - C compiler
110
+## CXX - C++ compiler
111
+## CPP - C preprocessor
112
+##CACHE - Set to "none" to disable automatic use of ccache
113
+## Ciler flags
114
+## CXXFLAGS - Additional C++ compiler flags
115
+## LDFLAGS - Additional compiler flags during linking
116
+## LINKFLAGS - ?How is this diffes to use (for all tests)
117
+## CROSS - Tool prefix for cross compilation
118
+#
119
+# The following variables are defined from the corresponding
120
+# environment variables if set.
121
+#
122
+## CC_FOR_BUILD
123
+## LD
124
+
125
+use systPPFLAGS
126
+## LINKFLAGSmodule-options {}
127
+
128
+# Checks for the existence of the giveNote that the return code is not meaningful
129
+proc cc-check-something {name code} {
130
+ uplevel 1 $codee given type/strunction {function} {
131
+ cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
132
+}
133
+
134
+# Checks for the existence of the given type by compiling
135
+proc cctest_type {type} {
136
+ cctest -code "$type _x;"
137
+}
138
+
139
+# Checks for the existence of the given type/structure member.
140
+# e.g. "struct stat.st_mtime"
141
+proc cctest_member {struct_member} {
142
+ # split at the first dot
143
+ regexp {^([^.]+)[.](.*)$} $lassign [split $struct_member .]rn sizeof(_s.$member);"
144
+}
145
+
146
+# Checks for the existence of the given define by compiling
147
+#
148
+proc cctest_define {name} {
149
+ cctest -code "#ifndef $name\n#error not defined\n#endif"
150
+}
151
+
152
+# Checks for the existence of the given name either as
153
+# a macro (#define) or an rvalue (such as an enum)
154
+#
155
+proc cctest_decl {name} {
156
+ cctest -code "#ifndef $name\n(void)$name;\n#endif"
157
+}
158
+
159
+# @cc-check-sizeof type ...
160
+#
161
+# Checks the size of the given types (between 1 and 32, inclusive).
162
+# Defines a variable with the size determined, or 'unknown'"unknown"ng', defines 'SIZEOF_LSIZEOF_LONG_LONGe.
163
+#
164
+proc cc-check-sizeof {args} {
165
+ foreach type $args {
166
+ msg-checking "Checking for sizeof $type..."
167
+ set size unknown
168
+ # Try the most common sizes first
169
+ foreach i {4 8 1 2 16 32} {
170
+ if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
171
+ set size $i
172
+ break
173
+ }
174
+ }
175
+ msg-result $size
176
+ set define [feature-define-name $type SIZEOF_]
177
+ define $define $size
178
+ }
179
+ # Return the last result
180
+ get-define $define
181
+}
182
+
183
+# Checks for each feature in $list by using the given script.
184
+#
185
+# When the script is evaluated, $each is set to the feature
186
+# being checked, and $extra is set to any additional cctest args.
187
+#
188
+# Returns 1 if all features were found, or 0 otherwise.
189
+proc cc-check-some-feature {list script} {
190
+ set ret 1
191
+ foreach each $list {
192
+ if {![check-feature $each $script]} {
193
+ set ret 0
194
+ }
195
+ }
196
+ return $ret
197
+}
198
+
199
+# @cc-check-includes includes ...
200
+#
201
+# Checks that the given include files can be used.
202
+proc cc-check-includes {args} {
203
+ c
204
+procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member
205
+ cctest -code "static $struct _s; return sizeof(_s.$member);"
206
+}
207
+
208
+# Checks for the existence of the given define by compiling
209
+#
210
+proc cctest_define {name} {
211
+ cctest -code "#ifndef $name\n#error not defined\n#endif"
212
+}
213
+
214
+# Checks for the existence of the given name either as
215
+# a macro (#define) or an rvalue (such as an enum)
216
+#
217
+proc cctest_decl {name} {
218
+ cctest -code "#ifndef $name\n(void)$name;\n#endif"
219
+}
220
+ given types (bet#includeddetermined, or 'unknown' otherwise.
221
+# e.g. for type 'long long', defines 'SIZEOF_LONG_LONG'.
222
+# Returns the size of the last type.
223
+#
224
+proc cc-check-sizeof {args} {
225
+ foreach type $adfirst dot
226
+ regexp {^([^.]+)[.](.*)$} $struct_member -> struct member
227
+ cctest -code "static $struct _s; return sizeof(_s.$member);"
228
+}
229
+
230
+# Checks for the existence of the given define by compiling
231
+#
232
+proc cctest_define FLAGS - ?How is this di# @synopsis:
233
+#
234
+# The 'cc' module supports checking various 'features' of the C or C++
235
+# compiler/linker environment. Common commands are ,
236
+# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set:
237
+#
238
+## CC - C compiler
239
+## CXX - C++ compiler
240
+## CPP - C preprocessor
241
+##CACHE - Set to "none" to disfor a declsable automatic use of ccache
242
+## Ciler flags
243
+## C# Copyright (c) 2010 Work foreach type $args {
244
+ msg-checking "Checking for sizeof $type..."
245
+ set size unknown
246
+ # Try the most common sizes first
247
+ foreach i {4 8 1 2 16 32} {
248
+ if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
249
+ set size $i
250
+ break
251
+ }
252
+ }
253
+ msg-result $size
254
+ set define [feature-define-name $type SIZEOF_]
255
+ define $define $size
256
+ }
257
+ # Return the last result
258
+ get-define $define
259
+}
260
+
261
+# Checks for each feature in $list by using the given script.
262
+#
263
+# When the script is evaluated, $each is set to the feature
264
+# being checked, and $extra is set to any additional cctest args.
265
+#
266
+# Returns 1 if all features were found, or 0 otherwise.
267
+proc cc-check-some-feature {list script} {
268
+ set ret 1ch $script]} {
269
+ set ret 0
270
+ }
271
+ }
272
+ return $ret
273
+}
274
+
275
+# @cc-check-includes includes ...
276
+#
277
+# Checks that the given include files can be used.
278
+proc cc-check-includes {args} {
279
+ cc-check-some-feature $args {
280
+ set with {}
281
+ if {[dict exists $::autosetup(cc-include-deps) $each]} {
282
+ set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]]
283
+ msg-quiet cc-check-includes {*}$deps
284
+ foreach i $deps {
285
+ if {[have-feature $i]} {
286
+ lappend with $i
287
+ure $each $scriptargs {
288
+ set new($name) $value
289
+ } $i]} {
290
+ lappend$newme\n(void)$name;\n#th]} {
291
+ cc-with [list -includes $with] {
292
+ cctest -includes $each
293
+ }
294
+ } else {
295
+ cctest -includes $each
296
+ }
297
+ }
298
+}
299
+
300
+# @cc-include-needs include required ...
301
+#
302
+# Ensures that when checking for '$include', a check is first
303
+# made for eachtk is first
304
+# made for each '$required' file, and if found, it is included with '#include'.
305
+proc cc-include-needs {file args} {
306
+ foreach depfile $args {
307
+ dict set ::autosetup(cc-include-deps) $file $depfile 1
308
+ }
309
+}
310
+
311
+# C *-*-darwin* {
312
+ # Don't-gstabs
313
+ }
314
+ }$value$valuecc-check-tools ld.o
--- a/autosetup/cc.tcl
+++ b/autosetup/cc.tcl
@@ -0,0 +1,314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/cc.tcl
+++ b/autosetup/cc.tcl
@@ -0,0 +1,314 @@
1 # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2 # All rights reserved
3
4 # @synopsis:
5 #
6 # The 'cc' module supports checking various 'features' of the C or C++
7 # compiler/linker environment. Common commands are ,
8 # cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set:
9 #
10 ## CC - C compiler
11 ## CXX - C++ compiler
12 ## CPP - C preprocessor
13 ##CACHE - Set to "none" to disable automatic use of ccache
14 ## Ciler flags
15 ## CXXFLAGS - Additional C++ compiler flags
16 ## LDFLAGS - Additional compiler flags during linking
17 ## LINKFLAGS - ?How is this diffes to use (for all tests)
18 ## CROSS - Tool prefix for cross compilation
19 #
20 # The following variables are defined from the corresponding
21 # environment variables if set.
22 #
23 ## CC_FOR_BUILD
24 ## LD
25
26 use systPPFLAGS
27 ## LINKFLAGSmodule-options {}
28
29 # Checks for the existence of the giveNote that the return code is not meaningful
30 proc cc-check-something {name code} {
31 uplevel 1 $codee given type/strunction {function} {
32 cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
33 }
34
35 # Checks for the existence of the given type by compiling
36 proc cctest_type {type} {
37 cctest -code "$type _x;"
38 }
39
40 # Checks for the existence of the given type/structure member.
41 # e.g. "struct stat.st_mtime"
42 proc cctest_member {struct_member} {
43 # split at the first dot
44 regexp {^([^.]+)[.](.*)$} $lassign me;\n#endif"
45 }
46
47 # @cc-ch
48 # e.g. "struct stypeses a variable with the 4 8 1 2 16 32} {
49 if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
50 set size $i
51 break
52 }
53 }
54 msg-result $size
55 set define [feature-define-name $type SIZEOF_]
56 define $define $size
57 }
58 # Return the last result
59 get-define $define
60 }
61
62 # Checks for each feature in $list by using the given script.
63 #
64 # When the script is evaluated, $each is set to the feature
65 # being checked, and $extra is set to any additional cctest args.
66 #
67 # Returns 1 if all features were found, or 0 otherwise.
68 proc cc-check-some-feature {list script} {
69 set ret 1
70 foreach each $list {
71 if {![check-feature $each $script]} {
72 set ret 0
73 }
74 }
75 return $ret
76 }
77
78 # @cc-check-includes includes ...
79 #
80 # Checks that the given include files can be used.
81 proc cc-check-includes {args} {
82 c
83 procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member
84 cctest -code "static $struct _s; return sizeof(_s.$member);"
85 }
86
87 # Checks for the existence of the given define by compiling
88 #
89 proc cctest_define {name} {
90 cctest -code "#ifndef $name\n#error not defined\n#endif"
91 }
92
93 # Checks forcks that the given include files can be used.
94 proc cc-check-includes {args} {
95 cc-check-some-feature $args {
96 set with {}
97 if {[dict exists $::autosetup(cc-include-deps) $each]} {
98 set deps! cc-check-include$exeecks tha]} {
99 cc-with [list -includes $w }
100 define $TOOL $exeed if set:
101 #
102 ## CC
103 # @synopsis:
104 #
105 # The 'cc' module supports checking various 'features' of the C or C++
106 # compiler/linker environment. Common commands are ,
107 # cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set:
108 #
109 ## CC - C compiler
110 ## CXX - C++ compiler
111 ## CPP - C preprocessor
112 ##CACHE - Set to "none" to disable automatic use of ccache
113 ## Ciler flags
114 ## CXXFLAGS - Additional C++ compiler flags
115 ## LDFLAGS - Additional compiler flags during linking
116 ## LINKFLAGS - ?How is this diffes to use (for all tests)
117 ## CROSS - Tool prefix for cross compilation
118 #
119 # The following variables are defined from the corresponding
120 # environment variables if set.
121 #
122 ## CC_FOR_BUILD
123 ## LD
124
125 use systPPFLAGS
126 ## LINKFLAGSmodule-options {}
127
128 # Checks for the existence of the giveNote that the return code is not meaningful
129 proc cc-check-something {name code} {
130 uplevel 1 $codee given type/strunction {function} {
131 cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
132 }
133
134 # Checks for the existence of the given type by compiling
135 proc cctest_type {type} {
136 cctest -code "$type _x;"
137 }
138
139 # Checks for the existence of the given type/structure member.
140 # e.g. "struct stat.st_mtime"
141 proc cctest_member {struct_member} {
142 # split at the first dot
143 regexp {^([^.]+)[.](.*)$} $lassign [split $struct_member .]rn sizeof(_s.$member);"
144 }
145
146 # Checks for the existence of the given define by compiling
147 #
148 proc cctest_define {name} {
149 cctest -code "#ifndef $name\n#error not defined\n#endif"
150 }
151
152 # Checks for the existence of the given name either as
153 # a macro (#define) or an rvalue (such as an enum)
154 #
155 proc cctest_decl {name} {
156 cctest -code "#ifndef $name\n(void)$name;\n#endif"
157 }
158
159 # @cc-check-sizeof type ...
160 #
161 # Checks the size of the given types (between 1 and 32, inclusive).
162 # Defines a variable with the size determined, or 'unknown'"unknown"ng', defines 'SIZEOF_LSIZEOF_LONG_LONGe.
163 #
164 proc cc-check-sizeof {args} {
165 foreach type $args {
166 msg-checking "Checking for sizeof $type..."
167 set size unknown
168 # Try the most common sizes first
169 foreach i {4 8 1 2 16 32} {
170 if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
171 set size $i
172 break
173 }
174 }
175 msg-result $size
176 set define [feature-define-name $type SIZEOF_]
177 define $define $size
178 }
179 # Return the last result
180 get-define $define
181 }
182
183 # Checks for each feature in $list by using the given script.
184 #
185 # When the script is evaluated, $each is set to the feature
186 # being checked, and $extra is set to any additional cctest args.
187 #
188 # Returns 1 if all features were found, or 0 otherwise.
189 proc cc-check-some-feature {list script} {
190 set ret 1
191 foreach each $list {
192 if {![check-feature $each $script]} {
193 set ret 0
194 }
195 }
196 return $ret
197 }
198
199 # @cc-check-includes includes ...
200 #
201 # Checks that the given include files can be used.
202 proc cc-check-includes {args} {
203 c
204 procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member
205 cctest -code "static $struct _s; return sizeof(_s.$member);"
206 }
207
208 # Checks for the existence of the given define by compiling
209 #
210 proc cctest_define {name} {
211 cctest -code "#ifndef $name\n#error not defined\n#endif"
212 }
213
214 # Checks for the existence of the given name either as
215 # a macro (#define) or an rvalue (such as an enum)
216 #
217 proc cctest_decl {name} {
218 cctest -code "#ifndef $name\n(void)$name;\n#endif"
219 }
220 given types (bet#includeddetermined, or 'unknown' otherwise.
221 # e.g. for type 'long long', defines 'SIZEOF_LONG_LONG'.
222 # Returns the size of the last type.
223 #
224 proc cc-check-sizeof {args} {
225 foreach type $adfirst dot
226 regexp {^([^.]+)[.](.*)$} $struct_member -> struct member
227 cctest -code "static $struct _s; return sizeof(_s.$member);"
228 }
229
230 # Checks for the existence of the given define by compiling
231 #
232 proc cctest_define FLAGS - ?How is this di# @synopsis:
233 #
234 # The 'cc' module supports checking various 'features' of the C or C++
235 # compiler/linker environment. Common commands are ,
236 # cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set:
237 #
238 ## CC - C compiler
239 ## CXX - C++ compiler
240 ## CPP - C preprocessor
241 ##CACHE - Set to "none" to disfor a declsable automatic use of ccache
242 ## Ciler flags
243 ## C# Copyright (c) 2010 Work foreach type $args {
244 msg-checking "Checking for sizeof $type..."
245 set size unknown
246 # Try the most common sizes first
247 foreach i {4 8 1 2 16 32} {
248 if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
249 set size $i
250 break
251 }
252 }
253 msg-result $size
254 set define [feature-define-name $type SIZEOF_]
255 define $define $size
256 }
257 # Return the last result
258 get-define $define
259 }
260
261 # Checks for each feature in $list by using the given script.
262 #
263 # When the script is evaluated, $each is set to the feature
264 # being checked, and $extra is set to any additional cctest args.
265 #
266 # Returns 1 if all features were found, or 0 otherwise.
267 proc cc-check-some-feature {list script} {
268 set ret 1ch $script]} {
269 set ret 0
270 }
271 }
272 return $ret
273 }
274
275 # @cc-check-includes includes ...
276 #
277 # Checks that the given include files can be used.
278 proc cc-check-includes {args} {
279 cc-check-some-feature $args {
280 set with {}
281 if {[dict exists $::autosetup(cc-include-deps) $each]} {
282 set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]]
283 msg-quiet cc-check-includes {*}$deps
284 foreach i $deps {
285 if {[have-feature $i]} {
286 lappend with $i
287 ure $each $scriptargs {
288 set new($name) $value
289 } $i]} {
290 lappend$newme\n(void)$name;\n#th]} {
291 cc-with [list -includes $with] {
292 cctest -includes $each
293 }
294 } else {
295 cctest -includes $each
296 }
297 }
298 }
299
300 # @cc-include-needs include required ...
301 #
302 # Ensures that when checking for '$include', a check is first
303 # made for eachtk is first
304 # made for each '$required' file, and if found, it is included with '#include'.
305 proc cc-include-needs {file args} {
306 foreach depfile $args {
307 dict set ::autosetup(cc-include-deps) $file $depfile 1
308 }
309 }
310
311 # C *-*-darwin* {
312 # Don't-gstabs
313 }
314 }$value$valuecc-check-tools ld.o
--- a/autosetup/config.guess
+++ b/autosetup/config.guess
@@ -0,0 +1,307 @@
1
+03-23 the terms of the GNU General Public License as published by
2
+# t(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006,oftware Foundation, 0-09-24r
4
+# (at your option) any later version.
5
+#
6
+# This program is distributed in the hope that it will be useful, but
7
+# WITHOUT ANY WARRANTY; without even the implied w2 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8
+# General Public License for more details.
9
+#
10
+# You should have received a copy of the GNU General Public License
11
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
12
+#
13
+# As a special exceptionto the GNU General Public License, if you
14
+# distribute this file as part of a program that contains a
15
+# configuration script generated by Autoconwrite to the Free Software
16
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Bmay include it under
17
+# the same distribution terms that you use for the rest of that
18
+# program. This Exception is an additional permission under section 7
19
+# of the GNU General Public License, version 3 ("GPLv3").
20
+#
21
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
22
+#
23
+# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
24
+
25
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
26
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
27
+# Attempt to guess a canonical system name.
28
+# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
29
+# under the terms of the GNU General Public License as published by
30
+# t;e Free Software Foundation, either version 3 of the L;cense, or
31
+# (at your option) any later version.
32
+#
33
+# This program is distributed in the hope that it will be useful, but
34
+# WITHOUT ANY WARRANTY; without even the implied warranty of
35
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36
+# General Public License for more details.
37
+#
38
+# You should have received a copy of the GNU General Public License
39
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
40
+#
41
+# As a special exceptionto the GNU General Public License, if you
42
+# distribute this file as part of a program that contains a
43
+# configuration script generated by Autoconf, you may include it under
44
+# the same distribution terms that you use for the rest of that
45
+# program. This Exception is an additional permission under section 7
46
+# of the GNU General Public License, version 3 ("GPLv3").
47
+#
48
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
49
+#
50
+# You can get the latest version of this script from:
51
+# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
52
+
53
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
54
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl
55
+# Attempt to guess a canoniAttempt to g! /bin/sh
56
+# Attemp#*) machine=${! /bin/sh
57
+# Attemp#! /bin/sh
58
+# Attempt to guess a canonical system name.
59
+# Copyright 1992-2018canonical system name.
60
+# Copyrig! /bin/sh
61
+# Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh
62
+# Attemp#! /bin/sh
63
+# Attempt to guess a ${! /bin/sh
64
+# Attemp#! /bin/sh
65
+# Attempt to guess a cekkoBSD:*:*)
66
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*)
67
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh
68
+# Attempt to guess a canonical system name.
69
+# Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name.
70
+# Copyright 1992-2018 Free Software Foundation, Inc.
71
+
72
+timestamp='2018-03-08it and/or modify it
73
+# under the terms of the GNU General Public License as published by
74
+# t;e Free Software Foundation, either version 3 of the L;cense, or
75
+# (at your o program.
76
+
77
+
78
+# neral Public License
79
+# along with he GNU General Public03-23 the terms of the and include a ChangeLog
80
+# entrhe GNU General Public License as published by
81
+# t;e Free Software Foundation, either version 3 of the L;cense, or
82
+# (at your option) any later version.
83
+#
84
+# This program is distributed in the hope that it will be useful, but
85
+# WITHOUT ANY WARRANTY; without even the implied warranty of
86
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87
+# General Public License for more details.
88
+#
89
+# You should have received a copy of the GNU General Public License
90
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
91
+#
92
+# As a special exceptionto the GNU General Public License, if you
93
+# distribute this file as part of a program that contains a
94
+# configuration script generated by Autoconf, you may include it under
95
+# the same distribution terms that you use for the rest of that
96
+# program. This Exception is an additional permission under section 7
97
+# of the GNU General Public License, version 3 ("GPLv3").
98
+#
99
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
100
+#
101
+# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
102
+
103
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
104
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
105
+# Attempt to guess a canonical system name.
106
+# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
107
+# under the terms of the GNU General Public License as published by
108
+# t;e Free Software Foundation, either version 3 of the L;cense, or
109
+# (at your option) any later version.
110
+#
111
+# This program is distributed in the hope that it will be useful, but
112
+# WITHOUT ANY WARRANTY; without even the implied warranty of
113
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
114
+# General Public License for more details.
115
+#
116
+# You should have received a copy of the GNU General Public License
117
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
118
+#
119
+# As a special exceptionto the GNU General Public License, if you
120
+# distribute this file as part of a program that contains a
121
+# configuration script generated by Autoconf, you may include it under
122
+# the same distribution terms that you use for the rest of that
123
+# program. This Exception is an additional permission under section 7
124
+# of the GNU General Public License, version 3 ("GPLv3").
125
+#
126
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
127
+#
128
+# You can get the latest version of this script from:
129
+# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
130
+
131
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
132
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl
133
+# Attempt to guess a canoniAttempt to g! /bin/sh
134
+# Attemp#*) machine=${! /bin/sh
135
+# Attemp#! /bin/sh
136
+# Attempt to guess a canonical system name.
137
+# Copyright 1992-2018canonical system name.
138
+# Copyrig! /bin/sh
139
+# Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh
140
+# Attemp#! /bin/sh
141
+# Attempt to guess a ${! /bin/sh
142
+# Attemp#! /bin/sh
143
+# Attempt to guess a cekkoBSD:*:*)
144
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*)
145
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh
146
+# Attempt to guess a canonical system name.
147
+# Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name.
148
+# Copyright 1992-2018 Free Software Foundation, Inc.
149
+
150
+timestamp='2018-03-08it and/or modify it
151
+# under the terms of the GNU General Public License as published by
152
+# t;e Free Software Foundation, either version 3 of the L;cense, or
153
+# (at your o.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
154
+# Attempt to guess a canonical system name.
155
+# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
156
+# under the terms of the GNU General Public License as published by
157
+# t;e Free Software Foundation, either version 3 of the L;cense, or
158
+# (at your option) any later version.
159
+#
160
+# This program is distributed in the hope that it will be useful, but
161
+# WITHOUT ANY WARRANTY; without even the implied warranty of
162
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
163
+# General Public License for more details.
164
+#
165
+# You should have received a copy of the GNU General Public License
166
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
167
+#
168
+# As a special exceptionto the GNU General Public License, if you
169
+# distribute this file as part of a program that contains a
170
+# configuration script generated by Autoconf, you may include it under
171
+# the same distribution terms that you use for the rest of that
172
+# program. This Exception is an additional permission under section 7
173
+# of the GNU General Public License, version 3 ("GPLv3").
174
+#
175
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
176
+#
177
+# You can get the latest version of this script from:
178
+# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
179
+
180
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
181
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl
182
+# Attempt to guess a canoniAttempt to g! /bin/sh
183
+# Attemp#*) machine=${! /bin/sh
184
+# Attemp#! /bin/sh
185
+# Attempt to guess a canonical system name.
186
+# Copyright 1992-2018canonical system name.
187
+# Copyrig! /bin/sh
188
+# Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh
189
+# Attemp#! /bin/sh
190
+# Attempt to guess a ${! /bin/sh
191
+# Attemp#! /bin/sh
192
+# Attempt to guess a cekkoBSD:*:*)
193
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*)
194
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh
195
+# Attempt to guess a canonical system name.
196
+# Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name.
197
+# Copyright 1992-2018 Free Software Foundation, Inc.
198
+
199
+timestamp='2018-03-08it and/or modify it
200
+# under the terms of the GNU General Public License as published by
201
+# t;e Free Software Foundation, either version 3 of the L;cense, or
202
+# (at your oished by
203
+# t;e Free Software Foundation, either version 3 of the L;cense, or
204
+# (at your option) any later version.
205
+#
206
+# This program is distributed in the hope that it will be useful, but
207
+# WITHOUT ANY WARRANTY; without even the implied warranty of
208
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
209
+# General Public License for more details.
210
+#
211
+# You should have received a copy of the GNU General Public License
212
+# along with this progra(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
213
+2001, 2002, 2003, 2004, 2005, 2006, 2implied warranty ofot, see <https://www.gnu.org/licenses/>.
214
+#
215
+# As a special exceptionto the GNU General Public License, if you
216
+# distribute this file as part of a program that contains a
217
+# configuration script generated by Autoconf, you may include it under
218
+# the same distribution terms that you use for the rest of that
219
+# program. This Exception is an additional permission under section 7
220
+# of the GNU General Public License, version 3 ("GPLv3").
221
+#
222
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
223
+#
224
+# You can get the latest version of this script from:
225
+# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
226
+
227
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
228
+ cat <<-EOF > $dummy.c`$CC_FORHUP INT TERMneral Public License, version 3 ("GPLv3").
229
+#
230
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
231
+#
232
+# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
233
+
234
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
235
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
236
+# Attempt to guess a canonical system name.
237
+# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
238
+# under the terms of the GNU General Public License as published by
239
+# t;e Free Software Foundation, either version 3 of the L;cense, or
240
+# (at your optionHUP INT PIPE TERM03-23 the terms of the GNU General Public License as published by
241
+# t;e Free Software Foundation, either version 3 of the L;cense, or
242
+# (at your option) any later version.
243
+#
244
+# This program is distributed in the hope tha03-23 the terms of the GNU General Public License as published by
245
+# t;e Free Software Foundation, either version 3 of the L;cense, or
246
+# (at your option) any later version.
247
+#
248
+# This program is distributed in the hope that it will be useful, but
249
+# WITHOUT ANY WARRANTY; without even the implied warranty of
250
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
251
+# General Public License for more details.
252
+#
253
+# You should have received a copy of the GNU General Public License
254
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
255
+#
256
+# As a special exceptionto the GNU General Public License, if you
257
+# distribute this file as part of a program that contains a
258
+# configuration script generated by Autoconf, you may include it under
259
+# the same distribution terms that you use for the rest of that
260
+# program. This Exception is an additional permission under section 7
261
+# of the GNU General Public License, version 3 ("GPLv3").
262
+#
263
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
264
+#
265
+# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
266
+
267
+$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
268
+ cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
269
+# Attempt to guess a canonical system name.
270
+# Open exit :riscos:*:*|arm t it will be useful, but
271
+03-23 th 23 the terms of the GNU General Public License as published by
272
+# t;e Free Software Foundation, either version 3 of the L;cense, or
273
+# (at your option) any later version.
274
+#
275
+# This program is distributed in the hope that it will be useful, but
276
+# WITHOUT ANY WARRANTY; without even the implied warranty of
277
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
278
+# General Public License for more details.
279
+#
280
+# You should have received a copy of the GNU General Public License
281
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
282
+#
283
+# As a special exceptionto the GNU General Public License, if you
284
+# distribute this file as part of a program that contains a
285
+# configuration script generated by Autoconf, you may include it under
286
+# the same distribution terms that you use for the rest of that
287
+# program. This Exception is an additional permission under section 7
288
+# of the GNU General Public License, version 3 ("GPLv3").
289
+#
290
+# Originally written ms of the GNU Genera532)case "${sc_kernel_bits}" in
291
+ 32) HP_ARCH="hppa2.0n" ;;
292
+esac ;;
293
+
294
+ #include <stdlib.h>
295
+ #include <unistd.h>
296
+
297
+ int main ()
298
+ {
299
+ #if
300
+ #endif
301
+switch (cpu)
302
+ "); break;
303
+ 2_0:
304
+ #if
305
+ switch (bits)
306
+ {
307
+
--- a/autosetup/config.guess
+++ b/autosetup/config.guess
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/config.guess
+++ b/autosetup/config.guess
@@ -0,0 +1,307 @@
1 03-23 the terms of the GNU General Public License as published by
2 # t(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004, 2005, 2006,oftware Foundation, 0-09-24r
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful, but
7 # WITHOUT ANY WARRANTY; without even the implied w2 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8 # General Public License for more details.
9 #
10 # You should have received a copy of the GNU General Public License
11 # along with this program; if not, see <https://www.gnu.org/licenses/>.
12 #
13 # As a special exceptionto the GNU General Public License, if you
14 # distribute this file as part of a program that contains a
15 # configuration script generated by Autoconwrite to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Bmay include it under
17 # the same distribution terms that you use for the rest of that
18 # program. This Exception is an additional permission under section 7
19 # of the GNU General Public License, version 3 ("GPLv3").
20 #
21 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
22 #
23 # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
24
25 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
26 cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
27 # Attempt to guess a canonical system name.
28 # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
29 # under the terms of the GNU General Public License as published by
30 # t;e Free Software Foundation, either version 3 of the L;cense, or
31 # (at your option) any later version.
32 #
33 # This program is distributed in the hope that it will be useful, but
34 # WITHOUT ANY WARRANTY; without even the implied warranty of
35 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 # General Public License for more details.
37 #
38 # You should have received a copy of the GNU General Public License
39 # along with this program; if not, see <https://www.gnu.org/licenses/>.
40 #
41 # As a special exceptionto the GNU General Public License, if you
42 # distribute this file as part of a program that contains a
43 # configuration script generated by Autoconf, you may include it under
44 # the same distribution terms that you use for the rest of that
45 # program. This Exception is an additional permission under section 7
46 # of the GNU General Public License, version 3 ("GPLv3").
47 #
48 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
49 #
50 # You can get the latest version of this script from:
51 # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
52
53 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
54 cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl
55 # Attempt to guess a canoniAttempt to g! /bin/sh
56 # Attemp#*) machine=${! /bin/sh
57 # Attemp#! /bin/sh
58 # Attempt to guess a canonical system name.
59 # Copyright 1992-2018canonical system name.
60 # Copyrig! /bin/sh
61 # Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh
62 # Attemp#! /bin/sh
63 # Attempt to guess a ${! /bin/sh
64 # Attemp#! /bin/sh
65 # Attempt to guess a cekkoBSD:*:*)
66 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*)
67 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh
68 # Attempt to guess a canonical system name.
69 # Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name.
70 # Copyright 1992-2018 Free Software Foundation, Inc.
71
72 timestamp='2018-03-08it and/or modify it
73 # under the terms of the GNU General Public License as published by
74 # t;e Free Software Foundation, either version 3 of the L;cense, or
75 # (at your o program.
76
77
78 # neral Public License
79 # along with he GNU General Public03-23 the terms of the and include a ChangeLog
80 # entrhe GNU General Public License as published by
81 # t;e Free Software Foundation, either version 3 of the L;cense, or
82 # (at your option) any later version.
83 #
84 # This program is distributed in the hope that it will be useful, but
85 # WITHOUT ANY WARRANTY; without even the implied warranty of
86 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 # General Public License for more details.
88 #
89 # You should have received a copy of the GNU General Public License
90 # along with this program; if not, see <https://www.gnu.org/licenses/>.
91 #
92 # As a special exceptionto the GNU General Public License, if you
93 # distribute this file as part of a program that contains a
94 # configuration script generated by Autoconf, you may include it under
95 # the same distribution terms that you use for the rest of that
96 # program. This Exception is an additional permission under section 7
97 # of the GNU General Public License, version 3 ("GPLv3").
98 #
99 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
100 #
101 # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
102
103 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
104 cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
105 # Attempt to guess a canonical system name.
106 # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
107 # under the terms of the GNU General Public License as published by
108 # t;e Free Software Foundation, either version 3 of the L;cense, or
109 # (at your option) any later version.
110 #
111 # This program is distributed in the hope that it will be useful, but
112 # WITHOUT ANY WARRANTY; without even the implied warranty of
113 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
114 # General Public License for more details.
115 #
116 # You should have received a copy of the GNU General Public License
117 # along with this program; if not, see <https://www.gnu.org/licenses/>.
118 #
119 # As a special exceptionto the GNU General Public License, if you
120 # distribute this file as part of a program that contains a
121 # configuration script generated by Autoconf, you may include it under
122 # the same distribution terms that you use for the rest of that
123 # program. This Exception is an additional permission under section 7
124 # of the GNU General Public License, version 3 ("GPLv3").
125 #
126 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
127 #
128 # You can get the latest version of this script from:
129 # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
130
131 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
132 cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl
133 # Attempt to guess a canoniAttempt to g! /bin/sh
134 # Attemp#*) machine=${! /bin/sh
135 # Attemp#! /bin/sh
136 # Attempt to guess a canonical system name.
137 # Copyright 1992-2018canonical system name.
138 # Copyrig! /bin/sh
139 # Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh
140 # Attemp#! /bin/sh
141 # Attempt to guess a ${! /bin/sh
142 # Attemp#! /bin/sh
143 # Attempt to guess a cekkoBSD:*:*)
144 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*)
145 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh
146 # Attempt to guess a canonical system name.
147 # Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name.
148 # Copyright 1992-2018 Free Software Foundation, Inc.
149
150 timestamp='2018-03-08it and/or modify it
151 # under the terms of the GNU General Public License as published by
152 # t;e Free Software Foundation, either version 3 of the L;cense, or
153 # (at your o.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
154 # Attempt to guess a canonical system name.
155 # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
156 # under the terms of the GNU General Public License as published by
157 # t;e Free Software Foundation, either version 3 of the L;cense, or
158 # (at your option) any later version.
159 #
160 # This program is distributed in the hope that it will be useful, but
161 # WITHOUT ANY WARRANTY; without even the implied warranty of
162 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
163 # General Public License for more details.
164 #
165 # You should have received a copy of the GNU General Public License
166 # along with this program; if not, see <https://www.gnu.org/licenses/>.
167 #
168 # As a special exceptionto the GNU General Public License, if you
169 # distribute this file as part of a program that contains a
170 # configuration script generated by Autoconf, you may include it under
171 # the same distribution terms that you use for the rest of that
172 # program. This Exception is an additional permission under section 7
173 # of the GNU General Public License, version 3 ("GPLv3").
174 #
175 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
176 #
177 # You can get the latest version of this script from:
178 # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
179
180 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
181 cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl
182 # Attempt to guess a canoniAttempt to g! /bin/sh
183 # Attemp#*) machine=${! /bin/sh
184 # Attemp#! /bin/sh
185 # Attempt to guess a canonical system name.
186 # Copyright 1992-2018canonical system name.
187 # Copyrig! /bin/sh
188 # Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh
189 # Attemp#! /bin/sh
190 # Attempt to guess a ${! /bin/sh
191 # Attemp#! /bin/sh
192 # Attempt to guess a cekkoBSD:*:*)
193 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*)
194 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh
195 # Attempt to guess a canonical system name.
196 # Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name.
197 # Copyright 1992-2018 Free Software Foundation, Inc.
198
199 timestamp='2018-03-08it and/or modify it
200 # under the terms of the GNU General Public License as published by
201 # t;e Free Software Foundation, either version 3 of the L;cense, or
202 # (at your oished by
203 # t;e Free Software Foundation, either version 3 of the L;cense, or
204 # (at your option) any later version.
205 #
206 # This program is distributed in the hope that it will be useful, but
207 # WITHOUT ANY WARRANTY; without even the implied warranty of
208 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
209 # General Public License for more details.
210 #
211 # You should have received a copy of the GNU General Public License
212 # along with this progra(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
213 2001, 2002, 2003, 2004, 2005, 2006, 2implied warranty ofot, see <https://www.gnu.org/licenses/>.
214 #
215 # As a special exceptionto the GNU General Public License, if you
216 # distribute this file as part of a program that contains a
217 # configuration script generated by Autoconf, you may include it under
218 # the same distribution terms that you use for the rest of that
219 # program. This Exception is an additional permission under section 7
220 # of the GNU General Public License, version 3 ("GPLv3").
221 #
222 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
223 #
224 # You can get the latest version of this script from:
225 # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
226
227 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
228 cat <<-EOF > $dummy.c`$CC_FORHUP INT TERMneral Public License, version 3 ("GPLv3").
229 #
230 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
231 #
232 # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
233
234 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
235 cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
236 # Attempt to guess a canonical system name.
237 # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it
238 # under the terms of the GNU General Public License as published by
239 # t;e Free Software Foundation, either version 3 of the L;cense, or
240 # (at your optionHUP INT PIPE TERM03-23 the terms of the GNU General Public License as published by
241 # t;e Free Software Foundation, either version 3 of the L;cense, or
242 # (at your option) any later version.
243 #
244 # This program is distributed in the hope tha03-23 the terms of the GNU General Public License as published by
245 # t;e Free Software Foundation, either version 3 of the L;cense, or
246 # (at your option) any later version.
247 #
248 # This program is distributed in the hope that it will be useful, but
249 # WITHOUT ANY WARRANTY; without even the implied warranty of
250 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
251 # General Public License for more details.
252 #
253 # You should have received a copy of the GNU General Public License
254 # along with this program; if not, see <https://www.gnu.org/licenses/>.
255 #
256 # As a special exceptionto the GNU General Public License, if you
257 # distribute this file as part of a program that contains a
258 # configuration script generated by Autoconf, you may include it under
259 # the same distribution terms that you use for the rest of that
260 # program. This Exception is an additional permission under section 7
261 # of the GNU General Public License, version 3 ("GPLv3").
262 #
263 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
264 #
265 # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc.
266
267 $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM}
268 cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh
269 # Attempt to guess a canonical system name.
270 # Open exit :riscos:*:*|arm t it will be useful, but
271 03-23 th 23 the terms of the GNU General Public License as published by
272 # t;e Free Software Foundation, either version 3 of the L;cense, or
273 # (at your option) any later version.
274 #
275 # This program is distributed in the hope that it will be useful, but
276 # WITHOUT ANY WARRANTY; without even the implied warranty of
277 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
278 # General Public License for more details.
279 #
280 # You should have received a copy of the GNU General Public License
281 # along with this program; if not, see <https://www.gnu.org/licenses/>.
282 #
283 # As a special exceptionto the GNU General Public License, if you
284 # distribute this file as part of a program that contains a
285 # configuration script generated by Autoconf, you may include it under
286 # the same distribution terms that you use for the rest of that
287 # program. This Exception is an additional permission under section 7
288 # of the GNU General Public License, version 3 ("GPLv3").
289 #
290 # Originally written ms of the GNU Genera532)case "${sc_kernel_bits}" in
291 32) HP_ARCH="hppa2.0n" ;;
292 esac ;;
293
294 #include <stdlib.h>
295 #include <unistd.h>
296
297 int main ()
298 {
299 #if
300 #endif
301 switch (cpu)
302 "); break;
303 2_0:
304 #if
305 switch (bits)
306 {
307
--- a/autosetup/config.sub
+++ b/autosetup/config.sub
@@ -0,0 +1 @@
1
+#! /bin/ncr3#! /bin/
--- a/autosetup/config.sub
+++ b/autosetup/config.sub
@@ -0,0 +1 @@
 
--- a/autosetup/config.sub
+++ b/autosetup/config.sub
@@ -0,0 +1 @@
1 #! /bin/ncr3#! /bin/
--- a/autosetup/find-tclsh
+++ b/autosetup/find-tclsh
@@ -0,0 +1,9 @@
1
+#!/bin/sh
2
+# Looks for a suitable tclsh or jimsh in the PATH
3
+# If not foundstrap jimsh d=`dirname "$0"`
4
+{ "$d/jimshd/${1-ac"; } 2>&imsh0"
5
+for cc in tclsh8.7; do
6
+ jimsh0-tclsh}"; } 2>/devexit 0
7
+done
8
+echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
9
+for cc in ${CC_FOR_BUILD:-PATH="$PATH:$d2>/dev/null
--- a/autosetup/find-tclsh
+++ b/autosetup/find-tclsh
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
--- a/autosetup/find-tclsh
+++ b/autosetup/find-tclsh
@@ -0,0 +1,9 @@
1 #!/bin/sh
2 # Looks for a suitable tclsh or jimsh in the PATH
3 # If not foundstrap jimsh d=`dirname "$0"`
4 { "$d/jimshd/${1-ac"; } 2>&imsh0"
5 for cc in tclsh8.7; do
6 jimsh0-tclsh}"; } 2>/devexit 0
7 done
8 echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
9 for cc in ${CC_FOR_BUILD:-PATH="$PATH:$d2>/dev/null
--- a/autosetup/jimsh0.c
+++ b/autosetup/jimsh0.c
@@ -0,0 +1,144 @@
1
+3cl. See http://jim.berlios.de/ */
2
+#define _GNU_SOURCEREFERENCES single source file,/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */
3
+#define JIM_TCL_COMPAT_H
4
+#define TCL_LIBRARY "."
5
+#define jim_ext_stdlib
6
+#define jimregexpxec
7
+#define jim_efilexec
8
+#define jim_eexecxec
9
+#define jim_eclockxec
10
+#define jim_ee TCL_PLATFORM_OS "windows"
11
+#define TCL_PLATFORM_PLATFORM "windows"
12
+#define TCL_PLATFORM_PATH_SEPARATOR ";"
13
+#define HAVE_MKDIR_ONE_ARG
14
+#define HAVE_SYSTEM
15
+#elif defined(__MINGW32__)
16
+#defi HAVE_DIRENT_H
17
+#define HAVE_UNISTD_H
18
+#define HAVE_UMASK
19
+#include elseSEPARATOR ":"
20
+#ifdef _ATFORM_PLATFORM "unix"
21
+#define TCL_PLATFORM_PATH_SEPARMKSTEMP
22
+#define HAVE_LINK
23
+#define HAVE_SYS_TIME_H
24
+#define HAVE_DITFORM "unix"
25
+#define TCL_PLATFndif
26
+#define JIM_VERS3cl. See http://jim.berlios.de/ */
27
+#define _GNU_SOURCEREFERENCES single source file,/* /**
28
+ * UTF-8 utility functions
29
+ *
30
+ * (c) 2010 Steve Bennett <[email protected]>
31
+ *
32
+ * See LICENCE for licence details.
33
+ */
34
+
35
+/**
36
+ * Converts the given unicode codepoint (0 - 0xffff) to utf-8
37
+ * and stores the result at 'p'.
38
+ *
39
+ * Returns the number of utf-8 characters (1-3).
40
+ */
41
+intJim Tcl. See http://jim.tcl.tk/ */
42
+#define JIM_TCL_COMPAT_H
43
+#define/* No utf-8 support. 1 byte = 1 char */
44
+#define utf8_strlen(S, B) TCL_LIBRARY "."
45
+#define j
46
+#defineS, CP) (*(CP) = #define jim_eexecxec
47
+#define jim_eclockxec
48
+#define jim_ee TCL_PLATFORM_OS "windows"
49
+#define TCL_PLATFORM_PLATFORM "windows"
50
+#define TCL_PLAT/**
51
+ * Returns the length of the utf-8 sequence starting with 'c'.
52
+ *
53
+ * Returns 1-4, or -1 if this is not a valid start byte.
54
+ *
55
+ * Note that charlen=4 is not supported by the rest of the API.
56
+ */
57
+int utf8_charlen(int c);
58
+
59
+/**
60
+ * Returns the number of characters in the utf-8
61
+ * string of the given byte length.
62
+ *
63
+ * Any bytes which are not part of an valid utf-8
64
+ * sequence are treated as individual characters.
65
+ *
66
+ * The string *must* be null terminated.
67
+ *
68
+ * Does not support unicode code points > \uffff
69
+ */
70
+int utf8_strlen(bytelen);
71
+
72
+/**
73
+ * Returns the byte index of the given character in the utf-8 string.
74
+ *
75
+ * The string *must* be null terminated.
76
+ *
77
+ * This will return the byte length of a utf-8 string
78
+ * if given the char charindex);
79
+
80
+/**
81
+ * Returns the unicode codepoint corresponding to the
82
+ * utf-8 sequence 'str'.
83
+ *
84
+ * Stores the result in *uc and returns the number of bytes
85
+ * consumed.
86
+ *
87
+ * If 'str' is null terminated, then an invalid utf-8 sequence
88
+ * at the end of the string will be returned as individual bytes.
89
+ *
90
+ * If it is not null terminated, the length *must* be checked first.
91
+ *
92
+ * Does not support unicode c*uc);
93
+
94
+/**
95
+ * Returns the number of bytes before 'str' that the previous
96
+ * utf-8 character sequence starts (which may be the middle of a sequence).
97
+ *
98
+ * Looks back at most 'len' bytes backwards, which must be > 0.
99
+ * If no start char is found, returns -len
100
+ */
101
+int utf8_prev_len(
102
+/**
103
+ * Returns the upper-case variant of the given unicode codepoint.
104
+ *
105
+ * Does not support unicode code points > \uffff
106
+ */
107
+int utf8_upper(int uc);
108
+
109
+/**
110
+ * Returns the lower-case variant of the given unicode codepoint.
111
+ *
112
+ * NOTE: Use utf8_upper() in preference for case-insensitive matching.
113
+ *
114
+ * Does not support unicode code points > \uffff
115
+ */
116
+int utf8_lower(int uc);
117
+
118
+#endif
119
+
120
+#endif
121
+/* Jim - A small embeddable Tcl interpreter
122
+ *
123
+ * Copyright 2005 Salvatore Sanfilippo <[email protected]>
124
+ * Copyright 2005 Clemens Hintze <[email protected]>
125
+ * Copyright 2005 patthoyts - Pat Thoyts <[email protected]>
126
+ * Copyright 2008 oharboe - �yvind Harboe - [email protected]
127
+ * Copyright 2008 Andrew Lunn <[email protected]>
128
+ * Copyright 2008 Duane Ellis <[email protected]>
129
+ * Copyright 2008 Uwe Klein <[email protected]>
130
+ *
131
+ * Redistribution and use in source and binary forms, with or without
132
+ * modification, are permitted provided that the following conditions
133
+ * are met:
134
+ *
135
+ * 1. Redistributions of source code must retain the above copyright
136
+ * notice, this list of conditions and the following disclaimer.
137
+ * 2. Redistributions in binary form must reproduce the above
138
+ * copyright notice, this list of conditions and the following
139
+ * disclaimer in the documentation and/or other materials
140
+ * provided with the distribution.
141
+ *
142
+ * THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
143
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
144
+ * THE IMPLIED WARRANTIES OF MERCHANTABILI
--- a/autosetup/jimsh0.c
+++ b/autosetup/jimsh0.c
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/jimsh0.c
+++ b/autosetup/jimsh0.c
@@ -0,0 +1,144 @@
1 3cl. See http://jim.berlios.de/ */
2 #define _GNU_SOURCEREFERENCES single source file,/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */
3 #define JIM_TCL_COMPAT_H
4 #define TCL_LIBRARY "."
5 #define jim_ext_stdlib
6 #define jimregexpxec
7 #define jim_efilexec
8 #define jim_eexecxec
9 #define jim_eclockxec
10 #define jim_ee TCL_PLATFORM_OS "windows"
11 #define TCL_PLATFORM_PLATFORM "windows"
12 #define TCL_PLATFORM_PATH_SEPARATOR ";"
13 #define HAVE_MKDIR_ONE_ARG
14 #define HAVE_SYSTEM
15 #elif defined(__MINGW32__)
16 #defi HAVE_DIRENT_H
17 #define HAVE_UNISTD_H
18 #define HAVE_UMASK
19 #include elseSEPARATOR ":"
20 #ifdef _ATFORM_PLATFORM "unix"
21 #define TCL_PLATFORM_PATH_SEPARMKSTEMP
22 #define HAVE_LINK
23 #define HAVE_SYS_TIME_H
24 #define HAVE_DITFORM "unix"
25 #define TCL_PLATFndif
26 #define JIM_VERS3cl. See http://jim.berlios.de/ */
27 #define _GNU_SOURCEREFERENCES single source file,/* /**
28 * UTF-8 utility functions
29 *
30 * (c) 2010 Steve Bennett <[email protected]>
31 *
32 * See LICENCE for licence details.
33 */
34
35 /**
36 * Converts the given unicode codepoint (0 - 0xffff) to utf-8
37 * and stores the result at 'p'.
38 *
39 * Returns the number of utf-8 characters (1-3).
40 */
41 intJim Tcl. See http://jim.tcl.tk/ */
42 #define JIM_TCL_COMPAT_H
43 #define/* No utf-8 support. 1 byte = 1 char */
44 #define utf8_strlen(S, B) TCL_LIBRARY "."
45 #define j
46 #defineS, CP) (*(CP) = #define jim_eexecxec
47 #define jim_eclockxec
48 #define jim_ee TCL_PLATFORM_OS "windows"
49 #define TCL_PLATFORM_PLATFORM "windows"
50 #define TCL_PLAT/**
51 * Returns the length of the utf-8 sequence starting with 'c'.
52 *
53 * Returns 1-4, or -1 if this is not a valid start byte.
54 *
55 * Note that charlen=4 is not supported by the rest of the API.
56 */
57 int utf8_charlen(int c);
58
59 /**
60 * Returns the number of characters in the utf-8
61 * string of the given byte length.
62 *
63 * Any bytes which are not part of an valid utf-8
64 * sequence are treated as individual characters.
65 *
66 * The string *must* be null terminated.
67 *
68 * Does not support unicode code points > \uffff
69 */
70 int utf8_strlen(bytelen);
71
72 /**
73 * Returns the byte index of the given character in the utf-8 string.
74 *
75 * The string *must* be null terminated.
76 *
77 * This will return the byte length of a utf-8 string
78 * if given the char charindex);
79
80 /**
81 * Returns the unicode codepoint corresponding to the
82 * utf-8 sequence 'str'.
83 *
84 * Stores the result in *uc and returns the number of bytes
85 * consumed.
86 *
87 * If 'str' is null terminated, then an invalid utf-8 sequence
88 * at the end of the string will be returned as individual bytes.
89 *
90 * If it is not null terminated, the length *must* be checked first.
91 *
92 * Does not support unicode c*uc);
93
94 /**
95 * Returns the number of bytes before 'str' that the previous
96 * utf-8 character sequence starts (which may be the middle of a sequence).
97 *
98 * Looks back at most 'len' bytes backwards, which must be > 0.
99 * If no start char is found, returns -len
100 */
101 int utf8_prev_len(
102 /**
103 * Returns the upper-case variant of the given unicode codepoint.
104 *
105 * Does not support unicode code points > \uffff
106 */
107 int utf8_upper(int uc);
108
109 /**
110 * Returns the lower-case variant of the given unicode codepoint.
111 *
112 * NOTE: Use utf8_upper() in preference for case-insensitive matching.
113 *
114 * Does not support unicode code points > \uffff
115 */
116 int utf8_lower(int uc);
117
118 #endif
119
120 #endif
121 /* Jim - A small embeddable Tcl interpreter
122 *
123 * Copyright 2005 Salvatore Sanfilippo <[email protected]>
124 * Copyright 2005 Clemens Hintze <[email protected]>
125 * Copyright 2005 patthoyts - Pat Thoyts <[email protected]>
126 * Copyright 2008 oharboe - �yvind Harboe - [email protected]
127 * Copyright 2008 Andrew Lunn <[email protected]>
128 * Copyright 2008 Duane Ellis <[email protected]>
129 * Copyright 2008 Uwe Klein <[email protected]>
130 *
131 * Redistribution and use in source and binary forms, with or without
132 * modification, are permitted provided that the following conditions
133 * are met:
134 *
135 * 1. Redistributions of source code must retain the above copyright
136 * notice, this list of conditions and the following disclaimer.
137 * 2. Redistributions in binary form must reproduce the above
138 * copyright notice, this list of conditions and the following
139 * disclaimer in the documentation and/or other materials
140 * provided with the distribution.
141 *
142 * THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY
143 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
144 * THE IMPLIED WARRANTIES OF MERCHANTABILI
--- a/autosetup/local.tcl
+++ b/autosetup/local.tcl
@@ -0,0 +1,2 @@
1
+# For this project, d
2
+set useropts(nopager)tosetup(optdefault) nopager 1
--- a/autosetup/local.tcl
+++ b/autosetup/local.tcl
@@ -0,0 +1,2 @@
 
 
--- a/autosetup/local.tcl
+++ b/autosetup/local.tcl
@@ -0,0 +1,2 @@
1 # For this project, d
2 set useropts(nopager)tosetup(optdefault) nopager 1
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -0,0 +1,130 @@
1
+# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2
+# All rights reserved
3
+
4
+# @synopsis:
5
+#
6
+# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
7
+#
8
+# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
9
+#
10
+# It defines the fol--prefix unless overridden by th
11
+# Note that the hidden unless 'options-defaults { prefix compatibility
12
+ module-optionsation and options
13
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
14
+#
15
+# It also support the "feature" naming convention, where searching
16
+# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
17
+#
18
+## datadir
19
+## sysconfdir
20
+## sharedstatedir
21
+## localstatedir
22
+## infodir
23
+## mandir
24
+## includedir
25
+#
26
+# If '--pre
27
+# defines featuresysconf {
28
+ msg-checking "Che 2010 WorkWare Systems http://www.workware.net.au/
29
+# All rights reserved
30
+
31
+# @synopsis:
32
+#
33
+# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
34
+#
35
+# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
36
+#
37
+# It defines the fol--prefix unless overridden by the module-optionsation and options
38
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
39
+#
40
+# It also support the "feature" naming convention, where searching
41
+# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
42
+#
43
+## datadir
44
+## sysconfdir
45
+## sharedstatedir
46
+## localstatedir
47
+## infodir
48
+## mandir
49
+## includedir
50
+#
51
+# If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
52
+ program-transform-name:
53
+}
54
+
55
+# @check-feature name { script }
56
+#
57
+# defines feature '$nReturns 1 if exists, or 0 if not
58
+#ode} {
59
+ msg-checking "Checking for $name..."
60
+ set r [uplevel 1 $code
61
+ define-feature $name $r
62
+ if {$r} {
63
+ msg-result "ok"
64
+ } else {
65
+ msg-result "not found"
66
+ }
67
+ return $r
68
+}
69
+
70
+# @have-feature name ?default=0?
71
+#
72
+# Returns the value of feature '$name' if defined,the feature if de
73
+# is translated thehave-feature {name {defathe 0}. Use @top_sr# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
74
+# All rights reserved
75
+
76
+# @synopsis:
77
+#
78
+# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
79
+#
80
+# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
81
+#
82
+# It defines the fol--prefix unless overridden by the module-optionsation and options
83
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
84
+#
85
+# It also support the "feature" naming convention, where searching
86
+# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
87
+#
88
+## datadir
89
+## sysconfdir
90
+## sharedstatedir
91
+## localstatedir
92
+## infodir
93
+## mandir
94
+## includedir
95
+#
96
+# If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
97
+ program-transform-name:
98
+}
99
+
100
+# @check-feature set prefixdefine[get-env exec-prefix \${prefix}]]\${exec_prefix}/bi# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
101
+# All rights reserved
102
+
103
+# @synopsis:
104
+#
105
+# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
106
+#
107
+# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
108
+#
109
+# It defines the fol--prefix unless overridden by the module-optionsation and options
110
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
111
+#
112
+# It also support the "feature" naming convention, where searching
113
+# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
114
+#
115
+## datadir
116
+## sysconfdir
117
+## sharedstatedir
118
+## localstatedir
119
+## infodir
120
+## mandir
121
+## includreadfile $infileAnd less common ones too
122
+, 'buil \${prefix}
123
+define define define libexecdir [get-env ]
124
+define datadir \${prefix}/share
125
+]
126
+define define localstatedir [get-env localvar]
127
+define define infodir [get-env s:
128
+#
129
+# This module supports c# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
130
+# All rights rese
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -0,0 +1,130 @@
1 # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
2 # All rights reserved
3
4 # @synopsis:
5 #
6 # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
7 #
8 # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
9 #
10 # It defines the fol--prefix unless overridden by th
11 # Note that the hidden unless 'options-defaults { prefix compatibility
12 module-optionsation and options
13 # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
14 #
15 # It also support the "feature" naming convention, where searching
16 # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
17 #
18 ## datadir
19 ## sysconfdir
20 ## sharedstatedir
21 ## localstatedir
22 ## infodir
23 ## mandir
24 ## includedir
25 #
26 # If '--pre
27 # defines featuresysconf {
28 msg-checking "Che 2010 WorkWare Systems http://www.workware.net.au/
29 # All rights reserved
30
31 # @synopsis:
32 #
33 # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
34 #
35 # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
36 #
37 # It defines the fol--prefix unless overridden by the module-optionsation and options
38 # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
39 #
40 # It also support the "feature" naming convention, where searching
41 # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
42 #
43 ## datadir
44 ## sysconfdir
45 ## sharedstatedir
46 ## localstatedir
47 ## infodir
48 ## mandir
49 ## includedir
50 #
51 # If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
52 program-transform-name:
53 }
54
55 # @check-feature name { script }
56 #
57 # defines feature '$nReturns 1 if exists, or 0 if not
58 #ode} {
59 msg-checking "Checking for $name..."
60 set r [uplevel 1 $code
61 define-feature $name $r
62 if {$r} {
63 msg-result "ok"
64 } else {
65 msg-result "not found"
66 }
67 return $r
68 }
69
70 # @have-feature name ?default=0?
71 #
72 # Returns the value of feature '$name' if defined,the feature if de
73 # is translated thehave-feature {name {defathe 0}. Use @top_sr# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
74 # All rights reserved
75
76 # @synopsis:
77 #
78 # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
79 #
80 # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
81 #
82 # It defines the fol--prefix unless overridden by the module-optionsation and options
83 # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
84 #
85 # It also support the "feature" naming convention, where searching
86 # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
87 #
88 ## datadir
89 ## sysconfdir
90 ## sharedstatedir
91 ## localstatedir
92 ## infodir
93 ## mandir
94 ## includedir
95 #
96 # If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
97 program-transform-name:
98 }
99
100 # @check-feature set prefixdefine[get-env exec-prefix \${prefix}]]\${exec_prefix}/bi# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
101 # All rights reserved
102
103 # @synopsis:
104 #
105 # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
106 #
107 # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
108 #
109 # It defines the fol--prefix unless overridden by the module-optionsation and options
110 # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
111 #
112 # It also support the "feature" naming convention, where searching
113 # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
114 #
115 ## datadir
116 ## sysconfdir
117 ## sharedstatedir
118 ## localstatedir
119 ## infodir
120 ## mandir
121 ## includreadfile $infileAnd less common ones too
122 , 'buil \${prefix}
123 define define define libexecdir [get-env ]
124 define datadir \${prefix}/share
125 ]
126 define define localstatedir [get-env localvar]
127 define define infodir [get-env s:
128 #
129 # This module supports c# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
130 # All rights rese
--- a/autosetup/test-tclsh
+++ b/autosetup/test-tclsh
@@ -0,0 +1,21 @@
1
+# A small Tcl script to verify that the chosen
2
+# interpreter works. Sometimes we might e.g. pick up
3
+# an interpreter for a different arch.
4
+# Outputs the full path to the interpreter
5
+
6
+if {[catch {info version} version] == 0} {
7
+ # This is Jim Tcl
8
+ if {$version >= 0.70} {
9
+ # Ensure that rege
10
+ # Older versions of jimsh mayinfo patchlevel]]} {
11
+ puts [info nameofexecutable]
12
+ exit 0
13
+ }
14
+}
15
+exit 1
16
+puts [file join [p]
17
+ exit 0
18
+ }
19
+} elseif {[catch {info tclversion} version] == 0} {
20
+ if {$version >= 8.5 && ![string match 8.5a* [info patchlevel]]} {
21
+ puts [info nameofexecut
--- a/autosetup/test-tclsh
+++ b/autosetup/test-tclsh
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/test-tclsh
+++ b/autosetup/test-tclsh
@@ -0,0 +1,21 @@
1 # A small Tcl script to verify that the chosen
2 # interpreter works. Sometimes we might e.g. pick up
3 # an interpreter for a different arch.
4 # Outputs the full path to the interpreter
5
6 if {[catch {info version} version] == 0} {
7 # This is Jim Tcl
8 if {$version >= 0.70} {
9 # Ensure that rege
10 # Older versions of jimsh mayinfo patchlevel]]} {
11 puts [info nameofexecutable]
12 exit 0
13 }
14 }
15 exit 1
16 puts [file join [p]
17 exit 0
18 }
19 } elseif {[catch {info tclversion} version] == 0} {
20 if {$version >= 8.5 && ![string match 8.5a* [info patchlevel]]} {
21 puts [info nameofexecut
+3
--- a/configure
+++ b/configure
@@ -0,0 +1,3 @@
1
+#!/bin/sh
2
+dir=autosetup"
3
+#st -f `"ir/auhen exec" || echo false`
--- a/configure
+++ b/configure
@@ -0,0 +1,3 @@
 
 
 
--- a/configure
+++ b/configure
@@ -0,0 +1,3 @@
1 #!/bin/sh
2 dir=autosetup"
3 #st -f `"ir/auhen exec" || echo false`
+74 -21
--- src/add.c
+++ src/add.c
@@ -92,66 +92,76 @@
9292
**
9393
** Omit any file whose name is pOmit.
9494
*/
9595
static int add_one_file(
9696
const char *zPath, /* Tree-name of file to add. */
97
- int vid /* Add to this VFILE */
97
+ int vid, /* Add to this VFILE */
98
+ int caseSensitive /* True if filenames are case sensitive */
9899
){
100
+ const char *zCollate = caseSensitive ? "binary" : "nocase";
99101
if( !file_is_simple_pathname(zPath) ){
100102
fossil_fatal("filename contains illegal characters: %s", zPath);
101103
}
102
-#if defined(_WIN32)
103104
if( db_exists("SELECT 1 FROM vfile"
104
- " WHERE pathname=%Q COLLATE nocase", zPath) ){
105
+ " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){
105106
db_multi_exec("UPDATE vfile SET deleted=0"
106
- " WHERE pathname=%Q COLLATE nocase", zPath);
107
- }
108
-#else
109
- if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
110
- db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
111
- }
112
-#endif
113
- else{
107
+ " WHERE pathname=%Q COLLATE %s", zPath, zCollate);
108
+ }else{
114109
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
115110
db_multi_exec(
116111
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
117112
"VALUES(%d,0,0,0,%Q,%d)",
118113
vid, zPath, file_isexe(zFullname));
119114
fossil_free(zFullname);
120115
}
121
- fossil_print("ADDED %s\n", zPath);
122
- return 1;
116
+ if( db_changes() ){
117
+ fossil_print("ADDED %s\n", zPath);
118
+ return 1;
119
+ }else{
120
+ fossil_print("SKIP %s\n", zPath);
121
+ return 0;
122
+ }
123123
}
124124
125125
/*
126126
** Add all files in the sfile temp table.
127127
**
128128
** Automatically exclude the repository file.
129129
*/
130
-static int add_files_in_sfile(int vid){
130
+static int add_files_in_sfile(int vid, int caseSensitive){
131131
const char *zRepo; /* Name of the repository database file */
132132
int nAdd = 0; /* Number of files added */
133133
int i; /* Loop counter */
134134
const char *zReserved; /* Name of a reserved file */
135135
Blob repoName; /* Treename of the repository */
136136
Stmt loop; /* SQL to loop over all files to add */
137
+ int (*xCmp)(const char*,const char*);
137138
138139
if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
139140
blob_zero(&repoName);
140141
zRepo = "";
141142
}else{
142143
zRepo = blob_str(&repoName);
144
+ }
145
+ if( caseSensitive ){
146
+ xCmp = fossil_strcmp;
147
+ }else{
148
+ xCmp = fossil_stricmp;
149
+ db_multi_exec(
150
+ "CREATE INDEX IF NOT EXISTS vfile_nocase"
151
+ " ON vfile(pathname COLLATE nocase)"
152
+ );
143153
}
144154
db_prepare(&loop, "SELECT x FROM sfile ORDER BY x");
145155
while( db_step(&loop)==SQLITE_ROW ){
146156
const char *zToAdd = db_column_text(&loop, 0);
147157
if( fossil_strcmp(zToAdd, zRepo)==0 ) continue;
148158
for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){
149
- if( fossil_strcmp(zToAdd, zReserved)==0 ) break;
159
+ if( xCmp(zToAdd, zReserved)==0 ) break;
150160
}
151161
if( zReserved ) continue;
152
- nAdd += add_one_file(zToAdd, vid);
162
+ nAdd += add_one_file(zToAdd, vid, caseSensitive);
153163
}
154164
db_finalize(&loop);
155165
blob_reset(&repoName);
156166
return nAdd;
157167
}
@@ -180,14 +190,17 @@
180190
int i; /* Loop counter */
181191
int vid; /* Currently checked out version */
182192
int nRoot; /* Full path characters in g.zLocalRoot */
183193
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
184194
Glob *pIgnore; /* Ignore everything matching this glob pattern */
195
+ int caseSensitive; /* True if filenames are case sensitive */
185196
186197
zIgnoreFlag = find_option("ignore",0,1);
187198
includeDotFiles = find_option("dotfiles",0,0)!=0;
199
+ capture_case_sensitive_option();
188200
db_must_be_within_tree();
201
+ caseSensitive = filenames_are_case_sensitive();
189202
if( zIgnoreFlag==0 ){
190203
zIgnoreFlag = db_get("ignore-glob", 0);
191204
}
192205
vid = db_lget_int("checkout",0);
193206
if( vid==0 ){
@@ -229,11 +242,11 @@
229242
}
230243
blob_reset(&fullName);
231244
}
232245
glob_free(pIgnore);
233246
234
- add_files_in_sfile(vid);
247
+ add_files_in_sfile(vid, caseSensitive);
235248
db_end_transaction(0);
236249
}
237250
238251
/*
239252
** COMMAND: rm
@@ -289,10 +302,48 @@
289302
"UPDATE vfile SET deleted=1 WHERE pathname IN sfile;"
290303
"DELETE FROM vfile WHERE rid=0 AND deleted;"
291304
);
292305
db_end_transaction(0);
293306
}
307
+
308
+/*
309
+** Capture the command-line --case-sensitive option.
310
+*/
311
+static const char *zCaseSensitive = 0;
312
+void capture_case_sensitive_option(void){
313
+ if( zCaseSensitive==0 ){
314
+ zCaseSensitive = find_option("case-sensitive",0,1);
315
+ }
316
+}
317
+
318
+/*
319
+** This routine determines if files should be case-sensitive or not.
320
+** In other words, this routine determines if two filenames that
321
+** differ only in case should be considered the same name or not.
322
+**
323
+** The case-sensitive setting determines the default value. If
324
+** the case-sensitive setting is undefined, then case sensitivity
325
+** defaults on for Mac and Windows and off for all other unix.
326
+**
327
+** The --case-sensitive BOOLEAN command-line option overrides any
328
+** setting.
329
+*/
330
+int filenames_are_case_sensitive(void){
331
+ int caseSensitive;
332
+
333
+ if( zCaseSensitive ){
334
+ caseSensitive = is_truth(zCaseSensitive);
335
+ }else{
336
+#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
337
+ caseSensitive = 1;
338
+#else
339
+ caseSensitive = 0;
340
+#endif
341
+ caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
342
+ }
343
+ return caseSensitive;
344
+}
294345
295346
/*
296347
** COMMAND: addremove
297348
**
298349
** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
@@ -319,27 +370,29 @@
319370
**
320371
** The --test option shows what would happen without actually doing anything.
321372
**
322373
** This command can be used to track third party software.
323374
**
324
-**
325375
** SUMMARY: fossil addremove
326
-** Options: ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
376
+** Options: ?--dotfiles? ?--ignore GLOB? ?--test? ?--case-sensitive BOOL?
327377
*/
328
-void import_cmd(void){
378
+void addremove_cmd(void){
329379
Blob path;
330380
const char *zIgnoreFlag = find_option("ignore",0,1);
331381
int allFlag = find_option("dotfiles",0,0)!=0;
332382
int isTest = find_option("test",0,0)!=0;
383
+ int caseSensitive;
333384
int n;
334385
Stmt q;
335386
int vid;
336387
int nAdd = 0;
337388
int nDelete = 0;
338389
Glob *pIgnore;
339390
391
+ capture_case_sensitive_option();
340392
db_must_be_within_tree();
393
+ caseSensitive = filenames_are_case_sensitive();
341394
if( zIgnoreFlag==0 ){
342395
zIgnoreFlag = db_get("ignore-glob", 0);
343396
}
344397
vid = db_lget_int("checkout",0);
345398
if( vid==0 ){
@@ -358,11 +411,11 @@
358411
blob_init(&path, g.zLocalRoot, n-1);
359412
/* now we read the complete file structure into a temp table */
360413
pIgnore = glob_create(zIgnoreFlag);
361414
vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
362415
glob_free(pIgnore);
363
- nAdd = add_files_in_sfile(vid);
416
+ nAdd = add_files_in_sfile(vid, caseSensitive);
364417
365418
/* step 2: search for missing files */
366419
db_prepare(&q,
367420
"SELECT pathname, %Q || pathname, deleted FROM vfile"
368421
" WHERE NOT deleted"
369422
--- src/add.c
+++ src/add.c
@@ -92,66 +92,76 @@
92 **
93 ** Omit any file whose name is pOmit.
94 */
95 static int add_one_file(
96 const char *zPath, /* Tree-name of file to add. */
97 int vid /* Add to this VFILE */
 
98 ){
 
99 if( !file_is_simple_pathname(zPath) ){
100 fossil_fatal("filename contains illegal characters: %s", zPath);
101 }
102 #if defined(_WIN32)
103 if( db_exists("SELECT 1 FROM vfile"
104 " WHERE pathname=%Q COLLATE nocase", zPath) ){
105 db_multi_exec("UPDATE vfile SET deleted=0"
106 " WHERE pathname=%Q COLLATE nocase", zPath);
107 }
108 #else
109 if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
110 db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
111 }
112 #endif
113 else{
114 char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
115 db_multi_exec(
116 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
117 "VALUES(%d,0,0,0,%Q,%d)",
118 vid, zPath, file_isexe(zFullname));
119 fossil_free(zFullname);
120 }
121 fossil_print("ADDED %s\n", zPath);
122 return 1;
 
 
 
 
 
123 }
124
125 /*
126 ** Add all files in the sfile temp table.
127 **
128 ** Automatically exclude the repository file.
129 */
130 static int add_files_in_sfile(int vid){
131 const char *zRepo; /* Name of the repository database file */
132 int nAdd = 0; /* Number of files added */
133 int i; /* Loop counter */
134 const char *zReserved; /* Name of a reserved file */
135 Blob repoName; /* Treename of the repository */
136 Stmt loop; /* SQL to loop over all files to add */
 
137
138 if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
139 blob_zero(&repoName);
140 zRepo = "";
141 }else{
142 zRepo = blob_str(&repoName);
 
 
 
 
 
 
 
 
 
143 }
144 db_prepare(&loop, "SELECT x FROM sfile ORDER BY x");
145 while( db_step(&loop)==SQLITE_ROW ){
146 const char *zToAdd = db_column_text(&loop, 0);
147 if( fossil_strcmp(zToAdd, zRepo)==0 ) continue;
148 for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){
149 if( fossil_strcmp(zToAdd, zReserved)==0 ) break;
150 }
151 if( zReserved ) continue;
152 nAdd += add_one_file(zToAdd, vid);
153 }
154 db_finalize(&loop);
155 blob_reset(&repoName);
156 return nAdd;
157 }
@@ -180,14 +190,17 @@
180 int i; /* Loop counter */
181 int vid; /* Currently checked out version */
182 int nRoot; /* Full path characters in g.zLocalRoot */
183 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
184 Glob *pIgnore; /* Ignore everything matching this glob pattern */
 
185
186 zIgnoreFlag = find_option("ignore",0,1);
187 includeDotFiles = find_option("dotfiles",0,0)!=0;
 
188 db_must_be_within_tree();
 
189 if( zIgnoreFlag==0 ){
190 zIgnoreFlag = db_get("ignore-glob", 0);
191 }
192 vid = db_lget_int("checkout",0);
193 if( vid==0 ){
@@ -229,11 +242,11 @@
229 }
230 blob_reset(&fullName);
231 }
232 glob_free(pIgnore);
233
234 add_files_in_sfile(vid);
235 db_end_transaction(0);
236 }
237
238 /*
239 ** COMMAND: rm
@@ -289,10 +302,48 @@
289 "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;"
290 "DELETE FROM vfile WHERE rid=0 AND deleted;"
291 );
292 db_end_transaction(0);
293 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
295 /*
296 ** COMMAND: addremove
297 **
298 ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
@@ -319,27 +370,29 @@
319 **
320 ** The --test option shows what would happen without actually doing anything.
321 **
322 ** This command can be used to track third party software.
323 **
324 **
325 ** SUMMARY: fossil addremove
326 ** Options: ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
327 */
328 void import_cmd(void){
329 Blob path;
330 const char *zIgnoreFlag = find_option("ignore",0,1);
331 int allFlag = find_option("dotfiles",0,0)!=0;
332 int isTest = find_option("test",0,0)!=0;
 
333 int n;
334 Stmt q;
335 int vid;
336 int nAdd = 0;
337 int nDelete = 0;
338 Glob *pIgnore;
339
 
340 db_must_be_within_tree();
 
341 if( zIgnoreFlag==0 ){
342 zIgnoreFlag = db_get("ignore-glob", 0);
343 }
344 vid = db_lget_int("checkout",0);
345 if( vid==0 ){
@@ -358,11 +411,11 @@
358 blob_init(&path, g.zLocalRoot, n-1);
359 /* now we read the complete file structure into a temp table */
360 pIgnore = glob_create(zIgnoreFlag);
361 vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
362 glob_free(pIgnore);
363 nAdd = add_files_in_sfile(vid);
364
365 /* step 2: search for missing files */
366 db_prepare(&q,
367 "SELECT pathname, %Q || pathname, deleted FROM vfile"
368 " WHERE NOT deleted"
369
--- src/add.c
+++ src/add.c
@@ -92,66 +92,76 @@
92 **
93 ** Omit any file whose name is pOmit.
94 */
95 static int add_one_file(
96 const char *zPath, /* Tree-name of file to add. */
97 int vid, /* Add to this VFILE */
98 int caseSensitive /* True if filenames are case sensitive */
99 ){
100 const char *zCollate = caseSensitive ? "binary" : "nocase";
101 if( !file_is_simple_pathname(zPath) ){
102 fossil_fatal("filename contains illegal characters: %s", zPath);
103 }
 
104 if( db_exists("SELECT 1 FROM vfile"
105 " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){
106 db_multi_exec("UPDATE vfile SET deleted=0"
107 " WHERE pathname=%Q COLLATE %s", zPath, zCollate);
108 }else{
 
 
 
 
 
 
109 char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
110 db_multi_exec(
111 "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)"
112 "VALUES(%d,0,0,0,%Q,%d)",
113 vid, zPath, file_isexe(zFullname));
114 fossil_free(zFullname);
115 }
116 if( db_changes() ){
117 fossil_print("ADDED %s\n", zPath);
118 return 1;
119 }else{
120 fossil_print("SKIP %s\n", zPath);
121 return 0;
122 }
123 }
124
125 /*
126 ** Add all files in the sfile temp table.
127 **
128 ** Automatically exclude the repository file.
129 */
130 static int add_files_in_sfile(int vid, int caseSensitive){
131 const char *zRepo; /* Name of the repository database file */
132 int nAdd = 0; /* Number of files added */
133 int i; /* Loop counter */
134 const char *zReserved; /* Name of a reserved file */
135 Blob repoName; /* Treename of the repository */
136 Stmt loop; /* SQL to loop over all files to add */
137 int (*xCmp)(const char*,const char*);
138
139 if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){
140 blob_zero(&repoName);
141 zRepo = "";
142 }else{
143 zRepo = blob_str(&repoName);
144 }
145 if( caseSensitive ){
146 xCmp = fossil_strcmp;
147 }else{
148 xCmp = fossil_stricmp;
149 db_multi_exec(
150 "CREATE INDEX IF NOT EXISTS vfile_nocase"
151 " ON vfile(pathname COLLATE nocase)"
152 );
153 }
154 db_prepare(&loop, "SELECT x FROM sfile ORDER BY x");
155 while( db_step(&loop)==SQLITE_ROW ){
156 const char *zToAdd = db_column_text(&loop, 0);
157 if( fossil_strcmp(zToAdd, zRepo)==0 ) continue;
158 for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){
159 if( xCmp(zToAdd, zReserved)==0 ) break;
160 }
161 if( zReserved ) continue;
162 nAdd += add_one_file(zToAdd, vid, caseSensitive);
163 }
164 db_finalize(&loop);
165 blob_reset(&repoName);
166 return nAdd;
167 }
@@ -180,14 +190,17 @@
190 int i; /* Loop counter */
191 int vid; /* Currently checked out version */
192 int nRoot; /* Full path characters in g.zLocalRoot */
193 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
194 Glob *pIgnore; /* Ignore everything matching this glob pattern */
195 int caseSensitive; /* True if filenames are case sensitive */
196
197 zIgnoreFlag = find_option("ignore",0,1);
198 includeDotFiles = find_option("dotfiles",0,0)!=0;
199 capture_case_sensitive_option();
200 db_must_be_within_tree();
201 caseSensitive = filenames_are_case_sensitive();
202 if( zIgnoreFlag==0 ){
203 zIgnoreFlag = db_get("ignore-glob", 0);
204 }
205 vid = db_lget_int("checkout",0);
206 if( vid==0 ){
@@ -229,11 +242,11 @@
242 }
243 blob_reset(&fullName);
244 }
245 glob_free(pIgnore);
246
247 add_files_in_sfile(vid, caseSensitive);
248 db_end_transaction(0);
249 }
250
251 /*
252 ** COMMAND: rm
@@ -289,10 +302,48 @@
302 "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;"
303 "DELETE FROM vfile WHERE rid=0 AND deleted;"
304 );
305 db_end_transaction(0);
306 }
307
308 /*
309 ** Capture the command-line --case-sensitive option.
310 */
311 static const char *zCaseSensitive = 0;
312 void capture_case_sensitive_option(void){
313 if( zCaseSensitive==0 ){
314 zCaseSensitive = find_option("case-sensitive",0,1);
315 }
316 }
317
318 /*
319 ** This routine determines if files should be case-sensitive or not.
320 ** In other words, this routine determines if two filenames that
321 ** differ only in case should be considered the same name or not.
322 **
323 ** The case-sensitive setting determines the default value. If
324 ** the case-sensitive setting is undefined, then case sensitivity
325 ** defaults on for Mac and Windows and off for all other unix.
326 **
327 ** The --case-sensitive BOOLEAN command-line option overrides any
328 ** setting.
329 */
330 int filenames_are_case_sensitive(void){
331 int caseSensitive;
332
333 if( zCaseSensitive ){
334 caseSensitive = is_truth(zCaseSensitive);
335 }else{
336 #if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
337 caseSensitive = 1;
338 #else
339 caseSensitive = 0;
340 #endif
341 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
342 }
343 return caseSensitive;
344 }
345
346 /*
347 ** COMMAND: addremove
348 **
349 ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test?
@@ -319,27 +370,29 @@
370 **
371 ** The --test option shows what would happen without actually doing anything.
372 **
373 ** This command can be used to track third party software.
374 **
 
375 ** SUMMARY: fossil addremove
376 ** Options: ?--dotfiles? ?--ignore GLOB? ?--test? ?--case-sensitive BOOL?
377 */
378 void addremove_cmd(void){
379 Blob path;
380 const char *zIgnoreFlag = find_option("ignore",0,1);
381 int allFlag = find_option("dotfiles",0,0)!=0;
382 int isTest = find_option("test",0,0)!=0;
383 int caseSensitive;
384 int n;
385 Stmt q;
386 int vid;
387 int nAdd = 0;
388 int nDelete = 0;
389 Glob *pIgnore;
390
391 capture_case_sensitive_option();
392 db_must_be_within_tree();
393 caseSensitive = filenames_are_case_sensitive();
394 if( zIgnoreFlag==0 ){
395 zIgnoreFlag = db_get("ignore-glob", 0);
396 }
397 vid = db_lget_int("checkout",0);
398 if( vid==0 ){
@@ -358,11 +411,11 @@
411 blob_init(&path, g.zLocalRoot, n-1);
412 /* now we read the complete file structure into a temp table */
413 pIgnore = glob_create(zIgnoreFlag);
414 vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
415 glob_free(pIgnore);
416 nAdd = add_files_in_sfile(vid, caseSensitive);
417
418 /* step 2: search for missing files */
419 db_prepare(&q,
420 "SELECT pathname, %Q || pathname, deleted FROM vfile"
421 " WHERE NOT deleted"
422
+51 -32
--- src/branch.c
+++ src/branch.c
@@ -176,10 +176,47 @@
176176
db_end_transaction(0);
177177
178178
/* Do an autosync push, if requested */
179179
autosync(AUTOSYNC_PUSH);
180180
}
181
+
182
+/*
183
+** Prepare a query that will list all branches.
184
+*/
185
+static void prepareBranchQuery(Stmt *pQuery, int showAll, int showClosed){
186
+ if( showClosed ){
187
+ db_prepare(pQuery,
188
+ "SELECT value FROM tagxref"
189
+ " WHERE tagid=%d AND value NOT NULL "
190
+ "EXCEPT "
191
+ "SELECT value FROM tagxref"
192
+ " WHERE tagid=%d"
193
+ " AND rid IN leaf"
194
+ " AND NOT %z"
195
+ " ORDER BY value COLLATE nocase /*sort*/",
196
+ TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
197
+ );
198
+ }else if( showAll ){
199
+ db_prepare(pQuery,
200
+ "SELECT DISTINCT value FROM tagxref"
201
+ " WHERE tagid=%d AND value NOT NULL"
202
+ " AND rid IN leaf"
203
+ " ORDER BY value COLLATE nocase /*sort*/",
204
+ TAG_BRANCH
205
+ );
206
+ }else{
207
+ db_prepare(pQuery,
208
+ "SELECT DISTINCT value FROM tagxref"
209
+ " WHERE tagid=%d AND value NOT NULL"
210
+ " AND rid IN leaf"
211
+ " AND NOT %z"
212
+ " ORDER BY value COLLATE nocase /*sort*/",
213
+ TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
214
+ );
215
+ }
216
+}
217
+
181218
182219
/*
183220
** COMMAND: branch
184221
**
185222
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
@@ -194,11 +231,12 @@
194231
** --private option makes the branch private.
195232
**
196233
** %fossil branch list
197234
** %fossil branch ls
198235
**
199
-** List all branches
236
+** List all branches. Use --all or --closed to list all branches
237
+** or closed branches. The default is to show only open branches.
200238
**
201239
*/
202240
void branch_cmd(void){
203241
int n;
204242
const char *zCmd = "list";
@@ -212,24 +250,19 @@
212250
branch_new();
213251
}else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){
214252
Stmt q;
215253
int vid;
216254
char *zCurrent = 0;
255
+ int showAll = find_option("all",0,0)!=0;
256
+ int showClosed = find_option("closed",0,0)!=0;
217257
218258
if( g.localOpen ){
219259
vid = db_lget_int("checkout", 0);
220260
zCurrent = db_text(0, "SELECT value FROM tagxref"
221261
" WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
222262
}
223
- db_prepare(&q,
224
- "SELECT DISTINCT value FROM tagxref"
225
- " WHERE tagid=%d AND value NOT NULL"
226
- " AND rid IN leaf"
227
- " AND NOT %z"
228
- " ORDER BY value /*sort*/",
229
- TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
230
- );
263
+ prepareBranchQuery(&q, showAll, showClosed);
231264
while( db_step(&q)==SQLITE_ROW ){
232265
const char *zBr = db_column_text(&q, 0);
233266
int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
234267
fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
235268
}
@@ -247,19 +280,26 @@
247280
*/
248281
void brlist_page(void){
249282
Stmt q;
250283
int cnt;
251284
int showClosed = P("closed")!=0;
285
+ int showAll = P("all")!=0;
252286
253287
login_check_credentials();
254288
if( !g.okRead ){ login_needed(); return; }
255289
256
- style_header(showClosed ? "Closed Branches" : "Open Branches");
290
+ style_header(showClosed ? "Closed Branches" :
291
+ showAll ? "All Branches" : "Open Branches");
257292
style_submenu_element("Timeline", "Timeline", "brtimeline");
258293
if( showClosed ){
294
+ style_submenu_element("All", "All", "brlist?all");
295
+ style_submenu_element("Open","Open","brlist");
296
+ }else if( showAll ){
297
+ style_submenu_element("Closed", "Closed", "brlist?closed");
259298
style_submenu_element("Open","Open","brlist");
260299
}else{
300
+ style_submenu_element("All", "All", "brlist?all");
261301
style_submenu_element("Closed","Closed","brlist?closed");
262302
}
263303
login_anonymous_available();
264304
style_sidebox_begin("Nomenclature:", "33%");
265305
@ <ol>
@@ -275,33 +315,12 @@
275315
@ Closed branches are fixed and do not change (unless they are first
276316
@ reopened)</li>
277317
@ </ol>
278318
style_sidebox_end();
279319
320
+ prepareBranchQuery(&q, showAll, showClosed);
280321
cnt = 0;
281
- if( showClosed ){
282
- db_prepare(&q,
283
- "SELECT value FROM tagxref"
284
- " WHERE tagid=%d AND value NOT NULL "
285
- "EXCEPT "
286
- "SELECT value FROM tagxref"
287
- " WHERE tagid=%d"
288
- " AND rid IN leaf"
289
- " AND NOT %z"
290
- " ORDER BY value /*sort*/",
291
- TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
292
- );
293
- }else{
294
- db_prepare(&q,
295
- "SELECT DISTINCT value FROM tagxref"
296
- " WHERE tagid=%d AND value NOT NULL"
297
- " AND rid IN leaf"
298
- " AND NOT %z"
299
- " ORDER BY value /*sort*/",
300
- TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
301
- );
302
- }
303322
while( db_step(&q)==SQLITE_ROW ){
304323
const char *zBr = db_column_text(&q, 0);
305324
if( cnt==0 ){
306325
if( showClosed ){
307326
@ <h2>Closed Branches:</h2>
308327
--- src/branch.c
+++ src/branch.c
@@ -176,10 +176,47 @@
176 db_end_transaction(0);
177
178 /* Do an autosync push, if requested */
179 autosync(AUTOSYNC_PUSH);
180 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
182 /*
183 ** COMMAND: branch
184 **
185 ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
@@ -194,11 +231,12 @@
194 ** --private option makes the branch private.
195 **
196 ** %fossil branch list
197 ** %fossil branch ls
198 **
199 ** List all branches
 
200 **
201 */
202 void branch_cmd(void){
203 int n;
204 const char *zCmd = "list";
@@ -212,24 +250,19 @@
212 branch_new();
213 }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){
214 Stmt q;
215 int vid;
216 char *zCurrent = 0;
 
 
217
218 if( g.localOpen ){
219 vid = db_lget_int("checkout", 0);
220 zCurrent = db_text(0, "SELECT value FROM tagxref"
221 " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
222 }
223 db_prepare(&q,
224 "SELECT DISTINCT value FROM tagxref"
225 " WHERE tagid=%d AND value NOT NULL"
226 " AND rid IN leaf"
227 " AND NOT %z"
228 " ORDER BY value /*sort*/",
229 TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
230 );
231 while( db_step(&q)==SQLITE_ROW ){
232 const char *zBr = db_column_text(&q, 0);
233 int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
234 fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
235 }
@@ -247,19 +280,26 @@
247 */
248 void brlist_page(void){
249 Stmt q;
250 int cnt;
251 int showClosed = P("closed")!=0;
 
252
253 login_check_credentials();
254 if( !g.okRead ){ login_needed(); return; }
255
256 style_header(showClosed ? "Closed Branches" : "Open Branches");
 
257 style_submenu_element("Timeline", "Timeline", "brtimeline");
258 if( showClosed ){
 
 
 
 
259 style_submenu_element("Open","Open","brlist");
260 }else{
 
261 style_submenu_element("Closed","Closed","brlist?closed");
262 }
263 login_anonymous_available();
264 style_sidebox_begin("Nomenclature:", "33%");
265 @ <ol>
@@ -275,33 +315,12 @@
275 @ Closed branches are fixed and do not change (unless they are first
276 @ reopened)</li>
277 @ </ol>
278 style_sidebox_end();
279
 
280 cnt = 0;
281 if( showClosed ){
282 db_prepare(&q,
283 "SELECT value FROM tagxref"
284 " WHERE tagid=%d AND value NOT NULL "
285 "EXCEPT "
286 "SELECT value FROM tagxref"
287 " WHERE tagid=%d"
288 " AND rid IN leaf"
289 " AND NOT %z"
290 " ORDER BY value /*sort*/",
291 TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
292 );
293 }else{
294 db_prepare(&q,
295 "SELECT DISTINCT value FROM tagxref"
296 " WHERE tagid=%d AND value NOT NULL"
297 " AND rid IN leaf"
298 " AND NOT %z"
299 " ORDER BY value /*sort*/",
300 TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
301 );
302 }
303 while( db_step(&q)==SQLITE_ROW ){
304 const char *zBr = db_column_text(&q, 0);
305 if( cnt==0 ){
306 if( showClosed ){
307 @ <h2>Closed Branches:</h2>
308
--- src/branch.c
+++ src/branch.c
@@ -176,10 +176,47 @@
176 db_end_transaction(0);
177
178 /* Do an autosync push, if requested */
179 autosync(AUTOSYNC_PUSH);
180 }
181
182 /*
183 ** Prepare a query that will list all branches.
184 */
185 static void prepareBranchQuery(Stmt *pQuery, int showAll, int showClosed){
186 if( showClosed ){
187 db_prepare(pQuery,
188 "SELECT value FROM tagxref"
189 " WHERE tagid=%d AND value NOT NULL "
190 "EXCEPT "
191 "SELECT value FROM tagxref"
192 " WHERE tagid=%d"
193 " AND rid IN leaf"
194 " AND NOT %z"
195 " ORDER BY value COLLATE nocase /*sort*/",
196 TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
197 );
198 }else if( showAll ){
199 db_prepare(pQuery,
200 "SELECT DISTINCT value FROM tagxref"
201 " WHERE tagid=%d AND value NOT NULL"
202 " AND rid IN leaf"
203 " ORDER BY value COLLATE nocase /*sort*/",
204 TAG_BRANCH
205 );
206 }else{
207 db_prepare(pQuery,
208 "SELECT DISTINCT value FROM tagxref"
209 " WHERE tagid=%d AND value NOT NULL"
210 " AND rid IN leaf"
211 " AND NOT %z"
212 " ORDER BY value COLLATE nocase /*sort*/",
213 TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
214 );
215 }
216 }
217
218
219 /*
220 ** COMMAND: branch
221 **
222 ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
@@ -194,11 +231,12 @@
231 ** --private option makes the branch private.
232 **
233 ** %fossil branch list
234 ** %fossil branch ls
235 **
236 ** List all branches. Use --all or --closed to list all branches
237 ** or closed branches. The default is to show only open branches.
238 **
239 */
240 void branch_cmd(void){
241 int n;
242 const char *zCmd = "list";
@@ -212,24 +250,19 @@
250 branch_new();
251 }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){
252 Stmt q;
253 int vid;
254 char *zCurrent = 0;
255 int showAll = find_option("all",0,0)!=0;
256 int showClosed = find_option("closed",0,0)!=0;
257
258 if( g.localOpen ){
259 vid = db_lget_int("checkout", 0);
260 zCurrent = db_text(0, "SELECT value FROM tagxref"
261 " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
262 }
263 prepareBranchQuery(&q, showAll, showClosed);
 
 
 
 
 
 
 
264 while( db_step(&q)==SQLITE_ROW ){
265 const char *zBr = db_column_text(&q, 0);
266 int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0;
267 fossil_print("%s%s\n", (isCur ? "* " : " "), zBr);
268 }
@@ -247,19 +280,26 @@
280 */
281 void brlist_page(void){
282 Stmt q;
283 int cnt;
284 int showClosed = P("closed")!=0;
285 int showAll = P("all")!=0;
286
287 login_check_credentials();
288 if( !g.okRead ){ login_needed(); return; }
289
290 style_header(showClosed ? "Closed Branches" :
291 showAll ? "All Branches" : "Open Branches");
292 style_submenu_element("Timeline", "Timeline", "brtimeline");
293 if( showClosed ){
294 style_submenu_element("All", "All", "brlist?all");
295 style_submenu_element("Open","Open","brlist");
296 }else if( showAll ){
297 style_submenu_element("Closed", "Closed", "brlist?closed");
298 style_submenu_element("Open","Open","brlist");
299 }else{
300 style_submenu_element("All", "All", "brlist?all");
301 style_submenu_element("Closed","Closed","brlist?closed");
302 }
303 login_anonymous_available();
304 style_sidebox_begin("Nomenclature:", "33%");
305 @ <ol>
@@ -275,33 +315,12 @@
315 @ Closed branches are fixed and do not change (unless they are first
316 @ reopened)</li>
317 @ </ol>
318 style_sidebox_end();
319
320 prepareBranchQuery(&q, showAll, showClosed);
321 cnt = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322 while( db_step(&q)==SQLITE_ROW ){
323 const char *zBr = db_column_text(&q, 0);
324 if( cnt==0 ){
325 if( showClosed ){
326 @ <h2>Closed Branches:</h2>
327
+1 -1
--- src/browse.c
+++ src/browse.c
@@ -267,11 +267,11 @@
267267
if( zFN[0]=='/' ){
268268
zFN++;
269269
@ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li>
270270
}else if( zCI ){
271271
const char *zUuid = db_column_text(&q, 1);
272
- @ <li><a href="%s(g.zTop)/artifact?name=%s(zUuid)">%h(zFN)</a></li>
272
+ @ <li><a href="%s(g.zTop)/artifact/%s(zUuid)">%h(zFN)</a></li>
273273
}else{
274274
@ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN)
275275
@ </a></li>
276276
}
277277
}
278278
--- src/browse.c
+++ src/browse.c
@@ -267,11 +267,11 @@
267 if( zFN[0]=='/' ){
268 zFN++;
269 @ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li>
270 }else if( zCI ){
271 const char *zUuid = db_column_text(&q, 1);
272 @ <li><a href="%s(g.zTop)/artifact?name=%s(zUuid)">%h(zFN)</a></li>
273 }else{
274 @ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN)
275 @ </a></li>
276 }
277 }
278
--- src/browse.c
+++ src/browse.c
@@ -267,11 +267,11 @@
267 if( zFN[0]=='/' ){
268 zFN++;
269 @ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li>
270 }else if( zCI ){
271 const char *zUuid = db_column_text(&q, 1);
272 @ <li><a href="%s(g.zTop)/artifact/%s(zUuid)">%h(zFN)</a></li>
273 }else{
274 @ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN)
275 @ </a></li>
276 }
277 }
278
+13 -3
--- src/cgi.c
+++ src/cgi.c
@@ -295,11 +295,11 @@
295295
if( blob_size(&extraHeader)>0 ){
296296
fprintf(g.httpOut, "%s", blob_buffer(&extraHeader));
297297
}
298298
299299
/* Add headers to turn on useful security options in browsers. */
300
- fprintf(g.httpOut, "X-Frame-Options: DENY\r\n");
300
+ fprintf(g.httpOut, "X-Frame-Options: SAMEORIGIN\r\n");
301301
/* This stops fossil pages appearing in frames or iframes, preventing
302302
** click-jacking attacks on supporting browsers.
303303
**
304304
** Other good headers would be
305305
** Strict-Transport-Security: max-age=62208000
@@ -353,10 +353,11 @@
353353
if( size>0 ){
354354
fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut);
355355
}
356356
}
357357
}
358
+ fflush(g.httpOut);
358359
CGIDEBUG(("DONE\n"));
359360
}
360361
361362
/*
362363
** Do a redirect request to the URL given in the argument.
@@ -887,17 +888,26 @@
887888
}
888889
889890
/*
890891
** Print all query parameters on standard output. Format the
891892
** parameters as HTML. This is used for testing and debugging.
893
+** Release builds omit the values of the cookies to avoid defeating
894
+** the purpose of setting HttpOnly cookies.
892895
*/
893896
void cgi_print_all(void){
894897
int i;
898
+ int showAll = 0;
899
+#ifdef FOSSIL_DEBUG
900
+ /* Show the values of cookies in debug mode. */
901
+ showAll = 1;
902
+#endif
895903
cgi_parameter("",""); /* Force the parameters into sorted order */
896904
for(i=0; i<nUsedQP; i++){
897
- cgi_printf("%s = %s <br />\n",
898
- htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1));
905
+ if( showAll || (fossil_stricmp("HTTP_COOKIE",aParamQP[i].zName)!=0 && fossil_strnicmp("fossil-",aParamQP[i].zName,7)!=0) ){
906
+ cgi_printf("%s = %s <br />\n",
907
+ htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1));
908
+ }
899909
}
900910
}
901911
902912
/*
903913
** This routine works like "printf" except that it has the
904914
--- src/cgi.c
+++ src/cgi.c
@@ -295,11 +295,11 @@
295 if( blob_size(&extraHeader)>0 ){
296 fprintf(g.httpOut, "%s", blob_buffer(&extraHeader));
297 }
298
299 /* Add headers to turn on useful security options in browsers. */
300 fprintf(g.httpOut, "X-Frame-Options: DENY\r\n");
301 /* This stops fossil pages appearing in frames or iframes, preventing
302 ** click-jacking attacks on supporting browsers.
303 **
304 ** Other good headers would be
305 ** Strict-Transport-Security: max-age=62208000
@@ -353,10 +353,11 @@
353 if( size>0 ){
354 fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut);
355 }
356 }
357 }
 
358 CGIDEBUG(("DONE\n"));
359 }
360
361 /*
362 ** Do a redirect request to the URL given in the argument.
@@ -887,17 +888,26 @@
887 }
888
889 /*
890 ** Print all query parameters on standard output. Format the
891 ** parameters as HTML. This is used for testing and debugging.
 
 
892 */
893 void cgi_print_all(void){
894 int i;
 
 
 
 
 
895 cgi_parameter("",""); /* Force the parameters into sorted order */
896 for(i=0; i<nUsedQP; i++){
897 cgi_printf("%s = %s <br />\n",
898 htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1));
 
 
899 }
900 }
901
902 /*
903 ** This routine works like "printf" except that it has the
904
--- src/cgi.c
+++ src/cgi.c
@@ -295,11 +295,11 @@
295 if( blob_size(&extraHeader)>0 ){
296 fprintf(g.httpOut, "%s", blob_buffer(&extraHeader));
297 }
298
299 /* Add headers to turn on useful security options in browsers. */
300 fprintf(g.httpOut, "X-Frame-Options: SAMEORIGIN\r\n");
301 /* This stops fossil pages appearing in frames or iframes, preventing
302 ** click-jacking attacks on supporting browsers.
303 **
304 ** Other good headers would be
305 ** Strict-Transport-Security: max-age=62208000
@@ -353,10 +353,11 @@
353 if( size>0 ){
354 fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut);
355 }
356 }
357 }
358 fflush(g.httpOut);
359 CGIDEBUG(("DONE\n"));
360 }
361
362 /*
363 ** Do a redirect request to the URL given in the argument.
@@ -887,17 +888,26 @@
888 }
889
890 /*
891 ** Print all query parameters on standard output. Format the
892 ** parameters as HTML. This is used for testing and debugging.
893 ** Release builds omit the values of the cookies to avoid defeating
894 ** the purpose of setting HttpOnly cookies.
895 */
896 void cgi_print_all(void){
897 int i;
898 int showAll = 0;
899 #ifdef FOSSIL_DEBUG
900 /* Show the values of cookies in debug mode. */
901 showAll = 1;
902 #endif
903 cgi_parameter("",""); /* Force the parameters into sorted order */
904 for(i=0; i<nUsedQP; i++){
905 if( showAll || (fossil_stricmp("HTTP_COOKIE",aParamQP[i].zName)!=0 && fossil_strnicmp("fossil-",aParamQP[i].zName,7)!=0) ){
906 cgi_printf("%s = %s <br />\n",
907 htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1));
908 }
909 }
910 }
911
912 /*
913 ** This routine works like "printf" except that it has the
914
+92 -15
--- src/checkin.c
+++ src/checkin.c
@@ -32,60 +32,72 @@
3232
** are not true files results in a fatal error.
3333
*/
3434
static void status_report(
3535
Blob *report, /* Append the status report here */
3636
const char *zPrefix, /* Prefix on each line of the report */
37
- int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */
37
+ int missingIsFatal, /* MISSING and NOT_A_FILE are fatal errors */
38
+ int cwdRelative /* Report relative to the current working dir */
3839
){
3940
Stmt q;
4041
int nPrefix = strlen(zPrefix);
4142
int nErr = 0;
43
+ Blob rewrittenPathname;
4244
db_prepare(&q,
4345
"SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
4446
" FROM vfile "
4547
" WHERE file_is_selected(id)"
4648
" AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
4749
);
50
+ blob_zero(&rewrittenPathname);
4851
while( db_step(&q)==SQLITE_ROW ){
4952
const char *zPathname = db_column_text(&q,0);
53
+ const char *zDisplayName = zPathname;
5054
int isDeleted = db_column_int(&q, 1);
5155
int isChnged = db_column_int(&q,2);
5256
int isNew = db_column_int(&q,3)==0;
5357
int isRenamed = db_column_int(&q,4);
5458
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
59
+ if( cwdRelative ){
60
+ file_relative_name(zFullName, &rewrittenPathname);
61
+ zDisplayName = blob_str(&rewrittenPathname);
62
+ if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
63
+ zDisplayName += 2; /* no unnecessary ./ prefix */
64
+ }
65
+ }
5566
blob_append(report, zPrefix, nPrefix);
5667
if( isDeleted ){
57
- blob_appendf(report, "DELETED %s\n", zPathname);
68
+ blob_appendf(report, "DELETED %s\n", zDisplayName);
5869
}else if( !file_isfile(zFullName) ){
5970
if( file_access(zFullName, 0)==0 ){
60
- blob_appendf(report, "NOT_A_FILE %s\n", zPathname);
71
+ blob_appendf(report, "NOT_A_FILE %s\n", zDisplayName);
6172
if( missingIsFatal ){
62
- fossil_warning("not a file: %s", zPathname);
73
+ fossil_warning("not a file: %s", zDisplayName);
6374
nErr++;
6475
}
6576
}else{
66
- blob_appendf(report, "MISSING %s\n", zPathname);
77
+ blob_appendf(report, "MISSING %s\n", zDisplayName);
6778
if( missingIsFatal ){
68
- fossil_warning("missing file: %s", zPathname);
79
+ fossil_warning("missing file: %s", zDisplayName);
6980
nErr++;
7081
}
7182
}
7283
}else if( isNew ){
73
- blob_appendf(report, "ADDED %s\n", zPathname);
84
+ blob_appendf(report, "ADDED %s\n", zDisplayName);
7485
}else if( isDeleted ){
75
- blob_appendf(report, "DELETED %s\n", zPathname);
86
+ blob_appendf(report, "DELETED %s\n", zDisplayName);
7687
}else if( isChnged==2 ){
77
- blob_appendf(report, "UPDATED_BY_MERGE %s\n", zPathname);
88
+ blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName);
7889
}else if( isChnged==3 ){
79
- blob_appendf(report, "ADDED_BY_MERGE %s\n", zPathname);
90
+ blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName);
8091
}else if( isChnged==1 ){
81
- blob_appendf(report, "EDITED %s\n", zPathname);
92
+ blob_appendf(report, "EDITED %s\n", zDisplayName);
8293
}else if( isRenamed ){
83
- blob_appendf(report, "RENAMED %s\n", zPathname);
94
+ blob_appendf(report, "RENAMED %s\n", zDisplayName);
8495
}
8596
free(zFullName);
8697
}
98
+ blob_reset(&rewrittenPathname);
8799
db_finalize(&q);
88100
db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
89101
" WHERE id=0");
90102
while( db_step(&q)==SQLITE_ROW ){
91103
blob_append(report, zPrefix, nPrefix);
@@ -94,33 +106,59 @@
94106
db_finalize(&q);
95107
if( nErr ){
96108
fossil_fatal("aborting due to prior errors");
97109
}
98110
}
111
+
112
+/*
113
+** Use the "relative-paths" setting and the --abs-paths and
114
+** --rel-paths command line options to determine whether the
115
+** status report should be shown relative to the current
116
+** working directory.
117
+*/
118
+static int determine_cwd_relative_option()
119
+{
120
+ int relativePaths = db_get_boolean("relative-paths", 1);
121
+ int absPathOption = find_option("abs-paths", 0, 0)!=0;
122
+ int relPathOption = find_option("rel-paths", 0, 0)!=0;
123
+ if( absPathOption ){ relativePaths = 0; }
124
+ if( relPathOption ){ relativePaths = 1; }
125
+ return relativePaths;
126
+}
99127
100128
/*
101129
** COMMAND: changes
102130
**
103131
** Usage: %fossil changes
104132
**
105133
** Report on the edit status of all files in the current checkout.
106134
** See also the "status" and "extra" commands.
107135
**
136
+** Pathnames are displayed according to the "relative-paths" setting,
137
+** unless overridden by the --abs-paths or --rel-paths options.
138
+**
108139
** Options:
109140
**
110141
** --sha1sum Verify file status using SHA1 hashing rather
111142
** than relying on file mtimes.
143
+**
144
+** --abs-paths Display absolute pathnames.
145
+**
146
+** --rel-paths Display pathnames relative to the current working
147
+** directory.
112148
*/
113149
void changes_cmd(void){
114150
Blob report;
115151
int vid;
116152
int useSha1sum = find_option("sha1sum", 0, 0)!=0;
153
+ int cwdRelative = 0;
117154
db_must_be_within_tree();
155
+ cwdRelative = determine_cwd_relative_option();
118156
blob_zero(&report);
119157
vid = db_lget_int("checkout", 0);
120158
vfile_check_signature(vid, 0, useSha1sum);
121
- status_report(&report, "", 0);
159
+ status_report(&report, "", 0, cwdRelative);
122160
blob_write_to_file(&report, "-");
123161
}
124162
125163
/*
126164
** COMMAND: status
@@ -127,14 +165,22 @@
127165
**
128166
** Usage: %fossil status
129167
**
130168
** Report on the status of the current checkout.
131169
**
170
+** Pathnames are displayed according to the "relative-paths" setting,
171
+** unless overridden by the --abs-paths or --rel-paths options.
172
+**
132173
** Options:
133174
**
134175
** --sha1sum Verify file status using SHA1 hashing rather
135176
** than relying on file mtimes.
177
+**
178
+** --abs-paths Display absolute pathnames.
179
+**
180
+** --rel-paths Display pathnames relative to the current working
181
+** directory.
136182
*/
137183
void status_cmd(void){
138184
int vid;
139185
db_must_be_within_tree();
140186
/* 012345678901234 */
@@ -212,22 +258,41 @@
212258
** ignored but can be included by adding the --dotfiles option.
213259
**
214260
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
215261
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
216262
** is used if the --ignore option is omitted.
263
+**
264
+** Pathnames are displayed according to the "relative-paths" setting,
265
+** unless overridden by the --abs-paths or --rel-paths options.
266
+**
267
+** Options:
268
+**
269
+** --dotfiles Include files with names beginning with "."
270
+**
271
+** --ignore GLOBPATTERN
272
+** Override the "ignore-glob" setting.
273
+**
274
+** --abs-paths Display absolute pathnames.
275
+**
276
+** --rel-paths Display pathnames relative to the current working
277
+** directory.
217278
*/
218279
void extra_cmd(void){
219280
Blob path;
220281
Blob repo;
221282
Stmt q;
222283
int n;
223284
const char *zIgnoreFlag = find_option("ignore",0,1);
224285
int allFlag = find_option("dotfiles",0,0)!=0;
286
+ int cwdRelative = 0;
225287
int outputManifest;
226288
Glob *pIgnore;
289
+ Blob rewrittenPathname;
290
+ const char *zPathname, *zDisplayName;
227291
228292
db_must_be_within_tree();
293
+ cwdRelative = determine_cwd_relative_option();
229294
outputManifest = db_get_boolean("manifest",0);
230295
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
231296
n = strlen(g.zLocalRoot);
232297
blob_init(&path, g.zLocalRoot, n-1);
233298
if( zIgnoreFlag==0 ){
@@ -243,13 +308,25 @@
243308
fossil_all_reserved_names()
244309
);
245310
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
246311
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
247312
}
313
+ blob_zero(&rewrittenPathname);
248314
while( db_step(&q)==SQLITE_ROW ){
249
- fossil_print("%s\n", db_column_text(&q, 0));
315
+ zDisplayName = zPathname = db_column_text(&q, 0);
316
+ if( cwdRelative ) {
317
+ char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
318
+ file_relative_name(zFullName, &rewrittenPathname);
319
+ free(zFullName);
320
+ zDisplayName = blob_str(&rewrittenPathname);
321
+ if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
322
+ zDisplayName += 2; /* no unnecessary ./ prefix */
323
+ }
324
+ }
325
+ fossil_print("%s\n", zDisplayName);
250326
}
327
+ blob_reset(&rewrittenPathname);
251328
db_finalize(&q);
252329
}
253330
254331
/*
255332
** COMMAND: clean
@@ -367,11 +444,11 @@
367444
"# PRIVATE BRANCH: This check-in will be private and will not sync to\n"
368445
"# repositories.\n"
369446
"#\n", -1
370447
);
371448
}
372
- status_report(&text, "# ", 1);
449
+ status_report(&text, "# ", 1, 0);
373450
zEditor = db_get("editor", 0);
374451
if( zEditor==0 ){
375452
zEditor = getenv("VISUAL");
376453
}
377454
if( zEditor==0 ){
378455
--- src/checkin.c
+++ src/checkin.c
@@ -32,60 +32,72 @@
32 ** are not true files results in a fatal error.
33 */
34 static void status_report(
35 Blob *report, /* Append the status report here */
36 const char *zPrefix, /* Prefix on each line of the report */
37 int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */
 
38 ){
39 Stmt q;
40 int nPrefix = strlen(zPrefix);
41 int nErr = 0;
 
42 db_prepare(&q,
43 "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
44 " FROM vfile "
45 " WHERE file_is_selected(id)"
46 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
47 );
 
48 while( db_step(&q)==SQLITE_ROW ){
49 const char *zPathname = db_column_text(&q,0);
 
50 int isDeleted = db_column_int(&q, 1);
51 int isChnged = db_column_int(&q,2);
52 int isNew = db_column_int(&q,3)==0;
53 int isRenamed = db_column_int(&q,4);
54 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
 
 
 
 
 
 
 
55 blob_append(report, zPrefix, nPrefix);
56 if( isDeleted ){
57 blob_appendf(report, "DELETED %s\n", zPathname);
58 }else if( !file_isfile(zFullName) ){
59 if( file_access(zFullName, 0)==0 ){
60 blob_appendf(report, "NOT_A_FILE %s\n", zPathname);
61 if( missingIsFatal ){
62 fossil_warning("not a file: %s", zPathname);
63 nErr++;
64 }
65 }else{
66 blob_appendf(report, "MISSING %s\n", zPathname);
67 if( missingIsFatal ){
68 fossil_warning("missing file: %s", zPathname);
69 nErr++;
70 }
71 }
72 }else if( isNew ){
73 blob_appendf(report, "ADDED %s\n", zPathname);
74 }else if( isDeleted ){
75 blob_appendf(report, "DELETED %s\n", zPathname);
76 }else if( isChnged==2 ){
77 blob_appendf(report, "UPDATED_BY_MERGE %s\n", zPathname);
78 }else if( isChnged==3 ){
79 blob_appendf(report, "ADDED_BY_MERGE %s\n", zPathname);
80 }else if( isChnged==1 ){
81 blob_appendf(report, "EDITED %s\n", zPathname);
82 }else if( isRenamed ){
83 blob_appendf(report, "RENAMED %s\n", zPathname);
84 }
85 free(zFullName);
86 }
 
87 db_finalize(&q);
88 db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
89 " WHERE id=0");
90 while( db_step(&q)==SQLITE_ROW ){
91 blob_append(report, zPrefix, nPrefix);
@@ -94,33 +106,59 @@
94 db_finalize(&q);
95 if( nErr ){
96 fossil_fatal("aborting due to prior errors");
97 }
98 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
100 /*
101 ** COMMAND: changes
102 **
103 ** Usage: %fossil changes
104 **
105 ** Report on the edit status of all files in the current checkout.
106 ** See also the "status" and "extra" commands.
107 **
 
 
 
108 ** Options:
109 **
110 ** --sha1sum Verify file status using SHA1 hashing rather
111 ** than relying on file mtimes.
 
 
 
 
 
112 */
113 void changes_cmd(void){
114 Blob report;
115 int vid;
116 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
 
117 db_must_be_within_tree();
 
118 blob_zero(&report);
119 vid = db_lget_int("checkout", 0);
120 vfile_check_signature(vid, 0, useSha1sum);
121 status_report(&report, "", 0);
122 blob_write_to_file(&report, "-");
123 }
124
125 /*
126 ** COMMAND: status
@@ -127,14 +165,22 @@
127 **
128 ** Usage: %fossil status
129 **
130 ** Report on the status of the current checkout.
131 **
 
 
 
132 ** Options:
133 **
134 ** --sha1sum Verify file status using SHA1 hashing rather
135 ** than relying on file mtimes.
 
 
 
 
 
136 */
137 void status_cmd(void){
138 int vid;
139 db_must_be_within_tree();
140 /* 012345678901234 */
@@ -212,22 +258,41 @@
212 ** ignored but can be included by adding the --dotfiles option.
213 **
214 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
215 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
216 ** is used if the --ignore option is omitted.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217 */
218 void extra_cmd(void){
219 Blob path;
220 Blob repo;
221 Stmt q;
222 int n;
223 const char *zIgnoreFlag = find_option("ignore",0,1);
224 int allFlag = find_option("dotfiles",0,0)!=0;
 
225 int outputManifest;
226 Glob *pIgnore;
 
 
227
228 db_must_be_within_tree();
 
229 outputManifest = db_get_boolean("manifest",0);
230 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
231 n = strlen(g.zLocalRoot);
232 blob_init(&path, g.zLocalRoot, n-1);
233 if( zIgnoreFlag==0 ){
@@ -243,13 +308,25 @@
243 fossil_all_reserved_names()
244 );
245 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
246 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
247 }
 
248 while( db_step(&q)==SQLITE_ROW ){
249 fossil_print("%s\n", db_column_text(&q, 0));
 
 
 
 
 
 
 
 
 
 
250 }
 
251 db_finalize(&q);
252 }
253
254 /*
255 ** COMMAND: clean
@@ -367,11 +444,11 @@
367 "# PRIVATE BRANCH: This check-in will be private and will not sync to\n"
368 "# repositories.\n"
369 "#\n", -1
370 );
371 }
372 status_report(&text, "# ", 1);
373 zEditor = db_get("editor", 0);
374 if( zEditor==0 ){
375 zEditor = getenv("VISUAL");
376 }
377 if( zEditor==0 ){
378
--- src/checkin.c
+++ src/checkin.c
@@ -32,60 +32,72 @@
32 ** are not true files results in a fatal error.
33 */
34 static void status_report(
35 Blob *report, /* Append the status report here */
36 const char *zPrefix, /* Prefix on each line of the report */
37 int missingIsFatal, /* MISSING and NOT_A_FILE are fatal errors */
38 int cwdRelative /* Report relative to the current working dir */
39 ){
40 Stmt q;
41 int nPrefix = strlen(zPrefix);
42 int nErr = 0;
43 Blob rewrittenPathname;
44 db_prepare(&q,
45 "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
46 " FROM vfile "
47 " WHERE file_is_selected(id)"
48 " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
49 );
50 blob_zero(&rewrittenPathname);
51 while( db_step(&q)==SQLITE_ROW ){
52 const char *zPathname = db_column_text(&q,0);
53 const char *zDisplayName = zPathname;
54 int isDeleted = db_column_int(&q, 1);
55 int isChnged = db_column_int(&q,2);
56 int isNew = db_column_int(&q,3)==0;
57 int isRenamed = db_column_int(&q,4);
58 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
59 if( cwdRelative ){
60 file_relative_name(zFullName, &rewrittenPathname);
61 zDisplayName = blob_str(&rewrittenPathname);
62 if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
63 zDisplayName += 2; /* no unnecessary ./ prefix */
64 }
65 }
66 blob_append(report, zPrefix, nPrefix);
67 if( isDeleted ){
68 blob_appendf(report, "DELETED %s\n", zDisplayName);
69 }else if( !file_isfile(zFullName) ){
70 if( file_access(zFullName, 0)==0 ){
71 blob_appendf(report, "NOT_A_FILE %s\n", zDisplayName);
72 if( missingIsFatal ){
73 fossil_warning("not a file: %s", zDisplayName);
74 nErr++;
75 }
76 }else{
77 blob_appendf(report, "MISSING %s\n", zDisplayName);
78 if( missingIsFatal ){
79 fossil_warning("missing file: %s", zDisplayName);
80 nErr++;
81 }
82 }
83 }else if( isNew ){
84 blob_appendf(report, "ADDED %s\n", zDisplayName);
85 }else if( isDeleted ){
86 blob_appendf(report, "DELETED %s\n", zDisplayName);
87 }else if( isChnged==2 ){
88 blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName);
89 }else if( isChnged==3 ){
90 blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName);
91 }else if( isChnged==1 ){
92 blob_appendf(report, "EDITED %s\n", zDisplayName);
93 }else if( isRenamed ){
94 blob_appendf(report, "RENAMED %s\n", zDisplayName);
95 }
96 free(zFullName);
97 }
98 blob_reset(&rewrittenPathname);
99 db_finalize(&q);
100 db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
101 " WHERE id=0");
102 while( db_step(&q)==SQLITE_ROW ){
103 blob_append(report, zPrefix, nPrefix);
@@ -94,33 +106,59 @@
106 db_finalize(&q);
107 if( nErr ){
108 fossil_fatal("aborting due to prior errors");
109 }
110 }
111
112 /*
113 ** Use the "relative-paths" setting and the --abs-paths and
114 ** --rel-paths command line options to determine whether the
115 ** status report should be shown relative to the current
116 ** working directory.
117 */
118 static int determine_cwd_relative_option()
119 {
120 int relativePaths = db_get_boolean("relative-paths", 1);
121 int absPathOption = find_option("abs-paths", 0, 0)!=0;
122 int relPathOption = find_option("rel-paths", 0, 0)!=0;
123 if( absPathOption ){ relativePaths = 0; }
124 if( relPathOption ){ relativePaths = 1; }
125 return relativePaths;
126 }
127
128 /*
129 ** COMMAND: changes
130 **
131 ** Usage: %fossil changes
132 **
133 ** Report on the edit status of all files in the current checkout.
134 ** See also the "status" and "extra" commands.
135 **
136 ** Pathnames are displayed according to the "relative-paths" setting,
137 ** unless overridden by the --abs-paths or --rel-paths options.
138 **
139 ** Options:
140 **
141 ** --sha1sum Verify file status using SHA1 hashing rather
142 ** than relying on file mtimes.
143 **
144 ** --abs-paths Display absolute pathnames.
145 **
146 ** --rel-paths Display pathnames relative to the current working
147 ** directory.
148 */
149 void changes_cmd(void){
150 Blob report;
151 int vid;
152 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
153 int cwdRelative = 0;
154 db_must_be_within_tree();
155 cwdRelative = determine_cwd_relative_option();
156 blob_zero(&report);
157 vid = db_lget_int("checkout", 0);
158 vfile_check_signature(vid, 0, useSha1sum);
159 status_report(&report, "", 0, cwdRelative);
160 blob_write_to_file(&report, "-");
161 }
162
163 /*
164 ** COMMAND: status
@@ -127,14 +165,22 @@
165 **
166 ** Usage: %fossil status
167 **
168 ** Report on the status of the current checkout.
169 **
170 ** Pathnames are displayed according to the "relative-paths" setting,
171 ** unless overridden by the --abs-paths or --rel-paths options.
172 **
173 ** Options:
174 **
175 ** --sha1sum Verify file status using SHA1 hashing rather
176 ** than relying on file mtimes.
177 **
178 ** --abs-paths Display absolute pathnames.
179 **
180 ** --rel-paths Display pathnames relative to the current working
181 ** directory.
182 */
183 void status_cmd(void){
184 int vid;
185 db_must_be_within_tree();
186 /* 012345678901234 */
@@ -212,22 +258,41 @@
258 ** ignored but can be included by adding the --dotfiles option.
259 **
260 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
261 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
262 ** is used if the --ignore option is omitted.
263 **
264 ** Pathnames are displayed according to the "relative-paths" setting,
265 ** unless overridden by the --abs-paths or --rel-paths options.
266 **
267 ** Options:
268 **
269 ** --dotfiles Include files with names beginning with "."
270 **
271 ** --ignore GLOBPATTERN
272 ** Override the "ignore-glob" setting.
273 **
274 ** --abs-paths Display absolute pathnames.
275 **
276 ** --rel-paths Display pathnames relative to the current working
277 ** directory.
278 */
279 void extra_cmd(void){
280 Blob path;
281 Blob repo;
282 Stmt q;
283 int n;
284 const char *zIgnoreFlag = find_option("ignore",0,1);
285 int allFlag = find_option("dotfiles",0,0)!=0;
286 int cwdRelative = 0;
287 int outputManifest;
288 Glob *pIgnore;
289 Blob rewrittenPathname;
290 const char *zPathname, *zDisplayName;
291
292 db_must_be_within_tree();
293 cwdRelative = determine_cwd_relative_option();
294 outputManifest = db_get_boolean("manifest",0);
295 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
296 n = strlen(g.zLocalRoot);
297 blob_init(&path, g.zLocalRoot, n-1);
298 if( zIgnoreFlag==0 ){
@@ -243,13 +308,25 @@
308 fossil_all_reserved_names()
309 );
310 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
311 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
312 }
313 blob_zero(&rewrittenPathname);
314 while( db_step(&q)==SQLITE_ROW ){
315 zDisplayName = zPathname = db_column_text(&q, 0);
316 if( cwdRelative ) {
317 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
318 file_relative_name(zFullName, &rewrittenPathname);
319 free(zFullName);
320 zDisplayName = blob_str(&rewrittenPathname);
321 if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
322 zDisplayName += 2; /* no unnecessary ./ prefix */
323 }
324 }
325 fossil_print("%s\n", zDisplayName);
326 }
327 blob_reset(&rewrittenPathname);
328 db_finalize(&q);
329 }
330
331 /*
332 ** COMMAND: clean
@@ -367,11 +444,11 @@
444 "# PRIVATE BRANCH: This check-in will be private and will not sync to\n"
445 "# repositories.\n"
446 "#\n", -1
447 );
448 }
449 status_report(&text, "# ", 1, 0);
450 zEditor = db_get("editor", 0);
451 if( zEditor==0 ){
452 zEditor = getenv("VISUAL");
453 }
454 if( zEditor==0 ){
455
--- src/checkout.c
+++ src/checkout.c
@@ -232,10 +232,11 @@
232232
if( !keepFlag ){
233233
vfile_to_disk(vid, 0, 1, promptFlag);
234234
}
235235
checkout_set_all_exe(vid);
236236
manifest_to_disk(vid);
237
+ ensure_empty_dirs_created();
237238
db_lset_int("checkout", vid);
238239
undo_reset();
239240
db_multi_exec("DELETE FROM vmerge");
240241
if( !keepFlag && db_get_boolean("repo-cksum",1) ){
241242
vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
242243
--- src/checkout.c
+++ src/checkout.c
@@ -232,10 +232,11 @@
232 if( !keepFlag ){
233 vfile_to_disk(vid, 0, 1, promptFlag);
234 }
235 checkout_set_all_exe(vid);
236 manifest_to_disk(vid);
 
237 db_lset_int("checkout", vid);
238 undo_reset();
239 db_multi_exec("DELETE FROM vmerge");
240 if( !keepFlag && db_get_boolean("repo-cksum",1) ){
241 vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
242
--- src/checkout.c
+++ src/checkout.c
@@ -232,10 +232,11 @@
232 if( !keepFlag ){
233 vfile_to_disk(vid, 0, 1, promptFlag);
234 }
235 checkout_set_all_exe(vid);
236 manifest_to_disk(vid);
237 ensure_empty_dirs_created();
238 db_lset_int("checkout", vid);
239 undo_reset();
240 db_multi_exec("DELETE FROM vmerge");
241 if( !keepFlag && db_get_boolean("repo-cksum",1) ){
242 vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
243
+17 -3
--- src/clone.c
+++ src/clone.c
@@ -37,15 +37,17 @@
3737
**
3838
** Options:
3939
**
4040
** --admin-user|-A USERNAME Make USERNAME the administrator
4141
** --private Also clone private branches
42
+** --ssl-identity=filename Use the SSL identity if requested by the server
4243
**
4344
*/
4445
void clone_cmd(void){
4546
char *zPassword;
4647
const char *zDefaultUser; /* Optional name of the default user */
48
+ const char *zPw; /* The user clone password */
4749
int nErr = 0;
4850
int bPrivate; /* Also clone private branches */
4951
5052
bPrivate = find_option("private",0,0)!=0;
5153
url_proxy_options();
@@ -76,13 +78,15 @@
7678
"DELETE FROM blob WHERE rid IN private;"
7779
"DELETE FROM delta wHERE rid IN private;"
7880
"DELETE FROM private;"
7981
);
8082
shun_artifacts();
81
- g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
82
- if( g.zLogin==0 ){
83
- db_create_default_users(1,zDefaultUser);
83
+ db_create_default_users(1, zDefaultUser);
84
+ if( zDefaultUser ){
85
+ g.zLogin = zDefaultUser;
86
+ }else{
87
+ g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
8488
}
8589
fossil_print("Repository cloned into %s\n", g.argv[3]);
8690
}else{
8791
db_create_repository(g.argv[3]);
8892
db_open_repository(g.argv[3]);
@@ -91,10 +95,18 @@
9195
db_initial_setup(0, zDefaultUser, 0);
9296
user_select();
9397
db_set("content-schema", CONTENT_SCHEMA, 0);
9498
db_set("aux-schema", AUX_SCHEMA, 0);
9599
db_set("last-sync-url", g.argv[2], 0);
100
+ if( g.zSSLIdentity!=0 ){
101
+ /* If the --ssl-identity option was specified, store it as a setting */
102
+ Blob fn;
103
+ blob_zero(&fn);
104
+ file_canonical_name(g.zSSLIdentity, &fn);
105
+ db_set("ssl-identity", blob_str(&fn), 0);
106
+ blob_reset(&fn);
107
+ }
96108
db_multi_exec(
97109
"REPLACE INTO config(name,value,mtime)"
98110
" VALUES('server-code', lower(hex(randomblob(20))), now());"
99111
);
100112
url_enable_proxy(0);
@@ -116,7 +128,9 @@
116128
rebuild_db(0, 1, 0);
117129
fossil_print("project-id: %s\n", db_get("project-code", 0));
118130
fossil_print("server-id: %s\n", db_get("server-code", 0));
119131
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
120132
fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
133
+ zPw = g.urlPasswd;
134
+ if( !g.dontKeepUrl && zPw) db_set("last-sync-pw", obscure(zPw), 0);
121135
db_end_transaction(0);
122136
}
123137
--- src/clone.c
+++ src/clone.c
@@ -37,15 +37,17 @@
37 **
38 ** Options:
39 **
40 ** --admin-user|-A USERNAME Make USERNAME the administrator
41 ** --private Also clone private branches
 
42 **
43 */
44 void clone_cmd(void){
45 char *zPassword;
46 const char *zDefaultUser; /* Optional name of the default user */
 
47 int nErr = 0;
48 int bPrivate; /* Also clone private branches */
49
50 bPrivate = find_option("private",0,0)!=0;
51 url_proxy_options();
@@ -76,13 +78,15 @@
76 "DELETE FROM blob WHERE rid IN private;"
77 "DELETE FROM delta wHERE rid IN private;"
78 "DELETE FROM private;"
79 );
80 shun_artifacts();
81 g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
82 if( g.zLogin==0 ){
83 db_create_default_users(1,zDefaultUser);
 
 
84 }
85 fossil_print("Repository cloned into %s\n", g.argv[3]);
86 }else{
87 db_create_repository(g.argv[3]);
88 db_open_repository(g.argv[3]);
@@ -91,10 +95,18 @@
91 db_initial_setup(0, zDefaultUser, 0);
92 user_select();
93 db_set("content-schema", CONTENT_SCHEMA, 0);
94 db_set("aux-schema", AUX_SCHEMA, 0);
95 db_set("last-sync-url", g.argv[2], 0);
 
 
 
 
 
 
 
 
96 db_multi_exec(
97 "REPLACE INTO config(name,value,mtime)"
98 " VALUES('server-code', lower(hex(randomblob(20))), now());"
99 );
100 url_enable_proxy(0);
@@ -116,7 +128,9 @@
116 rebuild_db(0, 1, 0);
117 fossil_print("project-id: %s\n", db_get("project-code", 0));
118 fossil_print("server-id: %s\n", db_get("server-code", 0));
119 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
120 fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
 
 
121 db_end_transaction(0);
122 }
123
--- src/clone.c
+++ src/clone.c
@@ -37,15 +37,17 @@
37 **
38 ** Options:
39 **
40 ** --admin-user|-A USERNAME Make USERNAME the administrator
41 ** --private Also clone private branches
42 ** --ssl-identity=filename Use the SSL identity if requested by the server
43 **
44 */
45 void clone_cmd(void){
46 char *zPassword;
47 const char *zDefaultUser; /* Optional name of the default user */
48 const char *zPw; /* The user clone password */
49 int nErr = 0;
50 int bPrivate; /* Also clone private branches */
51
52 bPrivate = find_option("private",0,0)!=0;
53 url_proxy_options();
@@ -76,13 +78,15 @@
78 "DELETE FROM blob WHERE rid IN private;"
79 "DELETE FROM delta wHERE rid IN private;"
80 "DELETE FROM private;"
81 );
82 shun_artifacts();
83 db_create_default_users(1, zDefaultUser);
84 if( zDefaultUser ){
85 g.zLogin = zDefaultUser;
86 }else{
87 g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
88 }
89 fossil_print("Repository cloned into %s\n", g.argv[3]);
90 }else{
91 db_create_repository(g.argv[3]);
92 db_open_repository(g.argv[3]);
@@ -91,10 +95,18 @@
95 db_initial_setup(0, zDefaultUser, 0);
96 user_select();
97 db_set("content-schema", CONTENT_SCHEMA, 0);
98 db_set("aux-schema", AUX_SCHEMA, 0);
99 db_set("last-sync-url", g.argv[2], 0);
100 if( g.zSSLIdentity!=0 ){
101 /* If the --ssl-identity option was specified, store it as a setting */
102 Blob fn;
103 blob_zero(&fn);
104 file_canonical_name(g.zSSLIdentity, &fn);
105 db_set("ssl-identity", blob_str(&fn), 0);
106 blob_reset(&fn);
107 }
108 db_multi_exec(
109 "REPLACE INTO config(name,value,mtime)"
110 " VALUES('server-code', lower(hex(randomblob(20))), now());"
111 );
112 url_enable_proxy(0);
@@ -116,7 +128,9 @@
128 rebuild_db(0, 1, 0);
129 fossil_print("project-id: %s\n", db_get("project-code", 0));
130 fossil_print("server-id: %s\n", db_get("server-code", 0));
131 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
132 fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
133 zPw = g.urlPasswd;
134 if( !g.dontKeepUrl && zPw) db_set("last-sync-pw", obscure(zPw), 0);
135 db_end_transaction(0);
136 }
137
+5 -1
--- src/config.h
+++ src/config.h
@@ -24,10 +24,14 @@
2424
#define _LARGE_FILE 1
2525
#ifndef _FILE_OFFSET_BITS
2626
# define _FILE_OFFSET_BITS 64
2727
#endif
2828
#define _LARGEFILE_SOURCE 1
29
+
30
+#ifdef HAVE_AUTOCONFIG_H
31
+#include "autoconfig.h"
32
+#endif
2933
3034
#ifndef _RC_COMPILE_
3135
3236
/*
3337
** System header files used by all modules
@@ -85,11 +89,11 @@
8589
#include "sqlite3.h"
8690
8791
/*
8892
** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257.
8993
*/
90
-#if defined(__sun__) || defined(sun)
94
+#if HAVE_GETPASSPHRASE
9195
#define getpass getpassphrase
9296
#endif
9397
9498
/*
9599
** Typedef for a 64-bit integer
96100
--- src/config.h
+++ src/config.h
@@ -24,10 +24,14 @@
24 #define _LARGE_FILE 1
25 #ifndef _FILE_OFFSET_BITS
26 # define _FILE_OFFSET_BITS 64
27 #endif
28 #define _LARGEFILE_SOURCE 1
 
 
 
 
29
30 #ifndef _RC_COMPILE_
31
32 /*
33 ** System header files used by all modules
@@ -85,11 +89,11 @@
85 #include "sqlite3.h"
86
87 /*
88 ** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257.
89 */
90 #if defined(__sun__) || defined(sun)
91 #define getpass getpassphrase
92 #endif
93
94 /*
95 ** Typedef for a 64-bit integer
96
--- src/config.h
+++ src/config.h
@@ -24,10 +24,14 @@
24 #define _LARGE_FILE 1
25 #ifndef _FILE_OFFSET_BITS
26 # define _FILE_OFFSET_BITS 64
27 #endif
28 #define _LARGEFILE_SOURCE 1
29
30 #ifdef HAVE_AUTOCONFIG_H
31 #include "autoconfig.h"
32 #endif
33
34 #ifndef _RC_COMPILE_
35
36 /*
37 ** System header files used by all modules
@@ -85,11 +89,11 @@
89 #include "sqlite3.h"
90
91 /*
92 ** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257.
93 */
94 #if HAVE_GETPASSPHRASE
95 #define getpass getpassphrase
96 #endif
97
98 /*
99 ** Typedef for a 64-bit integer
100
--- src/configure.c
+++ src/configure.c
@@ -81,10 +81,11 @@
8181
{ "project-name", CONFIGSET_PROJ },
8282
{ "project-description", CONFIGSET_PROJ },
8383
{ "manifest", CONFIGSET_PROJ },
8484
{ "ignore-glob", CONFIGSET_PROJ },
8585
{ "crnl-glob", CONFIGSET_PROJ },
86
+ { "empty-dirs", CONFIGSET_PROJ },
8687
{ "index-page", CONFIGSET_SKIN },
8788
{ "timeline-block-markup", CONFIGSET_SKIN },
8889
{ "timeline-max-comment", CONFIGSET_SKIN },
8990
{ "ticket-table", CONFIGSET_TKT },
9091
{ "ticket-common", CONFIGSET_TKT },
9192
--- src/configure.c
+++ src/configure.c
@@ -81,10 +81,11 @@
81 { "project-name", CONFIGSET_PROJ },
82 { "project-description", CONFIGSET_PROJ },
83 { "manifest", CONFIGSET_PROJ },
84 { "ignore-glob", CONFIGSET_PROJ },
85 { "crnl-glob", CONFIGSET_PROJ },
 
86 { "index-page", CONFIGSET_SKIN },
87 { "timeline-block-markup", CONFIGSET_SKIN },
88 { "timeline-max-comment", CONFIGSET_SKIN },
89 { "ticket-table", CONFIGSET_TKT },
90 { "ticket-common", CONFIGSET_TKT },
91
--- src/configure.c
+++ src/configure.c
@@ -81,10 +81,11 @@
81 { "project-name", CONFIGSET_PROJ },
82 { "project-description", CONFIGSET_PROJ },
83 { "manifest", CONFIGSET_PROJ },
84 { "ignore-glob", CONFIGSET_PROJ },
85 { "crnl-glob", CONFIGSET_PROJ },
86 { "empty-dirs", CONFIGSET_PROJ },
87 { "index-page", CONFIGSET_SKIN },
88 { "timeline-block-markup", CONFIGSET_SKIN },
89 { "timeline-max-comment", CONFIGSET_SKIN },
90 { "ticket-table", CONFIGSET_TKT },
91 { "ticket-common", CONFIGSET_TKT },
92
+180 -52
--- src/db.c
+++ src/db.c
@@ -153,13 +153,17 @@
153153
** Force a rollback and shutdown the database
154154
*/
155155
void db_force_rollback(void){
156156
int i;
157157
static int busy = 0;
158
+ sqlite3_stmt *pStmt = 0;
158159
if( busy || g.db==0 ) return;
159160
busy = 1;
160161
undo_rollback();
162
+ while( (pStmt = sqlite3_next_stmt(g.db,pStmt))!=0 ){
163
+ sqlite3_reset(pStmt);
164
+ }
161165
while( pAllStmt ){
162166
db_finalize(pAllStmt);
163167
}
164168
if( nBegin ){
165169
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
@@ -809,10 +813,11 @@
809813
static const char *aDbName[] = { "/_FOSSIL_", "/.fos" };
810814
811815
if( g.localOpen) return 1;
812816
file_getcwd(zPwd, sizeof(zPwd)-20);
813817
n = strlen(zPwd);
818
+ if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.';
814819
while( n>0 ){
815820
if( file_access(zPwd, W_OK) ) break;
816821
for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){
817822
sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]);
818823
if( isValidLocalDb(zPwd) ){
@@ -1058,14 +1063,13 @@
10581063
10591064
/*
10601065
** Create the default user accounts in the USER table.
10611066
*/
10621067
void db_create_default_users(int setupUserOnly, const char *zDefaultUser){
1063
- const char *zUser;
1064
- zUser = db_get("default-user", 0);
1068
+ const char *zUser = zDefaultUser;
10651069
if( zUser==0 ){
1066
- zUser = zDefaultUser;
1070
+ zUser = db_get("default-user", 0);
10671071
}
10681072
if( zUser==0 ){
10691073
#if defined(_WIN32)
10701074
zUser = getenv("USERNAME");
10711075
#else
@@ -1074,12 +1078,15 @@
10741078
}
10751079
if( zUser==0 ){
10761080
zUser = "root";
10771081
}
10781082
db_multi_exec(
1079
- "INSERT INTO user(login, pw, cap, info)"
1080
- "VALUES(%Q,lower(hex(randomblob(3))),'s','')", zUser
1083
+ "INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser
1084
+ );
1085
+ db_multi_exec(
1086
+ "UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))"
1087
+ " WHERE login=%Q", zUser
10811088
);
10821089
if( !setupUserOnly ){
10831090
db_multi_exec(
10841091
"INSERT INTO user(login,pw,cap,info)"
10851092
" VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');"
@@ -1363,19 +1370,19 @@
13631370
*/
13641371
int is_truth(const char *zVal){
13651372
static const char *azOn[] = { "on", "yes", "true", "1" };
13661373
int i;
13671374
for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1368
- if( fossil_strcmp(zVal,azOn[i])==0 ) return 1;
1375
+ if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
13691376
}
13701377
return 0;
13711378
}
13721379
int is_false(const char *zVal){
13731380
static const char *azOff[] = { "off", "no", "false", "0" };
13741381
int i;
13751382
for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1376
- if( fossil_strcmp(zVal,azOff[i])==0 ) return 1;
1383
+ if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
13771384
}
13781385
return 0;
13791386
}
13801387
13811388
/*
@@ -1392,24 +1399,93 @@
13921399
sqlite3 *dbTemp = g.db;
13931400
g.db = g.dbConfig;
13941401
g.dbConfig = dbTemp;
13951402
}
13961403
}
1404
+
1405
+/*
1406
+** Logic for reading potentially versioned settings from
1407
+** .fossil-settings/<name> , and emits warnings if necessary.
1408
+** Returns the non-versioned value without modification if there is no
1409
+** versioned value.
1410
+*/
1411
+static char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){
1412
+ /* Attempt to load the versioned setting from a checked out file */
1413
+ char *zVersionedSetting = 0;
1414
+ int noWarn = 0;
1415
+
1416
+ if( db_open_local() ){
1417
+ Blob versionedPathname;
1418
+ char *zVersionedPathname;
1419
+ blob_zero(&versionedPathname);
1420
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1421
+ g.zLocalRoot, zName);
1422
+ zVersionedPathname = blob_str(&versionedPathname);
1423
+ if( file_size(zVersionedPathname)>=0 ){
1424
+ /* File exists, and contains the value for this setting. Load from
1425
+ ** the file. */
1426
+ Blob setting;
1427
+ blob_zero(&setting);
1428
+ if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1429
+ blob_trim(&setting); /* Avoid non-obvious problems with line endings
1430
+ ** on boolean properties */
1431
+ zVersionedSetting = strdup(blob_str(&setting));
1432
+ }
1433
+ blob_reset(&setting);
1434
+ /* See if there's a no-warn flag */
1435
+ blob_append(&versionedPathname, ".no-warn", -1);
1436
+ if( file_size(blob_str(&versionedPathname))>=0 ){
1437
+ noWarn = 1;
1438
+ }
1439
+ }
1440
+ blob_reset(&versionedPathname);
1441
+ }
1442
+ /* Display a warning? */
1443
+ if( zVersionedSetting!=0 && zNonVersionedSetting!=0
1444
+ && zNonVersionedSetting[0]!='\0' && !noWarn
1445
+ ){
1446
+ /* There's a versioned setting, and a non-versioned setting. Tell
1447
+ ** the user about the conflict */
1448
+ fossil_warning(
1449
+ "setting %s has both versioned and non-versioned values: using "
1450
+ "versioned value from file .fossil-settings/%s (to silence this "
1451
+ "warning, either create an empty file named "
1452
+ ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1453
+ " with \"fossil unset %s\")", zName, zName, zName, zName
1454
+ );
1455
+ }
1456
+ /* Prefer the versioned setting */
1457
+ return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting;
1458
+}
1459
+
13971460
13981461
/*
13991462
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
14001463
** repository and local databases.
14011464
*/
14021465
char *db_get(const char *zName, char *zDefault){
14031466
char *z = 0;
1467
+ int i;
1468
+ const struct stControlSettings *ctrlSetting = 0;
1469
+ /* Is this a setting? */
1470
+ for(i=0; ctrlSettings[i].name; i++){
1471
+ if( strcmp(ctrlSettings[i].name, zName)==0 ){
1472
+ ctrlSetting = &(ctrlSettings[i]);
1473
+ break;
1474
+ }
1475
+ }
14041476
if( g.repositoryOpen ){
14051477
z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
14061478
}
14071479
if( z==0 && g.configOpen ){
14081480
db_swap_connections();
14091481
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
14101482
db_swap_connections();
1483
+ }
1484
+ if( ctrlSetting!=0 && ctrlSetting->versionable ){
1485
+ /* This is a versionable setting, try and get the info from a checked out file */
1486
+ z = db_get_do_versionable(zName, z);
14111487
}
14121488
if( z==0 ){
14131489
z = zDefault;
14141490
}
14151491
return z;
@@ -1596,30 +1672,39 @@
15961672
}
15971673
15981674
/*
15991675
** Print the value of a setting named zName
16001676
*/
1601
-static void print_setting(const char *zName){
1677
+static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
16021678
Stmt q;
16031679
if( g.repositoryOpen ){
16041680
db_prepare(&q,
16051681
"SELECT '(local)', value FROM config WHERE name=%Q"
16061682
" UNION ALL "
16071683
"SELECT '(global)', value FROM global_config WHERE name=%Q",
1608
- zName, zName
1684
+ ctrlSetting->name, ctrlSetting->name
16091685
);
16101686
}else{
16111687
db_prepare(&q,
16121688
"SELECT '(global)', value FROM global_config WHERE name=%Q",
1613
- zName
1689
+ ctrlSetting->name
16141690
);
16151691
}
16161692
if( db_step(&q)==SQLITE_ROW ){
1617
- fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
1693
+ fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0),
16181694
db_column_text(&q, 1));
16191695
}else{
1620
- fossil_print("%-20s\n", zName);
1696
+ fossil_print("%-20s\n", ctrlSetting->name);
1697
+ }
1698
+ if( ctrlSetting->versionable && localOpen ){
1699
+ /* Check to see if this is overridden by a versionable settings file */
1700
+ Blob versionedPathname;
1701
+ blob_zero(&versionedPathname);
1702
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
1703
+ if( file_size(blob_str(&versionedPathname))>=0 ){
1704
+ fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
1705
+ }
16211706
}
16221707
db_finalize(&q);
16231708
}
16241709
16251710
@@ -1635,42 +1720,49 @@
16351720
#if INTERFACE
16361721
struct stControlSettings {
16371722
char const *name; /* Name of the setting */
16381723
char const *var; /* Internal variable name used by db_set() */
16391724
int width; /* Width of display. 0 for boolean values */
1725
+ int versionable; /* Is this setting versionable? */
16401726
char const *def; /* Default value */
16411727
};
16421728
#endif /* INTERFACE */
16431729
struct stControlSettings const ctrlSettings[] = {
1644
- { "access-log", 0, 0, "off" },
1645
- { "auto-captcha", "autocaptcha", 0, "on" },
1646
- { "auto-shun", 0, 0, "on" },
1647
- { "autosync", 0, 0, "on" },
1648
- { "binary-glob", 0, 32, "" },
1649
- { "clearsign", 0, 0, "off" },
1650
- { "crnl-glob", 0, 16, "" },
1651
- { "default-perms", 0, 16, "u" },
1652
- { "diff-command", 0, 16, "" },
1653
- { "dont-push", 0, 0, "off" },
1654
- { "editor", 0, 16, "" },
1655
- { "gdiff-command", 0, 16, "gdiff" },
1656
- { "gmerge-command",0, 40, "" },
1657
- { "https-login", 0, 0, "off" },
1658
- { "ignore-glob", 0, 40, "" },
1659
- { "http-port", 0, 16, "8080" },
1660
- { "localauth", 0, 0, "off" },
1661
- { "main-branch", 0, 40, "trunk" },
1662
- { "manifest", 0, 0, "off" },
1663
- { "max-upload", 0, 25, "250000" },
1664
- { "mtime-changes", 0, 0, "on" },
1665
- { "pgp-command", 0, 32, "gpg --clearsign -o " },
1666
- { "proxy", 0, 32, "off" },
1667
- { "repo-cksum", 0, 0, "on" },
1668
- { "self-register", 0, 0, "off" },
1669
- { "ssh-command", 0, 32, "" },
1670
- { "web-browser", 0, 32, "" },
1671
- { 0,0,0,0 }
1730
+ { "access-log", 0, 0, 0, "off" },
1731
+ { "auto-captcha", "autocaptcha", 0, 0, "on" },
1732
+ { "auto-shun", 0, 0, 0, "on" },
1733
+ { "autosync", 0, 0, 0, "on" },
1734
+ { "binary-glob", 0, 32, 1, "" },
1735
+ { "clearsign", 0, 0, 0, "off" },
1736
+ { "case-sensitive",0, 0, 0, "on" },
1737
+ { "crnl-glob", 0, 16, 1, "" },
1738
+ { "default-perms", 0, 16, 0, "u" },
1739
+ { "diff-command", 0, 16, 0, "" },
1740
+ { "dont-push", 0, 0, 0, "off" },
1741
+ { "editor", 0, 16, 0, "" },
1742
+ { "gdiff-command", 0, 16, 0, "gdiff" },
1743
+ { "gmerge-command",0, 40, 0, "" },
1744
+ { "https-login", 0, 0, 0, "off" },
1745
+ { "ignore-glob", 0, 40, 1, "" },
1746
+ { "empty-dirs", 0, 40, 1, "" },
1747
+ { "http-port", 0, 16, 0, "8080" },
1748
+ { "localauth", 0, 0, 0, "off" },
1749
+ { "main-branch", 0, 40, 0, "trunk" },
1750
+ { "manifest", 0, 0, 1, "off" },
1751
+ { "max-upload", 0, 25, 0, "250000" },
1752
+ { "mtime-changes", 0, 0, 0, "on" },
1753
+ { "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
1754
+ { "proxy", 0, 32, 0, "off" },
1755
+ { "relative-paths",0, 0, 0, "on" },
1756
+ { "repo-cksum", 0, 0, 0, "on" },
1757
+ { "self-register", 0, 0, 0, "off" },
1758
+ { "ssl-ca-location",0, 40, 0, "" },
1759
+ { "ssl-identity", 0, 40, 0, "" },
1760
+ { "ssh-command", 0, 32, 0, "" },
1761
+ { "web-browser", 0, 32, 0, "" },
1762
+ { "white-foreground", 0, 0, 0, "off" },
1763
+ { 0,0,0,0,0 }
16721764
};
16731765
16741766
/*
16751767
** COMMAND: settings
16761768
** COMMAND: unset
@@ -1679,10 +1771,14 @@
16791771
** %fossil unset PROPERTY ?-global?
16801772
**
16811773
** The "settings" command with no arguments lists all properties and their
16821774
** values. With just a property name it shows the value of that property.
16831775
** With a value argument it changes the property for the current repository.
1776
+**
1777
+** Settings marked as versionable are overridden by the contents of the
1778
+** file named .fossil-settings/PROPERTY in the checked out files, if that
1779
+** file exists.
16841780
**
16851781
** The "unset" command clears a property setting.
16861782
**
16871783
**
16881784
** auto-captcha If enabled, the Login page provides a button to
@@ -1696,20 +1792,25 @@
16961792
** or update and automatically push after commit or
16971793
** tag or branch creation. If the value is "pullonly"
16981794
** then only pull operations occur automatically.
16991795
** Default: on
17001796
**
1701
-** binary-glob The VALUE is a comma-separated list of GLOB patterns
1702
-** that should be treated as binary files for merging
1703
-** purposes. Example: *.xml
1797
+** binary-glob The VALUE is a comma or newline-separated list of
1798
+** (versionable) GLOB patterns that should be treated as binary files
1799
+** for merging purposes. Example: *.xml
1800
+**
1801
+** case-sensitive If TRUE, the files whose names differ only in case
1802
+** care considered distinct. If FALSE files whose names
1803
+** differ only in case are the same file. Defaults to
1804
+** TRUE for unix and FALSE for windows and mac.
17041805
**
17051806
** clearsign When enabled, fossil will attempt to sign all commits
17061807
** with gpg. When disabled (the default), commits will
17071808
** be unsigned. Default: off
17081809
**
1709
-** crnl-glob A comma-separated list of GLOB patterns for text files
1710
-** in which it is ok to have CR+NL line endings.
1810
+** crnl-glob A comma or newline-separated list of GLOB patterns for
1811
+** (versionable) text files in which it is ok to have CR+NL line endings.
17111812
** Set to "*" to disable CR+NL checking.
17121813
**
17131814
** default-perms Permissions given automatically to new users. For more
17141815
** information on permissions see Users page in Server
17151816
** Administration of the HTTP UI. Default: u.
@@ -1717,10 +1818,15 @@
17171818
** diff-command External command to run when performing a diff.
17181819
** If undefined, the internal text diff will be used.
17191820
**
17201821
** dont-push Prevent this repository from pushing from client to
17211822
** server. Useful when setting up a private branch.
1823
+**
1824
+** empty-dirs A comma or newline-separated list of pathnames. On
1825
+** (versionable) update and checkout commands, if no file or directory
1826
+** exists with that name, an empty directory will be
1827
+** created.
17221828
**
17231829
** editor Text editor command used for check-in comments.
17241830
**
17251831
** gdiff-command External command to run when performing a graphical
17261832
** diff. If undefined, text diff will be used.
@@ -1735,23 +1841,23 @@
17351841
** and "ui" commands. Default: 8080
17361842
**
17371843
** https-login Send login creditials using HTTPS instead of HTTP
17381844
** even if the login page request came via HTTP.
17391845
**
1740
-** ignore-glob The VALUE is a comma-separated list of GLOB patterns
1741
-** specifying files that the "extra" command will ignore.
1742
-** Example: *.o,*.obj,*.exe
1846
+** ignore-glob The VALUE is a comma or newline-separated list of GLOB
1847
+** (versionable) patterns specifying files that the "extra" command will
1848
+** ignore. Example: *.o,*.obj,*.exe
17431849
**
17441850
** localauth If enabled, require that HTTP connections from
17451851
** 127.0.0.1 be authenticated by password. If
17461852
** false, all HTTP requests from localhost have
17471853
** unrestricted access to the repository.
17481854
**
17491855
** main-branch The primary branch for the project. Default: trunk
17501856
**
17511857
** manifest If enabled, automatically create files "manifest" and
1752
-** "manifest.uuid" in every checkout. The SQLite and
1858
+** (versionable) "manifest.uuid" in every checkout. The SQLite and
17531859
** Fossil repositories both require this. Default: off.
17541860
**
17551861
** max-upload A limit on the size of uplink HTTP requests. The
17561862
** default is 250000 bytes.
17571863
**
@@ -1763,10 +1869,13 @@
17631869
**
17641870
** proxy URL of the HTTP proxy. If undefined or "off" then
17651871
** the "http_proxy" environment variable is consulted.
17661872
** If the http_proxy environment variable is undefined
17671873
** then a direct HTTP connection is used.
1874
+**
1875
+** relative-paths When showing changes and extras, report paths relative
1876
+** to the current working directory. Default: "on"
17681877
**
17691878
** repo-cksum Compute checksums over all files in each checkout
17701879
** as a double-check of correctness. Defaults to "on".
17711880
** Disable on large repositories for a performance
17721881
** improvement.
@@ -1773,10 +1882,28 @@
17731882
**
17741883
** self-register Allow users to register themselves through the HTTP UI.
17751884
** This is useful if you want to see other names than
17761885
** "Anonymous" in e.g. ticketing system. On the other hand
17771886
** users can not be deleted. Default: off.
1887
+**
1888
+** ssl-ca-location The full pathname to a file containing PEM encoded
1889
+** CA root certificates, or a directory of certificates
1890
+** with filenames formed from the certificate hashes as
1891
+** required by OpenSSL.
1892
+** If set, this will override the OS default list of
1893
+** OpenSSL CAs. If unset, the default list will be used.
1894
+** Some platforms may add additional certificates.
1895
+** Check your platform behaviour is as required if the
1896
+** exact contents of the CA root is critical for your
1897
+** application.
1898
+**
1899
+** ssl-identity The full pathname to a file containing a certificate
1900
+** and private key in PEM format. Create by concatenating
1901
+** the certificate and private key files.
1902
+** This identity will be presented to SSL servers to
1903
+** authenticate this client, in addition to the normal
1904
+** password authentication.
17781905
**
17791906
** ssh-command Command used to talk to a remote machine with
17801907
** the "ssh://" protocol.
17811908
**
17821909
** web-browser A shell command used to launch your preferred
@@ -1797,12 +1924,13 @@
17971924
}
17981925
if( unsetFlag && g.argc!=3 ){
17991926
usage("PROPERTY ?-global?");
18001927
}
18011928
if( g.argc==2 ){
1929
+ int openLocal = db_open_local();
18021930
for(i=0; ctrlSettings[i].name; i++){
1803
- print_setting(ctrlSettings[i].name);
1931
+ print_setting(&ctrlSettings[i], openLocal);
18041932
}
18051933
}else if( g.argc==3 || g.argc==4 ){
18061934
const char *zName = g.argv[2];
18071935
int isManifest;
18081936
int n = strlen(zName);
@@ -1820,13 +1948,13 @@
18201948
db_unset(ctrlSettings[i].name, globalFlag);
18211949
}else if( g.argc==4 ){
18221950
db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
18231951
}else{
18241952
isManifest = 0;
1825
- print_setting(ctrlSettings[i].name);
1953
+ print_setting(&ctrlSettings[i], db_open_local());
18261954
}
1827
- if( isManifest ){
1955
+ if( isManifest && g.localOpen ){
18281956
manifest_to_disk(db_lget_int("checkout", 0));
18291957
}
18301958
}else{
18311959
usage("?PROPERTY? ?VALUE?");
18321960
}
18331961
--- src/db.c
+++ src/db.c
@@ -153,13 +153,17 @@
153 ** Force a rollback and shutdown the database
154 */
155 void db_force_rollback(void){
156 int i;
157 static int busy = 0;
 
158 if( busy || g.db==0 ) return;
159 busy = 1;
160 undo_rollback();
 
 
 
161 while( pAllStmt ){
162 db_finalize(pAllStmt);
163 }
164 if( nBegin ){
165 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
@@ -809,10 +813,11 @@
809 static const char *aDbName[] = { "/_FOSSIL_", "/.fos" };
810
811 if( g.localOpen) return 1;
812 file_getcwd(zPwd, sizeof(zPwd)-20);
813 n = strlen(zPwd);
 
814 while( n>0 ){
815 if( file_access(zPwd, W_OK) ) break;
816 for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){
817 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]);
818 if( isValidLocalDb(zPwd) ){
@@ -1058,14 +1063,13 @@
1058
1059 /*
1060 ** Create the default user accounts in the USER table.
1061 */
1062 void db_create_default_users(int setupUserOnly, const char *zDefaultUser){
1063 const char *zUser;
1064 zUser = db_get("default-user", 0);
1065 if( zUser==0 ){
1066 zUser = zDefaultUser;
1067 }
1068 if( zUser==0 ){
1069 #if defined(_WIN32)
1070 zUser = getenv("USERNAME");
1071 #else
@@ -1074,12 +1078,15 @@
1074 }
1075 if( zUser==0 ){
1076 zUser = "root";
1077 }
1078 db_multi_exec(
1079 "INSERT INTO user(login, pw, cap, info)"
1080 "VALUES(%Q,lower(hex(randomblob(3))),'s','')", zUser
 
 
 
1081 );
1082 if( !setupUserOnly ){
1083 db_multi_exec(
1084 "INSERT INTO user(login,pw,cap,info)"
1085 " VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');"
@@ -1363,19 +1370,19 @@
1363 */
1364 int is_truth(const char *zVal){
1365 static const char *azOn[] = { "on", "yes", "true", "1" };
1366 int i;
1367 for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1368 if( fossil_strcmp(zVal,azOn[i])==0 ) return 1;
1369 }
1370 return 0;
1371 }
1372 int is_false(const char *zVal){
1373 static const char *azOff[] = { "off", "no", "false", "0" };
1374 int i;
1375 for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1376 if( fossil_strcmp(zVal,azOff[i])==0 ) return 1;
1377 }
1378 return 0;
1379 }
1380
1381 /*
@@ -1392,24 +1399,93 @@
1392 sqlite3 *dbTemp = g.db;
1393 g.db = g.dbConfig;
1394 g.dbConfig = dbTemp;
1395 }
1396 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1397
1398 /*
1399 ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
1400 ** repository and local databases.
1401 */
1402 char *db_get(const char *zName, char *zDefault){
1403 char *z = 0;
 
 
 
 
 
 
 
 
 
1404 if( g.repositoryOpen ){
1405 z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
1406 }
1407 if( z==0 && g.configOpen ){
1408 db_swap_connections();
1409 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1410 db_swap_connections();
 
 
 
 
1411 }
1412 if( z==0 ){
1413 z = zDefault;
1414 }
1415 return z;
@@ -1596,30 +1672,39 @@
1596 }
1597
1598 /*
1599 ** Print the value of a setting named zName
1600 */
1601 static void print_setting(const char *zName){
1602 Stmt q;
1603 if( g.repositoryOpen ){
1604 db_prepare(&q,
1605 "SELECT '(local)', value FROM config WHERE name=%Q"
1606 " UNION ALL "
1607 "SELECT '(global)', value FROM global_config WHERE name=%Q",
1608 zName, zName
1609 );
1610 }else{
1611 db_prepare(&q,
1612 "SELECT '(global)', value FROM global_config WHERE name=%Q",
1613 zName
1614 );
1615 }
1616 if( db_step(&q)==SQLITE_ROW ){
1617 fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
1618 db_column_text(&q, 1));
1619 }else{
1620 fossil_print("%-20s\n", zName);
 
 
 
 
 
 
 
 
 
1621 }
1622 db_finalize(&q);
1623 }
1624
1625
@@ -1635,42 +1720,49 @@
1635 #if INTERFACE
1636 struct stControlSettings {
1637 char const *name; /* Name of the setting */
1638 char const *var; /* Internal variable name used by db_set() */
1639 int width; /* Width of display. 0 for boolean values */
 
1640 char const *def; /* Default value */
1641 };
1642 #endif /* INTERFACE */
1643 struct stControlSettings const ctrlSettings[] = {
1644 { "access-log", 0, 0, "off" },
1645 { "auto-captcha", "autocaptcha", 0, "on" },
1646 { "auto-shun", 0, 0, "on" },
1647 { "autosync", 0, 0, "on" },
1648 { "binary-glob", 0, 32, "" },
1649 { "clearsign", 0, 0, "off" },
1650 { "crnl-glob", 0, 16, "" },
1651 { "default-perms", 0, 16, "u" },
1652 { "diff-command", 0, 16, "" },
1653 { "dont-push", 0, 0, "off" },
1654 { "editor", 0, 16, "" },
1655 { "gdiff-command", 0, 16, "gdiff" },
1656 { "gmerge-command",0, 40, "" },
1657 { "https-login", 0, 0, "off" },
1658 { "ignore-glob", 0, 40, "" },
1659 { "http-port", 0, 16, "8080" },
1660 { "localauth", 0, 0, "off" },
1661 { "main-branch", 0, 40, "trunk" },
1662 { "manifest", 0, 0, "off" },
1663 { "max-upload", 0, 25, "250000" },
1664 { "mtime-changes", 0, 0, "on" },
1665 { "pgp-command", 0, 32, "gpg --clearsign -o " },
1666 { "proxy", 0, 32, "off" },
1667 { "repo-cksum", 0, 0, "on" },
1668 { "self-register", 0, 0, "off" },
1669 { "ssh-command", 0, 32, "" },
1670 { "web-browser", 0, 32, "" },
1671 { 0,0,0,0 }
 
 
 
 
 
 
1672 };
1673
1674 /*
1675 ** COMMAND: settings
1676 ** COMMAND: unset
@@ -1679,10 +1771,14 @@
1679 ** %fossil unset PROPERTY ?-global?
1680 **
1681 ** The "settings" command with no arguments lists all properties and their
1682 ** values. With just a property name it shows the value of that property.
1683 ** With a value argument it changes the property for the current repository.
 
 
 
 
1684 **
1685 ** The "unset" command clears a property setting.
1686 **
1687 **
1688 ** auto-captcha If enabled, the Login page provides a button to
@@ -1696,20 +1792,25 @@
1696 ** or update and automatically push after commit or
1697 ** tag or branch creation. If the value is "pullonly"
1698 ** then only pull operations occur automatically.
1699 ** Default: on
1700 **
1701 ** binary-glob The VALUE is a comma-separated list of GLOB patterns
1702 ** that should be treated as binary files for merging
1703 ** purposes. Example: *.xml
 
 
 
 
 
1704 **
1705 ** clearsign When enabled, fossil will attempt to sign all commits
1706 ** with gpg. When disabled (the default), commits will
1707 ** be unsigned. Default: off
1708 **
1709 ** crnl-glob A comma-separated list of GLOB patterns for text files
1710 ** in which it is ok to have CR+NL line endings.
1711 ** Set to "*" to disable CR+NL checking.
1712 **
1713 ** default-perms Permissions given automatically to new users. For more
1714 ** information on permissions see Users page in Server
1715 ** Administration of the HTTP UI. Default: u.
@@ -1717,10 +1818,15 @@
1717 ** diff-command External command to run when performing a diff.
1718 ** If undefined, the internal text diff will be used.
1719 **
1720 ** dont-push Prevent this repository from pushing from client to
1721 ** server. Useful when setting up a private branch.
 
 
 
 
 
1722 **
1723 ** editor Text editor command used for check-in comments.
1724 **
1725 ** gdiff-command External command to run when performing a graphical
1726 ** diff. If undefined, text diff will be used.
@@ -1735,23 +1841,23 @@
1735 ** and "ui" commands. Default: 8080
1736 **
1737 ** https-login Send login creditials using HTTPS instead of HTTP
1738 ** even if the login page request came via HTTP.
1739 **
1740 ** ignore-glob The VALUE is a comma-separated list of GLOB patterns
1741 ** specifying files that the "extra" command will ignore.
1742 ** Example: *.o,*.obj,*.exe
1743 **
1744 ** localauth If enabled, require that HTTP connections from
1745 ** 127.0.0.1 be authenticated by password. If
1746 ** false, all HTTP requests from localhost have
1747 ** unrestricted access to the repository.
1748 **
1749 ** main-branch The primary branch for the project. Default: trunk
1750 **
1751 ** manifest If enabled, automatically create files "manifest" and
1752 ** "manifest.uuid" in every checkout. The SQLite and
1753 ** Fossil repositories both require this. Default: off.
1754 **
1755 ** max-upload A limit on the size of uplink HTTP requests. The
1756 ** default is 250000 bytes.
1757 **
@@ -1763,10 +1869,13 @@
1763 **
1764 ** proxy URL of the HTTP proxy. If undefined or "off" then
1765 ** the "http_proxy" environment variable is consulted.
1766 ** If the http_proxy environment variable is undefined
1767 ** then a direct HTTP connection is used.
 
 
 
1768 **
1769 ** repo-cksum Compute checksums over all files in each checkout
1770 ** as a double-check of correctness. Defaults to "on".
1771 ** Disable on large repositories for a performance
1772 ** improvement.
@@ -1773,10 +1882,28 @@
1773 **
1774 ** self-register Allow users to register themselves through the HTTP UI.
1775 ** This is useful if you want to see other names than
1776 ** "Anonymous" in e.g. ticketing system. On the other hand
1777 ** users can not be deleted. Default: off.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1778 **
1779 ** ssh-command Command used to talk to a remote machine with
1780 ** the "ssh://" protocol.
1781 **
1782 ** web-browser A shell command used to launch your preferred
@@ -1797,12 +1924,13 @@
1797 }
1798 if( unsetFlag && g.argc!=3 ){
1799 usage("PROPERTY ?-global?");
1800 }
1801 if( g.argc==2 ){
 
1802 for(i=0; ctrlSettings[i].name; i++){
1803 print_setting(ctrlSettings[i].name);
1804 }
1805 }else if( g.argc==3 || g.argc==4 ){
1806 const char *zName = g.argv[2];
1807 int isManifest;
1808 int n = strlen(zName);
@@ -1820,13 +1948,13 @@
1820 db_unset(ctrlSettings[i].name, globalFlag);
1821 }else if( g.argc==4 ){
1822 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
1823 }else{
1824 isManifest = 0;
1825 print_setting(ctrlSettings[i].name);
1826 }
1827 if( isManifest ){
1828 manifest_to_disk(db_lget_int("checkout", 0));
1829 }
1830 }else{
1831 usage("?PROPERTY? ?VALUE?");
1832 }
1833
--- src/db.c
+++ src/db.c
@@ -153,13 +153,17 @@
153 ** Force a rollback and shutdown the database
154 */
155 void db_force_rollback(void){
156 int i;
157 static int busy = 0;
158 sqlite3_stmt *pStmt = 0;
159 if( busy || g.db==0 ) return;
160 busy = 1;
161 undo_rollback();
162 while( (pStmt = sqlite3_next_stmt(g.db,pStmt))!=0 ){
163 sqlite3_reset(pStmt);
164 }
165 while( pAllStmt ){
166 db_finalize(pAllStmt);
167 }
168 if( nBegin ){
169 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
@@ -809,10 +813,11 @@
813 static const char *aDbName[] = { "/_FOSSIL_", "/.fos" };
814
815 if( g.localOpen) return 1;
816 file_getcwd(zPwd, sizeof(zPwd)-20);
817 n = strlen(zPwd);
818 if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.';
819 while( n>0 ){
820 if( file_access(zPwd, W_OK) ) break;
821 for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){
822 sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]);
823 if( isValidLocalDb(zPwd) ){
@@ -1058,14 +1063,13 @@
1063
1064 /*
1065 ** Create the default user accounts in the USER table.
1066 */
1067 void db_create_default_users(int setupUserOnly, const char *zDefaultUser){
1068 const char *zUser = zDefaultUser;
 
1069 if( zUser==0 ){
1070 zUser = db_get("default-user", 0);
1071 }
1072 if( zUser==0 ){
1073 #if defined(_WIN32)
1074 zUser = getenv("USERNAME");
1075 #else
@@ -1074,12 +1078,15 @@
1078 }
1079 if( zUser==0 ){
1080 zUser = "root";
1081 }
1082 db_multi_exec(
1083 "INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser
1084 );
1085 db_multi_exec(
1086 "UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))"
1087 " WHERE login=%Q", zUser
1088 );
1089 if( !setupUserOnly ){
1090 db_multi_exec(
1091 "INSERT INTO user(login,pw,cap,info)"
1092 " VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');"
@@ -1363,19 +1370,19 @@
1370 */
1371 int is_truth(const char *zVal){
1372 static const char *azOn[] = { "on", "yes", "true", "1" };
1373 int i;
1374 for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1375 if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
1376 }
1377 return 0;
1378 }
1379 int is_false(const char *zVal){
1380 static const char *azOff[] = { "off", "no", "false", "0" };
1381 int i;
1382 for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1383 if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
1384 }
1385 return 0;
1386 }
1387
1388 /*
@@ -1392,24 +1399,93 @@
1399 sqlite3 *dbTemp = g.db;
1400 g.db = g.dbConfig;
1401 g.dbConfig = dbTemp;
1402 }
1403 }
1404
1405 /*
1406 ** Logic for reading potentially versioned settings from
1407 ** .fossil-settings/<name> , and emits warnings if necessary.
1408 ** Returns the non-versioned value without modification if there is no
1409 ** versioned value.
1410 */
1411 static char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){
1412 /* Attempt to load the versioned setting from a checked out file */
1413 char *zVersionedSetting = 0;
1414 int noWarn = 0;
1415
1416 if( db_open_local() ){
1417 Blob versionedPathname;
1418 char *zVersionedPathname;
1419 blob_zero(&versionedPathname);
1420 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1421 g.zLocalRoot, zName);
1422 zVersionedPathname = blob_str(&versionedPathname);
1423 if( file_size(zVersionedPathname)>=0 ){
1424 /* File exists, and contains the value for this setting. Load from
1425 ** the file. */
1426 Blob setting;
1427 blob_zero(&setting);
1428 if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1429 blob_trim(&setting); /* Avoid non-obvious problems with line endings
1430 ** on boolean properties */
1431 zVersionedSetting = strdup(blob_str(&setting));
1432 }
1433 blob_reset(&setting);
1434 /* See if there's a no-warn flag */
1435 blob_append(&versionedPathname, ".no-warn", -1);
1436 if( file_size(blob_str(&versionedPathname))>=0 ){
1437 noWarn = 1;
1438 }
1439 }
1440 blob_reset(&versionedPathname);
1441 }
1442 /* Display a warning? */
1443 if( zVersionedSetting!=0 && zNonVersionedSetting!=0
1444 && zNonVersionedSetting[0]!='\0' && !noWarn
1445 ){
1446 /* There's a versioned setting, and a non-versioned setting. Tell
1447 ** the user about the conflict */
1448 fossil_warning(
1449 "setting %s has both versioned and non-versioned values: using "
1450 "versioned value from file .fossil-settings/%s (to silence this "
1451 "warning, either create an empty file named "
1452 ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1453 " with \"fossil unset %s\")", zName, zName, zName, zName
1454 );
1455 }
1456 /* Prefer the versioned setting */
1457 return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting;
1458 }
1459
1460
1461 /*
1462 ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
1463 ** repository and local databases.
1464 */
1465 char *db_get(const char *zName, char *zDefault){
1466 char *z = 0;
1467 int i;
1468 const struct stControlSettings *ctrlSetting = 0;
1469 /* Is this a setting? */
1470 for(i=0; ctrlSettings[i].name; i++){
1471 if( strcmp(ctrlSettings[i].name, zName)==0 ){
1472 ctrlSetting = &(ctrlSettings[i]);
1473 break;
1474 }
1475 }
1476 if( g.repositoryOpen ){
1477 z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
1478 }
1479 if( z==0 && g.configOpen ){
1480 db_swap_connections();
1481 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1482 db_swap_connections();
1483 }
1484 if( ctrlSetting!=0 && ctrlSetting->versionable ){
1485 /* This is a versionable setting, try and get the info from a checked out file */
1486 z = db_get_do_versionable(zName, z);
1487 }
1488 if( z==0 ){
1489 z = zDefault;
1490 }
1491 return z;
@@ -1596,30 +1672,39 @@
1672 }
1673
1674 /*
1675 ** Print the value of a setting named zName
1676 */
1677 static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
1678 Stmt q;
1679 if( g.repositoryOpen ){
1680 db_prepare(&q,
1681 "SELECT '(local)', value FROM config WHERE name=%Q"
1682 " UNION ALL "
1683 "SELECT '(global)', value FROM global_config WHERE name=%Q",
1684 ctrlSetting->name, ctrlSetting->name
1685 );
1686 }else{
1687 db_prepare(&q,
1688 "SELECT '(global)', value FROM global_config WHERE name=%Q",
1689 ctrlSetting->name
1690 );
1691 }
1692 if( db_step(&q)==SQLITE_ROW ){
1693 fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0),
1694 db_column_text(&q, 1));
1695 }else{
1696 fossil_print("%-20s\n", ctrlSetting->name);
1697 }
1698 if( ctrlSetting->versionable && localOpen ){
1699 /* Check to see if this is overridden by a versionable settings file */
1700 Blob versionedPathname;
1701 blob_zero(&versionedPathname);
1702 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
1703 if( file_size(blob_str(&versionedPathname))>=0 ){
1704 fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
1705 }
1706 }
1707 db_finalize(&q);
1708 }
1709
1710
@@ -1635,42 +1720,49 @@
1720 #if INTERFACE
1721 struct stControlSettings {
1722 char const *name; /* Name of the setting */
1723 char const *var; /* Internal variable name used by db_set() */
1724 int width; /* Width of display. 0 for boolean values */
1725 int versionable; /* Is this setting versionable? */
1726 char const *def; /* Default value */
1727 };
1728 #endif /* INTERFACE */
1729 struct stControlSettings const ctrlSettings[] = {
1730 { "access-log", 0, 0, 0, "off" },
1731 { "auto-captcha", "autocaptcha", 0, 0, "on" },
1732 { "auto-shun", 0, 0, 0, "on" },
1733 { "autosync", 0, 0, 0, "on" },
1734 { "binary-glob", 0, 32, 1, "" },
1735 { "clearsign", 0, 0, 0, "off" },
1736 { "case-sensitive",0, 0, 0, "on" },
1737 { "crnl-glob", 0, 16, 1, "" },
1738 { "default-perms", 0, 16, 0, "u" },
1739 { "diff-command", 0, 16, 0, "" },
1740 { "dont-push", 0, 0, 0, "off" },
1741 { "editor", 0, 16, 0, "" },
1742 { "gdiff-command", 0, 16, 0, "gdiff" },
1743 { "gmerge-command",0, 40, 0, "" },
1744 { "https-login", 0, 0, 0, "off" },
1745 { "ignore-glob", 0, 40, 1, "" },
1746 { "empty-dirs", 0, 40, 1, "" },
1747 { "http-port", 0, 16, 0, "8080" },
1748 { "localauth", 0, 0, 0, "off" },
1749 { "main-branch", 0, 40, 0, "trunk" },
1750 { "manifest", 0, 0, 1, "off" },
1751 { "max-upload", 0, 25, 0, "250000" },
1752 { "mtime-changes", 0, 0, 0, "on" },
1753 { "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
1754 { "proxy", 0, 32, 0, "off" },
1755 { "relative-paths",0, 0, 0, "on" },
1756 { "repo-cksum", 0, 0, 0, "on" },
1757 { "self-register", 0, 0, 0, "off" },
1758 { "ssl-ca-location",0, 40, 0, "" },
1759 { "ssl-identity", 0, 40, 0, "" },
1760 { "ssh-command", 0, 32, 0, "" },
1761 { "web-browser", 0, 32, 0, "" },
1762 { "white-foreground", 0, 0, 0, "off" },
1763 { 0,0,0,0,0 }
1764 };
1765
1766 /*
1767 ** COMMAND: settings
1768 ** COMMAND: unset
@@ -1679,10 +1771,14 @@
1771 ** %fossil unset PROPERTY ?-global?
1772 **
1773 ** The "settings" command with no arguments lists all properties and their
1774 ** values. With just a property name it shows the value of that property.
1775 ** With a value argument it changes the property for the current repository.
1776 **
1777 ** Settings marked as versionable are overridden by the contents of the
1778 ** file named .fossil-settings/PROPERTY in the checked out files, if that
1779 ** file exists.
1780 **
1781 ** The "unset" command clears a property setting.
1782 **
1783 **
1784 ** auto-captcha If enabled, the Login page provides a button to
@@ -1696,20 +1792,25 @@
1792 ** or update and automatically push after commit or
1793 ** tag or branch creation. If the value is "pullonly"
1794 ** then only pull operations occur automatically.
1795 ** Default: on
1796 **
1797 ** binary-glob The VALUE is a comma or newline-separated list of
1798 ** (versionable) GLOB patterns that should be treated as binary files
1799 ** for merging purposes. Example: *.xml
1800 **
1801 ** case-sensitive If TRUE, the files whose names differ only in case
1802 ** care considered distinct. If FALSE files whose names
1803 ** differ only in case are the same file. Defaults to
1804 ** TRUE for unix and FALSE for windows and mac.
1805 **
1806 ** clearsign When enabled, fossil will attempt to sign all commits
1807 ** with gpg. When disabled (the default), commits will
1808 ** be unsigned. Default: off
1809 **
1810 ** crnl-glob A comma or newline-separated list of GLOB patterns for
1811 ** (versionable) text files in which it is ok to have CR+NL line endings.
1812 ** Set to "*" to disable CR+NL checking.
1813 **
1814 ** default-perms Permissions given automatically to new users. For more
1815 ** information on permissions see Users page in Server
1816 ** Administration of the HTTP UI. Default: u.
@@ -1717,10 +1818,15 @@
1818 ** diff-command External command to run when performing a diff.
1819 ** If undefined, the internal text diff will be used.
1820 **
1821 ** dont-push Prevent this repository from pushing from client to
1822 ** server. Useful when setting up a private branch.
1823 **
1824 ** empty-dirs A comma or newline-separated list of pathnames. On
1825 ** (versionable) update and checkout commands, if no file or directory
1826 ** exists with that name, an empty directory will be
1827 ** created.
1828 **
1829 ** editor Text editor command used for check-in comments.
1830 **
1831 ** gdiff-command External command to run when performing a graphical
1832 ** diff. If undefined, text diff will be used.
@@ -1735,23 +1841,23 @@
1841 ** and "ui" commands. Default: 8080
1842 **
1843 ** https-login Send login creditials using HTTPS instead of HTTP
1844 ** even if the login page request came via HTTP.
1845 **
1846 ** ignore-glob The VALUE is a comma or newline-separated list of GLOB
1847 ** (versionable) patterns specifying files that the "extra" command will
1848 ** ignore. Example: *.o,*.obj,*.exe
1849 **
1850 ** localauth If enabled, require that HTTP connections from
1851 ** 127.0.0.1 be authenticated by password. If
1852 ** false, all HTTP requests from localhost have
1853 ** unrestricted access to the repository.
1854 **
1855 ** main-branch The primary branch for the project. Default: trunk
1856 **
1857 ** manifest If enabled, automatically create files "manifest" and
1858 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
1859 ** Fossil repositories both require this. Default: off.
1860 **
1861 ** max-upload A limit on the size of uplink HTTP requests. The
1862 ** default is 250000 bytes.
1863 **
@@ -1763,10 +1869,13 @@
1869 **
1870 ** proxy URL of the HTTP proxy. If undefined or "off" then
1871 ** the "http_proxy" environment variable is consulted.
1872 ** If the http_proxy environment variable is undefined
1873 ** then a direct HTTP connection is used.
1874 **
1875 ** relative-paths When showing changes and extras, report paths relative
1876 ** to the current working directory. Default: "on"
1877 **
1878 ** repo-cksum Compute checksums over all files in each checkout
1879 ** as a double-check of correctness. Defaults to "on".
1880 ** Disable on large repositories for a performance
1881 ** improvement.
@@ -1773,10 +1882,28 @@
1882 **
1883 ** self-register Allow users to register themselves through the HTTP UI.
1884 ** This is useful if you want to see other names than
1885 ** "Anonymous" in e.g. ticketing system. On the other hand
1886 ** users can not be deleted. Default: off.
1887 **
1888 ** ssl-ca-location The full pathname to a file containing PEM encoded
1889 ** CA root certificates, or a directory of certificates
1890 ** with filenames formed from the certificate hashes as
1891 ** required by OpenSSL.
1892 ** If set, this will override the OS default list of
1893 ** OpenSSL CAs. If unset, the default list will be used.
1894 ** Some platforms may add additional certificates.
1895 ** Check your platform behaviour is as required if the
1896 ** exact contents of the CA root is critical for your
1897 ** application.
1898 **
1899 ** ssl-identity The full pathname to a file containing a certificate
1900 ** and private key in PEM format. Create by concatenating
1901 ** the certificate and private key files.
1902 ** This identity will be presented to SSL servers to
1903 ** authenticate this client, in addition to the normal
1904 ** password authentication.
1905 **
1906 ** ssh-command Command used to talk to a remote machine with
1907 ** the "ssh://" protocol.
1908 **
1909 ** web-browser A shell command used to launch your preferred
@@ -1797,12 +1924,13 @@
1924 }
1925 if( unsetFlag && g.argc!=3 ){
1926 usage("PROPERTY ?-global?");
1927 }
1928 if( g.argc==2 ){
1929 int openLocal = db_open_local();
1930 for(i=0; ctrlSettings[i].name; i++){
1931 print_setting(&ctrlSettings[i], openLocal);
1932 }
1933 }else if( g.argc==3 || g.argc==4 ){
1934 const char *zName = g.argv[2];
1935 int isManifest;
1936 int n = strlen(zName);
@@ -1820,13 +1948,13 @@
1948 db_unset(ctrlSettings[i].name, globalFlag);
1949 }else if( g.argc==4 ){
1950 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
1951 }else{
1952 isManifest = 0;
1953 print_setting(&ctrlSettings[i], db_open_local());
1954 }
1955 if( isManifest && g.localOpen ){
1956 manifest_to_disk(db_lget_int("checkout", 0));
1957 }
1958 }else{
1959 usage("?PROPERTY? ?VALUE?");
1960 }
1961
--- src/descendants.c
+++ src/descendants.c
@@ -186,10 +186,45 @@
186186
}
187187
db_reset(&q);
188188
}
189189
bag_clear(&seen);
190190
pqueue_clear(&queue);
191
+ db_finalize(&ins);
192
+ db_finalize(&q);
193
+}
194
+
195
+/*
196
+** Compute up to N direct ancestors (merge ancestors do not count)
197
+** for the check-in rid and put them in a table named "ancestor".
198
+** Label each generation with consecutive integers going backwards
199
+** in time such that rid has the smallest generation number and the oldest
200
+** direct ancestor as the largest generation number.
201
+*/
202
+void compute_direct_ancestors(int rid, int N){
203
+ Stmt ins;
204
+ Stmt q;
205
+ int gen = 0;
206
+ db_multi_exec(
207
+ "CREATE TEMP TABLE ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
208
+ "INSERT INTO ancestor VALUES(%d, 0);", rid
209
+ );
210
+ db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
211
+ db_prepare(&q,
212
+ "SELECT pid FROM plink"
213
+ " WHERE cid=:rid AND isprim"
214
+ );
215
+ while( (N--)>0 ){
216
+ db_bind_int(&q, ":rid", rid);
217
+ if( db_step(&q)!=SQLITE_ROW ) break;
218
+ rid = db_column_int(&q, 0);
219
+ db_reset(&q);
220
+ gen++;
221
+ db_bind_int(&ins, ":rid", rid);
222
+ db_bind_int(&ins, ":gen", gen);
223
+ db_step(&ins);
224
+ db_reset(&ins);
225
+ }
191226
db_finalize(&ins);
192227
db_finalize(&q);
193228
}
194229
195230
/*
196231
--- src/descendants.c
+++ src/descendants.c
@@ -186,10 +186,45 @@
186 }
187 db_reset(&q);
188 }
189 bag_clear(&seen);
190 pqueue_clear(&queue);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191 db_finalize(&ins);
192 db_finalize(&q);
193 }
194
195 /*
196
--- src/descendants.c
+++ src/descendants.c
@@ -186,10 +186,45 @@
186 }
187 db_reset(&q);
188 }
189 bag_clear(&seen);
190 pqueue_clear(&queue);
191 db_finalize(&ins);
192 db_finalize(&q);
193 }
194
195 /*
196 ** Compute up to N direct ancestors (merge ancestors do not count)
197 ** for the check-in rid and put them in a table named "ancestor".
198 ** Label each generation with consecutive integers going backwards
199 ** in time such that rid has the smallest generation number and the oldest
200 ** direct ancestor as the largest generation number.
201 */
202 void compute_direct_ancestors(int rid, int N){
203 Stmt ins;
204 Stmt q;
205 int gen = 0;
206 db_multi_exec(
207 "CREATE TEMP TABLE ancestor(rid INTEGER, generation INTEGER PRIMARY KEY);"
208 "INSERT INTO ancestor VALUES(%d, 0);", rid
209 );
210 db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)");
211 db_prepare(&q,
212 "SELECT pid FROM plink"
213 " WHERE cid=:rid AND isprim"
214 );
215 while( (N--)>0 ){
216 db_bind_int(&q, ":rid", rid);
217 if( db_step(&q)!=SQLITE_ROW ) break;
218 rid = db_column_int(&q, 0);
219 db_reset(&q);
220 gen++;
221 db_bind_int(&ins, ":rid", rid);
222 db_bind_int(&ins, ":gen", gen);
223 db_step(&ins);
224 db_reset(&ins);
225 }
226 db_finalize(&ins);
227 db_finalize(&q);
228 }
229
230 /*
231
+8 -7
--- src/diff.c
+++ src/diff.c
@@ -758,16 +758,16 @@
758758
** it was checked in (mlink.mid).
759759
*/
760760
static void annotate_file(
761761
Annotator *p, /* The annotator */
762762
int fnid, /* The name of the file to be annotated */
763
- int mid, /* The specific version of the file for this step */
763
+ int mid, /* Use the version of the file in this check-in */
764764
int webLabel, /* Use web-style annotations if true */
765765
int iLimit, /* Limit the number of levels if greater than zero */
766766
int annFlags /* Flags to alter the annotation */
767767
){
768
- Blob toAnnotate; /* Text of the final version of the file */
768
+ Blob toAnnotate; /* Text of the final (mid) version of the file */
769769
Blob step; /* Text of previous revision */
770770
int rid; /* Artifact ID of the file being annotated */
771771
char *zLabel; /* Label to apply to a line */
772772
Stmt q; /* Query returning all ancestor versions */
773773
@@ -778,23 +778,24 @@
778778
}
779779
if( !content_get(rid, &toAnnotate) ){
780780
fossil_panic("unable to retrieve content of artifact #%d", rid);
781781
}
782782
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
783
- compute_ancestors(mid, 1000000000);
783
+ if( iLimit<=0 ) iLimit = 1000000000;
784
+ compute_direct_ancestors(mid, iLimit);
784785
annotation_start(p, &toAnnotate);
785786
786787
db_prepare(&q,
787788
"SELECT mlink.fid,"
788789
" (SELECT uuid FROM blob WHERE rid=mlink.%s),"
789790
" date(event.mtime), "
790791
" coalesce(event.euser,event.user) "
791
- " FROM mlink, event"
792
+ " FROM ancestor, mlink, event"
792793
" WHERE mlink.fnid=%d"
793
- " AND mlink.mid IN ok"
794
- " AND event.objid=mlink.mid"
795
- " ORDER BY event.mtime DESC"
794
+ " AND mlink.mid=ancestor.rid"
795
+ " AND event.objid=ancestor.rid"
796
+ " ORDER BY ancestor.generation ASC"
796797
" LIMIT %d",
797798
(annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid",
798799
fnid,
799800
iLimit>0 ? iLimit : 10000000
800801
);
801802
--- src/diff.c
+++ src/diff.c
@@ -758,16 +758,16 @@
758 ** it was checked in (mlink.mid).
759 */
760 static void annotate_file(
761 Annotator *p, /* The annotator */
762 int fnid, /* The name of the file to be annotated */
763 int mid, /* The specific version of the file for this step */
764 int webLabel, /* Use web-style annotations if true */
765 int iLimit, /* Limit the number of levels if greater than zero */
766 int annFlags /* Flags to alter the annotation */
767 ){
768 Blob toAnnotate; /* Text of the final version of the file */
769 Blob step; /* Text of previous revision */
770 int rid; /* Artifact ID of the file being annotated */
771 char *zLabel; /* Label to apply to a line */
772 Stmt q; /* Query returning all ancestor versions */
773
@@ -778,23 +778,24 @@
778 }
779 if( !content_get(rid, &toAnnotate) ){
780 fossil_panic("unable to retrieve content of artifact #%d", rid);
781 }
782 db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
783 compute_ancestors(mid, 1000000000);
 
784 annotation_start(p, &toAnnotate);
785
786 db_prepare(&q,
787 "SELECT mlink.fid,"
788 " (SELECT uuid FROM blob WHERE rid=mlink.%s),"
789 " date(event.mtime), "
790 " coalesce(event.euser,event.user) "
791 " FROM mlink, event"
792 " WHERE mlink.fnid=%d"
793 " AND mlink.mid IN ok"
794 " AND event.objid=mlink.mid"
795 " ORDER BY event.mtime DESC"
796 " LIMIT %d",
797 (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid",
798 fnid,
799 iLimit>0 ? iLimit : 10000000
800 );
801
--- src/diff.c
+++ src/diff.c
@@ -758,16 +758,16 @@
758 ** it was checked in (mlink.mid).
759 */
760 static void annotate_file(
761 Annotator *p, /* The annotator */
762 int fnid, /* The name of the file to be annotated */
763 int mid, /* Use the version of the file in this check-in */
764 int webLabel, /* Use web-style annotations if true */
765 int iLimit, /* Limit the number of levels if greater than zero */
766 int annFlags /* Flags to alter the annotation */
767 ){
768 Blob toAnnotate; /* Text of the final (mid) version of the file */
769 Blob step; /* Text of previous revision */
770 int rid; /* Artifact ID of the file being annotated */
771 char *zLabel; /* Label to apply to a line */
772 Stmt q; /* Query returning all ancestor versions */
773
@@ -778,23 +778,24 @@
778 }
779 if( !content_get(rid, &toAnnotate) ){
780 fossil_panic("unable to retrieve content of artifact #%d", rid);
781 }
782 db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
783 if( iLimit<=0 ) iLimit = 1000000000;
784 compute_direct_ancestors(mid, iLimit);
785 annotation_start(p, &toAnnotate);
786
787 db_prepare(&q,
788 "SELECT mlink.fid,"
789 " (SELECT uuid FROM blob WHERE rid=mlink.%s),"
790 " date(event.mtime), "
791 " coalesce(event.euser,event.user) "
792 " FROM ancestor, mlink, event"
793 " WHERE mlink.fnid=%d"
794 " AND mlink.mid=ancestor.rid"
795 " AND event.objid=ancestor.rid"
796 " ORDER BY ancestor.generation ASC"
797 " LIMIT %d",
798 (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid",
799 fnid,
800 iLimit>0 ? iLimit : 10000000
801 );
802
+22 -16
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -175,23 +175,24 @@
175175
blob_reset(&cmd);
176176
}
177177
}
178178
179179
/*
180
-** Do a diff against a single file named in g.argv[2] from version zFrom
180
+** Do a diff against a single file named in zFileTreeName from version zFrom
181181
** against the same file on disk.
182182
*/
183183
static void diff_one_against_disk(
184184
const char *zFrom, /* Name of file */
185185
const char *zDiffCmd, /* Use this "diff" command */
186
- int ignoreEolWs /* Ignore whitespace changes at end of lines */
186
+ int ignoreEolWs, /* Ignore whitespace changes at end of lines */
187
+ const char *zFileTreeName
187188
){
188189
Blob fname;
189190
Blob content;
190
- file_tree_name(g.argv[2], &fname, 1);
191
+ file_tree_name(zFileTreeName, &fname, 1);
191192
historical_version_of_file(zFrom, blob_str(&fname), &content, 0, 0);
192
- diff_file(&content, g.argv[2], g.argv[2], zDiffCmd, ignoreEolWs);
193
+ diff_file(&content, zFileTreeName, zFileTreeName, zDiffCmd, ignoreEolWs);
193194
blob_reset(&content);
194195
blob_reset(&fname);
195196
}
196197
197198
/*
@@ -295,22 +296,22 @@
295296
}
296297
297298
/*
298299
** Output the differences between two versions of a single file.
299300
** zFrom and zTo are the check-ins containing the two file versions.
300
-** The filename is contained in g.argv[2].
301301
*/
302302
static void diff_one_two_versions(
303303
const char *zFrom,
304304
const char *zTo,
305305
const char *zDiffCmd,
306
- int ignoreEolWs
306
+ int ignoreEolWs,
307
+ const char *zFileTreeName
307308
){
308309
char *zName;
309310
Blob fname;
310311
Blob v1, v2;
311
- file_tree_name(g.argv[2], &fname, 1);
312
+ file_tree_name(zFileTreeName, &fname, 1);
312313
zName = blob_str(&fname);
313314
historical_version_of_file(zFrom, zName, &v1, 0, 0);
314315
historical_version_of_file(zTo, zName, &v2, 0, 0);
315316
diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
316317
blob_reset(&v1);
@@ -408,16 +409,16 @@
408409
409410
/*
410411
** COMMAND: diff
411412
** COMMAND: gdiff
412413
**
413
-** Usage: %fossil diff|gdiff ?options? ?FILE?
414
+** Usage: %fossil diff|gdiff ?options? ?FILE1? ?FILE2 ...?
414415
**
415
-** Show the difference between the current version of FILE (as it
416
-** exists on disk) and that same file as it was checked out. Or
417
-** if the FILE argument is omitted, show the unsaved changed currently
418
-** in the working check-out.
416
+** Show the difference between the current version of each of the FILEs
417
+** specified (as they exist on disk) and that same file as it was checked
418
+** out. Or if the FILE arguments are omitted, show the unsaved changed
419
+** currently in the working check-out.
419420
**
420421
** If the "--from VERSION" or "-r VERSION" option is used it specifies
421422
** the source check-in for the diff operation. If not specified, the
422423
** source check-in is the base check-in for the current check-out.
423424
**
@@ -440,10 +441,11 @@
440441
int hasNFlag; /* True if -N or --new-file flag is used */
441442
const char *zFrom; /* Source version number */
442443
const char *zTo; /* Target version number */
443444
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
444445
int diffFlags = 0; /* Flags to control the DIFF */
446
+ int f;
445447
446448
isGDiff = g.argv[1][0]=='g';
447449
isInternDiff = find_option("internal","i",0)!=0;
448450
zFrom = find_option("from", "r", 1);
449451
zTo = find_option("to", 0, 1);
@@ -455,12 +457,14 @@
455457
db_must_be_within_tree();
456458
verify_all_options();
457459
if( !isInternDiff ){
458460
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
459461
}
460
- if( g.argc==3 ){
461
- diff_one_against_disk(zFrom, zDiffCmd, 0);
462
+ if( g.argc>=3 ){
463
+ for(f=2; f<g.argc; ++f){
464
+ diff_one_against_disk(zFrom, zDiffCmd, 0, g.argv[f]);
465
+ }
462466
}else{
463467
diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
464468
}
465469
}else if( zFrom==0 ){
466470
fossil_fatal("must use --from if --to is present");
@@ -468,12 +472,14 @@
468472
db_find_and_open_repository(0, 0);
469473
verify_all_options();
470474
if( !isInternDiff ){
471475
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
472476
}
473
- if( g.argc==3 ){
474
- diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
477
+ if( g.argc>=3 ){
478
+ for(f=2; f<g.argc; ++f){
479
+ diff_one_two_versions(zFrom, zTo, zDiffCmd, 0, g.argv[f]);
480
+ }
475481
}else{
476482
diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
477483
}
478484
}
479485
}
480486
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -175,23 +175,24 @@
175 blob_reset(&cmd);
176 }
177 }
178
179 /*
180 ** Do a diff against a single file named in g.argv[2] from version zFrom
181 ** against the same file on disk.
182 */
183 static void diff_one_against_disk(
184 const char *zFrom, /* Name of file */
185 const char *zDiffCmd, /* Use this "diff" command */
186 int ignoreEolWs /* Ignore whitespace changes at end of lines */
 
187 ){
188 Blob fname;
189 Blob content;
190 file_tree_name(g.argv[2], &fname, 1);
191 historical_version_of_file(zFrom, blob_str(&fname), &content, 0, 0);
192 diff_file(&content, g.argv[2], g.argv[2], zDiffCmd, ignoreEolWs);
193 blob_reset(&content);
194 blob_reset(&fname);
195 }
196
197 /*
@@ -295,22 +296,22 @@
295 }
296
297 /*
298 ** Output the differences between two versions of a single file.
299 ** zFrom and zTo are the check-ins containing the two file versions.
300 ** The filename is contained in g.argv[2].
301 */
302 static void diff_one_two_versions(
303 const char *zFrom,
304 const char *zTo,
305 const char *zDiffCmd,
306 int ignoreEolWs
 
307 ){
308 char *zName;
309 Blob fname;
310 Blob v1, v2;
311 file_tree_name(g.argv[2], &fname, 1);
312 zName = blob_str(&fname);
313 historical_version_of_file(zFrom, zName, &v1, 0, 0);
314 historical_version_of_file(zTo, zName, &v2, 0, 0);
315 diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
316 blob_reset(&v1);
@@ -408,16 +409,16 @@
408
409 /*
410 ** COMMAND: diff
411 ** COMMAND: gdiff
412 **
413 ** Usage: %fossil diff|gdiff ?options? ?FILE?
414 **
415 ** Show the difference between the current version of FILE (as it
416 ** exists on disk) and that same file as it was checked out. Or
417 ** if the FILE argument is omitted, show the unsaved changed currently
418 ** in the working check-out.
419 **
420 ** If the "--from VERSION" or "-r VERSION" option is used it specifies
421 ** the source check-in for the diff operation. If not specified, the
422 ** source check-in is the base check-in for the current check-out.
423 **
@@ -440,10 +441,11 @@
440 int hasNFlag; /* True if -N or --new-file flag is used */
441 const char *zFrom; /* Source version number */
442 const char *zTo; /* Target version number */
443 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
444 int diffFlags = 0; /* Flags to control the DIFF */
 
445
446 isGDiff = g.argv[1][0]=='g';
447 isInternDiff = find_option("internal","i",0)!=0;
448 zFrom = find_option("from", "r", 1);
449 zTo = find_option("to", 0, 1);
@@ -455,12 +457,14 @@
455 db_must_be_within_tree();
456 verify_all_options();
457 if( !isInternDiff ){
458 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
459 }
460 if( g.argc==3 ){
461 diff_one_against_disk(zFrom, zDiffCmd, 0);
 
 
462 }else{
463 diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
464 }
465 }else if( zFrom==0 ){
466 fossil_fatal("must use --from if --to is present");
@@ -468,12 +472,14 @@
468 db_find_and_open_repository(0, 0);
469 verify_all_options();
470 if( !isInternDiff ){
471 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
472 }
473 if( g.argc==3 ){
474 diff_one_two_versions(zFrom, zTo, zDiffCmd, 0);
 
 
475 }else{
476 diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
477 }
478 }
479 }
480
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -175,23 +175,24 @@
175 blob_reset(&cmd);
176 }
177 }
178
179 /*
180 ** Do a diff against a single file named in zFileTreeName from version zFrom
181 ** against the same file on disk.
182 */
183 static void diff_one_against_disk(
184 const char *zFrom, /* Name of file */
185 const char *zDiffCmd, /* Use this "diff" command */
186 int ignoreEolWs, /* Ignore whitespace changes at end of lines */
187 const char *zFileTreeName
188 ){
189 Blob fname;
190 Blob content;
191 file_tree_name(zFileTreeName, &fname, 1);
192 historical_version_of_file(zFrom, blob_str(&fname), &content, 0, 0);
193 diff_file(&content, zFileTreeName, zFileTreeName, zDiffCmd, ignoreEolWs);
194 blob_reset(&content);
195 blob_reset(&fname);
196 }
197
198 /*
@@ -295,22 +296,22 @@
296 }
297
298 /*
299 ** Output the differences between two versions of a single file.
300 ** zFrom and zTo are the check-ins containing the two file versions.
 
301 */
302 static void diff_one_two_versions(
303 const char *zFrom,
304 const char *zTo,
305 const char *zDiffCmd,
306 int ignoreEolWs,
307 const char *zFileTreeName
308 ){
309 char *zName;
310 Blob fname;
311 Blob v1, v2;
312 file_tree_name(zFileTreeName, &fname, 1);
313 zName = blob_str(&fname);
314 historical_version_of_file(zFrom, zName, &v1, 0, 0);
315 historical_version_of_file(zTo, zName, &v2, 0, 0);
316 diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs);
317 blob_reset(&v1);
@@ -408,16 +409,16 @@
409
410 /*
411 ** COMMAND: diff
412 ** COMMAND: gdiff
413 **
414 ** Usage: %fossil diff|gdiff ?options? ?FILE1? ?FILE2 ...?
415 **
416 ** Show the difference between the current version of each of the FILEs
417 ** specified (as they exist on disk) and that same file as it was checked
418 ** out. Or if the FILE arguments are omitted, show the unsaved changed
419 ** currently in the working check-out.
420 **
421 ** If the "--from VERSION" or "-r VERSION" option is used it specifies
422 ** the source check-in for the diff operation. If not specified, the
423 ** source check-in is the base check-in for the current check-out.
424 **
@@ -440,10 +441,11 @@
441 int hasNFlag; /* True if -N or --new-file flag is used */
442 const char *zFrom; /* Source version number */
443 const char *zTo; /* Target version number */
444 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
445 int diffFlags = 0; /* Flags to control the DIFF */
446 int f;
447
448 isGDiff = g.argv[1][0]=='g';
449 isInternDiff = find_option("internal","i",0)!=0;
450 zFrom = find_option("from", "r", 1);
451 zTo = find_option("to", 0, 1);
@@ -455,12 +457,14 @@
457 db_must_be_within_tree();
458 verify_all_options();
459 if( !isInternDiff ){
460 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
461 }
462 if( g.argc>=3 ){
463 for(f=2; f<g.argc; ++f){
464 diff_one_against_disk(zFrom, zDiffCmd, 0, g.argv[f]);
465 }
466 }else{
467 diff_all_against_disk(zFrom, zDiffCmd, diffFlags);
468 }
469 }else if( zFrom==0 ){
470 fossil_fatal("must use --from if --to is present");
@@ -468,12 +472,14 @@
472 db_find_and_open_repository(0, 0);
473 verify_all_options();
474 if( !isInternDiff ){
475 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
476 }
477 if( g.argc>=3 ){
478 for(f=2; f<g.argc; ++f){
479 diff_one_two_versions(zFrom, zTo, zDiffCmd, 0, g.argv[f]);
480 }
481 }else{
482 diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags);
483 }
484 }
485 }
486
+161 -39
--- src/export.c
+++ src/export.c
@@ -39,11 +39,11 @@
3939
db_bind_text(&q, ":user", zUser);
4040
if( db_step(&q)!=SQLITE_ROW ){
4141
db_reset(&q);
4242
for(i=0; zUser[i] && zUser[i]!='>' && zUser[i]!='<'; i++){}
4343
if( zUser[i]==0 ){
44
- printf(" <%s>", zUser);
44
+ printf(" %s <%s>", zUser, zUser);
4545
return;
4646
}
4747
zName = mprintf("%s", zUser);
4848
for(i=j=0; zName[i]; i++){
4949
if( zName[i]!='<' && zName[i]!='>' ){
@@ -56,11 +56,11 @@
5656
return;
5757
}
5858
zContact = db_column_text(&q, 0);
5959
for(i=0; zContact[i] && zContact[i]!='>' && zContact[i]!='<'; i++){}
6060
if( zContact[i]==0 ){
61
- printf(" %s <%s>", zContact, zUser);
61
+ printf(" %s <%s>", zContact[0] ? zContact : zUser, zUser);
6262
db_reset(&q);
6363
return;
6464
}
6565
if( zContact[i]=='<' ){
6666
zEmail = mprintf("%s", &zContact[i]);
@@ -78,15 +78,17 @@
7878
free(zName);
7979
free(zEmail);
8080
db_reset(&q);
8181
}
8282
83
+#define BLOBMARK(rid) ((rid) * 2)
84
+#define COMMITMARK(rid) ((rid) * 2 + 1)
8385
8486
/*
8587
** COMMAND: export
8688
**
87
-** Usage: %fossil export --git ?REPOSITORY?
89
+** Usage: %fossil export --git ?options? ?REPOSITORY?
8890
**
8991
** Write an export of all check-ins to standard output. The export is
9092
** written in the git-fast-export file format assuming the --git option is
9193
** provided. The git-fast-export format is currently the only VCS
9294
** interchange format supported, though other formats may be added in
@@ -95,98 +97,190 @@
9597
** Run this command within a checkout. Or use the -R or --repository
9698
** option to specify a Fossil repository to be exported.
9799
**
98100
** Only check-ins are exported using --git. Git does not support tickets
99101
** or wiki or events or attachments, so none of those are exported.
102
+**
103
+** If the "--import-marks FILE" option is used, it contains a list of
104
+** rids to skip.
105
+**
106
+** If the "--export-marks FILE" option is used, the rid of all commits and
107
+** blobs written on exit for use with "--import-marks" on the next run.
100108
*/
101109
void export_cmd(void){
102
- Stmt q;
110
+ Stmt q, q2, q3;
103111
int i;
104
- int firstCkin; /* Integer offset to check-in marks */
105112
Bag blobs, vers;
113
+ const char *markfile_in;
114
+ const char *markfile_out;
115
+
106116
bag_init(&blobs);
107117
bag_init(&vers);
108118
109119
find_option("git", 0, 0); /* Ignore the --git option for now */
120
+ markfile_in = find_option("import-marks", 0, 1);
121
+ markfile_out = find_option("export-marks", 0, 1);
122
+
110123
db_find_and_open_repository(0, 2);
111124
verify_all_options();
112125
if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); }
126
+
127
+ db_multi_exec("CREATE TEMPORARY TABLE oldblob(rid INTEGER PRIMARY KEY)");
128
+ db_multi_exec("CREATE TEMPORARY TABLE oldcommit(rid INTEGER PRIMARY KEY)");
129
+ if( markfile_in!=0 ){
130
+ Stmt qb,qc;
131
+ char line[100];
132
+ FILE *f;
133
+
134
+ f = fopen(markfile_in, "r");
135
+ if( f==0 ){
136
+ fossil_panic("cannot open %s for reading", markfile_in);
137
+ }
138
+ db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)");
139
+ db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)");
140
+ while( fgets(line, sizeof(line), f)!=0 ){
141
+ if( *line == 'b' ){
142
+ db_bind_text(&qb, ":rid", line + 1);
143
+ db_step(&qb);
144
+ db_reset(&qb);
145
+ bag_insert(&blobs, atoi(line + 1));
146
+ }else if( *line == 'c' ){
147
+ db_bind_text(&qc, ":rid", line + 1);
148
+ db_step(&qc);
149
+ db_reset(&qc);
150
+ bag_insert(&vers, atoi(line + 1));
151
+ }else{
152
+ fossil_panic("bad input from %s: %s", markfile_in, line);
153
+ }
154
+ }
155
+ db_finalize(&qb);
156
+ db_finalize(&qc);
157
+ fclose(f);
158
+ }
113159
114160
/* Step 1: Generate "blob" records for every artifact that is part
115161
** of a check-in
116162
*/
117163
fossil_binary_mode(stdout);
118
- db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0");
164
+ db_multi_exec("CREATE TEMPORARY TABLE newblob(rid INTEGER KEY, srcid INTEGER)");
165
+ db_multi_exec("CREATE INDEX newblob_src ON newblob(srcid)");
166
+ db_multi_exec(
167
+ "INSERT INTO newblob"
168
+ " SELECT DISTINCT fid,"
169
+ " CASE WHEN EXISTS(SELECT 1 FROM delta WHERE rid=fid AND NOT EXISTS(SELECT 1 FROM oldblob WHERE srcid=fid))"
170
+ " THEN (SELECT srcid FROM delta WHERE rid=fid)"
171
+ " ELSE 0"
172
+ " END"
173
+ " FROM mlink"
174
+ " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)");
175
+ db_prepare(&q,
176
+ "SELECT DISTINCT fid FROM mlink"
177
+ " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)");
178
+ db_prepare(&q2, "INSERT INTO oldblob VALUES (:rid)");
179
+ db_prepare(&q3, "SELECT rid FROM newblob WHERE srcid= (:srcid)");
119180
while( db_step(&q)==SQLITE_ROW ){
120181
int rid = db_column_int(&q, 0);
121182
Blob content;
122
- content_get(rid, &content);
123
- printf("blob\nmark :%d\ndata %d\n", rid, blob_size(&content));
124
- bag_insert(&blobs, rid);
125
- fwrite(blob_buffer(&content), 1, blob_size(&content), stdout);
126
- printf("\n");
127
- blob_reset(&content);
183
+
184
+ while( !bag_find(&blobs, rid) ){
185
+ content_get(rid, &content);
186
+ db_bind_int(&q2, ":rid", rid);
187
+ db_step(&q2);
188
+ db_reset(&q2);
189
+ printf("blob\nmark :%d\ndata %d\n", BLOBMARK(rid), blob_size(&content));
190
+ bag_insert(&blobs, rid);
191
+ fwrite(blob_buffer(&content), 1, blob_size(&content), stdout);
192
+ printf("\n");
193
+ blob_reset(&content);
194
+
195
+ db_bind_int(&q3, ":srcid", rid);
196
+ if( db_step(&q3) != SQLITE_ROW ){
197
+ db_reset(&q3);
198
+ break;
199
+ }
200
+ rid = db_column_int(&q3, 0);
201
+ db_reset(&q3);
202
+ }
128203
}
129204
db_finalize(&q);
205
+ db_finalize(&q2);
206
+ db_finalize(&q3);
130207
131208
/* Output the commit records.
132209
*/
133
- firstCkin = db_int(0, "SELECT max(rid) FROM blob")+1;
134210
db_prepare(&q,
135211
"SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment),"
136212
" coalesce(user,euser),"
137213
" (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)"
138214
" FROM event"
139
- " WHERE type='ci'"
215
+ " WHERE type='ci' AND NOT EXISTS (SELECT 1 FROM oldcommit WHERE objid=rid)"
140216
" ORDER BY mtime ASC",
141217
TAG_BRANCH
142218
);
219
+ db_prepare(&q2, "INSERT INTO oldcommit VALUES (:rid)");
143220
while( db_step(&q)==SQLITE_ROW ){
221
+ Stmt q4;
144222
const char *zSecondsSince1970 = db_column_text(&q, 0);
145223
int ckinId = db_column_int(&q, 1);
146224
const char *zComment = db_column_text(&q, 2);
147225
const char *zUser = db_column_text(&q, 3);
148226
const char *zBranch = db_column_text(&q, 4);
149227
char *zBr;
150
- Manifest *p;
151
- ManifestFile *pFile;
152
- const char *zFromType;
153228
154229
bag_insert(&vers, ckinId);
230
+ db_bind_int(&q2, ":rid", ckinId);
231
+ db_step(&q2);
232
+ db_reset(&q2);
155233
if( zBranch==0 ) zBranch = "trunk";
156234
zBr = mprintf("%s", zBranch);
157235
for(i=0; zBr[i]; i++){
158236
if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_';
159237
}
160
- printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId+firstCkin);
238
+ printf("commit refs/heads/%s\nmark :%d\n", zBr, COMMITMARK(ckinId));
161239
free(zBr);
162240
printf("committer");
163241
print_person(zUser);
164242
printf(" %s +0000\n", zSecondsSince1970);
165243
if( zComment==0 ) zComment = "null comment";
166244
printf("data %d\n%s\n", (int)strlen(zComment), zComment);
167
- p = manifest_get(ckinId, CFTYPE_ANY);
168
- zFromType = "from";
169
- for(i=0; i<p->nParent; i++){
170
- int pid = fast_uuid_to_rid(p->azParent[i]);
171
- if( pid==0 || !bag_find(&vers, pid) ) continue;
172
- printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin);
173
- zFromType = "merge";
174
- }
175
- printf("deleteall\n");
176
- manifest_file_rewind(p);
177
- while( (pFile=manifest_file_next(p, 0))!=0 ){
178
- int fid = fast_uuid_to_rid(pFile->zUuid);
179
- const char *zPerm = "100644";
180
- if( fid==0 ) continue;
181
- if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755";
182
- if( !bag_find(&blobs, fid) ) continue;
183
- printf("M %s :%d %s\n", zPerm, fid, pFile->zName);
184
- }
185
- manifest_cache_insert(p);
245
+ db_prepare(&q3, "SELECT pid FROM plink WHERE cid=%d AND isprim", ckinId);
246
+ if( db_step(&q3) == SQLITE_ROW ){
247
+ printf("from :%d\n", COMMITMARK(db_column_int(&q3, 0)));
248
+ db_prepare(&q4,
249
+ "SELECT pid FROM plink"
250
+ " WHERE cid=%d AND NOT isprim"
251
+ " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
252
+ " ORDER BY pid",
253
+ ckinId);
254
+ while( db_step(&q4)==SQLITE_ROW ){
255
+ printf("merge :%d\n", COMMITMARK(db_column_int(&q4,0)));
256
+ }
257
+ db_finalize(&q4);
258
+ }else{
259
+ printf("deleteall\n");
260
+ }
261
+
262
+ db_prepare(&q4,
263
+ "SELECT filename.name, mlink.fid, mlink.mperm FROM mlink"
264
+ " JOIN filename ON filename.fnid=mlink.fnid"
265
+ " WHERE mlink.mid=%d",
266
+ ckinId
267
+ );
268
+ while( db_step(&q4)==SQLITE_ROW ){
269
+ const char *zName = db_column_text(&q4,0);
270
+ int zNew = db_column_int(&q4,1);
271
+ int mPerm = db_column_int(&q4,2);
272
+ if( zNew==0)
273
+ printf("D %s\n", zName);
274
+ else if( bag_find(&blobs, zNew) )
275
+ printf("M %s :%d %s\n", mPerm ? "100755" : "100644", BLOBMARK(zNew), zName);
276
+ }
277
+ db_finalize(&q4);
278
+ db_finalize(&q3);
186279
printf("\n");
187280
}
281
+ db_finalize(&q2);
188282
db_finalize(&q);
189283
bag_clear(&blobs);
190284
manifest_cache_clear();
191285
192286
@@ -196,17 +290,45 @@
196290
" FROM tagxref JOIN tag USING(tagid)"
197291
" WHERE tagtype=1 AND tagname GLOB 'sym-*'"
198292
);
199293
while( db_step(&q)==SQLITE_ROW ){
200294
const char *zTagname = db_column_text(&q, 0);
295
+ char *zEncoded = 0;
201296
int rid = db_column_int(&q, 1);
202297
const char *zSecSince1970 = db_column_text(&q, 2);
298
+ int i;
203299
if( rid==0 || !bag_find(&vers, rid) ) continue;
204300
zTagname += 4;
205
- printf("tag %s\n", zTagname);
206
- printf("from :%d\n", rid+firstCkin);
301
+ zEncoded = mprintf("%s", zTagname);
302
+ for(i=0; zEncoded[i]; i++){
303
+ if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_';
304
+ }
305
+ printf("tag %s\n", zEncoded);
306
+ printf("from :%d\n", COMMITMARK(rid));
207307
printf("tagger <tagger> %s +0000\n", zSecSince1970);
208308
printf("data 0\n");
309
+ fossil_free(zEncoded);
209310
}
210311
db_finalize(&q);
211312
bag_clear(&vers);
313
+
314
+ if( markfile_out!=0 ){
315
+ FILE *f;
316
+ f = fopen(markfile_out, "w");
317
+ if( f == 0 ){
318
+ fossil_panic("cannot open %s for writing", markfile_out);
319
+ }
320
+ db_prepare(&q, "SELECT rid FROM oldblob");
321
+ while( db_step(&q)==SQLITE_ROW ){
322
+ fprintf(f, "b%d\n", db_column_int(&q, 0));
323
+ }
324
+ db_finalize(&q);
325
+ db_prepare(&q, "SELECT rid FROM oldcommit");
326
+ while( db_step(&q)==SQLITE_ROW ){
327
+ fprintf(f, "c%d\n", db_column_int(&q, 0));
328
+ }
329
+ db_finalize(&q);
330
+ if( ferror(f)!=0 || fclose(f)!=0 ) {
331
+ fossil_panic("error while writing %s", markfile_out);
332
+ }
333
+ }
212334
}
213335
--- src/export.c
+++ src/export.c
@@ -39,11 +39,11 @@
39 db_bind_text(&q, ":user", zUser);
40 if( db_step(&q)!=SQLITE_ROW ){
41 db_reset(&q);
42 for(i=0; zUser[i] && zUser[i]!='>' && zUser[i]!='<'; i++){}
43 if( zUser[i]==0 ){
44 printf(" <%s>", zUser);
45 return;
46 }
47 zName = mprintf("%s", zUser);
48 for(i=j=0; zName[i]; i++){
49 if( zName[i]!='<' && zName[i]!='>' ){
@@ -56,11 +56,11 @@
56 return;
57 }
58 zContact = db_column_text(&q, 0);
59 for(i=0; zContact[i] && zContact[i]!='>' && zContact[i]!='<'; i++){}
60 if( zContact[i]==0 ){
61 printf(" %s <%s>", zContact, zUser);
62 db_reset(&q);
63 return;
64 }
65 if( zContact[i]=='<' ){
66 zEmail = mprintf("%s", &zContact[i]);
@@ -78,15 +78,17 @@
78 free(zName);
79 free(zEmail);
80 db_reset(&q);
81 }
82
 
 
83
84 /*
85 ** COMMAND: export
86 **
87 ** Usage: %fossil export --git ?REPOSITORY?
88 **
89 ** Write an export of all check-ins to standard output. The export is
90 ** written in the git-fast-export file format assuming the --git option is
91 ** provided. The git-fast-export format is currently the only VCS
92 ** interchange format supported, though other formats may be added in
@@ -95,98 +97,190 @@
95 ** Run this command within a checkout. Or use the -R or --repository
96 ** option to specify a Fossil repository to be exported.
97 **
98 ** Only check-ins are exported using --git. Git does not support tickets
99 ** or wiki or events or attachments, so none of those are exported.
 
 
 
 
 
 
100 */
101 void export_cmd(void){
102 Stmt q;
103 int i;
104 int firstCkin; /* Integer offset to check-in marks */
105 Bag blobs, vers;
 
 
 
106 bag_init(&blobs);
107 bag_init(&vers);
108
109 find_option("git", 0, 0); /* Ignore the --git option for now */
 
 
 
110 db_find_and_open_repository(0, 2);
111 verify_all_options();
112 if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
114 /* Step 1: Generate "blob" records for every artifact that is part
115 ** of a check-in
116 */
117 fossil_binary_mode(stdout);
118 db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119 while( db_step(&q)==SQLITE_ROW ){
120 int rid = db_column_int(&q, 0);
121 Blob content;
122 content_get(rid, &content);
123 printf("blob\nmark :%d\ndata %d\n", rid, blob_size(&content));
124 bag_insert(&blobs, rid);
125 fwrite(blob_buffer(&content), 1, blob_size(&content), stdout);
126 printf("\n");
127 blob_reset(&content);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128 }
129 db_finalize(&q);
 
 
130
131 /* Output the commit records.
132 */
133 firstCkin = db_int(0, "SELECT max(rid) FROM blob")+1;
134 db_prepare(&q,
135 "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment),"
136 " coalesce(user,euser),"
137 " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)"
138 " FROM event"
139 " WHERE type='ci'"
140 " ORDER BY mtime ASC",
141 TAG_BRANCH
142 );
 
143 while( db_step(&q)==SQLITE_ROW ){
 
144 const char *zSecondsSince1970 = db_column_text(&q, 0);
145 int ckinId = db_column_int(&q, 1);
146 const char *zComment = db_column_text(&q, 2);
147 const char *zUser = db_column_text(&q, 3);
148 const char *zBranch = db_column_text(&q, 4);
149 char *zBr;
150 Manifest *p;
151 ManifestFile *pFile;
152 const char *zFromType;
153
154 bag_insert(&vers, ckinId);
 
 
 
155 if( zBranch==0 ) zBranch = "trunk";
156 zBr = mprintf("%s", zBranch);
157 for(i=0; zBr[i]; i++){
158 if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_';
159 }
160 printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId+firstCkin);
161 free(zBr);
162 printf("committer");
163 print_person(zUser);
164 printf(" %s +0000\n", zSecondsSince1970);
165 if( zComment==0 ) zComment = "null comment";
166 printf("data %d\n%s\n", (int)strlen(zComment), zComment);
167 p = manifest_get(ckinId, CFTYPE_ANY);
168 zFromType = "from";
169 for(i=0; i<p->nParent; i++){
170 int pid = fast_uuid_to_rid(p->azParent[i]);
171 if( pid==0 || !bag_find(&vers, pid) ) continue;
172 printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin);
173 zFromType = "merge";
174 }
175 printf("deleteall\n");
176 manifest_file_rewind(p);
177 while( (pFile=manifest_file_next(p, 0))!=0 ){
178 int fid = fast_uuid_to_rid(pFile->zUuid);
179 const char *zPerm = "100644";
180 if( fid==0 ) continue;
181 if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755";
182 if( !bag_find(&blobs, fid) ) continue;
183 printf("M %s :%d %s\n", zPerm, fid, pFile->zName);
184 }
185 manifest_cache_insert(p);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186 printf("\n");
187 }
 
188 db_finalize(&q);
189 bag_clear(&blobs);
190 manifest_cache_clear();
191
192
@@ -196,17 +290,45 @@
196 " FROM tagxref JOIN tag USING(tagid)"
197 " WHERE tagtype=1 AND tagname GLOB 'sym-*'"
198 );
199 while( db_step(&q)==SQLITE_ROW ){
200 const char *zTagname = db_column_text(&q, 0);
 
201 int rid = db_column_int(&q, 1);
202 const char *zSecSince1970 = db_column_text(&q, 2);
 
203 if( rid==0 || !bag_find(&vers, rid) ) continue;
204 zTagname += 4;
205 printf("tag %s\n", zTagname);
206 printf("from :%d\n", rid+firstCkin);
 
 
 
 
207 printf("tagger <tagger> %s +0000\n", zSecSince1970);
208 printf("data 0\n");
 
209 }
210 db_finalize(&q);
211 bag_clear(&vers);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212 }
213
--- src/export.c
+++ src/export.c
@@ -39,11 +39,11 @@
39 db_bind_text(&q, ":user", zUser);
40 if( db_step(&q)!=SQLITE_ROW ){
41 db_reset(&q);
42 for(i=0; zUser[i] && zUser[i]!='>' && zUser[i]!='<'; i++){}
43 if( zUser[i]==0 ){
44 printf(" %s <%s>", zUser, zUser);
45 return;
46 }
47 zName = mprintf("%s", zUser);
48 for(i=j=0; zName[i]; i++){
49 if( zName[i]!='<' && zName[i]!='>' ){
@@ -56,11 +56,11 @@
56 return;
57 }
58 zContact = db_column_text(&q, 0);
59 for(i=0; zContact[i] && zContact[i]!='>' && zContact[i]!='<'; i++){}
60 if( zContact[i]==0 ){
61 printf(" %s <%s>", zContact[0] ? zContact : zUser, zUser);
62 db_reset(&q);
63 return;
64 }
65 if( zContact[i]=='<' ){
66 zEmail = mprintf("%s", &zContact[i]);
@@ -78,15 +78,17 @@
78 free(zName);
79 free(zEmail);
80 db_reset(&q);
81 }
82
83 #define BLOBMARK(rid) ((rid) * 2)
84 #define COMMITMARK(rid) ((rid) * 2 + 1)
85
86 /*
87 ** COMMAND: export
88 **
89 ** Usage: %fossil export --git ?options? ?REPOSITORY?
90 **
91 ** Write an export of all check-ins to standard output. The export is
92 ** written in the git-fast-export file format assuming the --git option is
93 ** provided. The git-fast-export format is currently the only VCS
94 ** interchange format supported, though other formats may be added in
@@ -95,98 +97,190 @@
97 ** Run this command within a checkout. Or use the -R or --repository
98 ** option to specify a Fossil repository to be exported.
99 **
100 ** Only check-ins are exported using --git. Git does not support tickets
101 ** or wiki or events or attachments, so none of those are exported.
102 **
103 ** If the "--import-marks FILE" option is used, it contains a list of
104 ** rids to skip.
105 **
106 ** If the "--export-marks FILE" option is used, the rid of all commits and
107 ** blobs written on exit for use with "--import-marks" on the next run.
108 */
109 void export_cmd(void){
110 Stmt q, q2, q3;
111 int i;
 
112 Bag blobs, vers;
113 const char *markfile_in;
114 const char *markfile_out;
115
116 bag_init(&blobs);
117 bag_init(&vers);
118
119 find_option("git", 0, 0); /* Ignore the --git option for now */
120 markfile_in = find_option("import-marks", 0, 1);
121 markfile_out = find_option("export-marks", 0, 1);
122
123 db_find_and_open_repository(0, 2);
124 verify_all_options();
125 if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); }
126
127 db_multi_exec("CREATE TEMPORARY TABLE oldblob(rid INTEGER PRIMARY KEY)");
128 db_multi_exec("CREATE TEMPORARY TABLE oldcommit(rid INTEGER PRIMARY KEY)");
129 if( markfile_in!=0 ){
130 Stmt qb,qc;
131 char line[100];
132 FILE *f;
133
134 f = fopen(markfile_in, "r");
135 if( f==0 ){
136 fossil_panic("cannot open %s for reading", markfile_in);
137 }
138 db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)");
139 db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)");
140 while( fgets(line, sizeof(line), f)!=0 ){
141 if( *line == 'b' ){
142 db_bind_text(&qb, ":rid", line + 1);
143 db_step(&qb);
144 db_reset(&qb);
145 bag_insert(&blobs, atoi(line + 1));
146 }else if( *line == 'c' ){
147 db_bind_text(&qc, ":rid", line + 1);
148 db_step(&qc);
149 db_reset(&qc);
150 bag_insert(&vers, atoi(line + 1));
151 }else{
152 fossil_panic("bad input from %s: %s", markfile_in, line);
153 }
154 }
155 db_finalize(&qb);
156 db_finalize(&qc);
157 fclose(f);
158 }
159
160 /* Step 1: Generate "blob" records for every artifact that is part
161 ** of a check-in
162 */
163 fossil_binary_mode(stdout);
164 db_multi_exec("CREATE TEMPORARY TABLE newblob(rid INTEGER KEY, srcid INTEGER)");
165 db_multi_exec("CREATE INDEX newblob_src ON newblob(srcid)");
166 db_multi_exec(
167 "INSERT INTO newblob"
168 " SELECT DISTINCT fid,"
169 " CASE WHEN EXISTS(SELECT 1 FROM delta WHERE rid=fid AND NOT EXISTS(SELECT 1 FROM oldblob WHERE srcid=fid))"
170 " THEN (SELECT srcid FROM delta WHERE rid=fid)"
171 " ELSE 0"
172 " END"
173 " FROM mlink"
174 " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)");
175 db_prepare(&q,
176 "SELECT DISTINCT fid FROM mlink"
177 " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)");
178 db_prepare(&q2, "INSERT INTO oldblob VALUES (:rid)");
179 db_prepare(&q3, "SELECT rid FROM newblob WHERE srcid= (:srcid)");
180 while( db_step(&q)==SQLITE_ROW ){
181 int rid = db_column_int(&q, 0);
182 Blob content;
183
184 while( !bag_find(&blobs, rid) ){
185 content_get(rid, &content);
186 db_bind_int(&q2, ":rid", rid);
187 db_step(&q2);
188 db_reset(&q2);
189 printf("blob\nmark :%d\ndata %d\n", BLOBMARK(rid), blob_size(&content));
190 bag_insert(&blobs, rid);
191 fwrite(blob_buffer(&content), 1, blob_size(&content), stdout);
192 printf("\n");
193 blob_reset(&content);
194
195 db_bind_int(&q3, ":srcid", rid);
196 if( db_step(&q3) != SQLITE_ROW ){
197 db_reset(&q3);
198 break;
199 }
200 rid = db_column_int(&q3, 0);
201 db_reset(&q3);
202 }
203 }
204 db_finalize(&q);
205 db_finalize(&q2);
206 db_finalize(&q3);
207
208 /* Output the commit records.
209 */
 
210 db_prepare(&q,
211 "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment),"
212 " coalesce(user,euser),"
213 " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)"
214 " FROM event"
215 " WHERE type='ci' AND NOT EXISTS (SELECT 1 FROM oldcommit WHERE objid=rid)"
216 " ORDER BY mtime ASC",
217 TAG_BRANCH
218 );
219 db_prepare(&q2, "INSERT INTO oldcommit VALUES (:rid)");
220 while( db_step(&q)==SQLITE_ROW ){
221 Stmt q4;
222 const char *zSecondsSince1970 = db_column_text(&q, 0);
223 int ckinId = db_column_int(&q, 1);
224 const char *zComment = db_column_text(&q, 2);
225 const char *zUser = db_column_text(&q, 3);
226 const char *zBranch = db_column_text(&q, 4);
227 char *zBr;
 
 
 
228
229 bag_insert(&vers, ckinId);
230 db_bind_int(&q2, ":rid", ckinId);
231 db_step(&q2);
232 db_reset(&q2);
233 if( zBranch==0 ) zBranch = "trunk";
234 zBr = mprintf("%s", zBranch);
235 for(i=0; zBr[i]; i++){
236 if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_';
237 }
238 printf("commit refs/heads/%s\nmark :%d\n", zBr, COMMITMARK(ckinId));
239 free(zBr);
240 printf("committer");
241 print_person(zUser);
242 printf(" %s +0000\n", zSecondsSince1970);
243 if( zComment==0 ) zComment = "null comment";
244 printf("data %d\n%s\n", (int)strlen(zComment), zComment);
245 db_prepare(&q3, "SELECT pid FROM plink WHERE cid=%d AND isprim", ckinId);
246 if( db_step(&q3) == SQLITE_ROW ){
247 printf("from :%d\n", COMMITMARK(db_column_int(&q3, 0)));
248 db_prepare(&q4,
249 "SELECT pid FROM plink"
250 " WHERE cid=%d AND NOT isprim"
251 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
252 " ORDER BY pid",
253 ckinId);
254 while( db_step(&q4)==SQLITE_ROW ){
255 printf("merge :%d\n", COMMITMARK(db_column_int(&q4,0)));
256 }
257 db_finalize(&q4);
258 }else{
259 printf("deleteall\n");
260 }
261
262 db_prepare(&q4,
263 "SELECT filename.name, mlink.fid, mlink.mperm FROM mlink"
264 " JOIN filename ON filename.fnid=mlink.fnid"
265 " WHERE mlink.mid=%d",
266 ckinId
267 );
268 while( db_step(&q4)==SQLITE_ROW ){
269 const char *zName = db_column_text(&q4,0);
270 int zNew = db_column_int(&q4,1);
271 int mPerm = db_column_int(&q4,2);
272 if( zNew==0)
273 printf("D %s\n", zName);
274 else if( bag_find(&blobs, zNew) )
275 printf("M %s :%d %s\n", mPerm ? "100755" : "100644", BLOBMARK(zNew), zName);
276 }
277 db_finalize(&q4);
278 db_finalize(&q3);
279 printf("\n");
280 }
281 db_finalize(&q2);
282 db_finalize(&q);
283 bag_clear(&blobs);
284 manifest_cache_clear();
285
286
@@ -196,17 +290,45 @@
290 " FROM tagxref JOIN tag USING(tagid)"
291 " WHERE tagtype=1 AND tagname GLOB 'sym-*'"
292 );
293 while( db_step(&q)==SQLITE_ROW ){
294 const char *zTagname = db_column_text(&q, 0);
295 char *zEncoded = 0;
296 int rid = db_column_int(&q, 1);
297 const char *zSecSince1970 = db_column_text(&q, 2);
298 int i;
299 if( rid==0 || !bag_find(&vers, rid) ) continue;
300 zTagname += 4;
301 zEncoded = mprintf("%s", zTagname);
302 for(i=0; zEncoded[i]; i++){
303 if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_';
304 }
305 printf("tag %s\n", zEncoded);
306 printf("from :%d\n", COMMITMARK(rid));
307 printf("tagger <tagger> %s +0000\n", zSecSince1970);
308 printf("data 0\n");
309 fossil_free(zEncoded);
310 }
311 db_finalize(&q);
312 bag_clear(&vers);
313
314 if( markfile_out!=0 ){
315 FILE *f;
316 f = fopen(markfile_out, "w");
317 if( f == 0 ){
318 fossil_panic("cannot open %s for writing", markfile_out);
319 }
320 db_prepare(&q, "SELECT rid FROM oldblob");
321 while( db_step(&q)==SQLITE_ROW ){
322 fprintf(f, "b%d\n", db_column_int(&q, 0));
323 }
324 db_finalize(&q);
325 db_prepare(&q, "SELECT rid FROM oldcommit");
326 while( db_step(&q)==SQLITE_ROW ){
327 fprintf(f, "c%d\n", db_column_int(&q, 0));
328 }
329 db_finalize(&q);
330 if( ferror(f)!=0 || fclose(f)!=0 ) {
331 fossil_panic("error while writing %s", markfile_out);
332 }
333 }
334 }
335
+35 -7
--- src/file.c
+++ src/file.c
@@ -19,10 +19,12 @@
1919
*/
2020
#include "config.h"
2121
#include <sys/types.h>
2222
#include <sys/stat.h>
2323
#include <unistd.h>
24
+#include <string.h>
25
+#include <errno.h>
2426
#include "file.h"
2527
2628
/*
2729
** The file status information from the most recent stat() call.
2830
**
@@ -397,11 +399,11 @@
397399
char *zPwdUtf8;
398400
int nPwd;
399401
int i;
400402
char zPwd[2000];
401403
if( getcwd(zPwd, sizeof(zPwd)-1)==0 ){
402
- fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-1);
404
+ fossil_fatal("cannot find the current working directory.");
403405
}
404406
zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
405407
nPwd = strlen(zPwdUtf8);
406408
if( nPwd > nBuf-1 ){
407409
fossil_fatal("pwd too big: max %d\n", nBuf-1);
@@ -409,11 +411,16 @@
409411
for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
410412
memcpy(zBuf, zPwdUtf8, nPwd+1);
411413
fossil_mbcs_free(zPwdUtf8);
412414
#else
413415
if( getcwd(zBuf, nBuf-1)==0 ){
414
- fossil_fatal("pwd too big: max %d\n", nBuf-1);
416
+ if( errno==ERANGE ){
417
+ fossil_fatal("pwd too big: max %d\n", nBuf-1);
418
+ }else{
419
+ fossil_fatal("cannot find current working directory; %s",
420
+ strerror(errno));
421
+ }
415422
}
416423
#endif
417424
}
418425
419426
/*
@@ -492,26 +499,45 @@
492499
}
493500
}
494501
}
495502
return 1;
496503
}
504
+
505
+/*
506
+** Return a pointer to the first character in a pathname past the
507
+** drive letter. This routine is a no-op on unix.
508
+*/
509
+char *file_without_drive_letter(char *zIn){
510
+#ifdef _WIN32
511
+ if( fossil_isalpha(zIn[0]) && zIn[1]==':' ) zIn += 2;
512
+#endif
513
+ return zIn;
514
+}
497515
498516
/*
499517
** Compute a pathname for a file or directory that is relative
500518
** to the current directory.
501519
*/
502520
void file_relative_name(const char *zOrigName, Blob *pOut){
503521
char *zPath;
504522
blob_set(pOut, zOrigName);
505523
blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut)));
506
- zPath = blob_buffer(pOut);
524
+ zPath = file_without_drive_letter(blob_buffer(pOut));
507525
if( zPath[0]=='/' ){
508526
int i, j;
509527
Blob tmp;
510
- char zPwd[2000];
511
- file_getcwd(zPwd, sizeof(zPwd)-20);
512
- for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){}
528
+ char *zPwd;
529
+ char zBuf[2000];
530
+ zPwd = zBuf;
531
+ file_getcwd(zBuf, sizeof(zBuf)-20);
532
+ zPwd = file_without_drive_letter(zBuf);
533
+ i = 1;
534
+#ifdef _WIN32
535
+ while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
536
+#else
537
+ while( zPath[i] && zPwd[i]==zPath[i] ) i++;
538
+#endif
513539
if( zPath[i]==0 ){
514540
blob_reset(pOut);
515541
if( zPwd[i]==0 ){
516542
blob_append(pOut, ".", 1);
517543
}else{
@@ -672,10 +698,11 @@
672698
"abcdefghijklmnopqrstuvwxyz"
673699
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
674700
"0123456789";
675701
unsigned int i, j;
676702
const char *zDir = ".";
703
+ int cnt = 0;
677704
678705
for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
679706
if( !file_isdir(azDirs[i]) ) continue;
680707
zDir = azDirs[i];
681708
break;
@@ -687,18 +714,19 @@
687714
if( (strlen(zDir) + 17) >= (size_t)nBuf ){
688715
fossil_fatal("insufficient space for temporary filename");
689716
}
690717
691718
do{
719
+ if( cnt++>20 ) fossil_panic("cannot generate a temporary filename");
692720
sqlite3_snprintf(nBuf-17, zBuf, "%s/", zDir);
693721
j = (int)strlen(zBuf);
694722
sqlite3_randomness(15, &zBuf[j]);
695723
for(i=0; i<15; i++, j++){
696724
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
697725
}
698726
zBuf[j] = 0;
699
- }while( file_size(zBuf)<0 );
727
+ }while( file_size(zBuf)>=0 );
700728
}
701729
702730
703731
/*
704732
** Return true if a file named zName exists and has identical content
705733
--- src/file.c
+++ src/file.c
@@ -19,10 +19,12 @@
19 */
20 #include "config.h"
21 #include <sys/types.h>
22 #include <sys/stat.h>
23 #include <unistd.h>
 
 
24 #include "file.h"
25
26 /*
27 ** The file status information from the most recent stat() call.
28 **
@@ -397,11 +399,11 @@
397 char *zPwdUtf8;
398 int nPwd;
399 int i;
400 char zPwd[2000];
401 if( getcwd(zPwd, sizeof(zPwd)-1)==0 ){
402 fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-1);
403 }
404 zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
405 nPwd = strlen(zPwdUtf8);
406 if( nPwd > nBuf-1 ){
407 fossil_fatal("pwd too big: max %d\n", nBuf-1);
@@ -409,11 +411,16 @@
409 for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
410 memcpy(zBuf, zPwdUtf8, nPwd+1);
411 fossil_mbcs_free(zPwdUtf8);
412 #else
413 if( getcwd(zBuf, nBuf-1)==0 ){
414 fossil_fatal("pwd too big: max %d\n", nBuf-1);
 
 
 
 
 
415 }
416 #endif
417 }
418
419 /*
@@ -492,26 +499,45 @@
492 }
493 }
494 }
495 return 1;
496 }
 
 
 
 
 
 
 
 
 
 
 
497
498 /*
499 ** Compute a pathname for a file or directory that is relative
500 ** to the current directory.
501 */
502 void file_relative_name(const char *zOrigName, Blob *pOut){
503 char *zPath;
504 blob_set(pOut, zOrigName);
505 blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut)));
506 zPath = blob_buffer(pOut);
507 if( zPath[0]=='/' ){
508 int i, j;
509 Blob tmp;
510 char zPwd[2000];
511 file_getcwd(zPwd, sizeof(zPwd)-20);
512 for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){}
 
 
 
 
 
 
 
 
513 if( zPath[i]==0 ){
514 blob_reset(pOut);
515 if( zPwd[i]==0 ){
516 blob_append(pOut, ".", 1);
517 }else{
@@ -672,10 +698,11 @@
672 "abcdefghijklmnopqrstuvwxyz"
673 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
674 "0123456789";
675 unsigned int i, j;
676 const char *zDir = ".";
 
677
678 for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
679 if( !file_isdir(azDirs[i]) ) continue;
680 zDir = azDirs[i];
681 break;
@@ -687,18 +714,19 @@
687 if( (strlen(zDir) + 17) >= (size_t)nBuf ){
688 fossil_fatal("insufficient space for temporary filename");
689 }
690
691 do{
 
692 sqlite3_snprintf(nBuf-17, zBuf, "%s/", zDir);
693 j = (int)strlen(zBuf);
694 sqlite3_randomness(15, &zBuf[j]);
695 for(i=0; i<15; i++, j++){
696 zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
697 }
698 zBuf[j] = 0;
699 }while( file_size(zBuf)<0 );
700 }
701
702
703 /*
704 ** Return true if a file named zName exists and has identical content
705
--- src/file.c
+++ src/file.c
@@ -19,10 +19,12 @@
19 */
20 #include "config.h"
21 #include <sys/types.h>
22 #include <sys/stat.h>
23 #include <unistd.h>
24 #include <string.h>
25 #include <errno.h>
26 #include "file.h"
27
28 /*
29 ** The file status information from the most recent stat() call.
30 **
@@ -397,11 +399,11 @@
399 char *zPwdUtf8;
400 int nPwd;
401 int i;
402 char zPwd[2000];
403 if( getcwd(zPwd, sizeof(zPwd)-1)==0 ){
404 fossil_fatal("cannot find the current working directory.");
405 }
406 zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
407 nPwd = strlen(zPwdUtf8);
408 if( nPwd > nBuf-1 ){
409 fossil_fatal("pwd too big: max %d\n", nBuf-1);
@@ -409,11 +411,16 @@
411 for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
412 memcpy(zBuf, zPwdUtf8, nPwd+1);
413 fossil_mbcs_free(zPwdUtf8);
414 #else
415 if( getcwd(zBuf, nBuf-1)==0 ){
416 if( errno==ERANGE ){
417 fossil_fatal("pwd too big: max %d\n", nBuf-1);
418 }else{
419 fossil_fatal("cannot find current working directory; %s",
420 strerror(errno));
421 }
422 }
423 #endif
424 }
425
426 /*
@@ -492,26 +499,45 @@
499 }
500 }
501 }
502 return 1;
503 }
504
505 /*
506 ** Return a pointer to the first character in a pathname past the
507 ** drive letter. This routine is a no-op on unix.
508 */
509 char *file_without_drive_letter(char *zIn){
510 #ifdef _WIN32
511 if( fossil_isalpha(zIn[0]) && zIn[1]==':' ) zIn += 2;
512 #endif
513 return zIn;
514 }
515
516 /*
517 ** Compute a pathname for a file or directory that is relative
518 ** to the current directory.
519 */
520 void file_relative_name(const char *zOrigName, Blob *pOut){
521 char *zPath;
522 blob_set(pOut, zOrigName);
523 blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut)));
524 zPath = file_without_drive_letter(blob_buffer(pOut));
525 if( zPath[0]=='/' ){
526 int i, j;
527 Blob tmp;
528 char *zPwd;
529 char zBuf[2000];
530 zPwd = zBuf;
531 file_getcwd(zBuf, sizeof(zBuf)-20);
532 zPwd = file_without_drive_letter(zBuf);
533 i = 1;
534 #ifdef _WIN32
535 while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
536 #else
537 while( zPath[i] && zPwd[i]==zPath[i] ) i++;
538 #endif
539 if( zPath[i]==0 ){
540 blob_reset(pOut);
541 if( zPwd[i]==0 ){
542 blob_append(pOut, ".", 1);
543 }else{
@@ -672,10 +698,11 @@
698 "abcdefghijklmnopqrstuvwxyz"
699 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
700 "0123456789";
701 unsigned int i, j;
702 const char *zDir = ".";
703 int cnt = 0;
704
705 for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
706 if( !file_isdir(azDirs[i]) ) continue;
707 zDir = azDirs[i];
708 break;
@@ -687,18 +714,19 @@
714 if( (strlen(zDir) + 17) >= (size_t)nBuf ){
715 fossil_fatal("insufficient space for temporary filename");
716 }
717
718 do{
719 if( cnt++>20 ) fossil_panic("cannot generate a temporary filename");
720 sqlite3_snprintf(nBuf-17, zBuf, "%s/", zDir);
721 j = (int)strlen(zBuf);
722 sqlite3_randomness(15, &zBuf[j]);
723 for(i=0; i<15; i++, j++){
724 zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
725 }
726 zBuf[j] = 0;
727 }while( file_size(zBuf)>=0 );
728 }
729
730
731 /*
732 ** Return true if a file named zName exists and has identical content
733
--- src/finfo.c
+++ src/finfo.c
@@ -193,10 +193,12 @@
193193
** Additional query parameters:
194194
**
195195
** a=DATE Only show changes after DATE
196196
** b=DATE Only show changes before DATE
197197
** n=NUM Show the first NUM changes only
198
+** brbg Background color by branch name
199
+** ubg Background color by user name
198200
*/
199201
void finfo_page(void){
200202
Stmt q;
201203
const char *zFilename;
202204
char zPrevDate[20];
@@ -204,10 +206,12 @@
204206
const char *zB;
205207
int n;
206208
Blob title;
207209
Blob sql;
208210
GraphContext *pGraph;
211
+ int brBg = P("brbg")!=0;
212
+ int uBg = P("ubg")!=0;
209213
210214
login_check_credentials();
211215
if( !g.okRead ){ login_needed(); return; }
212216
style_header("File History");
213217
login_anonymous_available();
@@ -268,10 +272,15 @@
268272
int gidx;
269273
char zTime[10];
270274
char zShort[20];
271275
char zShortCkin[20];
272276
if( zBr==0 ) zBr = "trunk";
277
+ if( uBg ){
278
+ zBgClr = hash_color(zUser);
279
+ }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
280
+ zBgClr = strcmp(zBr,"trunk")==0 ? "white" : hash_color(zBr);
281
+ }
273282
gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0);
274283
if( memcmp(zDate, zPrevDate, 10) ){
275284
sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
276285
@ <tr><td>
277286
@ <div class="divider">%s(zPrevDate)</div>
278287
--- src/finfo.c
+++ src/finfo.c
@@ -193,10 +193,12 @@
193 ** Additional query parameters:
194 **
195 ** a=DATE Only show changes after DATE
196 ** b=DATE Only show changes before DATE
197 ** n=NUM Show the first NUM changes only
 
 
198 */
199 void finfo_page(void){
200 Stmt q;
201 const char *zFilename;
202 char zPrevDate[20];
@@ -204,10 +206,12 @@
204 const char *zB;
205 int n;
206 Blob title;
207 Blob sql;
208 GraphContext *pGraph;
 
 
209
210 login_check_credentials();
211 if( !g.okRead ){ login_needed(); return; }
212 style_header("File History");
213 login_anonymous_available();
@@ -268,10 +272,15 @@
268 int gidx;
269 char zTime[10];
270 char zShort[20];
271 char zShortCkin[20];
272 if( zBr==0 ) zBr = "trunk";
 
 
 
 
 
273 gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0);
274 if( memcmp(zDate, zPrevDate, 10) ){
275 sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
276 @ <tr><td>
277 @ <div class="divider">%s(zPrevDate)</div>
278
--- src/finfo.c
+++ src/finfo.c
@@ -193,10 +193,12 @@
193 ** Additional query parameters:
194 **
195 ** a=DATE Only show changes after DATE
196 ** b=DATE Only show changes before DATE
197 ** n=NUM Show the first NUM changes only
198 ** brbg Background color by branch name
199 ** ubg Background color by user name
200 */
201 void finfo_page(void){
202 Stmt q;
203 const char *zFilename;
204 char zPrevDate[20];
@@ -204,10 +206,12 @@
206 const char *zB;
207 int n;
208 Blob title;
209 Blob sql;
210 GraphContext *pGraph;
211 int brBg = P("brbg")!=0;
212 int uBg = P("ubg")!=0;
213
214 login_check_credentials();
215 if( !g.okRead ){ login_needed(); return; }
216 style_header("File History");
217 login_anonymous_available();
@@ -268,10 +272,15 @@
272 int gidx;
273 char zTime[10];
274 char zShort[20];
275 char zShortCkin[20];
276 if( zBr==0 ) zBr = "trunk";
277 if( uBg ){
278 zBgClr = hash_color(zUser);
279 }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){
280 zBgClr = strcmp(zBr,"trunk")==0 ? "white" : hash_color(zBr);
281 }
282 gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0);
283 if( memcmp(zDate, zPrevDate, 10) ){
284 sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
285 @ <tr><td>
286 @ <div class="divider">%s(zPrevDate)</div>
287
+4 -4
--- src/glob.c
+++ src/glob.c
@@ -110,24 +110,24 @@
110110
p = fossil_malloc( sizeof(*p) + nList+1 );
111111
memset(p, 0, sizeof(*p));
112112
z = (char*)&p[1];
113113
memcpy(z, zPatternList, nList+1);
114114
while( z[0] ){
115
- while( z[0]==',' || z[0]==' ' ) z++; /* Skip leading spaces */
115
+ while( z[0]==',' || z[0]==' ' || z[0]=='\n' || z[0]=='\r' ) z++; /* Skip leading spaces and newlines */
116116
if( z[0]=='\'' || z[0]=='"' ){
117117
delimiter = z[0];
118118
z++;
119119
}else{
120120
delimiter = ',';
121121
}
122122
if( z[0]==0 ) break;
123123
p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
124124
p->azPattern[p->nPattern++] = z;
125
- for(i=0; z[i] && z[i]!=delimiter; i++){}
125
+ for(i=0; z[i] && z[i]!=delimiter && z[i]!='\n' && z[i]!='\r'; i++){}
126126
if( delimiter==',' ){
127
- /* Remove trailing spaces on a comma-delimited pattern */
128
- for(j=i; j>1 && z[j-1]==' '; j--){}
127
+ /* Remove trailing spaces / newlines on a comma-delimited pattern */
128
+ for(j=i; j>1 && (z[j-1]==' ' || z[j-1]=='\n' || z[j-1]=='\r'); j--){}
129129
if( j<i ) z[j] = 0;
130130
}
131131
if( z[i]==0 ) break;
132132
z[i] = 0;
133133
z += i+1;
134134
--- src/glob.c
+++ src/glob.c
@@ -110,24 +110,24 @@
110 p = fossil_malloc( sizeof(*p) + nList+1 );
111 memset(p, 0, sizeof(*p));
112 z = (char*)&p[1];
113 memcpy(z, zPatternList, nList+1);
114 while( z[0] ){
115 while( z[0]==',' || z[0]==' ' ) z++; /* Skip leading spaces */
116 if( z[0]=='\'' || z[0]=='"' ){
117 delimiter = z[0];
118 z++;
119 }else{
120 delimiter = ',';
121 }
122 if( z[0]==0 ) break;
123 p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
124 p->azPattern[p->nPattern++] = z;
125 for(i=0; z[i] && z[i]!=delimiter; i++){}
126 if( delimiter==',' ){
127 /* Remove trailing spaces on a comma-delimited pattern */
128 for(j=i; j>1 && z[j-1]==' '; j--){}
129 if( j<i ) z[j] = 0;
130 }
131 if( z[i]==0 ) break;
132 z[i] = 0;
133 z += i+1;
134
--- src/glob.c
+++ src/glob.c
@@ -110,24 +110,24 @@
110 p = fossil_malloc( sizeof(*p) + nList+1 );
111 memset(p, 0, sizeof(*p));
112 z = (char*)&p[1];
113 memcpy(z, zPatternList, nList+1);
114 while( z[0] ){
115 while( z[0]==',' || z[0]==' ' || z[0]=='\n' || z[0]=='\r' ) z++; /* Skip leading spaces and newlines */
116 if( z[0]=='\'' || z[0]=='"' ){
117 delimiter = z[0];
118 z++;
119 }else{
120 delimiter = ',';
121 }
122 if( z[0]==0 ) break;
123 p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
124 p->azPattern[p->nPattern++] = z;
125 for(i=0; z[i] && z[i]!=delimiter && z[i]!='\n' && z[i]!='\r'; i++){}
126 if( delimiter==',' ){
127 /* Remove trailing spaces / newlines on a comma-delimited pattern */
128 for(j=i; j>1 && (z[j-1]==' ' || z[j-1]=='\n' || z[j-1]=='\r'); j--){}
129 if( j<i ) z[j] = 0;
130 }
131 if( z[i]==0 ) break;
132 z[i] = 0;
133 z += i+1;
134
+2 -1
--- src/http.c
+++ src/http.c
@@ -110,11 +110,12 @@
110110
blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);
111111
fossil_free(zEncoded);
112112
fossil_free(zCredentials);
113113
}
114114
blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
115
- blob_appendf(pHdr, "User-Agent: Fossil/" MANIFEST_VERSION "\r\n");
115
+ blob_appendf(pHdr, "User-Agent: Fossil/" RELEASE_VERSION
116
+ "-" MANIFEST_VERSION "\r\n");
116117
if( g.fHttpTrace ){
117118
blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n");
118119
}else{
119120
blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
120121
}
121122
--- src/http.c
+++ src/http.c
@@ -110,11 +110,12 @@
110 blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);
111 fossil_free(zEncoded);
112 fossil_free(zCredentials);
113 }
114 blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
115 blob_appendf(pHdr, "User-Agent: Fossil/" MANIFEST_VERSION "\r\n");
 
116 if( g.fHttpTrace ){
117 blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n");
118 }else{
119 blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
120 }
121
--- src/http.c
+++ src/http.c
@@ -110,11 +110,12 @@
110 blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);
111 fossil_free(zEncoded);
112 fossil_free(zCredentials);
113 }
114 blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
115 blob_appendf(pHdr, "User-Agent: Fossil/" RELEASE_VERSION
116 "-" MANIFEST_VERSION "\r\n");
117 if( g.fHttpTrace ){
118 blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n");
119 }else{
120 blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
121 }
122
+61 -1
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -78,23 +78,76 @@
7878
** Return the current SSL error message
7979
*/
8080
const char *ssl_errmsg(void){
8181
return sslErrMsg;
8282
}
83
+
84
+/*
85
+** When a server requests a client certificate that hasn't been provided,
86
+** display a warning message explaining what to do next.
87
+*/
88
+static int ssl_client_cert_callback(SSL *ssl, X509 **x509, EVP_PKEY **pkey){
89
+ fossil_warning("The remote server requested a client certificate for "
90
+ "authentication. Specify the pathname to a file containing the PEM "
91
+ "encoded certificate and private key with the --ssl-identity option "
92
+ "or the ssl-identity setting.");
93
+ return 0; /* no cert available */
94
+}
8395
8496
/*
8597
** Call this routine once before any other use of the SSL interface.
8698
** This routine does initial configuration of the SSL module.
8799
*/
88100
void ssl_global_init(void){
101
+ const char *zCaSetting = 0, *zCaFile = 0, *zCaDirectory = 0;
102
+
89103
if( sslIsInit==0 ){
90104
SSL_library_init();
91105
SSL_load_error_strings();
92106
ERR_load_BIO_strings();
93107
OpenSSL_add_all_algorithms();
94108
sslCtx = SSL_CTX_new(SSLv23_client_method());
95
- X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
109
+
110
+ /* Set up acceptable CA root certificates */
111
+ zCaSetting = db_get("ssl-ca-location", 0);
112
+ if( zCaSetting==0 || zCaSetting[0]=='\0' ){
113
+ /* CA location not specified, use platform's default certificate store */
114
+ X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
115
+ }else{
116
+ /* User has specified a CA location, make sure it exists and use it */
117
+ switch( file_isdir(zCaSetting) ){
118
+ case 0: { /* doesn't exist */
119
+ fossil_fatal("ssl-ca-location is set to '%s', "
120
+ "but is not a file or directory", zCaSetting);
121
+ break;
122
+ }
123
+ case 1: { /* directory */
124
+ zCaDirectory = zCaSetting;
125
+ break;
126
+ }
127
+ case 2: { /* file */
128
+ zCaFile = zCaSetting;
129
+ break;
130
+ }
131
+ }
132
+ if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){
133
+ fossil_fatal("Failed to use CA root certificates from "
134
+ "ssl-ca-location '%s'", zCaSetting);
135
+ }
136
+ }
137
+
138
+ /* Load client SSL identity, preferring the filename specified on the command line */
139
+ const char *identityFile = ( g.zSSLIdentity!= 0) ? g.zSSLIdentity : db_get("ssl-identity", 0);
140
+ if( identityFile!=0 && identityFile[0]!='\0' ){
141
+ if( SSL_CTX_use_certificate_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!= 1
142
+ || SSL_CTX_use_PrivateKey_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!=1 ){
143
+ fossil_fatal("Could not load SSL identity from %s", identityFile);
144
+ }
145
+ }
146
+ /* Register a callback to tell the user what to do when the server asks for a cert */
147
+ SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback);
148
+
96149
sslIsInit = 1;
97150
}
98151
}
99152
100153
/*
@@ -204,10 +257,17 @@
204257
if( hasSavedCertificate ){
205258
warning = "WARNING: Certificate doesn't match the "
206259
"saved certificate for this host!";
207260
}
208261
prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n"
262
+ "Either:\n"
263
+ " * verify the certificate is correct using the "
264
+ "SHA1 fingerprint above\n"
265
+ " * use the global ssl-ca-location setting to specify your CA root\n"
266
+ " certificates list\n\n"
267
+ "If you are not expecting this message, answer no and "
268
+ "contact your server\nadministrator.\n\n"
209269
"Accept certificate [a=always/y/N]? ", desc, warning);
210270
BIO_free(mem);
211271
212272
prompt_user(prompt, &ans);
213273
free(prompt);
214274
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -78,23 +78,76 @@
78 ** Return the current SSL error message
79 */
80 const char *ssl_errmsg(void){
81 return sslErrMsg;
82 }
 
 
 
 
 
 
 
 
 
 
 
 
83
84 /*
85 ** Call this routine once before any other use of the SSL interface.
86 ** This routine does initial configuration of the SSL module.
87 */
88 void ssl_global_init(void){
 
 
89 if( sslIsInit==0 ){
90 SSL_library_init();
91 SSL_load_error_strings();
92 ERR_load_BIO_strings();
93 OpenSSL_add_all_algorithms();
94 sslCtx = SSL_CTX_new(SSLv23_client_method());
95 X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96 sslIsInit = 1;
97 }
98 }
99
100 /*
@@ -204,10 +257,17 @@
204 if( hasSavedCertificate ){
205 warning = "WARNING: Certificate doesn't match the "
206 "saved certificate for this host!";
207 }
208 prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n"
 
 
 
 
 
 
 
209 "Accept certificate [a=always/y/N]? ", desc, warning);
210 BIO_free(mem);
211
212 prompt_user(prompt, &ans);
213 free(prompt);
214
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -78,23 +78,76 @@
78 ** Return the current SSL error message
79 */
80 const char *ssl_errmsg(void){
81 return sslErrMsg;
82 }
83
84 /*
85 ** When a server requests a client certificate that hasn't been provided,
86 ** display a warning message explaining what to do next.
87 */
88 static int ssl_client_cert_callback(SSL *ssl, X509 **x509, EVP_PKEY **pkey){
89 fossil_warning("The remote server requested a client certificate for "
90 "authentication. Specify the pathname to a file containing the PEM "
91 "encoded certificate and private key with the --ssl-identity option "
92 "or the ssl-identity setting.");
93 return 0; /* no cert available */
94 }
95
96 /*
97 ** Call this routine once before any other use of the SSL interface.
98 ** This routine does initial configuration of the SSL module.
99 */
100 void ssl_global_init(void){
101 const char *zCaSetting = 0, *zCaFile = 0, *zCaDirectory = 0;
102
103 if( sslIsInit==0 ){
104 SSL_library_init();
105 SSL_load_error_strings();
106 ERR_load_BIO_strings();
107 OpenSSL_add_all_algorithms();
108 sslCtx = SSL_CTX_new(SSLv23_client_method());
109
110 /* Set up acceptable CA root certificates */
111 zCaSetting = db_get("ssl-ca-location", 0);
112 if( zCaSetting==0 || zCaSetting[0]=='\0' ){
113 /* CA location not specified, use platform's default certificate store */
114 X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx));
115 }else{
116 /* User has specified a CA location, make sure it exists and use it */
117 switch( file_isdir(zCaSetting) ){
118 case 0: { /* doesn't exist */
119 fossil_fatal("ssl-ca-location is set to '%s', "
120 "but is not a file or directory", zCaSetting);
121 break;
122 }
123 case 1: { /* directory */
124 zCaDirectory = zCaSetting;
125 break;
126 }
127 case 2: { /* file */
128 zCaFile = zCaSetting;
129 break;
130 }
131 }
132 if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){
133 fossil_fatal("Failed to use CA root certificates from "
134 "ssl-ca-location '%s'", zCaSetting);
135 }
136 }
137
138 /* Load client SSL identity, preferring the filename specified on the command line */
139 const char *identityFile = ( g.zSSLIdentity!= 0) ? g.zSSLIdentity : db_get("ssl-identity", 0);
140 if( identityFile!=0 && identityFile[0]!='\0' ){
141 if( SSL_CTX_use_certificate_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!= 1
142 || SSL_CTX_use_PrivateKey_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!=1 ){
143 fossil_fatal("Could not load SSL identity from %s", identityFile);
144 }
145 }
146 /* Register a callback to tell the user what to do when the server asks for a cert */
147 SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback);
148
149 sslIsInit = 1;
150 }
151 }
152
153 /*
@@ -204,10 +257,17 @@
257 if( hasSavedCertificate ){
258 warning = "WARNING: Certificate doesn't match the "
259 "saved certificate for this host!";
260 }
261 prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n"
262 "Either:\n"
263 " * verify the certificate is correct using the "
264 "SHA1 fingerprint above\n"
265 " * use the global ssl-ca-location setting to specify your CA root\n"
266 " certificates list\n\n"
267 "If you are not expecting this message, answer no and "
268 "contact your server\nadministrator.\n\n"
269 "Accept certificate [a=always/y/N]? ", desc, warning);
270 BIO_free(mem);
271
272 prompt_user(prompt, &ans);
273 free(prompt);
274
+30 -6
--- src/import.c
+++ src/import.c
@@ -207,10 +207,19 @@
207207
static int mfile_cmp(const void *pLeft, const void *pRight){
208208
const ImportFile *pA = (const ImportFile*)pLeft;
209209
const ImportFile *pB = (const ImportFile*)pRight;
210210
return fossil_strcmp(pA->zName, pB->zName);
211211
}
212
+
213
+/*
214
+** Compare two strings for sorting.
215
+*/
216
+static int string_cmp(const void *pLeft, const void *pRight){
217
+ const char *zLeft = *(char const **)pLeft;
218
+ const char *zRight = *(char const **)pRight;
219
+ return fossil_strcmp(zLeft, zRight);
220
+}
212221
213222
/* Forward reference */
214223
static void import_prior_files(void);
215224
216225
/*
@@ -218,11 +227,14 @@
218227
** manifest artifact to the BLOB table.
219228
*/
220229
static void finish_commit(void){
221230
int i;
222231
char *zFromBranch;
232
+ char *aTCard[4]; /* Array of T cards for manifest */
233
+ int nTCard = 0; /* Entries used in aTCard[] */
223234
Blob record, cksum;
235
+
224236
import_prior_files();
225237
qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
226238
blob_zero(&record);
227239
blob_appendf(&record, "C %F\n", gg.zComment);
228240
blob_appendf(&record, "D %s\n", gg.zDate);
@@ -245,21 +257,33 @@
245257
zFromBranch = db_text(0, "SELECT brnm FROM xbranch WHERE tname=%Q",
246258
gg.zFromMark);
247259
}else{
248260
zFromBranch = 0;
249261
}
262
+
263
+ /* Add the required "T" cards to the manifest. Make sure they are added
264
+ ** in sorted order and without any duplicates. Otherwise, fossil will not
265
+ ** recognize the document as a valid manifest. */
250266
if( !gg.tagCommit && fossil_strcmp(zFromBranch, gg.zBranch)!=0 ){
251
- blob_appendf(&record, "T *branch * %F\n", gg.zBranch);
252
- blob_appendf(&record, "T *sym-%F *\n", gg.zBranch);
267
+ aTCard[nTCard++] = mprintf("T *branch * %F\n", gg.zBranch);
268
+ aTCard[nTCard++] = mprintf("T *sym-%F *\n", gg.zBranch);
253269
if( zFromBranch ){
254
- blob_appendf(&record, "T -sym-%F *\n", zFromBranch);
270
+ aTCard[nTCard++] = mprintf("T -sym-%F *\n", zFromBranch);
271
+ }
272
+ }
273
+ if( gg.zFrom==0 ){
274
+ aTCard[nTCard++] = mprintf("T *sym-trunk *\n");
275
+ }
276
+ qsort(aTCard, nTCard, sizeof(char *), string_cmp);
277
+ for(i=0; i<nTCard; i++){
278
+ if( i==0 || fossil_strcmp(aTCard[i-1], aTCard[i]) ){
279
+ blob_appendf(&record, "%s", aTCard[i]);
255280
}
256281
}
282
+ for(i=0; i<nTCard; i++) free(aTCard[i]);
283
+
257284
free(zFromBranch);
258
- if( gg.zFrom==0 ){
259
- blob_appendf(&record, "T *sym-trunk *\n");
260
- }
261285
db_multi_exec("INSERT INTO xbranch(tname, brnm) VALUES(%Q,%Q)",
262286
gg.zMark, gg.zBranch);
263287
blob_appendf(&record, "U %F\n", gg.zUser);
264288
md5sum_blob(&record, &cksum);
265289
blob_appendf(&record, "Z %b\n", &cksum);
266290
--- src/import.c
+++ src/import.c
@@ -207,10 +207,19 @@
207 static int mfile_cmp(const void *pLeft, const void *pRight){
208 const ImportFile *pA = (const ImportFile*)pLeft;
209 const ImportFile *pB = (const ImportFile*)pRight;
210 return fossil_strcmp(pA->zName, pB->zName);
211 }
 
 
 
 
 
 
 
 
 
212
213 /* Forward reference */
214 static void import_prior_files(void);
215
216 /*
@@ -218,11 +227,14 @@
218 ** manifest artifact to the BLOB table.
219 */
220 static void finish_commit(void){
221 int i;
222 char *zFromBranch;
 
 
223 Blob record, cksum;
 
224 import_prior_files();
225 qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
226 blob_zero(&record);
227 blob_appendf(&record, "C %F\n", gg.zComment);
228 blob_appendf(&record, "D %s\n", gg.zDate);
@@ -245,21 +257,33 @@
245 zFromBranch = db_text(0, "SELECT brnm FROM xbranch WHERE tname=%Q",
246 gg.zFromMark);
247 }else{
248 zFromBranch = 0;
249 }
 
 
 
 
250 if( !gg.tagCommit && fossil_strcmp(zFromBranch, gg.zBranch)!=0 ){
251 blob_appendf(&record, "T *branch * %F\n", gg.zBranch);
252 blob_appendf(&record, "T *sym-%F *\n", gg.zBranch);
253 if( zFromBranch ){
254 blob_appendf(&record, "T -sym-%F *\n", zFromBranch);
 
 
 
 
 
 
 
 
 
255 }
256 }
 
 
257 free(zFromBranch);
258 if( gg.zFrom==0 ){
259 blob_appendf(&record, "T *sym-trunk *\n");
260 }
261 db_multi_exec("INSERT INTO xbranch(tname, brnm) VALUES(%Q,%Q)",
262 gg.zMark, gg.zBranch);
263 blob_appendf(&record, "U %F\n", gg.zUser);
264 md5sum_blob(&record, &cksum);
265 blob_appendf(&record, "Z %b\n", &cksum);
266
--- src/import.c
+++ src/import.c
@@ -207,10 +207,19 @@
207 static int mfile_cmp(const void *pLeft, const void *pRight){
208 const ImportFile *pA = (const ImportFile*)pLeft;
209 const ImportFile *pB = (const ImportFile*)pRight;
210 return fossil_strcmp(pA->zName, pB->zName);
211 }
212
213 /*
214 ** Compare two strings for sorting.
215 */
216 static int string_cmp(const void *pLeft, const void *pRight){
217 const char *zLeft = *(char const **)pLeft;
218 const char *zRight = *(char const **)pRight;
219 return fossil_strcmp(zLeft, zRight);
220 }
221
222 /* Forward reference */
223 static void import_prior_files(void);
224
225 /*
@@ -218,11 +227,14 @@
227 ** manifest artifact to the BLOB table.
228 */
229 static void finish_commit(void){
230 int i;
231 char *zFromBranch;
232 char *aTCard[4]; /* Array of T cards for manifest */
233 int nTCard = 0; /* Entries used in aTCard[] */
234 Blob record, cksum;
235
236 import_prior_files();
237 qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
238 blob_zero(&record);
239 blob_appendf(&record, "C %F\n", gg.zComment);
240 blob_appendf(&record, "D %s\n", gg.zDate);
@@ -245,21 +257,33 @@
257 zFromBranch = db_text(0, "SELECT brnm FROM xbranch WHERE tname=%Q",
258 gg.zFromMark);
259 }else{
260 zFromBranch = 0;
261 }
262
263 /* Add the required "T" cards to the manifest. Make sure they are added
264 ** in sorted order and without any duplicates. Otherwise, fossil will not
265 ** recognize the document as a valid manifest. */
266 if( !gg.tagCommit && fossil_strcmp(zFromBranch, gg.zBranch)!=0 ){
267 aTCard[nTCard++] = mprintf("T *branch * %F\n", gg.zBranch);
268 aTCard[nTCard++] = mprintf("T *sym-%F *\n", gg.zBranch);
269 if( zFromBranch ){
270 aTCard[nTCard++] = mprintf("T -sym-%F *\n", zFromBranch);
271 }
272 }
273 if( gg.zFrom==0 ){
274 aTCard[nTCard++] = mprintf("T *sym-trunk *\n");
275 }
276 qsort(aTCard, nTCard, sizeof(char *), string_cmp);
277 for(i=0; i<nTCard; i++){
278 if( i==0 || fossil_strcmp(aTCard[i-1], aTCard[i]) ){
279 blob_appendf(&record, "%s", aTCard[i]);
280 }
281 }
282 for(i=0; i<nTCard; i++) free(aTCard[i]);
283
284 free(zFromBranch);
 
 
 
285 db_multi_exec("INSERT INTO xbranch(tname, brnm) VALUES(%Q,%Q)",
286 gg.zMark, gg.zBranch);
287 blob_appendf(&record, "U %F\n", gg.zUser);
288 md5sum_blob(&record, &cksum);
289 blob_appendf(&record, "Z %b\n", &cksum);
290
+14 -8
--- src/info.c
+++ src/info.c
@@ -190,11 +190,11 @@
190190
" (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
191191
" value, datetime(tagxref.mtime,'localtime'), tagtype,"
192192
" (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
193193
" FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
194194
" WHERE tagxref.rid=%d AND tagname NOT GLOB '%s'"
195
- " ORDER BY tagname", rid, rid, rid, zNotGlob
195
+ " ORDER BY tagname /*sort*/", rid, rid, rid, zNotGlob
196196
);
197197
while( db_step(&q)==SQLITE_ROW ){
198198
const char *zTagname = db_column_text(&q, 1);
199199
const char *zSrcUuid = db_column_text(&q, 2);
200200
const char *zValue = db_column_text(&q, 3);
@@ -525,11 +525,11 @@
525525
" (SELECT uuid FROM blob WHERE rid=mlink.pid),"
526526
" (SELECT uuid FROM blob WHERE rid=mlink.fid),"
527527
" (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
528528
" FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
529529
" WHERE mlink.mid=%d"
530
- " ORDER BY name",
530
+ " ORDER BY name /*sort*/",
531531
rid
532532
);
533533
while( db_step(&q)==SQLITE_ROW ){
534534
const char *zName = db_column_text(&q,0);
535535
int mperm = db_column_int(&q, 1);
@@ -1213,12 +1213,18 @@
12131213
}
12141214
12151215
12161216
/*
12171217
** WEBPAGE: artifact
1218
-** URL: /artifact?name=ARTIFACTID
1218
+** URL: /artifact/ARTIFACTID
12191219
** URL: /artifact?ci=CHECKIN&filename=PATH
1220
+**
1221
+** Additional query parameters:
1222
+**
1223
+** ln - show line numbers
1224
+** ln=N - highlight line number N
1225
+** ln=M-N - highlight lines M through N inclusive
12201226
**
12211227
** Show the complete content of a file identified by ARTIFACTID
12221228
** as preformatted text.
12231229
*/
12241230
void artifact_page(void){
@@ -1260,24 +1266,24 @@
12601266
zMime = mimetype_from_name(blob_str(&downloadName));
12611267
if( zMime ){
12621268
if( fossil_strcmp(zMime, "text/html")==0 ){
12631269
if( P("txt") ){
12641270
style_submenu_element("Html", "Html",
1265
- "%s/artifact?name=%s", g.zTop, zUuid);
1271
+ "%s/artifact/%s", g.zTop, zUuid);
12661272
}else{
12671273
renderAsHtml = 1;
12681274
style_submenu_element("Text", "Text",
1269
- "%s/artifact?name=%s&amp;txt=1", g.zTop, zUuid);
1275
+ "%s/artifact/%s?txt=1", g.zTop, zUuid);
12701276
}
12711277
}else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){
12721278
if( P("txt") ){
12731279
style_submenu_element("Wiki", "Wiki",
1274
- "%s/artifact?name=%s", g.zTop, zUuid);
1280
+ "%s/artifact/%s", g.zTop, zUuid);
12751281
}else{
12761282
renderAsWiki = 1;
12771283
style_submenu_element("Text", "Text",
1278
- "%s/artifact?name=%s&amp;txt=1", g.zTop, zUuid);
1284
+ "%s/artifact/%s?txt=1", g.zTop, zUuid);
12791285
}
12801286
}
12811287
}
12821288
@ </p></blockquote>
12831289
@ <hr />
@@ -1790,11 +1796,11 @@
17901796
@ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" />
17911797
db_prepare(&q,
17921798
"SELECT tag.tagid, tagname FROM tagxref, tag"
17931799
" WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid"
17941800
" ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)"
1795
- " ELSE tagname END",
1801
+ " ELSE tagname END /*sort*/",
17961802
rid
17971803
);
17981804
while( db_step(&q)==SQLITE_ROW ){
17991805
int tagid = db_column_int(&q, 0);
18001806
const char *zTagName = db_column_text(&q, 1);
18011807
--- src/info.c
+++ src/info.c
@@ -190,11 +190,11 @@
190 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
191 " value, datetime(tagxref.mtime,'localtime'), tagtype,"
192 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
193 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
194 " WHERE tagxref.rid=%d AND tagname NOT GLOB '%s'"
195 " ORDER BY tagname", rid, rid, rid, zNotGlob
196 );
197 while( db_step(&q)==SQLITE_ROW ){
198 const char *zTagname = db_column_text(&q, 1);
199 const char *zSrcUuid = db_column_text(&q, 2);
200 const char *zValue = db_column_text(&q, 3);
@@ -525,11 +525,11 @@
525 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
526 " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
527 " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
528 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
529 " WHERE mlink.mid=%d"
530 " ORDER BY name",
531 rid
532 );
533 while( db_step(&q)==SQLITE_ROW ){
534 const char *zName = db_column_text(&q,0);
535 int mperm = db_column_int(&q, 1);
@@ -1213,12 +1213,18 @@
1213 }
1214
1215
1216 /*
1217 ** WEBPAGE: artifact
1218 ** URL: /artifact?name=ARTIFACTID
1219 ** URL: /artifact?ci=CHECKIN&filename=PATH
 
 
 
 
 
 
1220 **
1221 ** Show the complete content of a file identified by ARTIFACTID
1222 ** as preformatted text.
1223 */
1224 void artifact_page(void){
@@ -1260,24 +1266,24 @@
1260 zMime = mimetype_from_name(blob_str(&downloadName));
1261 if( zMime ){
1262 if( fossil_strcmp(zMime, "text/html")==0 ){
1263 if( P("txt") ){
1264 style_submenu_element("Html", "Html",
1265 "%s/artifact?name=%s", g.zTop, zUuid);
1266 }else{
1267 renderAsHtml = 1;
1268 style_submenu_element("Text", "Text",
1269 "%s/artifact?name=%s&amp;txt=1", g.zTop, zUuid);
1270 }
1271 }else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){
1272 if( P("txt") ){
1273 style_submenu_element("Wiki", "Wiki",
1274 "%s/artifact?name=%s", g.zTop, zUuid);
1275 }else{
1276 renderAsWiki = 1;
1277 style_submenu_element("Text", "Text",
1278 "%s/artifact?name=%s&amp;txt=1", g.zTop, zUuid);
1279 }
1280 }
1281 }
1282 @ </p></blockquote>
1283 @ <hr />
@@ -1790,11 +1796,11 @@
1790 @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" />
1791 db_prepare(&q,
1792 "SELECT tag.tagid, tagname FROM tagxref, tag"
1793 " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid"
1794 " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)"
1795 " ELSE tagname END",
1796 rid
1797 );
1798 while( db_step(&q)==SQLITE_ROW ){
1799 int tagid = db_column_int(&q, 0);
1800 const char *zTagName = db_column_text(&q, 1);
1801
--- src/info.c
+++ src/info.c
@@ -190,11 +190,11 @@
190 " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d),"
191 " value, datetime(tagxref.mtime,'localtime'), tagtype,"
192 " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)"
193 " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid"
194 " WHERE tagxref.rid=%d AND tagname NOT GLOB '%s'"
195 " ORDER BY tagname /*sort*/", rid, rid, rid, zNotGlob
196 );
197 while( db_step(&q)==SQLITE_ROW ){
198 const char *zTagname = db_column_text(&q, 1);
199 const char *zSrcUuid = db_column_text(&q, 2);
200 const char *zValue = db_column_text(&q, 3);
@@ -525,11 +525,11 @@
525 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
526 " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
527 " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
528 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
529 " WHERE mlink.mid=%d"
530 " ORDER BY name /*sort*/",
531 rid
532 );
533 while( db_step(&q)==SQLITE_ROW ){
534 const char *zName = db_column_text(&q,0);
535 int mperm = db_column_int(&q, 1);
@@ -1213,12 +1213,18 @@
1213 }
1214
1215
1216 /*
1217 ** WEBPAGE: artifact
1218 ** URL: /artifact/ARTIFACTID
1219 ** URL: /artifact?ci=CHECKIN&filename=PATH
1220 **
1221 ** Additional query parameters:
1222 **
1223 ** ln - show line numbers
1224 ** ln=N - highlight line number N
1225 ** ln=M-N - highlight lines M through N inclusive
1226 **
1227 ** Show the complete content of a file identified by ARTIFACTID
1228 ** as preformatted text.
1229 */
1230 void artifact_page(void){
@@ -1260,24 +1266,24 @@
1266 zMime = mimetype_from_name(blob_str(&downloadName));
1267 if( zMime ){
1268 if( fossil_strcmp(zMime, "text/html")==0 ){
1269 if( P("txt") ){
1270 style_submenu_element("Html", "Html",
1271 "%s/artifact/%s", g.zTop, zUuid);
1272 }else{
1273 renderAsHtml = 1;
1274 style_submenu_element("Text", "Text",
1275 "%s/artifact/%s?txt=1", g.zTop, zUuid);
1276 }
1277 }else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){
1278 if( P("txt") ){
1279 style_submenu_element("Wiki", "Wiki",
1280 "%s/artifact/%s", g.zTop, zUuid);
1281 }else{
1282 renderAsWiki = 1;
1283 style_submenu_element("Text", "Text",
1284 "%s/artifact/%s?txt=1", g.zTop, zUuid);
1285 }
1286 }
1287 }
1288 @ </p></blockquote>
1289 @ <hr />
@@ -1790,11 +1796,11 @@
1796 @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" />
1797 db_prepare(&q,
1798 "SELECT tag.tagid, tagname FROM tagxref, tag"
1799 " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid"
1800 " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)"
1801 " ELSE tagname END /*sort*/",
1802 rid
1803 );
1804 while( db_step(&q)==SQLITE_ROW ){
1805 int tagid = db_column_int(&q, 0);
1806 const char *zTagName = db_column_text(&q, 1);
1807
+10 -4
--- src/main.c
+++ src/main.c
@@ -2,11 +2,11 @@
22
** Copyright (c) 2006 D. Richard Hipp
33
**
44
** This program is free software; you can redistribute it and/or
55
** modify it under the terms of the Simplified BSD License (also
66
** known as the "2-Clause License" or "FreeBSD License".)
7
-
7
+**
88
** This program is distributed in the hope that it will be useful,
99
** but without any warranty; without even the implied warranty of
1010
** merchantability or fitness for a particular purpose.
1111
**
1212
** Author contact information:
@@ -105,10 +105,11 @@
105105
char *urlProxyAuth; /* Proxy-Authorizer: string */
106106
char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */
107107
int dontKeepUrl; /* Do not persist the URL */
108108
109109
const char *zLogin; /* Login name. "" if not logged in. */
110
+ const char *zSSLIdentity; /* Value of --ssl-identity option, filename of SSL client identity */
110111
int useLocalauth; /* No login required if from 127.0.0.1 */
111112
int noPswd; /* Logged in without password (on 127.0.0.1) */
112113
int userUid; /* Integer user id */
113114
114115
/* Information used to populate the RCVFROM table */
@@ -251,10 +252,11 @@
251252
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
252253
if( g.fSqlTrace ) g.fSqlStats = 1;
253254
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
254255
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
255256
g.zLogin = find_option("user", "U", 1);
257
+ g.zSSLIdentity = find_option("ssl-identity", 0, 1);
256258
if( find_option("help",0,0)!=0 ){
257259
/* --help anywhere on the command line is translated into
258260
** "fossil help argv[1] argv[2]..." */
259261
int i;
260262
char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
@@ -644,11 +646,11 @@
644646
** Usage: %fossil version
645647
**
646648
** Print the source code version number for the fossil executable.
647649
*/
648650
void version_cmd(void){
649
- fossil_print("This is fossil version "
651
+ fossil_print("This is fossil version " RELEASE_VERSION " "
650652
MANIFEST_VERSION " " MANIFEST_DATE " UTC\n");
651653
}
652654
653655
654656
/*
@@ -1102,11 +1104,12 @@
11021104
if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
11031105
cgi_setenv("HOME", blob_str(&value));
11041106
blob_reset(&value);
11051107
continue;
11061108
}
1107
- if( blob_eq(&key, "repository:") && blob_token(&line, &value) ){
1109
+ if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
1110
+ blob_trim(&value);
11081111
db_open_repository(blob_str(&value));
11091112
blob_reset(&value);
11101113
continue;
11111114
}
11121115
if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
@@ -1437,11 +1440,14 @@
14371440
if( isUiCmd ){
14381441
zBrowser = db_get("web-browser", "start");
14391442
zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
14401443
}
14411444
db_close(1);
1442
- win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags);
1445
+ if( win32_http_service(iPort, zNotFound, flags) ){
1446
+ win32_http_server(iPort, mxPort, zBrowserCmd,
1447
+ zStopperFile, zNotFound, flags);
1448
+ }
14431449
#endif
14441450
}
14451451
14461452
/*
14471453
** COMMAND: test-echo
14481454
--- src/main.c
+++ src/main.c
@@ -2,11 +2,11 @@
2 ** Copyright (c) 2006 D. Richard Hipp
3 **
4 ** This program is free software; you can redistribute it and/or
5 ** modify it under the terms of the Simplified BSD License (also
6 ** known as the "2-Clause License" or "FreeBSD License".)
7
8 ** This program is distributed in the hope that it will be useful,
9 ** but without any warranty; without even the implied warranty of
10 ** merchantability or fitness for a particular purpose.
11 **
12 ** Author contact information:
@@ -105,10 +105,11 @@
105 char *urlProxyAuth; /* Proxy-Authorizer: string */
106 char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */
107 int dontKeepUrl; /* Do not persist the URL */
108
109 const char *zLogin; /* Login name. "" if not logged in. */
 
110 int useLocalauth; /* No login required if from 127.0.0.1 */
111 int noPswd; /* Logged in without password (on 127.0.0.1) */
112 int userUid; /* Integer user id */
113
114 /* Information used to populate the RCVFROM table */
@@ -251,10 +252,11 @@
251 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
252 if( g.fSqlTrace ) g.fSqlStats = 1;
253 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
254 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
255 g.zLogin = find_option("user", "U", 1);
 
256 if( find_option("help",0,0)!=0 ){
257 /* --help anywhere on the command line is translated into
258 ** "fossil help argv[1] argv[2]..." */
259 int i;
260 char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
@@ -644,11 +646,11 @@
644 ** Usage: %fossil version
645 **
646 ** Print the source code version number for the fossil executable.
647 */
648 void version_cmd(void){
649 fossil_print("This is fossil version "
650 MANIFEST_VERSION " " MANIFEST_DATE " UTC\n");
651 }
652
653
654 /*
@@ -1102,11 +1104,12 @@
1102 if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
1103 cgi_setenv("HOME", blob_str(&value));
1104 blob_reset(&value);
1105 continue;
1106 }
1107 if( blob_eq(&key, "repository:") && blob_token(&line, &value) ){
 
1108 db_open_repository(blob_str(&value));
1109 blob_reset(&value);
1110 continue;
1111 }
1112 if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
@@ -1437,11 +1440,14 @@
1437 if( isUiCmd ){
1438 zBrowser = db_get("web-browser", "start");
1439 zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
1440 }
1441 db_close(1);
1442 win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags);
 
 
 
1443 #endif
1444 }
1445
1446 /*
1447 ** COMMAND: test-echo
1448
--- src/main.c
+++ src/main.c
@@ -2,11 +2,11 @@
2 ** Copyright (c) 2006 D. Richard Hipp
3 **
4 ** This program is free software; you can redistribute it and/or
5 ** modify it under the terms of the Simplified BSD License (also
6 ** known as the "2-Clause License" or "FreeBSD License".)
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but without any warranty; without even the implied warranty of
10 ** merchantability or fitness for a particular purpose.
11 **
12 ** Author contact information:
@@ -105,10 +105,11 @@
105 char *urlProxyAuth; /* Proxy-Authorizer: string */
106 char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */
107 int dontKeepUrl; /* Do not persist the URL */
108
109 const char *zLogin; /* Login name. "" if not logged in. */
110 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of SSL client identity */
111 int useLocalauth; /* No login required if from 127.0.0.1 */
112 int noPswd; /* Logged in without password (on 127.0.0.1) */
113 int userUid; /* Integer user id */
114
115 /* Information used to populate the RCVFROM table */
@@ -251,10 +252,11 @@
252 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
253 if( g.fSqlTrace ) g.fSqlStats = 1;
254 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
255 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
256 g.zLogin = find_option("user", "U", 1);
257 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
258 if( find_option("help",0,0)!=0 ){
259 /* --help anywhere on the command line is translated into
260 ** "fossil help argv[1] argv[2]..." */
261 int i;
262 char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
@@ -644,11 +646,11 @@
646 ** Usage: %fossil version
647 **
648 ** Print the source code version number for the fossil executable.
649 */
650 void version_cmd(void){
651 fossil_print("This is fossil version " RELEASE_VERSION " "
652 MANIFEST_VERSION " " MANIFEST_DATE " UTC\n");
653 }
654
655
656 /*
@@ -1102,11 +1104,12 @@
1104 if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
1105 cgi_setenv("HOME", blob_str(&value));
1106 blob_reset(&value);
1107 continue;
1108 }
1109 if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
1110 blob_trim(&value);
1111 db_open_repository(blob_str(&value));
1112 blob_reset(&value);
1113 continue;
1114 }
1115 if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
@@ -1437,11 +1440,14 @@
1440 if( isUiCmd ){
1441 zBrowser = db_get("web-browser", "start");
1442 zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser);
1443 }
1444 db_close(1);
1445 if( win32_http_service(iPort, zNotFound, flags) ){
1446 win32_http_server(iPort, mxPort, zBrowserCmd,
1447 zStopperFile, zNotFound, flags);
1448 }
1449 #endif
1450 }
1451
1452 /*
1453 ** COMMAND: test-echo
1454
+16 -7
--- src/main.mk
+++ src/main.mk
@@ -281,22 +281,31 @@
281281
$(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
282282
283283
$(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
284284
$(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
285285
286
+$(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c
287
+ $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c
288
+
286289
# WARNING. DANGER. Running the testsuite modifies the repository the
287290
# build is done from, i.e. the checkout belongs to. Do not sync/push
288291
# the repository after running the tests.
289292
test: $(APPNAME)
290293
$(TCLSH) test/tester.tcl $(APPNAME)
291294
292
-$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest
293
- awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h
294
- awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h
295
- awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n", substr($$2,1,10),substr($$2,12,8)}' $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h
295
+$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
296
+ $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
296297
297
-EXTRAOBJ = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
298
+# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
299
+# to 1. If it is set to 1, then there is no need to build or link
300
+# the sqlite3.o object. Instead, the system sqlite will be linked
301
+# using -lsqlite3.
302
+SQLITE3_OBJ.1 =
303
+SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
304
+SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
305
+
306
+EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
298307
299308
$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
300309
$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
301310
302311
# This rule prevents make from using its default rules to try build
@@ -889,16 +898,16 @@
889898
$(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
890899
$(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
891900
892901
$(OBJDIR)/zip.h: $(OBJDIR)/headers
893902
$(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c
894
- $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT2 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
903
+ $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT3 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
895904
896
-$(OBJDIR)/shell.o: $(SRCDIR)/shell.c
905
+$(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h
897906
$(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
898907
899908
$(OBJDIR)/th.o: $(SRCDIR)/th.c
900909
$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
901910
902911
$(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
903912
$(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
904913
905914
--- src/main.mk
+++ src/main.mk
@@ -281,22 +281,31 @@
281 $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
282
283 $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
284 $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
285
 
 
 
286 # WARNING. DANGER. Running the testsuite modifies the repository the
287 # build is done from, i.e. the checkout belongs to. Do not sync/push
288 # the repository after running the tests.
289 test: $(APPNAME)
290 $(TCLSH) test/tester.tcl $(APPNAME)
291
292 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest
293 awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h
294 awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h
295 awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n", substr($$2,1,10),substr($$2,12,8)}' $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h
296
297 EXTRAOBJ = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
 
 
 
 
 
 
 
 
298
299 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
300 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
301
302 # This rule prevents make from using its default rules to try build
@@ -889,16 +898,16 @@
889 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
890 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
891
892 $(OBJDIR)/zip.h: $(OBJDIR)/headers
893 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c
894 $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT2 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
895
896 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c
897 $(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
898
899 $(OBJDIR)/th.o: $(SRCDIR)/th.c
900 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
901
902 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
903 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
904
905
--- src/main.mk
+++ src/main.mk
@@ -281,22 +281,31 @@
281 $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
282
283 $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
284 $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
285
286 $(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c
287 $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c
288
289 # WARNING. DANGER. Running the testsuite modifies the repository the
290 # build is done from, i.e. the checkout belongs to. Do not sync/push
291 # the repository after running the tests.
292 test: $(APPNAME)
293 $(TCLSH) test/tester.tcl $(APPNAME)
294
295 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
296 $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
 
 
297
298 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
299 # to 1. If it is set to 1, then there is no need to build or link
300 # the sqlite3.o object. Instead, the system sqlite will be linked
301 # using -lsqlite3.
302 SQLITE3_OBJ.1 =
303 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
304 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
305
306 EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
307
308 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
309 $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
310
311 # This rule prevents make from using its default rules to try build
@@ -889,16 +898,16 @@
898 $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h
899 $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c
900
901 $(OBJDIR)/zip.h: $(OBJDIR)/headers
902 $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c
903 $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT3 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o
904
905 $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h
906 $(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o
907
908 $(OBJDIR)/th.o: $(SRCDIR)/th.c
909 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o
910
911 $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c
912 $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o
913
914
--- src/makeheaders.c
+++ src/makeheaders.c
@@ -3066,11 +3066,11 @@
30663066
*/
30673067
if( zSrc[nSrc]==':' ){
30683068
int nHdr;
30693069
char *zHdr;
30703070
zHdr = &zSrc[nSrc+1];
3071
- for(nHdr=0; zHdr[nHdr] && zHdr[nHdr]!=':'; nHdr++){}
3071
+ for(nHdr=0; zHdr[nHdr]; nHdr++){}
30723072
pFile->zHdr = StrDup(zHdr,nHdr);
30733073
}
30743074
30753075
/* Look for any 'c' or 'C' in the suffix of the file name and change
30763076
** that character to 'h' or 'H' respectively. If no 'c' or 'C' is found,
30773077
--- src/makeheaders.c
+++ src/makeheaders.c
@@ -3066,11 +3066,11 @@
3066 */
3067 if( zSrc[nSrc]==':' ){
3068 int nHdr;
3069 char *zHdr;
3070 zHdr = &zSrc[nSrc+1];
3071 for(nHdr=0; zHdr[nHdr] && zHdr[nHdr]!=':'; nHdr++){}
3072 pFile->zHdr = StrDup(zHdr,nHdr);
3073 }
3074
3075 /* Look for any 'c' or 'C' in the suffix of the file name and change
3076 ** that character to 'h' or 'H' respectively. If no 'c' or 'C' is found,
3077
--- src/makeheaders.c
+++ src/makeheaders.c
@@ -3066,11 +3066,11 @@
3066 */
3067 if( zSrc[nSrc]==':' ){
3068 int nHdr;
3069 char *zHdr;
3070 zHdr = &zSrc[nSrc+1];
3071 for(nHdr=0; zHdr[nHdr]; nHdr++){}
3072 pFile->zHdr = StrDup(zHdr,nHdr);
3073 }
3074
3075 /* Look for any 'c' or 'C' in the suffix of the file name and change
3076 ** that character to 'h' or 'H' respectively. If no 'c' or 'C' is found,
3077
+38 -31
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -176,27 +176,34 @@
176176
$(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
177177
178178
$(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
179179
$(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
180180
181
+$(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c
182
+ $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c
183
+
181184
# WARNING. DANGER. Running the testsuite modifies the repository the
182185
# build is done from, i.e. the checkout belongs to. Do not sync/push
183186
# the repository after running the tests.
184187
test: $(APPNAME)
185188
$(TCLSH) test/tester.tcl $(APPNAME)
186189
187
-$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest
188
- awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' \
189
- $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h
190
- awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' \
191
- $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h
192
- awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n",\
193
- substr($$2,1,10),substr($$2,12,8)}' \
194
- $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h
190
+$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
191
+ $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \
192
+ $(SRCDIR)/../manifest \
193
+ $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
194
+
195
+# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
196
+# to 1. If it is set to 1, then there is no need to build or link
197
+# the sqlite3.o object. Instead, the system sqlite will be linked
198
+# using -lsqlite3.
199
+SQLITE3_OBJ.1 =
200
+SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
201
+SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
195202
196203
EXTRAOBJ = \
197
- $(OBJDIR)/sqlite3.o \
204
+ $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
198205
$(OBJDIR)/shell.o \
199206
$(OBJDIR)/th.o \
200207
$(OBJDIR)/th_lang.o
201208
202209
$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
@@ -241,17 +248,17 @@
241248
242249
writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
243250
set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1}
244251
append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4"
245252
#append opt " -DSQLITE_ENABLE_FTS3=1"
246
-append opt " -DSQLITE_ENABLE_STAT2"
253
+append opt " -DSQLITE_ENABLE_STAT3"
247254
append opt " -Dlocaltime=fossil_localtime"
248255
append opt " -DSQLITE_ENABLE_LOCKING_STYLE=0"
249256
set SQLITE_OPTIONS $opt
250257
writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
251258
252
-writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c"
259
+writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
253260
set opt {-Dmain=sqlite3_shell}
254261
append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1"
255262
writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
256263
257264
writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
@@ -389,21 +396,21 @@
389396
$(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
390397
391398
$(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
392399
$(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
393400
394
-$(VERSION): $(SRCDIR)/../win/version.c
395
- $(BCC) -o $(OBJDIR)/version $(SRCDIR)/../win/version.c
401
+$(VERSION): $(SRCDIR)/mkversion.c
402
+ $(BCC) -o $(OBJDIR)/version $(SRCDIR)/mkversion.c
396403
397404
# WARNING. DANGER. Running the testsuite modifies the repository the
398405
# build is done from, i.e. the checkout belongs to. Do not sync/push
399406
# the repository after running the tests.
400407
test: $(APPNAME)
401408
$(TCLSH) test/tester.tcl $(APPNAME)
402409
403410
$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION)
404
- $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest >$(OBJDIR)/VERSION.h
411
+ $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
405412
406413
EXTRAOBJ = \
407414
$(OBJDIR)/sqlite3.o \
408415
$(OBJDIR)/shell.o \
409416
$(OBJDIR)/th.o \
@@ -459,11 +466,11 @@
459466
460467
writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
461468
set opt $SQLITE_OPTIONS
462469
writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
463470
464
-writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c"
471
+writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
465472
set opt {-Dmain=sqlite3_shell}
466473
append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1"
467474
writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
468475
469476
writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
@@ -556,11 +563,11 @@
556563
$(BCC) -o$@ $**
557564
558565
mkindex$E: $(SRCDIR)\mkindex.c
559566
$(BCC) -o$@ $**
560567
561
-version$E: $B\win\version.c
568
+version$E: $B\src\mkversion.c
562569
$(BCC) -o$@ $**
563570
564571
$(OBJDIR)\shell$O : $(SRCDIR)\shell.c
565572
$(TCC) -o$@ -c -Dmain=sqlite3_shell $(SQLITE_OPTIONS) $**
566573
@@ -571,11 +578,11 @@
571578
$(TCC) -o$@ -c $**
572579
573580
$(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c
574581
$(TCC) -o$@ -c $**
575582
576
-VERSION.h : version$E $B\manifest.uuid $B\manifest
583
+VERSION.h : version$E $B\manifest.uuid $B\manifest $B\VERSION
577584
+$** > $@
578585
579586
page_index.h: mkindex$E $(SRC)
580587
+$** > $@
581588
@@ -582,11 +589,11 @@
582589
clean:
583590
-del $(OBJDIR)\*.obj
584591
-del *.obj *_.c *.h *.map
585592
586593
realclean:
587
- -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E
594
+ -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E
588595
589596
}
590597
foreach s [lsort $src] {
591598
writeln "\$(OBJDIR)\\$s\$O : ${s}_.c ${s}.h"
592599
writeln "\t\$(TCC) -o\$@ -c ${s}_.c\n"
@@ -646,11 +653,11 @@
646653
INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
647654
648655
CFLAGS = -nologo -MT -O2
649656
BCC = $(CC) $(CFLAGS)
650657
TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
651
-LIBS = $(ZLIB) ws2_32.lib $(SSLLIB)
658
+LIBS = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
652659
LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
653660
}
654661
regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS
655662
writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n"
656663
writeln -nonewline "SRC = "
@@ -669,18 +676,18 @@
669676
670677
all: $(OX) $(APPNAME)
671678
672679
$(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts
673680
cd $(OX)
674
- link -LINK -OUT:$@ $(LIBDIR) @linkopts
681
+ link /NODEFAULTLIB:msvcrt -OUT:$@ $(LIBDIR) @linkopts
675682
676683
$(OX)\linkopts: $B\win\Makefile.msc}
677
-writeln -nonewline "\techo "
678
-foreach s [lsort $src] {
679
- writeln -nonewline "$s "
684
+set redir {>}
685
+foreach s [lsort [concat $src {shell sqlite3 th th_lang}]] {
686
+ writeln "\techo \$(OX)\\$s.obj $redir \$@"
687
+ set redir {>>}
680688
}
681
-writeln "sqlite3 th th_lang > \$@"
682689
writeln "\techo \$(LIBS) >> \$@\n\n"
683690
684691
writeln {
685692
686693
$(OX):
@@ -693,15 +700,15 @@
693700
$(BCC) $**
694701
695702
mkindex$E: $(SRCDIR)\mkindex.c
696703
$(BCC) $**
697704
698
-version$E: $B\win\version.c
705
+mkversion$E: $B\src\mkversion.c
699706
$(BCC) $**
700707
701708
$(OX)\shell$O : $(SRCDIR)\shell.c
702
- $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c shell_.c
709
+ $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c $(SRCDIR)\shell.c
703710
704711
$(OX)\sqlite3$O : $(SRCDIR)\sqlite3.c
705712
$(TCC) /Fo$@ -c $(SQLITE_OPTIONS) $**
706713
707714
$(OX)\th$O : $(SRCDIR)\th.c
@@ -708,11 +715,11 @@
708715
$(TCC) /Fo$@ -c $**
709716
710717
$(OX)\th_lang$O : $(SRCDIR)\th_lang.c
711718
$(TCC) /Fo$@ -c $**
712719
713
-VERSION.h : version$E $B\manifest.uuid $B\manifest
720
+VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION
714721
$** > $@
715722
716723
page_index.h: mkindex$E $(SRC)
717724
$** > $@
718725
@@ -720,11 +727,11 @@
720727
-del $(OX)\*.obj
721728
-del *.obj *_.c *.h *.map
722729
-del headers linkopts
723730
724731
realclean:
725
- -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E
732
+ -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E
726733
727734
}
728735
foreach s [lsort $src] {
729736
writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h"
730737
writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n"
@@ -880,11 +887,11 @@
880887
# compiling standard fossil utils
881888
$(UTILS_OBJ): %.obj: $(SRCDIR)%.c
882889
$(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@"
883890
884891
# compile special windows utils
885
-version.obj: $(WINDIR)version.c
892
+version.obj: $(SRCDIR)mkversion.c
886893
$(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@"
887894
888895
# generate the translated c-source files
889896
$(TRANSLATEDSRC): %_.c: $(SRCDIR)%.c translate.exe
890897
translate.exe $< >$@
@@ -892,12 +899,12 @@
892899
# generate the index source, containing all web references,..
893900
page_index.h: $(TRANSLATEDSRC) mkindex.exe
894901
mkindex.exe $(TRANSLATEDSRC) >$@
895902
896903
# extracting version info from manifest
897
-VERSION.h: version.exe ..\manifest.uuid ..\manifest
898
- version.exe ..\manifest.uuid ..\manifest > $@
904
+VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
905
+ version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@
899906
900907
# generate the simplified headers
901908
headers: makeheaders.exe page_index.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
902909
makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
903910
echo Done >$@
904911
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -176,27 +176,34 @@
176 $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
177
178 $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
179 $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
180
 
 
 
181 # WARNING. DANGER. Running the testsuite modifies the repository the
182 # build is done from, i.e. the checkout belongs to. Do not sync/push
183 # the repository after running the tests.
184 test: $(APPNAME)
185 $(TCLSH) test/tester.tcl $(APPNAME)
186
187 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest
188 awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' \
189 $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h
190 awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' \
191 $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h
192 awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n",\
193 substr($$2,1,10),substr($$2,12,8)}' \
194 $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h
 
 
 
 
195
196 EXTRAOBJ = \
197 $(OBJDIR)/sqlite3.o \
198 $(OBJDIR)/shell.o \
199 $(OBJDIR)/th.o \
200 $(OBJDIR)/th_lang.o
201
202 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
@@ -241,17 +248,17 @@
241
242 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
243 set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1}
244 append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4"
245 #append opt " -DSQLITE_ENABLE_FTS3=1"
246 append opt " -DSQLITE_ENABLE_STAT2"
247 append opt " -Dlocaltime=fossil_localtime"
248 append opt " -DSQLITE_ENABLE_LOCKING_STYLE=0"
249 set SQLITE_OPTIONS $opt
250 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
251
252 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c"
253 set opt {-Dmain=sqlite3_shell}
254 append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1"
255 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
256
257 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
@@ -389,21 +396,21 @@
389 $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
390
391 $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
392 $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
393
394 $(VERSION): $(SRCDIR)/../win/version.c
395 $(BCC) -o $(OBJDIR)/version $(SRCDIR)/../win/version.c
396
397 # WARNING. DANGER. Running the testsuite modifies the repository the
398 # build is done from, i.e. the checkout belongs to. Do not sync/push
399 # the repository after running the tests.
400 test: $(APPNAME)
401 $(TCLSH) test/tester.tcl $(APPNAME)
402
403 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION)
404 $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest >$(OBJDIR)/VERSION.h
405
406 EXTRAOBJ = \
407 $(OBJDIR)/sqlite3.o \
408 $(OBJDIR)/shell.o \
409 $(OBJDIR)/th.o \
@@ -459,11 +466,11 @@
459
460 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
461 set opt $SQLITE_OPTIONS
462 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
463
464 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c"
465 set opt {-Dmain=sqlite3_shell}
466 append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1"
467 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
468
469 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
@@ -556,11 +563,11 @@
556 $(BCC) -o$@ $**
557
558 mkindex$E: $(SRCDIR)\mkindex.c
559 $(BCC) -o$@ $**
560
561 version$E: $B\win\version.c
562 $(BCC) -o$@ $**
563
564 $(OBJDIR)\shell$O : $(SRCDIR)\shell.c
565 $(TCC) -o$@ -c -Dmain=sqlite3_shell $(SQLITE_OPTIONS) $**
566
@@ -571,11 +578,11 @@
571 $(TCC) -o$@ -c $**
572
573 $(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c
574 $(TCC) -o$@ -c $**
575
576 VERSION.h : version$E $B\manifest.uuid $B\manifest
577 +$** > $@
578
579 page_index.h: mkindex$E $(SRC)
580 +$** > $@
581
@@ -582,11 +589,11 @@
582 clean:
583 -del $(OBJDIR)\*.obj
584 -del *.obj *_.c *.h *.map
585
586 realclean:
587 -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E
588
589 }
590 foreach s [lsort $src] {
591 writeln "\$(OBJDIR)\\$s\$O : ${s}_.c ${s}.h"
592 writeln "\t\$(TCC) -o\$@ -c ${s}_.c\n"
@@ -646,11 +653,11 @@
646 INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
647
648 CFLAGS = -nologo -MT -O2
649 BCC = $(CC) $(CFLAGS)
650 TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
651 LIBS = $(ZLIB) ws2_32.lib $(SSLLIB)
652 LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
653 }
654 regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS
655 writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n"
656 writeln -nonewline "SRC = "
@@ -669,18 +676,18 @@
669
670 all: $(OX) $(APPNAME)
671
672 $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts
673 cd $(OX)
674 link -LINK -OUT:$@ $(LIBDIR) @linkopts
675
676 $(OX)\linkopts: $B\win\Makefile.msc}
677 writeln -nonewline "\techo "
678 foreach s [lsort $src] {
679 writeln -nonewline "$s "
 
680 }
681 writeln "sqlite3 th th_lang > \$@"
682 writeln "\techo \$(LIBS) >> \$@\n\n"
683
684 writeln {
685
686 $(OX):
@@ -693,15 +700,15 @@
693 $(BCC) $**
694
695 mkindex$E: $(SRCDIR)\mkindex.c
696 $(BCC) $**
697
698 version$E: $B\win\version.c
699 $(BCC) $**
700
701 $(OX)\shell$O : $(SRCDIR)\shell.c
702 $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c shell_.c
703
704 $(OX)\sqlite3$O : $(SRCDIR)\sqlite3.c
705 $(TCC) /Fo$@ -c $(SQLITE_OPTIONS) $**
706
707 $(OX)\th$O : $(SRCDIR)\th.c
@@ -708,11 +715,11 @@
708 $(TCC) /Fo$@ -c $**
709
710 $(OX)\th_lang$O : $(SRCDIR)\th_lang.c
711 $(TCC) /Fo$@ -c $**
712
713 VERSION.h : version$E $B\manifest.uuid $B\manifest
714 $** > $@
715
716 page_index.h: mkindex$E $(SRC)
717 $** > $@
718
@@ -720,11 +727,11 @@
720 -del $(OX)\*.obj
721 -del *.obj *_.c *.h *.map
722 -del headers linkopts
723
724 realclean:
725 -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E
726
727 }
728 foreach s [lsort $src] {
729 writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h"
730 writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n"
@@ -880,11 +887,11 @@
880 # compiling standard fossil utils
881 $(UTILS_OBJ): %.obj: $(SRCDIR)%.c
882 $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@"
883
884 # compile special windows utils
885 version.obj: $(WINDIR)version.c
886 $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@"
887
888 # generate the translated c-source files
889 $(TRANSLATEDSRC): %_.c: $(SRCDIR)%.c translate.exe
890 translate.exe $< >$@
@@ -892,12 +899,12 @@
892 # generate the index source, containing all web references,..
893 page_index.h: $(TRANSLATEDSRC) mkindex.exe
894 mkindex.exe $(TRANSLATEDSRC) >$@
895
896 # extracting version info from manifest
897 VERSION.h: version.exe ..\manifest.uuid ..\manifest
898 version.exe ..\manifest.uuid ..\manifest > $@
899
900 # generate the simplified headers
901 headers: makeheaders.exe page_index.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
902 makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
903 echo Done >$@
904
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -176,27 +176,34 @@
176 $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
177
178 $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
179 $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
180
181 $(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c
182 $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c
183
184 # WARNING. DANGER. Running the testsuite modifies the repository the
185 # build is done from, i.e. the checkout belongs to. Do not sync/push
186 # the repository after running the tests.
187 test: $(APPNAME)
188 $(TCLSH) test/tester.tcl $(APPNAME)
189
190 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion
191 $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \
192 $(SRCDIR)/../manifest \
193 $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
194
195 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
196 # to 1. If it is set to 1, then there is no need to build or link
197 # the sqlite3.o object. Instead, the system sqlite will be linked
198 # using -lsqlite3.
199 SQLITE3_OBJ.1 =
200 SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
201 SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
202
203 EXTRAOBJ = \
204 $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
205 $(OBJDIR)/shell.o \
206 $(OBJDIR)/th.o \
207 $(OBJDIR)/th_lang.o
208
209 $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ)
@@ -241,17 +248,17 @@
248
249 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
250 set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1}
251 append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4"
252 #append opt " -DSQLITE_ENABLE_FTS3=1"
253 append opt " -DSQLITE_ENABLE_STAT3"
254 append opt " -Dlocaltime=fossil_localtime"
255 append opt " -DSQLITE_ENABLE_LOCKING_STYLE=0"
256 set SQLITE_OPTIONS $opt
257 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
258
259 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
260 set opt {-Dmain=sqlite3_shell}
261 append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1"
262 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
263
264 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
@@ -389,21 +396,21 @@
396 $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c
397
398 $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c
399 $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c
400
401 $(VERSION): $(SRCDIR)/mkversion.c
402 $(BCC) -o $(OBJDIR)/version $(SRCDIR)/mkversion.c
403
404 # WARNING. DANGER. Running the testsuite modifies the repository the
405 # build is done from, i.e. the checkout belongs to. Do not sync/push
406 # the repository after running the tests.
407 test: $(APPNAME)
408 $(TCLSH) test/tester.tcl $(APPNAME)
409
410 $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION)
411 $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h
412
413 EXTRAOBJ = \
414 $(OBJDIR)/sqlite3.o \
415 $(OBJDIR)/shell.o \
416 $(OBJDIR)/th.o \
@@ -459,11 +466,11 @@
466
467 writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
468 set opt $SQLITE_OPTIONS
469 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n"
470
471 writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h"
472 set opt {-Dmain=sqlite3_shell}
473 append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1"
474 writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n"
475
476 writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c"
@@ -556,11 +563,11 @@
563 $(BCC) -o$@ $**
564
565 mkindex$E: $(SRCDIR)\mkindex.c
566 $(BCC) -o$@ $**
567
568 version$E: $B\src\mkversion.c
569 $(BCC) -o$@ $**
570
571 $(OBJDIR)\shell$O : $(SRCDIR)\shell.c
572 $(TCC) -o$@ -c -Dmain=sqlite3_shell $(SQLITE_OPTIONS) $**
573
@@ -571,11 +578,11 @@
578 $(TCC) -o$@ -c $**
579
580 $(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c
581 $(TCC) -o$@ -c $**
582
583 VERSION.h : version$E $B\manifest.uuid $B\manifest $B\VERSION
584 +$** > $@
585
586 page_index.h: mkindex$E $(SRC)
587 +$** > $@
588
@@ -582,11 +589,11 @@
589 clean:
590 -del $(OBJDIR)\*.obj
591 -del *.obj *_.c *.h *.map
592
593 realclean:
594 -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E
595
596 }
597 foreach s [lsort $src] {
598 writeln "\$(OBJDIR)\\$s\$O : ${s}_.c ${s}.h"
599 writeln "\t\$(TCC) -o\$@ -c ${s}_.c\n"
@@ -646,11 +653,11 @@
653 INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR)
654
655 CFLAGS = -nologo -MT -O2
656 BCC = $(CC) $(CFLAGS)
657 TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL)
658 LIBS = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB)
659 LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR)
660 }
661 regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS
662 writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n"
663 writeln -nonewline "SRC = "
@@ -669,18 +676,18 @@
676
677 all: $(OX) $(APPNAME)
678
679 $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts
680 cd $(OX)
681 link /NODEFAULTLIB:msvcrt -OUT:$@ $(LIBDIR) @linkopts
682
683 $(OX)\linkopts: $B\win\Makefile.msc}
684 set redir {>}
685 foreach s [lsort [concat $src {shell sqlite3 th th_lang}]] {
686 writeln "\techo \$(OX)\\$s.obj $redir \$@"
687 set redir {>>}
688 }
 
689 writeln "\techo \$(LIBS) >> \$@\n\n"
690
691 writeln {
692
693 $(OX):
@@ -693,15 +700,15 @@
700 $(BCC) $**
701
702 mkindex$E: $(SRCDIR)\mkindex.c
703 $(BCC) $**
704
705 mkversion$E: $B\src\mkversion.c
706 $(BCC) $**
707
708 $(OX)\shell$O : $(SRCDIR)\shell.c
709 $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c $(SRCDIR)\shell.c
710
711 $(OX)\sqlite3$O : $(SRCDIR)\sqlite3.c
712 $(TCC) /Fo$@ -c $(SQLITE_OPTIONS) $**
713
714 $(OX)\th$O : $(SRCDIR)\th.c
@@ -708,11 +715,11 @@
715 $(TCC) /Fo$@ -c $**
716
717 $(OX)\th_lang$O : $(SRCDIR)\th_lang.c
718 $(TCC) /Fo$@ -c $**
719
720 VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION
721 $** > $@
722
723 page_index.h: mkindex$E $(SRC)
724 $** > $@
725
@@ -720,11 +727,11 @@
727 -del $(OX)\*.obj
728 -del *.obj *_.c *.h *.map
729 -del headers linkopts
730
731 realclean:
732 -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E
733
734 }
735 foreach s [lsort $src] {
736 writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h"
737 writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n"
@@ -880,11 +887,11 @@
887 # compiling standard fossil utils
888 $(UTILS_OBJ): %.obj: $(SRCDIR)%.c
889 $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@"
890
891 # compile special windows utils
892 version.obj: $(SRCDIR)mkversion.c
893 $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@"
894
895 # generate the translated c-source files
896 $(TRANSLATEDSRC): %_.c: $(SRCDIR)%.c translate.exe
897 translate.exe $< >$@
@@ -892,12 +899,12 @@
899 # generate the index source, containing all web references,..
900 page_index.h: $(TRANSLATEDSRC) mkindex.exe
901 mkindex.exe $(TRANSLATEDSRC) >$@
902
903 # extracting version info from manifest
904 VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION
905 version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@
906
907 # generate the simplified headers
908 headers: makeheaders.exe page_index.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h
909 makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h
910 echo Done >$@
911
+4 -5
--- src/manifest.c
+++ src/manifest.c
@@ -342,11 +342,11 @@
342342
int sz = 0;
343343
344344
/* Every control artifact ends with a '\n' character. Exit early
345345
** if that is not the case for this artifact.
346346
*/
347
- z = blob_buffer(pContent);
347
+ z = blob_materialize(pContent);
348348
n = blob_size(pContent);
349349
if( n<=0 || z[n-1]!='\n' ){
350350
blob_reset(pContent);
351351
return 0;
352352
}
@@ -1323,14 +1323,13 @@
13231323
if( pChildFile ){
13241324
add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
13251325
isPublic, manifest_file_mperm(pChildFile));
13261326
}
13271327
}
1328
- }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
1329
- /* Parent is a delta but pChild is a baseline. Look for files that are
1330
- ** present in pParent but which are missing from pChild and mark them
1331
- ** has having been deleted. */
1328
+ }else if( pChild->zBaseline==0 ){
1329
+ /* pChild is a baseline. Look for files that are present in pParent
1330
+ ** but are missing from pChild and mark them as having been deleted. */
13321331
manifest_file_rewind(pParent);
13331332
while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
13341333
pChildFile = manifest_file_seek(pChild, pParentFile->zName);
13351334
if( pChildFile==0 && pParentFile->zUuid!=0 ){
13361335
add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0,
13371336
--- src/manifest.c
+++ src/manifest.c
@@ -342,11 +342,11 @@
342 int sz = 0;
343
344 /* Every control artifact ends with a '\n' character. Exit early
345 ** if that is not the case for this artifact.
346 */
347 z = blob_buffer(pContent);
348 n = blob_size(pContent);
349 if( n<=0 || z[n-1]!='\n' ){
350 blob_reset(pContent);
351 return 0;
352 }
@@ -1323,14 +1323,13 @@
1323 if( pChildFile ){
1324 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1325 isPublic, manifest_file_mperm(pChildFile));
1326 }
1327 }
1328 }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
1329 /* Parent is a delta but pChild is a baseline. Look for files that are
1330 ** present in pParent but which are missing from pChild and mark them
1331 ** has having been deleted. */
1332 manifest_file_rewind(pParent);
1333 while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
1334 pChildFile = manifest_file_seek(pChild, pParentFile->zName);
1335 if( pChildFile==0 && pParentFile->zUuid!=0 ){
1336 add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0,
1337
--- src/manifest.c
+++ src/manifest.c
@@ -342,11 +342,11 @@
342 int sz = 0;
343
344 /* Every control artifact ends with a '\n' character. Exit early
345 ** if that is not the case for this artifact.
346 */
347 z = blob_materialize(pContent);
348 n = blob_size(pContent);
349 if( n<=0 || z[n-1]!='\n' ){
350 blob_reset(pContent);
351 return 0;
352 }
@@ -1323,14 +1323,13 @@
1323 if( pChildFile ){
1324 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1325 isPublic, manifest_file_mperm(pChildFile));
1326 }
1327 }
1328 }else if( pChild->zBaseline==0 ){
1329 /* pChild is a baseline. Look for files that are present in pParent
1330 ** but are missing from pChild and mark them as having been deleted. */
 
1331 manifest_file_rewind(pParent);
1332 while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
1333 pChildFile = manifest_file_seek(pChild, pParentFile->zName);
1334 if( pChildFile==0 && pParentFile->zUuid!=0 ){
1335 add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0,
1336
+10 -2
--- src/merge.c
+++ src/merge.c
@@ -53,10 +53,14 @@
5353
** and do not try to merge parallel changes. This
5454
** option overrides the "binary-glob" setting.
5555
**
5656
** --nochange | -n Dryrun: do not actually make any changes; just
5757
** show what would have happened.
58
+**
59
+** --case-sensitive BOOL Overwrite the case-sensitive setting. If false,
60
+** files whose names differ only in case are taken
61
+** to be the same file.
5862
*/
5963
void merge_cmd(void){
6064
int vid; /* Current version "V" */
6165
int mid; /* Version we are merging from "M" */
6266
int pid; /* The pivot version - most recent common ancestor P */
@@ -69,10 +73,11 @@
6973
int debugFlag; /* True if --debug is present */
7074
int nChng; /* Number of file name changes */
7175
int *aChng; /* An array of file name changes */
7276
int i; /* Loop counter */
7377
int nConflict = 0; /* Number of conflicts seen */
78
+ int caseSensitive; /* True for case-sensitive filenames */
7479
Stmt q;
7580
7681
7782
/* Notation:
7883
**
@@ -87,14 +92,16 @@
8792
backoutFlag = find_option("backout",0,0)!=0;
8893
debugFlag = find_option("debug",0,0)!=0;
8994
zBinGlob = find_option("binary",0,1);
9095
nochangeFlag = find_option("nochange","n",0)!=0;
9196
zPivot = find_option("baseline",0,1);
97
+ capture_case_sensitive_option();
9298
if( g.argc!=3 ){
9399
usage("VERSION");
94100
}
95101
db_must_be_within_tree();
102
+ caseSensitive = filenames_are_case_sensitive();
96103
if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
97104
vid = db_lget_int("checkout", 0);
98105
if( vid==0 ){
99106
fossil_fatal("nothing is checked out");
100107
}
@@ -150,11 +157,11 @@
150157
** in the current checkout, the pivot, and the version being merged.
151158
*/
152159
db_multi_exec(
153160
"DROP TABLE IF EXISTS fv;"
154161
"CREATE TEMP TABLE fv("
155
- " fn TEXT PRIMARY KEY," /* The filename */
162
+ " fn TEXT PRIMARY KEY COLLATE %s," /* The filename */
156163
" idv INTEGER," /* VFILE entry for current version */
157164
" idp INTEGER," /* VFILE entry for the pivot */
158165
" idm INTEGER," /* VFILE entry for version merging in */
159166
" chnged BOOLEAN," /* True if current version has been edited */
160167
" ridv INTEGER," /* Record ID for current version */
@@ -161,11 +168,12 @@
161168
" ridp INTEGER," /* Record ID for pivot */
162169
" ridm INTEGER," /* Record ID for merge */
163170
" isexe BOOLEAN," /* Execute permission enabled */
164171
" fnp TEXT," /* The filename in the pivot */
165172
" fnm TEXT" /* the filename in the merged version */
166
- ");"
173
+ ");",
174
+ caseSensitive ? "binary" : "nocase"
167175
);
168176
169177
/* Add files found in V
170178
*/
171179
db_multi_exec(
172180
173181
ADDED src/mkversion.c
--- src/merge.c
+++ src/merge.c
@@ -53,10 +53,14 @@
53 ** and do not try to merge parallel changes. This
54 ** option overrides the "binary-glob" setting.
55 **
56 ** --nochange | -n Dryrun: do not actually make any changes; just
57 ** show what would have happened.
 
 
 
 
58 */
59 void merge_cmd(void){
60 int vid; /* Current version "V" */
61 int mid; /* Version we are merging from "M" */
62 int pid; /* The pivot version - most recent common ancestor P */
@@ -69,10 +73,11 @@
69 int debugFlag; /* True if --debug is present */
70 int nChng; /* Number of file name changes */
71 int *aChng; /* An array of file name changes */
72 int i; /* Loop counter */
73 int nConflict = 0; /* Number of conflicts seen */
 
74 Stmt q;
75
76
77 /* Notation:
78 **
@@ -87,14 +92,16 @@
87 backoutFlag = find_option("backout",0,0)!=0;
88 debugFlag = find_option("debug",0,0)!=0;
89 zBinGlob = find_option("binary",0,1);
90 nochangeFlag = find_option("nochange","n",0)!=0;
91 zPivot = find_option("baseline",0,1);
 
92 if( g.argc!=3 ){
93 usage("VERSION");
94 }
95 db_must_be_within_tree();
 
96 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
97 vid = db_lget_int("checkout", 0);
98 if( vid==0 ){
99 fossil_fatal("nothing is checked out");
100 }
@@ -150,11 +157,11 @@
150 ** in the current checkout, the pivot, and the version being merged.
151 */
152 db_multi_exec(
153 "DROP TABLE IF EXISTS fv;"
154 "CREATE TEMP TABLE fv("
155 " fn TEXT PRIMARY KEY," /* The filename */
156 " idv INTEGER," /* VFILE entry for current version */
157 " idp INTEGER," /* VFILE entry for the pivot */
158 " idm INTEGER," /* VFILE entry for version merging in */
159 " chnged BOOLEAN," /* True if current version has been edited */
160 " ridv INTEGER," /* Record ID for current version */
@@ -161,11 +168,12 @@
161 " ridp INTEGER," /* Record ID for pivot */
162 " ridm INTEGER," /* Record ID for merge */
163 " isexe BOOLEAN," /* Execute permission enabled */
164 " fnp TEXT," /* The filename in the pivot */
165 " fnm TEXT" /* the filename in the merged version */
166 ");"
 
167 );
168
169 /* Add files found in V
170 */
171 db_multi_exec(
172
173 DDED src/mkversion.c
--- src/merge.c
+++ src/merge.c
@@ -53,10 +53,14 @@
53 ** and do not try to merge parallel changes. This
54 ** option overrides the "binary-glob" setting.
55 **
56 ** --nochange | -n Dryrun: do not actually make any changes; just
57 ** show what would have happened.
58 **
59 ** --case-sensitive BOOL Overwrite the case-sensitive setting. If false,
60 ** files whose names differ only in case are taken
61 ** to be the same file.
62 */
63 void merge_cmd(void){
64 int vid; /* Current version "V" */
65 int mid; /* Version we are merging from "M" */
66 int pid; /* The pivot version - most recent common ancestor P */
@@ -69,10 +73,11 @@
73 int debugFlag; /* True if --debug is present */
74 int nChng; /* Number of file name changes */
75 int *aChng; /* An array of file name changes */
76 int i; /* Loop counter */
77 int nConflict = 0; /* Number of conflicts seen */
78 int caseSensitive; /* True for case-sensitive filenames */
79 Stmt q;
80
81
82 /* Notation:
83 **
@@ -87,14 +92,16 @@
92 backoutFlag = find_option("backout",0,0)!=0;
93 debugFlag = find_option("debug",0,0)!=0;
94 zBinGlob = find_option("binary",0,1);
95 nochangeFlag = find_option("nochange","n",0)!=0;
96 zPivot = find_option("baseline",0,1);
97 capture_case_sensitive_option();
98 if( g.argc!=3 ){
99 usage("VERSION");
100 }
101 db_must_be_within_tree();
102 caseSensitive = filenames_are_case_sensitive();
103 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
104 vid = db_lget_int("checkout", 0);
105 if( vid==0 ){
106 fossil_fatal("nothing is checked out");
107 }
@@ -150,11 +157,11 @@
157 ** in the current checkout, the pivot, and the version being merged.
158 */
159 db_multi_exec(
160 "DROP TABLE IF EXISTS fv;"
161 "CREATE TEMP TABLE fv("
162 " fn TEXT PRIMARY KEY COLLATE %s," /* The filename */
163 " idv INTEGER," /* VFILE entry for current version */
164 " idp INTEGER," /* VFILE entry for the pivot */
165 " idm INTEGER," /* VFILE entry for version merging in */
166 " chnged BOOLEAN," /* True if current version has been edited */
167 " ridv INTEGER," /* Record ID for current version */
@@ -161,11 +168,12 @@
168 " ridp INTEGER," /* Record ID for pivot */
169 " ridm INTEGER," /* Record ID for merge */
170 " isexe BOOLEAN," /* Execute permission enabled */
171 " fnp TEXT," /* The filename in the pivot */
172 " fnm TEXT" /* the filename in the merged version */
173 ");",
174 caseSensitive ? "binary" : "nocase"
175 );
176
177 /* Add files found in V
178 */
179 db_multi_exec(
180
181 DDED src/mkversion.c
+1 -6
--- a/src/mkversion.c
+++ b/src/mkversion.c
@@ -1,10 +1,5 @@
1
-fopen(argv[1],"gv[1],exists to do the job that AWK would do for the unix
2
-** makefile - to extract information from the "mainfest" and "manifest.uuid"
3
-** files for this p)
1
+fopen(argv[1],"gv[1],"fMSC_VER)
42
d = _MSC_VER / 1 return 0;
53
}
64
b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0;
75
}
8
-;
9
- char b[1024b[strlen(b)-1] =0; return 0"gv[1],"fMSC_VER)
10
- fopen(argv[1
--- a/src/mkversion.c
+++ b/src/mkversion.c
@@ -1,10 +1,5 @@
1 fopen(argv[1],"gv[1],exists to do the job that AWK would do for the unix
2 ** makefile - to extract information from the "mainfest" and "manifest.uuid"
3 ** files for this p)
4 d = _MSC_VER / 1 return 0;
5 }
6 b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0;
7 }
8 ;
9 char b[1024b[strlen(b)-1] =0; return 0"gv[1],"fMSC_VER)
10 fopen(argv[1
--- a/src/mkversion.c
+++ b/src/mkversion.c
@@ -1,10 +1,5 @@
1 fopen(argv[1],"gv[1],"fMSC_VER)
 
 
2 d = _MSC_VER / 1 return 0;
3 }
4 b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0;
5 }
 
 
 
--- a/src/mkversion.c
+++ b/src/mkversion.c
@@ -0,0 +1,5 @@
1
+fopen(argv[1],"gv[1],"fMSC_VER)
2
+ d = _MSC_VER / 1 return 0;
3
+}
4
+b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0;
5
+}
--- a/src/mkversion.c
+++ b/src/mkversion.c
@@ -0,0 +1,5 @@
 
 
 
 
 
--- a/src/mkversion.c
+++ b/src/mkversion.c
@@ -0,0 +1,5 @@
1 fopen(argv[1],"gv[1],"fMSC_VER)
2 d = _MSC_VER / 1 return 0;
3 }
4 b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0;
5 }
+1 -1
--- src/path.c
+++ src/path.c
@@ -366,11 +366,11 @@
366366
367367
*pnChng = 0;
368368
*aiChng = 0;
369369
if( iFrom==iTo ) return;
370370
path_reset();
371
- p = path_shortest(iFrom, iTo, 0);
371
+ p = path_shortest(iFrom, iTo, 1);
372372
if( p==0 ) return;
373373
path_reverse_path();
374374
db_prepare(&q1,
375375
"SELECT pfnid, fnid FROM mlink WHERE mid=:mid AND pfnid>0"
376376
);
377377
--- src/path.c
+++ src/path.c
@@ -366,11 +366,11 @@
366
367 *pnChng = 0;
368 *aiChng = 0;
369 if( iFrom==iTo ) return;
370 path_reset();
371 p = path_shortest(iFrom, iTo, 0);
372 if( p==0 ) return;
373 path_reverse_path();
374 db_prepare(&q1,
375 "SELECT pfnid, fnid FROM mlink WHERE mid=:mid AND pfnid>0"
376 );
377
--- src/path.c
+++ src/path.c
@@ -366,11 +366,11 @@
366
367 *pnChng = 0;
368 *aiChng = 0;
369 if( iFrom==iTo ) return;
370 path_reset();
371 p = path_shortest(iFrom, iTo, 1);
372 if( p==0 ) return;
373 path_reverse_path();
374 db_prepare(&q1,
375 "SELECT pfnid, fnid FROM mlink WHERE mid=:mid AND pfnid>0"
376 );
377
+1 -1
--- src/printf.c
+++ src/printf.c
@@ -859,11 +859,11 @@
859859
int a, b;
860860
do{
861861
a = *zA++;
862862
b = *zB++;
863863
}while( a==b && a!=0 );
864
- return a - b;
864
+ return ((unsigned char)a) - (unsigned char)b;
865865
}
866866
}
867867
868868
/*
869869
** Case insensitive string comparison.
870870
--- src/printf.c
+++ src/printf.c
@@ -859,11 +859,11 @@
859 int a, b;
860 do{
861 a = *zA++;
862 b = *zB++;
863 }while( a==b && a!=0 );
864 return a - b;
865 }
866 }
867
868 /*
869 ** Case insensitive string comparison.
870
--- src/printf.c
+++ src/printf.c
@@ -859,11 +859,11 @@
859 int a, b;
860 do{
861 a = *zA++;
862 b = *zB++;
863 }while( a==b && a!=0 );
864 return ((unsigned char)a) - (unsigned char)b;
865 }
866 }
867
868 /*
869 ** Case insensitive string comparison.
870
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -882,11 +882,11 @@
882882
}
883883
884884
/*
885885
** COMMAND: deconstruct
886886
**
887
-** Usage %fossil deconstruct ?OPTIONS? DESTIONATION
887
+** Usage %fossil deconstruct ?OPTIONS? DESTINATION
888888
**
889889
** Options:
890890
** -R|--repository REPOSITORY
891891
** -L|--prefixlength N
892892
**
893893
--- src/rebuild.c
+++ src/rebuild.c
@@ -882,11 +882,11 @@
882 }
883
884 /*
885 ** COMMAND: deconstruct
886 **
887 ** Usage %fossil deconstruct ?OPTIONS? DESTIONATION
888 **
889 ** Options:
890 ** -R|--repository REPOSITORY
891 ** -L|--prefixlength N
892 **
893
--- src/rebuild.c
+++ src/rebuild.c
@@ -882,11 +882,11 @@
882 }
883
884 /*
885 ** COMMAND: deconstruct
886 **
887 ** Usage %fossil deconstruct ?OPTIONS? DESTINATION
888 **
889 ** Options:
890 ** -R|--repository REPOSITORY
891 ** -L|--prefixlength N
892 **
893
+11 -2
--- src/setup.c
+++ src/setup.c
@@ -1062,25 +1062,34 @@
10621062
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
10631063
if( pSet->width==0 ){
10641064
onoff_attribute(pSet->name, pSet->name,
10651065
pSet->var!=0 ? pSet->var : pSet->name,
10661066
is_truth(pSet->def));
1067
- @ <br />
1067
+ if( pSet->versionable ){
1068
+ @ (v)<br />
1069
+ } else {
1070
+ @ <br />
1071
+ }
10681072
}
10691073
}
10701074
@ </td><td style="width: 30;"></td><td valign="top">
10711075
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
10721076
if( pSet->width!=0 ){
10731077
entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name,
10741078
pSet->var!=0 ? pSet->var : pSet->name,
10751079
(char*)pSet->def);
1076
- @ <br />
1080
+ if( pSet->versionable ){
1081
+ @ (v)<br />
1082
+ } else {
1083
+ @ <br />
1084
+ }
10771085
}
10781086
}
10791087
@ </td></tr></table>
10801088
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
10811089
@ </div></form>
1090
+ @ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p>
10821091
@ <hr /><p>
10831092
@ These settings work in the same way, as the <kbd>set</kbd> commandline:<br />
10841093
@ </p><pre>%s(zHelp_setting_cmd)</pre>
10851094
db_end_transaction(0);
10861095
style_footer();
10871096
--- src/setup.c
+++ src/setup.c
@@ -1062,25 +1062,34 @@
1062 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1063 if( pSet->width==0 ){
1064 onoff_attribute(pSet->name, pSet->name,
1065 pSet->var!=0 ? pSet->var : pSet->name,
1066 is_truth(pSet->def));
1067 @ <br />
 
 
 
 
1068 }
1069 }
1070 @ </td><td style="width: 30;"></td><td valign="top">
1071 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1072 if( pSet->width!=0 ){
1073 entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name,
1074 pSet->var!=0 ? pSet->var : pSet->name,
1075 (char*)pSet->def);
1076 @ <br />
 
 
 
 
1077 }
1078 }
1079 @ </td></tr></table>
1080 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1081 @ </div></form>
 
1082 @ <hr /><p>
1083 @ These settings work in the same way, as the <kbd>set</kbd> commandline:<br />
1084 @ </p><pre>%s(zHelp_setting_cmd)</pre>
1085 db_end_transaction(0);
1086 style_footer();
1087
--- src/setup.c
+++ src/setup.c
@@ -1062,25 +1062,34 @@
1062 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1063 if( pSet->width==0 ){
1064 onoff_attribute(pSet->name, pSet->name,
1065 pSet->var!=0 ? pSet->var : pSet->name,
1066 is_truth(pSet->def));
1067 if( pSet->versionable ){
1068 @ (v)<br />
1069 } else {
1070 @ <br />
1071 }
1072 }
1073 }
1074 @ </td><td style="width: 30;"></td><td valign="top">
1075 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1076 if( pSet->width!=0 ){
1077 entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name,
1078 pSet->var!=0 ? pSet->var : pSet->name,
1079 (char*)pSet->def);
1080 if( pSet->versionable ){
1081 @ (v)<br />
1082 } else {
1083 @ <br />
1084 }
1085 }
1086 }
1087 @ </td></tr></table>
1088 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1089 @ </div></form>
1090 @ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p>
1091 @ <hr /><p>
1092 @ These settings work in the same way, as the <kbd>set</kbd> commandline:<br />
1093 @ </p><pre>%s(zHelp_setting_cmd)</pre>
1094 db_end_transaction(0);
1095 style_footer();
1096
+5173 -2758
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.7.7. By combining all the individual C code files into this
3
+** version 3.7.8. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -648,13 +648,13 @@
648648
**
649649
** See also: [sqlite3_libversion()],
650650
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651651
** [sqlite_version()] and [sqlite_source_id()].
652652
*/
653
-#define SQLITE_VERSION "3.7.7"
654
-#define SQLITE_VERSION_NUMBER 3007007
655
-#define SQLITE_SOURCE_ID "2011-06-03 14:19:10 0206bc6f87bb9393218a380fc5b18039d334a8d8"
653
+#define SQLITE_VERSION "3.7.8"
654
+#define SQLITE_VERSION_NUMBER 3007008
655
+#define SQLITE_SOURCE_ID "2011-08-16 02:07:04 9650d7962804d61f56cac944ff9bb2c7bc111957"
656656
657657
/*
658658
** CAPI3REF: Run-Time Library Version Numbers
659659
** KEYWORDS: sqlite3_version, sqlite3_sourceid
660660
**
@@ -851,11 +851,11 @@
851851
** semicolon-separate SQL statements passed into its 2nd argument,
852852
** in the context of the [database connection] passed in as its 1st
853853
** argument. ^If the callback function of the 3rd argument to
854854
** sqlite3_exec() is not NULL, then it is invoked for each result row
855855
** coming out of the evaluated SQL statements. ^The 4th argument to
856
-** to sqlite3_exec() is relayed through to the 1st argument of each
856
+** sqlite3_exec() is relayed through to the 1st argument of each
857857
** callback invocation. ^If the callback pointer to sqlite3_exec()
858858
** is NULL, then no callback is ever invoked and result rows are
859859
** ignored.
860860
**
861861
** ^If an error occurs while evaluating the SQL statements passed into
@@ -1282,20 +1282,52 @@
12821282
** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
12831283
** VFSes do not need this signal and should silently ignore this opcode.
12841284
** Applications should not call [sqlite3_file_control()] with this
12851285
** opcode as doing so may disrupt the operation of the specialized VFSes
12861286
** that do require it.
1287
+**
1288
+** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
1289
+** retry counts and intervals for certain disk I/O operations for the
1290
+** windows [VFS] in order to work to provide robustness against
1291
+** anti-virus programs. By default, the windows VFS will retry file read,
1292
+** file write, and file delete opertions up to 10 times, with a delay
1293
+** of 25 milliseconds before the first retry and with the delay increasing
1294
+** by an additional 25 milliseconds with each subsequent retry. This
1295
+** opcode allows those to values (10 retries and 25 milliseconds of delay)
1296
+** to be adjusted. The values are changed for all database connections
1297
+** within the same process. The argument is a pointer to an array of two
1298
+** integers where the first integer i the new retry count and the second
1299
+** integer is the delay. If either integer is negative, then the setting
1300
+** is not changed but instead the prior value of that setting is written
1301
+** into the array entry, allowing the current retry settings to be
1302
+** interrogated. The zDbName parameter is ignored.
1303
+**
1304
+** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
1305
+** persistent [WAL | Write AHead Log] setting. By default, the auxiliary
1306
+** write ahead log and shared memory files used for transaction control
1307
+** are automatically deleted when the latest connection to the database
1308
+** closes. Setting persistent WAL mode causes those files to persist after
1309
+** close. Persisting the files is useful when other processes that do not
1310
+** have write permission on the directory containing the database file want
1311
+** to read the database file, as the WAL and shared memory files must exist
1312
+** in order for the database to be readable. The fourth parameter to
1313
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
1314
+** That integer is 0 to disable persistent WAL mode or 1 to enable persistent
1315
+** WAL mode. If the integer is -1, then it is overwritten with the current
1316
+** WAL persistence setting.
1317
+**
12871318
*/
12881319
#define SQLITE_FCNTL_LOCKSTATE 1
12891320
#define SQLITE_GET_LOCKPROXYFILE 2
12901321
#define SQLITE_SET_LOCKPROXYFILE 3
12911322
#define SQLITE_LAST_ERRNO 4
12921323
#define SQLITE_FCNTL_SIZE_HINT 5
12931324
#define SQLITE_FCNTL_CHUNK_SIZE 6
12941325
#define SQLITE_FCNTL_FILE_POINTER 7
12951326
#define SQLITE_FCNTL_SYNC_OMITTED 8
1296
-
1327
+#define SQLITE_FCNTL_WIN32_AV_RETRY 9
1328
+#define SQLITE_FCNTL_PERSIST_WAL 10
12971329
12981330
/*
12991331
** CAPI3REF: Mutex Handle
13001332
**
13011333
** The mutex module within SQLite defines [sqlite3_mutex] to be an
@@ -1443,11 +1475,11 @@
14431475
** The xSleep() method causes the calling thread to sleep for at
14441476
** least the number of microseconds given. ^The xCurrentTime()
14451477
** method returns a Julian Day Number for the current date and time as
14461478
** a floating point value.
14471479
** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
1448
-** Day Number multipled by 86400000 (the number of milliseconds in
1480
+** Day Number multiplied by 86400000 (the number of milliseconds in
14491481
** a 24-hour day).
14501482
** ^SQLite will use the xCurrentTimeInt64() method to get the current
14511483
** date and time if that method is available (if iVersion is 2 or
14521484
** greater and the function pointer is not NULL) and will fall back
14531485
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
@@ -1881,11 +1913,11 @@
18811913
** scratch memory beyond what is provided by this configuration option, then
18821914
** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
18831915
**
18841916
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
18851917
** <dd> ^This option specifies a static memory buffer that SQLite can use for
1886
-** the database page cache with the default page cache implemenation.
1918
+** the database page cache with the default page cache implementation.
18871919
** This configuration should not be used if an application-define page
18881920
** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
18891921
** There are three arguments to this option: A pointer to 8-byte aligned
18901922
** memory, the size of each page buffer (sz), and the number of pages (N).
18911923
** The sz argument should be the size of the largest database page
@@ -2979,16 +3011,16 @@
29793011
** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>
29803012
**
29813013
** ^If [URI filename] interpretation is enabled, and the filename argument
29823014
** begins with "file:", then the filename is interpreted as a URI. ^URI
29833015
** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
2984
-** is set in the fourth argument to sqlite3_open_v2(), or if it has
3016
+** set in the fourth argument to sqlite3_open_v2(), or if it has
29853017
** been enabled globally using the [SQLITE_CONFIG_URI] option with the
29863018
** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
29873019
** As of SQLite version 3.7.7, URI filename interpretation is turned off
29883020
** by default, but future releases of SQLite might enable URI filename
2989
-** intepretation by default. See "[URI filenames]" for additional
3021
+** interpretation by default. See "[URI filenames]" for additional
29903022
** information.
29913023
**
29923024
** URI filenames are parsed according to RFC 3986. ^If the URI contains an
29933025
** authority, then it must be either an empty string or the string
29943026
** "localhost". ^If the authority is not an empty string or "localhost", an
@@ -3365,11 +3397,11 @@
33653397
** a schema change, on the first [sqlite3_step()] call following any change
33663398
** to the [sqlite3_bind_text | bindings] of that [parameter].
33673399
** ^The specific value of WHERE-clause [parameter] might influence the
33683400
** choice of query plan if the parameter is the left-hand side of a [LIKE]
33693401
** or [GLOB] operator or if the parameter is compared to an indexed column
3370
-** and the [SQLITE_ENABLE_STAT2] compile-time option is enabled.
3402
+** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
33713403
** the
33723404
** </li>
33733405
** </ol>
33743406
*/
33753407
SQLITE_API int sqlite3_prepare(
@@ -3803,11 +3835,11 @@
38033835
** [extended result codes] might be returned as well.
38043836
**
38053837
** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
38063838
** database locks it needs to do its job. ^If the statement is a [COMMIT]
38073839
** or occurs outside of an explicit transaction, then you can retry the
3808
-** statement. If the statement is not a [COMMIT] and occurs within a
3840
+** statement. If the statement is not a [COMMIT] and occurs within an
38093841
** explicit transaction then you should rollback the transaction before
38103842
** continuing.
38113843
**
38123844
** ^[SQLITE_DONE] means that the statement has finished executing
38133845
** successfully. sqlite3_step() should not be called again on this virtual
@@ -4082,11 +4114,11 @@
40824114
40834115
/*
40844116
** CAPI3REF: Destroy A Prepared Statement Object
40854117
**
40864118
** ^The sqlite3_finalize() function is called to delete a [prepared statement].
4087
-** ^If the most recent evaluation of the statement encountered no errors or
4119
+** ^If the most recent evaluation of the statement encountered no errors
40884120
** or if the statement is never been evaluated, then sqlite3_finalize() returns
40894121
** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
40904122
** sqlite3_finalize(S) returns the appropriate [error code] or
40914123
** [extended error code].
40924124
**
@@ -5996,11 +6028,11 @@
59966028
** versions of these routines, it should at least provide stubs that always
59976029
** return true so that one does not get spurious assertion failures.
59986030
**
59996031
** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
60006032
** the routine should return 1. This seems counter-intuitive since
6001
-** clearly the mutex cannot be held if it does not exist. But the
6033
+** clearly the mutex cannot be held if it does not exist. But
60026034
** the reason the mutex does not exist is because the build is not
60036035
** using mutexes. And we do not want the assert() containing the
60046036
** call to sqlite3_mutex_held() to fail, so a non-zero return is
60056037
** the appropriate thing to do. ^The sqlite3_mutex_notheld()
60066038
** interface should also return 1 when given a NULL pointer.
@@ -6119,11 +6151,12 @@
61196151
#define SQLITE_TESTCTRL_RESERVE 14
61206152
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
61216153
#define SQLITE_TESTCTRL_ISKEYWORD 16
61226154
#define SQLITE_TESTCTRL_PGHDRSZ 17
61236155
#define SQLITE_TESTCTRL_SCRATCHMALLOC 18
6124
-#define SQLITE_TESTCTRL_LAST 18
6156
+#define SQLITE_TESTCTRL_LOCALTIME_FAULT 19
6157
+#define SQLITE_TESTCTRL_LAST 19
61256158
61266159
/*
61276160
** CAPI3REF: SQLite Runtime Status
61286161
**
61296162
** ^This interface is used to retrieve runtime status information
@@ -6505,11 +6538,11 @@
65056538
** [[the xFetch() page cache methods]]
65066539
** The xFetch() method locates a page in the cache and returns a pointer to
65076540
** the page, or a NULL pointer.
65086541
** A "page", in this context, means a buffer of szPage bytes aligned at an
65096542
** 8-byte boundary. The page to be fetched is determined by the key. ^The
6510
-** mimimum key value is 1. After it has been retrieved using xFetch, the page
6543
+** minimum key value is 1. After it has been retrieved using xFetch, the page
65116544
** is considered to be "pinned".
65126545
**
65136546
** If the requested page is already in the page cache, then the page cache
65146547
** implementation must return a pointer to the page buffer with its content
65156548
** intact. If the requested page is not already in the cache, then the
@@ -7678,10 +7711,22 @@
76787711
** is 0x00000000ffffffff. But because of quirks of some compilers, we
76797712
** have to specify the value in the less intuitive manner shown:
76807713
*/
76817714
#define SQLITE_MAX_U32 ((((u64)1)<<32)-1)
76827715
7716
+/*
7717
+** The datatype used to store estimates of the number of rows in a
7718
+** table or index. This is an unsigned integer type. For 99.9% of
7719
+** the world, a 32-bit integer is sufficient. But a 64-bit integer
7720
+** can be used at compile-time if desired.
7721
+*/
7722
+#ifdef SQLITE_64BIT_STATS
7723
+ typedef u64 tRowcnt; /* 64-bit only if requested at compile-time */
7724
+#else
7725
+ typedef u32 tRowcnt; /* 32-bit is the default */
7726
+#endif
7727
+
76837728
/*
76847729
** Macros to determine whether the machine is big or little endian,
76857730
** evaluated at runtime.
76867731
*/
76877732
#ifdef SQLITE_AMALGAMATION
@@ -8483,10 +8528,11 @@
84838528
SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
84848529
SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
84858530
SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
84868531
SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
84878532
SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
8533
+SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
84888534
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
84898535
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
84908536
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
84918537
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5);
84928538
SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);
@@ -9282,11 +9328,11 @@
92829328
** sqlite3_close().
92839329
*
92849330
** A thread must be holding a mutex on the corresponding Btree in order
92859331
** to access Schema content. This implies that the thread must also be
92869332
** holding a mutex on the sqlite3 connection pointer that owns the Btree.
9287
-** For a TEMP Schema, on the connection mutex is required.
9333
+** For a TEMP Schema, only the connection mutex is required.
92889334
*/
92899335
struct Schema {
92909336
int schema_cookie; /* Database schema version number for this file */
92919337
int iGeneration; /* Generation counter. Incremented with each change */
92929338
Hash tblHash; /* All tables indexed by name */
@@ -9555,10 +9601,12 @@
95559601
#define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */
95569602
#define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */
95579603
#define SQLITE_IndexCover 0x10 /* Disable index covering table */
95589604
#define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */
95599605
#define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */
9606
+#define SQLITE_IdxRealAsInt 0x80 /* Store REAL as INT in indices */
9607
+#define SQLITE_DistinctOpt 0x80 /* DISTINCT using indexes */
95609608
#define SQLITE_OptMask 0xff /* Mask of all disablable opts */
95619609
95629610
/*
95639611
** Possible values for the sqlite.magic field.
95649612
** The numbers are obtained at random and have no special meaning, other
@@ -9876,11 +9924,11 @@
98769924
int iPKey; /* If not negative, use aCol[iPKey] as the primary key */
98779925
int nCol; /* Number of columns in this table */
98789926
Column *aCol; /* Information about each column */
98799927
Index *pIndex; /* List of SQL indexes on this table. */
98809928
int tnum; /* Root BTree node for this table (see note above) */
9881
- unsigned nRowEst; /* Estimated rows in table - from sqlite_stat1 table */
9929
+ tRowcnt nRowEst; /* Estimated rows in table - from sqlite_stat1 table */
98829930
Select *pSelect; /* NULL for tables. Points to definition if a view. */
98839931
u16 nRef; /* Number of pointers to this Table */
98849932
u8 tabFlags; /* Mask of TF_* values */
98859933
u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */
98869934
FKey *pFKey; /* Linked list of all foreign keys in this table */
@@ -10075,35 +10123,43 @@
1007510123
*/
1007610124
struct Index {
1007710125
char *zName; /* Name of this index */
1007810126
int nColumn; /* Number of columns in the table used by this index */
1007910127
int *aiColumn; /* Which columns are used by this index. 1st is 0 */
10080
- unsigned *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
10128
+ tRowcnt *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
1008110129
Table *pTable; /* The SQL table being indexed */
1008210130
int tnum; /* Page containing root of this index in database file */
1008310131
u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
1008410132
u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
1008510133
u8 bUnordered; /* Use this index for == or IN queries only */
10134
+ u8 nSample; /* Number of elements in aSample[] */
1008610135
char *zColAff; /* String defining the affinity of each column */
1008710136
Index *pNext; /* The next index associated with the same table */
1008810137
Schema *pSchema; /* Schema containing this index */
1008910138
u8 *aSortOrder; /* Array of size Index.nColumn. True==DESC, False==ASC */
1009010139
char **azColl; /* Array of collation sequence names for index */
10091
- IndexSample *aSample; /* Array of SQLITE_INDEX_SAMPLES samples */
10140
+#ifdef SQLITE_ENABLE_STAT3
10141
+ tRowcnt avgEq; /* Average nEq value for key values not in aSample */
10142
+ IndexSample *aSample; /* Samples of the left-most key */
10143
+#endif
1009210144
};
1009310145
1009410146
/*
1009510147
** Each sample stored in the sqlite_stat2 table is represented in memory
1009610148
** using a structure of this type.
1009710149
*/
1009810150
struct IndexSample {
1009910151
union {
1010010152
char *z; /* Value if eType is SQLITE_TEXT or SQLITE_BLOB */
10101
- double r; /* Value if eType is SQLITE_FLOAT or SQLITE_INTEGER */
10153
+ double r; /* Value if eType is SQLITE_FLOAT */
10154
+ i64 i; /* Value if eType is SQLITE_INTEGER */
1010210155
} u;
1010310156
u8 eType; /* SQLITE_NULL, SQLITE_INTEGER ... etc. */
10104
- u8 nByte; /* Size in byte of text or blob. */
10157
+ u16 nByte; /* Size in byte of text or blob. */
10158
+ tRowcnt nEq; /* Est. number of rows where the key equals this sample */
10159
+ tRowcnt nLt; /* Est. number of rows where key is less than this sample */
10160
+ tRowcnt nDLt; /* Est. number of distinct keys less than this sample */
1010510161
};
1010610162
1010710163
/*
1010810164
** Each token coming out of the lexer is an instance of
1010910165
** this structure. Tokens are also used as part of an expression.
@@ -10446,10 +10502,11 @@
1044610502
Table *pTab; /* An SQL table corresponding to zName */
1044710503
Select *pSelect; /* A SELECT statement used in place of a table name */
1044810504
u8 isPopulated; /* Temporary table associated with SELECT is populated */
1044910505
u8 jointype; /* Type of join between this able and the previous */
1045010506
u8 notIndexed; /* True if there is a NOT INDEXED clause */
10507
+ u8 isCorrelated; /* True if sub-query is correlated */
1045110508
#ifndef SQLITE_OMIT_EXPLAIN
1045210509
u8 iSelectId; /* If pSelect!=0, the id of the sub-select in EQP */
1045310510
#endif
1045410511
int iCursor; /* The VDBE cursor number used to access this table */
1045510512
Expr *pOn; /* The ON clause of a join */
@@ -10565,10 +10622,11 @@
1056510622
struct WhereInfo {
1056610623
Parse *pParse; /* Parsing and code generating context */
1056710624
u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */
1056810625
u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE or DELETE */
1056910626
u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */
10627
+ u8 eDistinct;
1057010628
SrcList *pTabList; /* List of tables in the join */
1057110629
int iTop; /* The very beginning of the WHERE loop */
1057210630
int iContinue; /* Jump here to continue with next record */
1057310631
int iBreak; /* Jump here to break out of the loop */
1057410632
int nLevel; /* Number of nested loop */
@@ -10576,10 +10634,13 @@
1057610634
double savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */
1057710635
double nRowOut; /* Estimated number of output rows */
1057810636
WhereLevel a[1]; /* Information about each nest loop in WHERE */
1057910637
};
1058010638
10639
+#define WHERE_DISTINCT_UNIQUE 1
10640
+#define WHERE_DISTINCT_ORDERED 2
10641
+
1058110642
/*
1058210643
** A NameContext defines a context in which to resolve table and column
1058310644
** names. The context consists of a list of tables (the pSrcList) field and
1058410645
** a list of named expression (pEList). The named expression list may
1058510646
** be NULL. The pSrc corresponds to the FROM clause of a SELECT or
@@ -11052,10 +11113,11 @@
1105211113
int isPCacheInit; /* True after malloc is initialized */
1105311114
sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */
1105411115
int nRefInitMutex; /* Number of users of pInitMutex */
1105511116
void (*xLog)(void*,int,const char*); /* Function for logging */
1105611117
void *pLogArg; /* First argument to xLog() */
11118
+ int bLocaltimeFault; /* True to fail localtime() calls */
1105711119
};
1105811120
1105911121
/*
1106011122
** Context pointer passed down through the tree-walk.
1106111123
*/
@@ -11299,10 +11361,11 @@
1129911361
#else
1130011362
# define sqlite3ViewGetColumnNames(A,B) 0
1130111363
#endif
1130211364
1130311365
SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int);
11366
+SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int);
1130411367
SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*);
1130511368
#ifndef SQLITE_OMIT_AUTOINCREMENT
1130611369
SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse);
1130711370
SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse);
1130811371
#else
@@ -11336,11 +11399,11 @@
1133611399
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
1133711400
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *, char *);
1133811401
#endif
1133911402
SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*);
1134011403
SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
11341
-SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16);
11404
+SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**,ExprList*,u16);
1134211405
SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
1134311406
SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int);
1134411407
SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
1134511408
SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
1134611409
SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int);
@@ -11479,11 +11542,11 @@
1147911542
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
1148011543
SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
1148111544
SQLITE_PRIVATE int sqlite3Atoi(const char*);
1148211545
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
1148311546
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
11484
-SQLITE_PRIVATE int sqlite3Utf8Read(const u8*, const u8**);
11547
+SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8*, const u8**);
1148511548
1148611549
/*
1148711550
** Routines to read and write variable-length integers. These used to
1148811551
** be defined locally, but now we use the varint routines in the util.c
1148911552
** file. Code should use the MACRO forms below, as the Varint32 versions
@@ -11555,11 +11618,11 @@
1155511618
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
1155611619
void(*)(void*));
1155711620
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
1155811621
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
1155911622
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
11560
-#ifdef SQLITE_ENABLE_STAT2
11623
+#ifdef SQLITE_ENABLE_STAT3
1156111624
SQLITE_PRIVATE char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
1156211625
#endif
1156311626
SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
1156411627
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
1156511628
#ifndef SQLITE_AMALGAMATION
@@ -12012,10 +12075,11 @@
1201212075
0, /* isPCacheInit */
1201312076
0, /* pInitMutex */
1201412077
0, /* nRefInitMutex */
1201512078
0, /* xLog */
1201612079
0, /* pLogArg */
12080
+ 0, /* bLocaltimeFault */
1201712081
};
1201812082
1201912083
1202012084
/*
1202112085
** Hash table for global functions - functions common to all
@@ -12180,10 +12244,13 @@
1218012244
#ifdef SQLITE_ENABLE_RTREE
1218112245
"ENABLE_RTREE",
1218212246
#endif
1218312247
#ifdef SQLITE_ENABLE_STAT2
1218412248
"ENABLE_STAT2",
12249
+#endif
12250
+#ifdef SQLITE_ENABLE_STAT3
12251
+ "ENABLE_STAT3",
1218512252
#endif
1218612253
#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
1218712254
"ENABLE_UNLOCK_NOTIFY",
1218812255
#endif
1218912256
#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
@@ -13162,26 +13229,10 @@
1316213229
*/
1316313230
#include <time.h>
1316413231
1316513232
#ifndef SQLITE_OMIT_DATETIME_FUNCS
1316613233
13167
-/*
13168
-** On recent Windows platforms, the localtime_s() function is available
13169
-** as part of the "Secure CRT". It is essentially equivalent to
13170
-** localtime_r() available under most POSIX platforms, except that the
13171
-** order of the parameters is reversed.
13172
-**
13173
-** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
13174
-**
13175
-** If the user has not indicated to use localtime_r() or localtime_s()
13176
-** already, check for an MSVC build environment that provides
13177
-** localtime_s().
13178
-*/
13179
-#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
13180
- defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
13181
-#define HAVE_LOCALTIME_S 1
13182
-#endif
1318313234
1318413235
/*
1318513236
** A structure for holding a single date and time.
1318613237
*/
1318713238
typedef struct DateTime DateTime;
@@ -13522,20 +13573,90 @@
1352213573
static void clearYMD_HMS_TZ(DateTime *p){
1352313574
p->validYMD = 0;
1352413575
p->validHMS = 0;
1352513576
p->validTZ = 0;
1352613577
}
13578
+
13579
+/*
13580
+** On recent Windows platforms, the localtime_s() function is available
13581
+** as part of the "Secure CRT". It is essentially equivalent to
13582
+** localtime_r() available under most POSIX platforms, except that the
13583
+** order of the parameters is reversed.
13584
+**
13585
+** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
13586
+**
13587
+** If the user has not indicated to use localtime_r() or localtime_s()
13588
+** already, check for an MSVC build environment that provides
13589
+** localtime_s().
13590
+*/
13591
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
13592
+ defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
13593
+#define HAVE_LOCALTIME_S 1
13594
+#endif
13595
+
13596
+#ifndef SQLITE_OMIT_LOCALTIME
13597
+/*
13598
+** The following routine implements the rough equivalent of localtime_r()
13599
+** using whatever operating-system specific localtime facility that
13600
+** is available. This routine returns 0 on success and
13601
+** non-zero on any kind of error.
13602
+**
13603
+** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this
13604
+** routine will always fail.
13605
+*/
13606
+static int osLocaltime(time_t *t, struct tm *pTm){
13607
+ int rc;
13608
+#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \
13609
+ && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S)
13610
+ struct tm *pX;
13611
+#if SQLITE_THREADSAFE>0
13612
+ sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
13613
+#endif
13614
+ sqlite3_mutex_enter(mutex);
13615
+ pX = localtime(t);
13616
+#ifndef SQLITE_OMIT_BUILTIN_TEST
13617
+ if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
13618
+#endif
13619
+ if( pX ) *pTm = *pX;
13620
+ sqlite3_mutex_leave(mutex);
13621
+ rc = pX==0;
13622
+#else
13623
+#ifndef SQLITE_OMIT_BUILTIN_TEST
13624
+ if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
13625
+#endif
13626
+#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R
13627
+ rc = localtime_r(t, pTm)==0;
13628
+#else
13629
+ rc = localtime_s(pTm, t);
13630
+#endif /* HAVE_LOCALTIME_R */
13631
+#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */
13632
+ return rc;
13633
+}
13634
+#endif /* SQLITE_OMIT_LOCALTIME */
13635
+
1352713636
1352813637
#ifndef SQLITE_OMIT_LOCALTIME
1352913638
/*
13530
-** Compute the difference (in milliseconds)
13531
-** between localtime and UTC (a.k.a. GMT)
13532
-** for the time value p where p is in UTC.
13639
+** Compute the difference (in milliseconds) between localtime and UTC
13640
+** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs,
13641
+** return this value and set *pRc to SQLITE_OK.
13642
+**
13643
+** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value
13644
+** is undefined in this case.
1353313645
*/
13534
-static sqlite3_int64 localtimeOffset(DateTime *p){
13646
+static sqlite3_int64 localtimeOffset(
13647
+ DateTime *p, /* Date at which to calculate offset */
13648
+ sqlite3_context *pCtx, /* Write error here if one occurs */
13649
+ int *pRc /* OUT: Error code. SQLITE_OK or ERROR */
13650
+){
1353513651
DateTime x, y;
1353613652
time_t t;
13653
+ struct tm sLocal;
13654
+
13655
+ /* Initialize the contents of sLocal to avoid a compiler warning. */
13656
+ memset(&sLocal, 0, sizeof(sLocal));
13657
+
1353713658
x = *p;
1353813659
computeYMD_HMS(&x);
1353913660
if( x.Y<1971 || x.Y>=2038 ){
1354013661
x.Y = 2000;
1354113662
x.M = 1;
@@ -13549,51 +13670,27 @@
1354913670
}
1355013671
x.tz = 0;
1355113672
x.validJD = 0;
1355213673
computeJD(&x);
1355313674
t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);
13554
-#ifdef HAVE_LOCALTIME_R
13555
- {
13556
- struct tm sLocal;
13557
- localtime_r(&t, &sLocal);
13558
- y.Y = sLocal.tm_year + 1900;
13559
- y.M = sLocal.tm_mon + 1;
13560
- y.D = sLocal.tm_mday;
13561
- y.h = sLocal.tm_hour;
13562
- y.m = sLocal.tm_min;
13563
- y.s = sLocal.tm_sec;
13564
- }
13565
-#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
13566
- {
13567
- struct tm sLocal;
13568
- localtime_s(&sLocal, &t);
13569
- y.Y = sLocal.tm_year + 1900;
13570
- y.M = sLocal.tm_mon + 1;
13571
- y.D = sLocal.tm_mday;
13572
- y.h = sLocal.tm_hour;
13573
- y.m = sLocal.tm_min;
13574
- y.s = sLocal.tm_sec;
13575
- }
13576
-#else
13577
- {
13578
- struct tm *pTm;
13579
- sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
13580
- pTm = localtime(&t);
13581
- y.Y = pTm->tm_year + 1900;
13582
- y.M = pTm->tm_mon + 1;
13583
- y.D = pTm->tm_mday;
13584
- y.h = pTm->tm_hour;
13585
- y.m = pTm->tm_min;
13586
- y.s = pTm->tm_sec;
13587
- sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
13588
- }
13589
-#endif
13675
+ if( osLocaltime(&t, &sLocal) ){
13676
+ sqlite3_result_error(pCtx, "local time unavailable", -1);
13677
+ *pRc = SQLITE_ERROR;
13678
+ return 0;
13679
+ }
13680
+ y.Y = sLocal.tm_year + 1900;
13681
+ y.M = sLocal.tm_mon + 1;
13682
+ y.D = sLocal.tm_mday;
13683
+ y.h = sLocal.tm_hour;
13684
+ y.m = sLocal.tm_min;
13685
+ y.s = sLocal.tm_sec;
1359013686
y.validYMD = 1;
1359113687
y.validHMS = 1;
1359213688
y.validJD = 0;
1359313689