Fossil SCM

Updating from trunk to keep up working in the branch with the most recent fossil code.

viriketo 2011-08-30 08:01 UTC merge_renames merge
Commit 75aaf30aadc5cb32b00a5694e56a9216c07f09a5
83 files changed +38 -16 -3 +3 +9 +1 +2 +35 +1 +15 +73 +35 +314 +307 +1 +9 +144 +2 +80 +21 +3 +74 -21 +1 -1 +73 -36 +2 -2 +24 -8 +92 -15 +1 +17 -3 +5 -1 +1 +201 -52 +2 -2 +22 -16 +151 -36 +32 -6 +9 +4 -4 +2 -1 +61 -1 +11 -5 +9 -3 +16 -7 +32 -25 +3 -4 +10 -2 +1 -6 +5 +6 -2 +1 -1 +1 -1 +1 -1 +12 -2 +3777 -1278 +50 -23 +4 -2 +2 -1 +2 -1 +1 -1 +280 -29 +136 -20 +1 -1 +58 -2 +8 -20 +644 -9 +7 -1 +3 -3 +4 -4 +5 -5 +5 -5 -10 +63 -26 +1 +80 -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,15 @@
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-shareduplevel #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
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -0,0 +1,15 @@
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-shareduplevel #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
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,73 @@
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(BIG_ENDIAN) || !defined(BYTE_ORDER)
50
+ #error unknown
51
+ #elif BYTE_ORDER != BIG_ENDIAN
52
+ #error little
53
+ #endif
54
+ }]} {
55
+ define-feature big-endian
56
+ msg-result "big"
57
+ set rc 1
58
+ } elseif {[cctest -code {
59
+ #if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
60
+ #error unknown
61
+ #elif BYTE_ORDER != LITTLE_ENDIAN
62
+ #error big
63
+ #endif
64
+ }]} {
65
+ define-feature little-endian
66
+ msg-result "little"
67
+ set rc 1
68
+ } else {
69
+ msg-result "unknown"
70
+ }
71
+ }
72
+ return $rc
73
+}
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -0,0 +1,73 @@
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(BIG_ENDIAN) || !defined(BYTE_ORDER)
50 #error unknown
51 #elif BYTE_ORDER != BIG_ENDIAN
52 #error little
53 #endif
54 }]} {
55 define-feature big-endian
56 msg-result "big"
57 set rc 1
58 } elseif {[cctest -code {
59 #if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
60 #error unknown
61 #elif BYTE_ORDER != LITTLE_ENDIAN
62 #error big
63 #endif
64 }]} {
65 define-feature little-endian
66 msg-result "little"
67 set rc 1
68 } else {
69 msg-result "unknown"
70 }
71 }
72 return $rc
73 }
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -0,0 +1,35 @@
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 the toolchain
31
+# http://sourceforge.net/apps/mediawiki/predef/ define SHOBJ_LDFLAGS_R -bobject
32
+## SHOBJ_LDFLAGS Flags to us-fpshared Flags to us-fpicf/ define SHOBJ_LDFLAGS_R -bobject
33
+## SHOBJ_LDFLAGS Flags to us"-shared -nostartfiles"
34
+ }
35
+}
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/cc-shared.tcl
+++ b/autosetup/cc-shared.tcl
@@ -0,0 +1,35 @@
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 the toolchain
31 # http://sourceforge.net/apps/mediawiki/predef/ define SHOBJ_LDFLAGS_R -bobject
32 ## SHOBJ_LDFLAGS Flags to us-fpshared Flags to us-fpicf/ define SHOBJ_LDFLAGS_R -bobject
33 ## SHOBJ_LDFLAGS Flags to us"-shared -nostartfiles"
34 }
35 }
--- 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
--- 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
--- 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,80 @@
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 the module-optionsation and options
11
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
12
+#
13
+# It also support the "feature" naming convention, where searching
14
+# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
15
+#
16
+## datadir
17
+## sysconfdir
18
+## sharedstatedir
19
+## localstatedir
20
+## infodir
21
+## mandir
22
+## includedir
23
+#
24
+# If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
25
+ program-transform-name:
26
+}
27
+
28
+# @check-feature name { script }
29
+#
30
+# defines feature '$nReturns 1 if exists, or 0 if not
31
+#ode} {
32
+ msg-checking "Checking for $name..."
33
+ set r [uplevel 1 $code
34
+ define-feature $name $r
35
+ if {$r} {
36
+ msg-result "ok"
37
+ } else {
38
+ msg-result "not found"
39
+ }
40
+ return $r
41
+}
42
+
43
+# @have-feature name ?default=0?
44
+#
45
+# Returns the value of feature '$name' if defined,the feature if de
46
+# is translated thehave-feature {name {defathe 0}. Use @top_sr# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
47
+# All rights reserved
48
+
49
+# @synopsis:
50
+#
51
+# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
52
+#
53
+# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
54
+#
55
+# It defines the fol--prefix unless overridden by the module-optionsation and options
56
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
57
+#
58
+# It also support the "feature" naming convention, where searching
59
+# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
60
+#
61
+## datadir
62
+## sysconfdir
63
+## sharedstatedir
64
+## localstatedir
65
+## infodir
66
+## mandir
67
+## includedir
68
+#
69
+# If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
70
+ program-transform-name:
71
+}
72
+
73
+# @check-feature set prefixdefine[get-env exec-prefix \${prefix}]]\${exec_prefix}/bin
74
+ sbindir \${exec_prefix}/sbin
75
+ libexecdir \${exec_prefix}/libexec
76
+ libdir \${exec_prefix}/lib
77
+ datadir \${prefix}/share
78
+ sysconfdir \${prefix}/etc
79
+ sharedstatedir \${prefix}\${prefix}/var
80
+ infodir \${prefix}\${prefix}/share Copyright (c) ht (c) 2010 WorkWare Sys
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -0,0 +1,80 @@
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 the module-optionsation and options
11 # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
12 #
13 # It also support the "feature" naming convention, where searching
14 # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
15 #
16 ## datadir
17 ## sysconfdir
18 ## sharedstatedir
19 ## localstatedir
20 ## infodir
21 ## mandir
22 ## includedir
23 #
24 # If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
25 program-transform-name:
26 }
27
28 # @check-feature name { script }
29 #
30 # defines feature '$nReturns 1 if exists, or 0 if not
31 #ode} {
32 msg-checking "Checking for $name..."
33 set r [uplevel 1 $code
34 define-feature $name $r
35 if {$r} {
36 msg-result "ok"
37 } else {
38 msg-result "not found"
39 }
40 return $r
41 }
42
43 # @have-feature name ?default=0?
44 #
45 # Returns the value of feature '$name' if defined,the feature if de
46 # is translated thehave-feature {name {defathe 0}. Use @top_sr# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
47 # All rights reserved
48
49 # @synopsis:
50 #
51 # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
52 #
53 # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H
54 #
55 # It defines the fol--prefix unless overridden by the module-optionsation and options
56 # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
57 #
58 # It also support the "feature" naming convention, where searching
59 # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user:
60 #
61 ## datadir
62 ## sysconfdir
63 ## sharedstatedir
64 ## localstatedir
65 ## infodir
66 ## mandir
67 ## includedir
68 #
69 # If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' #
70 program-transform-name:
71 }
72
73 # @check-feature set prefixdefine[get-env exec-prefix \${prefix}]]\${exec_prefix}/bin
74 sbindir \${exec_prefix}/sbin
75 libexecdir \${exec_prefix}/libexec
76 libdir \${exec_prefix}/lib
77 datadir \${prefix}/share
78 sysconfdir \${prefix}/etc
79 sharedstatedir \${prefix}\${prefix}/var
80 infodir \${prefix}\${prefix}/share Copyright (c) ht (c) 2010 WorkWare Sys
--- 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
--- 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
+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
+1 -1
--- src/blob.c
+++ src/blob.c
@@ -120,11 +120,11 @@
120120
** This routine is called if a blob operation fails because we
121121
** have run out of memory.
122122
*/
123123
static void blob_panic(void){
124124
static const char zErrMsg[] = "out of memory\n";
125
- write(2, zErrMsg, sizeof(zErrMsg)-1);
125
+ fputs(zErrMsg, stderr);
126126
fossil_exit(1);
127127
}
128128
129129
/*
130130
** A reallocation function that assumes that aData came from malloc().
131131
--- src/blob.c
+++ src/blob.c
@@ -120,11 +120,11 @@
120 ** This routine is called if a blob operation fails because we
121 ** have run out of memory.
122 */
123 static void blob_panic(void){
124 static const char zErrMsg[] = "out of memory\n";
125 write(2, zErrMsg, sizeof(zErrMsg)-1);
126 fossil_exit(1);
127 }
128
129 /*
130 ** A reallocation function that assumes that aData came from malloc().
131
--- src/blob.c
+++ src/blob.c
@@ -120,11 +120,11 @@
120 ** This routine is called if a blob operation fails because we
121 ** have run out of memory.
122 */
123 static void blob_panic(void){
124 static const char zErrMsg[] = "out of memory\n";
125 fputs(zErrMsg, stderr);
126 fossil_exit(1);
127 }
128
129 /*
130 ** A reallocation function that assumes that aData came from malloc().
131
+73 -36
--- src/branch.c
+++ src/branch.c
@@ -174,12 +174,49 @@
174174
175175
/* Commit */
176176
db_end_transaction(0);
177177
178178
/* Do an autosync push, if requested */
179
- autosync(AUTOSYNC_PUSH);
179
+ if( !isPrivate ) 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
+ }
180216
}
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,21 +280,38 @@
247280
*/
248281
void brlist_page(void){
249282
Stmt q;
250283
int cnt;
251284
int showClosed = P("closed")!=0;
285
+ int showAll = P("all")!=0;
286
+ int colorTest = P("colortest")!=0;
252287
253288
login_check_credentials();
254289
if( !g.okRead ){ login_needed(); return; }
290
+ if( colorTest ){
291
+ showClosed = 0;
292
+ showAll = 1;
293
+ }
255294
256
- style_header(showClosed ? "Closed Branches" : "Open Branches");
295
+ style_header(showClosed ? "Closed Branches" :
296
+ showAll ? "All Branches" : "Open Branches");
257297
style_submenu_element("Timeline", "Timeline", "brtimeline");
258298
if( showClosed ){
299
+ style_submenu_element("All", "All", "brlist?all");
300
+ style_submenu_element("Open","Open","brlist");
301
+ }else if( showAll ){
302
+ style_submenu_element("Closed", "Closed", "brlist?closed");
259303
style_submenu_element("Open","Open","brlist");
260304
}else{
305
+ style_submenu_element("All", "All", "brlist?all");
261306
style_submenu_element("Closed","Closed","brlist?closed");
262307
}
308
+ if( !colorTest ){
309
+ style_submenu_element("Color-Test", "Color-Test", "brlist?colortest");
310
+ }else{
311
+ style_submenu_element("All", "All", "brlist?all");
312
+ }
263313
login_anonymous_available();
264314
style_sidebox_begin("Nomenclature:", "33%");
265315
@ <ol>
266316
@ <li> An <div class="sideboxDescribed"><a href="brlist">
267317
@ open branch</a></div> is a branch that has one or
@@ -275,46 +325,33 @@
275325
@ Closed branches are fixed and do not change (unless they are first
276326
@ reopened)</li>
277327
@ </ol>
278328
style_sidebox_end();
279329
330
+ prepareBranchQuery(&q, showAll, showClosed);
280331
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
- }
303332
while( db_step(&q)==SQLITE_ROW ){
304333
const char *zBr = db_column_text(&q, 0);
305334
if( cnt==0 ){
306
- if( showClosed ){
335
+ if( colorTest ){
336
+ @ <h2>Default background colors for all branches:</h2>
337
+ }else if( showAll ){
338
+ @ <h2>All Branches:</h2>
339
+ }else if( showClosed ){
307340
@ <h2>Closed Branches:</h2>
308341
}else{
309342
@ <h2>Open Branches:</h2>
310343
}
311344
@ <ul>
312345
cnt++;
313346
}
314
- if( g.okHistory ){
315
- @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a></li>
347
+ if( colorTest ){
348
+ const char *zColor = hash_color(zBr);
349
+ @ <li><span style="background-color: %s(zColor)">
350
+ @ %h(zBr) &rarr; %s(zColor)</span></li>
351
+ }else if( g.okHistory ){
352
+ @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
316353
}else{
317354
@ <li><b>%h(zBr)</b></li>
318355
}
319356
}
320357
if( cnt ){
321358
--- src/branch.c
+++ src/branch.c
@@ -174,12 +174,49 @@
174
175 /* Commit */
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,21 +280,38 @@
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>
266 @ <li> An <div class="sideboxDescribed"><a href="brlist">
267 @ open branch</a></div> is a branch that has one or
@@ -275,46 +325,33 @@
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 }else{
309 @ <h2>Open Branches:</h2>
310 }
311 @ <ul>
312 cnt++;
313 }
314 if( g.okHistory ){
315 @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a></li>
 
 
 
 
316 }else{
317 @ <li><b>%h(zBr)</b></li>
318 }
319 }
320 if( cnt ){
321
--- src/branch.c
+++ src/branch.c
@@ -174,12 +174,49 @@
174
175 /* Commit */
176 db_end_transaction(0);
177
178 /* Do an autosync push, if requested */
179 if( !isPrivate ) 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,21 +280,38 @@
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 int colorTest = P("colortest")!=0;
287
288 login_check_credentials();
289 if( !g.okRead ){ login_needed(); return; }
290 if( colorTest ){
291 showClosed = 0;
292 showAll = 1;
293 }
294
295 style_header(showClosed ? "Closed Branches" :
296 showAll ? "All Branches" : "Open Branches");
297 style_submenu_element("Timeline", "Timeline", "brtimeline");
298 if( showClosed ){
299 style_submenu_element("All", "All", "brlist?all");
300 style_submenu_element("Open","Open","brlist");
301 }else if( showAll ){
302 style_submenu_element("Closed", "Closed", "brlist?closed");
303 style_submenu_element("Open","Open","brlist");
304 }else{
305 style_submenu_element("All", "All", "brlist?all");
306 style_submenu_element("Closed","Closed","brlist?closed");
307 }
308 if( !colorTest ){
309 style_submenu_element("Color-Test", "Color-Test", "brlist?colortest");
310 }else{
311 style_submenu_element("All", "All", "brlist?all");
312 }
313 login_anonymous_available();
314 style_sidebox_begin("Nomenclature:", "33%");
315 @ <ol>
316 @ <li> An <div class="sideboxDescribed"><a href="brlist">
317 @ open branch</a></div> is a branch that has one or
@@ -275,46 +325,33 @@
325 @ Closed branches are fixed and do not change (unless they are first
326 @ reopened)</li>
327 @ </ol>
328 style_sidebox_end();
329
330 prepareBranchQuery(&q, showAll, showClosed);
331 cnt = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332 while( db_step(&q)==SQLITE_ROW ){
333 const char *zBr = db_column_text(&q, 0);
334 if( cnt==0 ){
335 if( colorTest ){
336 @ <h2>Default background colors for all branches:</h2>
337 }else if( showAll ){
338 @ <h2>All Branches:</h2>
339 }else if( showClosed ){
340 @ <h2>Closed Branches:</h2>
341 }else{
342 @ <h2>Open Branches:</h2>
343 }
344 @ <ul>
345 cnt++;
346 }
347 if( colorTest ){
348 const char *zColor = hash_color(zBr);
349 @ <li><span style="background-color: %s(zColor)">
350 @ %h(zBr) &rarr; %s(zColor)</span></li>
351 }else if( g.okHistory ){
352 @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
353 }else{
354 @ <li><b>%h(zBr)</b></li>
355 }
356 }
357 if( cnt ){
358
+2 -2
--- src/browse.c
+++ src/browse.c
@@ -146,11 +146,11 @@
146146
/* Compute the title of the page */
147147
blob_zero(&dirname);
148148
if( zD ){
149149
blob_append(&dirname, "in directory ", -1);
150150
hyperlinked_path(zD, &dirname, zCI);
151
- zPrefix = mprintf("%h/", zD);
151
+ zPrefix = mprintf("%s/", zD);
152152
}else{
153153
blob_append(&dirname, "in the top-level directory", -1);
154154
zPrefix = "";
155155
}
156156
if( zCI ){
@@ -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
@@ -146,11 +146,11 @@
146 /* Compute the title of the page */
147 blob_zero(&dirname);
148 if( zD ){
149 blob_append(&dirname, "in directory ", -1);
150 hyperlinked_path(zD, &dirname, zCI);
151 zPrefix = mprintf("%h/", zD);
152 }else{
153 blob_append(&dirname, "in the top-level directory", -1);
154 zPrefix = "";
155 }
156 if( zCI ){
@@ -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
@@ -146,11 +146,11 @@
146 /* Compute the title of the page */
147 blob_zero(&dirname);
148 if( zD ){
149 blob_append(&dirname, "in directory ", -1);
150 hyperlinked_path(zD, &dirname, zCI);
151 zPrefix = mprintf("%s/", zD);
152 }else{
153 blob_append(&dirname, "in the top-level directory", -1);
154 zPrefix = "";
155 }
156 if( zCI ){
@@ -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
+24 -8
--- 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
@@ -1143,11 +1153,13 @@
11431153
fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
11441154
fflush(stdout);
11451155
}
11461156
if( zBrowser ){
11471157
zBrowser = mprintf(zBrowser, iPort);
1148
- system(zBrowser);
1158
+ if( system(zBrowser)<0 ){
1159
+ fossil_warning("cannot start browser: %s\n", zBrowser);
1160
+ }
11491161
}
11501162
while( 1 ){
11511163
if( nchildren>MAX_PARALLEL ){
11521164
/* Slow down if connections are arriving too fast */
11531165
sleep( nchildren-MAX_PARALLEL );
@@ -1164,20 +1176,24 @@
11641176
child = fork();
11651177
if( child!=0 ){
11661178
if( child>0 ) nchildren++;
11671179
close(connection);
11681180
}else{
1181
+ int nErr = 0, fd;
11691182
close(0);
1170
- dup(connection);
1183
+ fd = dup(connection);
1184
+ if( fd!=0 ) nErr++;
11711185
close(1);
1172
- dup(connection);
1186
+ fd = dup(connection);
1187
+ if( fd!=1 ) nErr++;
11731188
if( !g.fHttpTrace && !g.fSqlTrace ){
11741189
close(2);
1175
- dup(connection);
1190
+ fd = dup(connection);
1191
+ if( fd!=2 ) nErr++;
11761192
}
11771193
close(connection);
1178
- return 0;
1194
+ return nErr;
11791195
}
11801196
}
11811197
}
11821198
/* Bury dead children */
11831199
while( waitpid(0, 0, WNOHANG)>0 ){
11841200
--- 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
@@ -1143,11 +1153,13 @@
1143 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
1144 fflush(stdout);
1145 }
1146 if( zBrowser ){
1147 zBrowser = mprintf(zBrowser, iPort);
1148 system(zBrowser);
 
 
1149 }
1150 while( 1 ){
1151 if( nchildren>MAX_PARALLEL ){
1152 /* Slow down if connections are arriving too fast */
1153 sleep( nchildren-MAX_PARALLEL );
@@ -1164,20 +1176,24 @@
1164 child = fork();
1165 if( child!=0 ){
1166 if( child>0 ) nchildren++;
1167 close(connection);
1168 }else{
 
1169 close(0);
1170 dup(connection);
 
1171 close(1);
1172 dup(connection);
 
1173 if( !g.fHttpTrace && !g.fSqlTrace ){
1174 close(2);
1175 dup(connection);
 
1176 }
1177 close(connection);
1178 return 0;
1179 }
1180 }
1181 }
1182 /* Bury dead children */
1183 while( waitpid(0, 0, WNOHANG)>0 ){
1184
--- 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
@@ -1143,11 +1153,13 @@
1153 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
1154 fflush(stdout);
1155 }
1156 if( zBrowser ){
1157 zBrowser = mprintf(zBrowser, iPort);
1158 if( system(zBrowser)<0 ){
1159 fossil_warning("cannot start browser: %s\n", zBrowser);
1160 }
1161 }
1162 while( 1 ){
1163 if( nchildren>MAX_PARALLEL ){
1164 /* Slow down if connections are arriving too fast */
1165 sleep( nchildren-MAX_PARALLEL );
@@ -1164,20 +1176,24 @@
1176 child = fork();
1177 if( child!=0 ){
1178 if( child>0 ) nchildren++;
1179 close(connection);
1180 }else{
1181 int nErr = 0, fd;
1182 close(0);
1183 fd = dup(connection);
1184 if( fd!=0 ) nErr++;
1185 close(1);
1186 fd = dup(connection);
1187 if( fd!=1 ) nErr++;
1188 if( !g.fHttpTrace && !g.fSqlTrace ){
1189 close(2);
1190 fd = dup(connection);
1191 if( fd!=2 ) nErr++;
1192 }
1193 close(connection);
1194 return nErr;
1195 }
1196 }
1197 }
1198 /* Bury dead children */
1199 while( waitpid(0, 0, WNOHANG)>0 ){
1200
+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
+201 -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,114 @@
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
+ char *zVersionedSetting = 0;
1413
+ int noWarn = 0;
1414
+ struct _cacheEntry {
1415
+ struct _cacheEntry *next;
1416
+ const char *zName, *zValue;
1417
+ } *cacheEntry = 0;
1418
+ static struct _cacheEntry *cache = 0;
1419
+
1420
+ /* Look up name in cache */
1421
+ cacheEntry = cache;
1422
+ while( cacheEntry!=0 ){
1423
+ if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
1424
+ zVersionedSetting = fossil_strdup(cacheEntry->zValue);
1425
+ break;
1426
+ }
1427
+ cacheEntry = cacheEntry->next;
1428
+ }
1429
+ /* Attempt to read value from file in checkout if there wasn't a cache hit
1430
+ ** and a checkout is open. */
1431
+ if( cacheEntry==0 ){
1432
+ Blob versionedPathname;
1433
+ char *zVersionedPathname;
1434
+ blob_zero(&versionedPathname);
1435
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1436
+ g.zLocalRoot, zName);
1437
+ zVersionedPathname = blob_str(&versionedPathname);
1438
+ if( file_size(zVersionedPathname)>=0 ){
1439
+ /* File exists, and contains the value for this setting. Load from
1440
+ ** the file. */
1441
+ Blob setting;
1442
+ blob_zero(&setting);
1443
+ if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1444
+ blob_trim(&setting); /* Avoid non-obvious problems with line endings
1445
+ ** on boolean properties */
1446
+ zVersionedSetting = strdup(blob_str(&setting));
1447
+ }
1448
+ blob_reset(&setting);
1449
+ /* See if there's a no-warn flag */
1450
+ blob_append(&versionedPathname, ".no-warn", -1);
1451
+ if( file_size(blob_str(&versionedPathname))>=0 ){
1452
+ noWarn = 1;
1453
+ }
1454
+ }
1455
+ blob_reset(&versionedPathname);
1456
+ /* Store result in cache, which can be the value or 0 if not found */
1457
+ cacheEntry = (struct _cacheEntry*)fossil_malloc(sizeof(struct _cacheEntry));
1458
+ cacheEntry->next = cache;
1459
+ cacheEntry->zName = zName;
1460
+ cacheEntry->zValue = fossil_strdup(zVersionedSetting);
1461
+ cache = cacheEntry;
1462
+ }
1463
+ /* Display a warning? */
1464
+ if( zVersionedSetting!=0 && zNonVersionedSetting!=0
1465
+ && zNonVersionedSetting[0]!='\0' && !noWarn
1466
+ ){
1467
+ /* There's a versioned setting, and a non-versioned setting. Tell
1468
+ ** the user about the conflict */
1469
+ fossil_warning(
1470
+ "setting %s has both versioned and non-versioned values: using "
1471
+ "versioned value from file .fossil-settings/%s (to silence this "
1472
+ "warning, either create an empty file named "
1473
+ ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1474
+ " with \"fossil unset %s\")", zName, zName, zName, zName
1475
+ );
1476
+ }
1477
+ /* Prefer the versioned setting */
1478
+ return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting;
1479
+}
1480
+
13971481
13981482
/*
13991483
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
14001484
** repository and local databases.
14011485
*/
14021486
char *db_get(const char *zName, char *zDefault){
14031487
char *z = 0;
1488
+ int i;
1489
+ const struct stControlSettings *ctrlSetting = 0;
1490
+ /* Is this a setting? */
1491
+ for(i=0; ctrlSettings[i].name; i++){
1492
+ if( strcmp(ctrlSettings[i].name, zName)==0 ){
1493
+ ctrlSetting = &(ctrlSettings[i]);
1494
+ break;
1495
+ }
1496
+ }
14041497
if( g.repositoryOpen ){
14051498
z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
14061499
}
14071500
if( z==0 && g.configOpen ){
14081501
db_swap_connections();
14091502
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
14101503
db_swap_connections();
1504
+ }
1505
+ if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1506
+ /* This is a versionable setting, try and get the info from a checked out file */
1507
+ z = db_get_do_versionable(zName, z);
14111508
}
14121509
if( z==0 ){
14131510
z = zDefault;
14141511
}
14151512
return z;
@@ -1596,30 +1693,39 @@
15961693
}
15971694
15981695
/*
15991696
** Print the value of a setting named zName
16001697
*/
1601
-static void print_setting(const char *zName){
1698
+static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
16021699
Stmt q;
16031700
if( g.repositoryOpen ){
16041701
db_prepare(&q,
16051702
"SELECT '(local)', value FROM config WHERE name=%Q"
16061703
" UNION ALL "
16071704
"SELECT '(global)', value FROM global_config WHERE name=%Q",
1608
- zName, zName
1705
+ ctrlSetting->name, ctrlSetting->name
16091706
);
16101707
}else{
16111708
db_prepare(&q,
16121709
"SELECT '(global)', value FROM global_config WHERE name=%Q",
1613
- zName
1710
+ ctrlSetting->name
16141711
);
16151712
}
16161713
if( db_step(&q)==SQLITE_ROW ){
1617
- fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
1714
+ fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0),
16181715
db_column_text(&q, 1));
16191716
}else{
1620
- fossil_print("%-20s\n", zName);
1717
+ fossil_print("%-20s\n", ctrlSetting->name);
1718
+ }
1719
+ if( ctrlSetting->versionable && localOpen ){
1720
+ /* Check to see if this is overridden by a versionable settings file */
1721
+ Blob versionedPathname;
1722
+ blob_zero(&versionedPathname);
1723
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
1724
+ if( file_size(blob_str(&versionedPathname))>=0 ){
1725
+ fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
1726
+ }
16211727
}
16221728
db_finalize(&q);
16231729
}
16241730
16251731
@@ -1635,42 +1741,49 @@
16351741
#if INTERFACE
16361742
struct stControlSettings {
16371743
char const *name; /* Name of the setting */
16381744
char const *var; /* Internal variable name used by db_set() */
16391745
int width; /* Width of display. 0 for boolean values */
1746
+ int versionable; /* Is this setting versionable? */
16401747
char const *def; /* Default value */
16411748
};
16421749
#endif /* INTERFACE */
16431750
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 }
1751
+ { "access-log", 0, 0, 0, "off" },
1752
+ { "auto-captcha", "autocaptcha", 0, 0, "on" },
1753
+ { "auto-shun", 0, 0, 0, "on" },
1754
+ { "autosync", 0, 0, 0, "on" },
1755
+ { "binary-glob", 0, 32, 1, "" },
1756
+ { "clearsign", 0, 0, 0, "off" },
1757
+ { "case-sensitive",0, 0, 0, "on" },
1758
+ { "crnl-glob", 0, 16, 1, "" },
1759
+ { "default-perms", 0, 16, 0, "u" },
1760
+ { "diff-command", 0, 16, 0, "" },
1761
+ { "dont-push", 0, 0, 0, "off" },
1762
+ { "editor", 0, 16, 0, "" },
1763
+ { "gdiff-command", 0, 16, 0, "gdiff" },
1764
+ { "gmerge-command",0, 40, 0, "" },
1765
+ { "https-login", 0, 0, 0, "off" },
1766
+ { "ignore-glob", 0, 40, 1, "" },
1767
+ { "empty-dirs", 0, 40, 1, "" },
1768
+ { "http-port", 0, 16, 0, "8080" },
1769
+ { "localauth", 0, 0, 0, "off" },
1770
+ { "main-branch", 0, 40, 0, "trunk" },
1771
+ { "manifest", 0, 0, 1, "off" },
1772
+ { "max-upload", 0, 25, 0, "250000" },
1773
+ { "mtime-changes", 0, 0, 0, "on" },
1774
+ { "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
1775
+ { "proxy", 0, 32, 0, "off" },
1776
+ { "relative-paths",0, 0, 0, "on" },
1777
+ { "repo-cksum", 0, 0, 0, "on" },
1778
+ { "self-register", 0, 0, 0, "off" },
1779
+ { "ssl-ca-location",0, 40, 0, "" },
1780
+ { "ssl-identity", 0, 40, 0, "" },
1781
+ { "ssh-command", 0, 32, 0, "" },
1782
+ { "web-browser", 0, 32, 0, "" },
1783
+ { "white-foreground", 0, 0, 0, "off" },
1784
+ { 0,0,0,0,0 }
16721785
};
16731786
16741787
/*
16751788
** COMMAND: settings
16761789
** COMMAND: unset
@@ -1679,10 +1792,14 @@
16791792
** %fossil unset PROPERTY ?-global?
16801793
**
16811794
** The "settings" command with no arguments lists all properties and their
16821795
** values. With just a property name it shows the value of that property.
16831796
** With a value argument it changes the property for the current repository.
1797
+**
1798
+** Settings marked as versionable are overridden by the contents of the
1799
+** file named .fossil-settings/PROPERTY in the checked out files, if that
1800
+** file exists.
16841801
**
16851802
** The "unset" command clears a property setting.
16861803
**
16871804
**
16881805
** auto-captcha If enabled, the Login page provides a button to
@@ -1696,20 +1813,25 @@
16961813
** or update and automatically push after commit or
16971814
** tag or branch creation. If the value is "pullonly"
16981815
** then only pull operations occur automatically.
16991816
** Default: on
17001817
**
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
1818
+** binary-glob The VALUE is a comma or newline-separated list of
1819
+** (versionable) GLOB patterns that should be treated as binary files
1820
+** for merging purposes. Example: *.xml
1821
+**
1822
+** case-sensitive If TRUE, the files whose names differ only in case
1823
+** care considered distinct. If FALSE files whose names
1824
+** differ only in case are the same file. Defaults to
1825
+** TRUE for unix and FALSE for windows and mac.
17041826
**
17051827
** clearsign When enabled, fossil will attempt to sign all commits
17061828
** with gpg. When disabled (the default), commits will
17071829
** be unsigned. Default: off
17081830
**
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.
1831
+** crnl-glob A comma or newline-separated list of GLOB patterns for
1832
+** (versionable) text files in which it is ok to have CR+NL line endings.
17111833
** Set to "*" to disable CR+NL checking.
17121834
**
17131835
** default-perms Permissions given automatically to new users. For more
17141836
** information on permissions see Users page in Server
17151837
** Administration of the HTTP UI. Default: u.
@@ -1717,10 +1839,15 @@
17171839
** diff-command External command to run when performing a diff.
17181840
** If undefined, the internal text diff will be used.
17191841
**
17201842
** dont-push Prevent this repository from pushing from client to
17211843
** server. Useful when setting up a private branch.
1844
+**
1845
+** empty-dirs A comma or newline-separated list of pathnames. On
1846
+** (versionable) update and checkout commands, if no file or directory
1847
+** exists with that name, an empty directory will be
1848
+** created.
17221849
**
17231850
** editor Text editor command used for check-in comments.
17241851
**
17251852
** gdiff-command External command to run when performing a graphical
17261853
** diff. If undefined, text diff will be used.
@@ -1735,23 +1862,23 @@
17351862
** and "ui" commands. Default: 8080
17361863
**
17371864
** https-login Send login creditials using HTTPS instead of HTTP
17381865
** even if the login page request came via HTTP.
17391866
**
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
1867
+** ignore-glob The VALUE is a comma or newline-separated list of GLOB
1868
+** (versionable) patterns specifying files that the "extra" command will
1869
+** ignore. Example: *.o,*.obj,*.exe
17431870
**
17441871
** localauth If enabled, require that HTTP connections from
17451872
** 127.0.0.1 be authenticated by password. If
17461873
** false, all HTTP requests from localhost have
17471874
** unrestricted access to the repository.
17481875
**
17491876
** main-branch The primary branch for the project. Default: trunk
17501877
**
17511878
** manifest If enabled, automatically create files "manifest" and
1752
-** "manifest.uuid" in every checkout. The SQLite and
1879
+** (versionable) "manifest.uuid" in every checkout. The SQLite and
17531880
** Fossil repositories both require this. Default: off.
17541881
**
17551882
** max-upload A limit on the size of uplink HTTP requests. The
17561883
** default is 250000 bytes.
17571884
**
@@ -1763,10 +1890,13 @@
17631890
**
17641891
** proxy URL of the HTTP proxy. If undefined or "off" then
17651892
** the "http_proxy" environment variable is consulted.
17661893
** If the http_proxy environment variable is undefined
17671894
** then a direct HTTP connection is used.
1895
+**
1896
+** relative-paths When showing changes and extras, report paths relative
1897
+** to the current working directory. Default: "on"
17681898
**
17691899
** repo-cksum Compute checksums over all files in each checkout
17701900
** as a double-check of correctness. Defaults to "on".
17711901
** Disable on large repositories for a performance
17721902
** improvement.
@@ -1773,10 +1903,28 @@
17731903
**
17741904
** self-register Allow users to register themselves through the HTTP UI.
17751905
** This is useful if you want to see other names than
17761906
** "Anonymous" in e.g. ticketing system. On the other hand
17771907
** users can not be deleted. Default: off.
1908
+**
1909
+** ssl-ca-location The full pathname to a file containing PEM encoded
1910
+** CA root certificates, or a directory of certificates
1911
+** with filenames formed from the certificate hashes as
1912
+** required by OpenSSL.
1913
+** If set, this will override the OS default list of
1914
+** OpenSSL CAs. If unset, the default list will be used.
1915
+** Some platforms may add additional certificates.
1916
+** Check your platform behaviour is as required if the
1917
+** exact contents of the CA root is critical for your
1918
+** application.
1919
+**
1920
+** ssl-identity The full pathname to a file containing a certificate
1921
+** and private key in PEM format. Create by concatenating
1922
+** the certificate and private key files.
1923
+** This identity will be presented to SSL servers to
1924
+** authenticate this client, in addition to the normal
1925
+** password authentication.
17781926
**
17791927
** ssh-command Command used to talk to a remote machine with
17801928
** the "ssh://" protocol.
17811929
**
17821930
** web-browser A shell command used to launch your preferred
@@ -1797,12 +1945,13 @@
17971945
}
17981946
if( unsetFlag && g.argc!=3 ){
17991947
usage("PROPERTY ?-global?");
18001948
}
18011949
if( g.argc==2 ){
1950
+ int openLocal = db_open_local();
18021951
for(i=0; ctrlSettings[i].name; i++){
1803
- print_setting(ctrlSettings[i].name);
1952
+ print_setting(&ctrlSettings[i], openLocal);
18041953
}
18051954
}else if( g.argc==3 || g.argc==4 ){
18061955
const char *zName = g.argv[2];
18071956
int isManifest;
18081957
int n = strlen(zName);
@@ -1820,13 +1969,13 @@
18201969
db_unset(ctrlSettings[i].name, globalFlag);
18211970
}else if( g.argc==4 ){
18221971
db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
18231972
}else{
18241973
isManifest = 0;
1825
- print_setting(ctrlSettings[i].name);
1974
+ print_setting(&ctrlSettings[i], db_open_local());
18261975
}
1827
- if( isManifest ){
1976
+ if( isManifest && g.localOpen ){
18281977
manifest_to_disk(db_lget_int("checkout", 0));
18291978
}
18301979
}else{
18311980
usage("?PROPERTY? ?VALUE?");
18321981
}
18331982
--- 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,114 @@
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 +1693,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 +1741,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 +1792,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 +1813,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 +1839,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 +1862,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 +1890,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 +1903,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 +1945,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 +1969,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,114 @@
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 char *zVersionedSetting = 0;
1413 int noWarn = 0;
1414 struct _cacheEntry {
1415 struct _cacheEntry *next;
1416 const char *zName, *zValue;
1417 } *cacheEntry = 0;
1418 static struct _cacheEntry *cache = 0;
1419
1420 /* Look up name in cache */
1421 cacheEntry = cache;
1422 while( cacheEntry!=0 ){
1423 if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
1424 zVersionedSetting = fossil_strdup(cacheEntry->zValue);
1425 break;
1426 }
1427 cacheEntry = cacheEntry->next;
1428 }
1429 /* Attempt to read value from file in checkout if there wasn't a cache hit
1430 ** and a checkout is open. */
1431 if( cacheEntry==0 ){
1432 Blob versionedPathname;
1433 char *zVersionedPathname;
1434 blob_zero(&versionedPathname);
1435 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1436 g.zLocalRoot, zName);
1437 zVersionedPathname = blob_str(&versionedPathname);
1438 if( file_size(zVersionedPathname)>=0 ){
1439 /* File exists, and contains the value for this setting. Load from
1440 ** the file. */
1441 Blob setting;
1442 blob_zero(&setting);
1443 if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1444 blob_trim(&setting); /* Avoid non-obvious problems with line endings
1445 ** on boolean properties */
1446 zVersionedSetting = strdup(blob_str(&setting));
1447 }
1448 blob_reset(&setting);
1449 /* See if there's a no-warn flag */
1450 blob_append(&versionedPathname, ".no-warn", -1);
1451 if( file_size(blob_str(&versionedPathname))>=0 ){
1452 noWarn = 1;
1453 }
1454 }
1455 blob_reset(&versionedPathname);
1456 /* Store result in cache, which can be the value or 0 if not found */
1457 cacheEntry = (struct _cacheEntry*)fossil_malloc(sizeof(struct _cacheEntry));
1458 cacheEntry->next = cache;
1459 cacheEntry->zName = zName;
1460 cacheEntry->zValue = fossil_strdup(zVersionedSetting);
1461 cache = cacheEntry;
1462 }
1463 /* Display a warning? */
1464 if( zVersionedSetting!=0 && zNonVersionedSetting!=0
1465 && zNonVersionedSetting[0]!='\0' && !noWarn
1466 ){
1467 /* There's a versioned setting, and a non-versioned setting. Tell
1468 ** the user about the conflict */
1469 fossil_warning(
1470 "setting %s has both versioned and non-versioned values: using "
1471 "versioned value from file .fossil-settings/%s (to silence this "
1472 "warning, either create an empty file named "
1473 ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1474 " with \"fossil unset %s\")", zName, zName, zName, zName
1475 );
1476 }
1477 /* Prefer the versioned setting */
1478 return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting;
1479 }
1480
1481
1482 /*
1483 ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
1484 ** repository and local databases.
1485 */
1486 char *db_get(const char *zName, char *zDefault){
1487 char *z = 0;
1488 int i;
1489 const struct stControlSettings *ctrlSetting = 0;
1490 /* Is this a setting? */
1491 for(i=0; ctrlSettings[i].name; i++){
1492 if( strcmp(ctrlSettings[i].name, zName)==0 ){
1493 ctrlSetting = &(ctrlSettings[i]);
1494 break;
1495 }
1496 }
1497 if( g.repositoryOpen ){
1498 z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
1499 }
1500 if( z==0 && g.configOpen ){
1501 db_swap_connections();
1502 z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
1503 db_swap_connections();
1504 }
1505 if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
1506 /* This is a versionable setting, try and get the info from a checked out file */
1507 z = db_get_do_versionable(zName, z);
1508 }
1509 if( z==0 ){
1510 z = zDefault;
1511 }
1512 return z;
@@ -1596,30 +1693,39 @@
1693 }
1694
1695 /*
1696 ** Print the value of a setting named zName
1697 */
1698 static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
1699 Stmt q;
1700 if( g.repositoryOpen ){
1701 db_prepare(&q,
1702 "SELECT '(local)', value FROM config WHERE name=%Q"
1703 " UNION ALL "
1704 "SELECT '(global)', value FROM global_config WHERE name=%Q",
1705 ctrlSetting->name, ctrlSetting->name
1706 );
1707 }else{
1708 db_prepare(&q,
1709 "SELECT '(global)', value FROM global_config WHERE name=%Q",
1710 ctrlSetting->name
1711 );
1712 }
1713 if( db_step(&q)==SQLITE_ROW ){
1714 fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0),
1715 db_column_text(&q, 1));
1716 }else{
1717 fossil_print("%-20s\n", ctrlSetting->name);
1718 }
1719 if( ctrlSetting->versionable && localOpen ){
1720 /* Check to see if this is overridden by a versionable settings file */
1721 Blob versionedPathname;
1722 blob_zero(&versionedPathname);
1723 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
1724 if( file_size(blob_str(&versionedPathname))>=0 ){
1725 fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
1726 }
1727 }
1728 db_finalize(&q);
1729 }
1730
1731
@@ -1635,42 +1741,49 @@
1741 #if INTERFACE
1742 struct stControlSettings {
1743 char const *name; /* Name of the setting */
1744 char const *var; /* Internal variable name used by db_set() */
1745 int width; /* Width of display. 0 for boolean values */
1746 int versionable; /* Is this setting versionable? */
1747 char const *def; /* Default value */
1748 };
1749 #endif /* INTERFACE */
1750 struct stControlSettings const ctrlSettings[] = {
1751 { "access-log", 0, 0, 0, "off" },
1752 { "auto-captcha", "autocaptcha", 0, 0, "on" },
1753 { "auto-shun", 0, 0, 0, "on" },
1754 { "autosync", 0, 0, 0, "on" },
1755 { "binary-glob", 0, 32, 1, "" },
1756 { "clearsign", 0, 0, 0, "off" },
1757 { "case-sensitive",0, 0, 0, "on" },
1758 { "crnl-glob", 0, 16, 1, "" },
1759 { "default-perms", 0, 16, 0, "u" },
1760 { "diff-command", 0, 16, 0, "" },
1761 { "dont-push", 0, 0, 0, "off" },
1762 { "editor", 0, 16, 0, "" },
1763 { "gdiff-command", 0, 16, 0, "gdiff" },
1764 { "gmerge-command",0, 40, 0, "" },
1765 { "https-login", 0, 0, 0, "off" },
1766 { "ignore-glob", 0, 40, 1, "" },
1767 { "empty-dirs", 0, 40, 1, "" },
1768 { "http-port", 0, 16, 0, "8080" },
1769 { "localauth", 0, 0, 0, "off" },
1770 { "main-branch", 0, 40, 0, "trunk" },
1771 { "manifest", 0, 0, 1, "off" },
1772 { "max-upload", 0, 25, 0, "250000" },
1773 { "mtime-changes", 0, 0, 0, "on" },
1774 { "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
1775 { "proxy", 0, 32, 0, "off" },
1776 { "relative-paths",0, 0, 0, "on" },
1777 { "repo-cksum", 0, 0, 0, "on" },
1778 { "self-register", 0, 0, 0, "off" },
1779 { "ssl-ca-location",0, 40, 0, "" },
1780 { "ssl-identity", 0, 40, 0, "" },
1781 { "ssh-command", 0, 32, 0, "" },
1782 { "web-browser", 0, 32, 0, "" },
1783 { "white-foreground", 0, 0, 0, "off" },
1784 { 0,0,0,0,0 }
1785 };
1786
1787 /*
1788 ** COMMAND: settings
1789 ** COMMAND: unset
@@ -1679,10 +1792,14 @@
1792 ** %fossil unset PROPERTY ?-global?
1793 **
1794 ** The "settings" command with no arguments lists all properties and their
1795 ** values. With just a property name it shows the value of that property.
1796 ** With a value argument it changes the property for the current repository.
1797 **
1798 ** Settings marked as versionable are overridden by the contents of the
1799 ** file named .fossil-settings/PROPERTY in the checked out files, if that
1800 ** file exists.
1801 **
1802 ** The "unset" command clears a property setting.
1803 **
1804 **
1805 ** auto-captcha If enabled, the Login page provides a button to
@@ -1696,20 +1813,25 @@
1813 ** or update and automatically push after commit or
1814 ** tag or branch creation. If the value is "pullonly"
1815 ** then only pull operations occur automatically.
1816 ** Default: on
1817 **
1818 ** binary-glob The VALUE is a comma or newline-separated list of
1819 ** (versionable) GLOB patterns that should be treated as binary files
1820 ** for merging purposes. Example: *.xml
1821 **
1822 ** case-sensitive If TRUE, the files whose names differ only in case
1823 ** care considered distinct. If FALSE files whose names
1824 ** differ only in case are the same file. Defaults to
1825 ** TRUE for unix and FALSE for windows and mac.
1826 **
1827 ** clearsign When enabled, fossil will attempt to sign all commits
1828 ** with gpg. When disabled (the default), commits will
1829 ** be unsigned. Default: off
1830 **
1831 ** crnl-glob A comma or newline-separated list of GLOB patterns for
1832 ** (versionable) text files in which it is ok to have CR+NL line endings.
1833 ** Set to "*" to disable CR+NL checking.
1834 **
1835 ** default-perms Permissions given automatically to new users. For more
1836 ** information on permissions see Users page in Server
1837 ** Administration of the HTTP UI. Default: u.
@@ -1717,10 +1839,15 @@
1839 ** diff-command External command to run when performing a diff.
1840 ** If undefined, the internal text diff will be used.
1841 **
1842 ** dont-push Prevent this repository from pushing from client to
1843 ** server. Useful when setting up a private branch.
1844 **
1845 ** empty-dirs A comma or newline-separated list of pathnames. On
1846 ** (versionable) update and checkout commands, if no file or directory
1847 ** exists with that name, an empty directory will be
1848 ** created.
1849 **
1850 ** editor Text editor command used for check-in comments.
1851 **
1852 ** gdiff-command External command to run when performing a graphical
1853 ** diff. If undefined, text diff will be used.
@@ -1735,23 +1862,23 @@
1862 ** and "ui" commands. Default: 8080
1863 **
1864 ** https-login Send login creditials using HTTPS instead of HTTP
1865 ** even if the login page request came via HTTP.
1866 **
1867 ** ignore-glob The VALUE is a comma or newline-separated list of GLOB
1868 ** (versionable) patterns specifying files that the "extra" command will
1869 ** ignore. Example: *.o,*.obj,*.exe
1870 **
1871 ** localauth If enabled, require that HTTP connections from
1872 ** 127.0.0.1 be authenticated by password. If
1873 ** false, all HTTP requests from localhost have
1874 ** unrestricted access to the repository.
1875 **
1876 ** main-branch The primary branch for the project. Default: trunk
1877 **
1878 ** manifest If enabled, automatically create files "manifest" and
1879 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
1880 ** Fossil repositories both require this. Default: off.
1881 **
1882 ** max-upload A limit on the size of uplink HTTP requests. The
1883 ** default is 250000 bytes.
1884 **
@@ -1763,10 +1890,13 @@
1890 **
1891 ** proxy URL of the HTTP proxy. If undefined or "off" then
1892 ** the "http_proxy" environment variable is consulted.
1893 ** If the http_proxy environment variable is undefined
1894 ** then a direct HTTP connection is used.
1895 **
1896 ** relative-paths When showing changes and extras, report paths relative
1897 ** to the current working directory. Default: "on"
1898 **
1899 ** repo-cksum Compute checksums over all files in each checkout
1900 ** as a double-check of correctness. Defaults to "on".
1901 ** Disable on large repositories for a performance
1902 ** improvement.
@@ -1773,10 +1903,28 @@
1903 **
1904 ** self-register Allow users to register themselves through the HTTP UI.
1905 ** This is useful if you want to see other names than
1906 ** "Anonymous" in e.g. ticketing system. On the other hand
1907 ** users can not be deleted. Default: off.
1908 **
1909 ** ssl-ca-location The full pathname to a file containing PEM encoded
1910 ** CA root certificates, or a directory of certificates
1911 ** with filenames formed from the certificate hashes as
1912 ** required by OpenSSL.
1913 ** If set, this will override the OS default list of
1914 ** OpenSSL CAs. If unset, the default list will be used.
1915 ** Some platforms may add additional certificates.
1916 ** Check your platform behaviour is as required if the
1917 ** exact contents of the CA root is critical for your
1918 ** application.
1919 **
1920 ** ssl-identity The full pathname to a file containing a certificate
1921 ** and private key in PEM format. Create by concatenating
1922 ** the certificate and private key files.
1923 ** This identity will be presented to SSL servers to
1924 ** authenticate this client, in addition to the normal
1925 ** password authentication.
1926 **
1927 ** ssh-command Command used to talk to a remote machine with
1928 ** the "ssh://" protocol.
1929 **
1930 ** web-browser A shell command used to launch your preferred
@@ -1797,12 +1945,13 @@
1945 }
1946 if( unsetFlag && g.argc!=3 ){
1947 usage("PROPERTY ?-global?");
1948 }
1949 if( g.argc==2 ){
1950 int openLocal = db_open_local();
1951 for(i=0; ctrlSettings[i].name; i++){
1952 print_setting(&ctrlSettings[i], openLocal);
1953 }
1954 }else if( g.argc==3 || g.argc==4 ){
1955 const char *zName = g.argv[2];
1956 int isManifest;
1957 int n = strlen(zName);
@@ -1820,13 +1969,13 @@
1969 db_unset(ctrlSettings[i].name, globalFlag);
1970 }else if( g.argc==4 ){
1971 db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
1972 }else{
1973 isManifest = 0;
1974 print_setting(&ctrlSettings[i], db_open_local());
1975 }
1976 if( isManifest && g.localOpen ){
1977 manifest_to_disk(db_lget_int("checkout", 0));
1978 }
1979 }else{
1980 usage("?PROPERTY? ?VALUE?");
1981 }
1982
--- src/descendants.c
+++ src/descendants.c
@@ -287,11 +287,11 @@
287287
"%s"
288288
" AND event.objid IN (SELECT rid FROM leaves)"
289289
" ORDER BY event.mtime DESC",
290290
timeline_query_for_tty()
291291
);
292
- print_timeline(&q, 20);
292
+ print_timeline(&q, 20, 0);
293293
db_finalize(&q);
294294
}
295295
296296
/*
297297
** COMMAND: leaves
@@ -322,11 +322,11 @@
322322
}else if( !showAll ){
323323
blob_appendf(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
324324
}
325325
db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_str(&sql));
326326
blob_reset(&sql);
327
- print_timeline(&q, 2000);
327
+ print_timeline(&q, 2000, 0);
328328
db_finalize(&q);
329329
}
330330
331331
/*
332332
** WEBPAGE: leaves
333333
--- src/descendants.c
+++ src/descendants.c
@@ -287,11 +287,11 @@
287 "%s"
288 " AND event.objid IN (SELECT rid FROM leaves)"
289 " ORDER BY event.mtime DESC",
290 timeline_query_for_tty()
291 );
292 print_timeline(&q, 20);
293 db_finalize(&q);
294 }
295
296 /*
297 ** COMMAND: leaves
@@ -322,11 +322,11 @@
322 }else if( !showAll ){
323 blob_appendf(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
324 }
325 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_str(&sql));
326 blob_reset(&sql);
327 print_timeline(&q, 2000);
328 db_finalize(&q);
329 }
330
331 /*
332 ** WEBPAGE: leaves
333
--- src/descendants.c
+++ src/descendants.c
@@ -287,11 +287,11 @@
287 "%s"
288 " AND event.objid IN (SELECT rid FROM leaves)"
289 " ORDER BY event.mtime DESC",
290 timeline_query_for_tty()
291 );
292 print_timeline(&q, 20, 0);
293 db_finalize(&q);
294 }
295
296 /*
297 ** COMMAND: leaves
@@ -322,11 +322,11 @@
322 }else if( !showAll ){
323 blob_appendf(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
324 }
325 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_str(&sql));
326 blob_reset(&sql);
327 print_timeline(&q, 2000, 0);
328 db_finalize(&q);
329 }
330
331 /*
332 ** WEBPAGE: leaves
333
+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
+151 -36
--- src/export.c
+++ src/export.c
@@ -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
@@ -207,13 +301,34 @@
207301
zEncoded = mprintf("%s", zTagname);
208302
for(i=0; zEncoded[i]; i++){
209303
if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_';
210304
}
211305
printf("tag %s\n", zEncoded);
212
- printf("from :%d\n", rid+firstCkin);
306
+ printf("from :%d\n", COMMITMARK(rid));
213307
printf("tagger <tagger> %s +0000\n", zSecSince1970);
214308
printf("data 0\n");
215309
fossil_free(zEncoded);
216310
}
217311
db_finalize(&q);
218312
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
+ }
219334
}
220335
--- src/export.c
+++ src/export.c
@@ -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
@@ -207,13 +301,34 @@
207 zEncoded = mprintf("%s", zTagname);
208 for(i=0; zEncoded[i]; i++){
209 if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_';
210 }
211 printf("tag %s\n", zEncoded);
212 printf("from :%d\n", rid+firstCkin);
213 printf("tagger <tagger> %s +0000\n", zSecSince1970);
214 printf("data 0\n");
215 fossil_free(zEncoded);
216 }
217 db_finalize(&q);
218 bag_clear(&vers);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219 }
220
--- src/export.c
+++ src/export.c
@@ -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
@@ -207,13 +301,34 @@
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
+32 -6
--- 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{
518544
--- 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{
518
--- 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{
544
--- 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
+11 -5
--- src/info.c
+++ src/info.c
@@ -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 />
12841290
--- src/info.c
+++ src/info.c
@@ -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 />
1284
--- src/info.c
+++ src/info.c
@@ -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 />
1290
+9 -3
--- src/main.c
+++ src/main.c
@@ -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
@@ -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
@@ -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
+32 -25
--- 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 = "
@@ -693,11 +700,11 @@
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
702709
$(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c $(SRCDIR)\shell.c
703710
@@ -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 = "
@@ -693,11 +700,11 @@
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 $(SRCDIR)\shell.c
703
@@ -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 = "
@@ -693,11 +700,11 @@
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
@@ -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
+3 -4
--- src/manifest.c
+++ src/manifest.c
@@ -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
@@ -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
@@ -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 }
+6 -2
--- src/popen.c
+++ src/popen.c
@@ -172,17 +172,21 @@
172172
close(pout[1]);
173173
*pChildPid = 0;
174174
return 1;
175175
}
176176
if( *pChildPid==0 ){
177
+ int fd;
178
+ int nErr = 0;
177179
/* This is the child process */
178180
close(0);
179
- dup(pout[0]);
181
+ fd = dup(pout[0]);
182
+ if( fd!=0 ) nErr++;
180183
close(pout[0]);
181184
close(pout[1]);
182185
close(1);
183
- dup(pin[1]);
186
+ fd = dup(pin[1]);
187
+ if( fd!=1 ) nErr++;
184188
close(pin[0]);
185189
close(pin[1]);
186190
execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0);
187191
return 1;
188192
}else{
189193
--- src/popen.c
+++ src/popen.c
@@ -172,17 +172,21 @@
172 close(pout[1]);
173 *pChildPid = 0;
174 return 1;
175 }
176 if( *pChildPid==0 ){
 
 
177 /* This is the child process */
178 close(0);
179 dup(pout[0]);
 
180 close(pout[0]);
181 close(pout[1]);
182 close(1);
183 dup(pin[1]);
 
184 close(pin[0]);
185 close(pin[1]);
186 execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0);
187 return 1;
188 }else{
189
--- src/popen.c
+++ src/popen.c
@@ -172,17 +172,21 @@
172 close(pout[1]);
173 *pChildPid = 0;
174 return 1;
175 }
176 if( *pChildPid==0 ){
177 int fd;
178 int nErr = 0;
179 /* This is the child process */
180 close(0);
181 fd = dup(pout[0]);
182 if( fd!=0 ) nErr++;
183 close(pout[0]);
184 close(pout[1]);
185 close(1);
186 fd = dup(pin[1]);
187 if( fd!=1 ) nErr++;
188 close(pin[0]);
189 close(pin[1]);
190 execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0);
191 return 1;
192 }else{
193
+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
+1 -1
--- src/search.c
+++ src/search.c
@@ -203,8 +203,8 @@
203203
db_prepare(&q,
204204
"SELECT rid, uuid, date, comment, 0, 0 FROM srch"
205205
" WHERE x>%d ORDER BY x DESC, date DESC",
206206
iBest/3
207207
);
208
- print_timeline(&q, 1000);
208
+ print_timeline(&q, 1000, 0);
209209
db_finalize(&q);
210210
}
211211
--- src/search.c
+++ src/search.c
@@ -203,8 +203,8 @@
203 db_prepare(&q,
204 "SELECT rid, uuid, date, comment, 0, 0 FROM srch"
205 " WHERE x>%d ORDER BY x DESC, date DESC",
206 iBest/3
207 );
208 print_timeline(&q, 1000);
209 db_finalize(&q);
210 }
211
--- src/search.c
+++ src/search.c
@@ -203,8 +203,8 @@
203 db_prepare(&q,
204 "SELECT rid, uuid, date, comment, 0, 0 FROM srch"
205 " WHERE x>%d ORDER BY x DESC, date DESC",
206 iBest/3
207 );
208 print_timeline(&q, 1000, 0);
209 db_finalize(&q);
210 }
211
+12 -2
--- src/setup.c
+++ src/setup.c
@@ -1050,10 +1050,11 @@
10501050
if( !g.okSetup ){
10511051
login_needed();
10521052
}
10531053
10541054
style_header("Settings");
1055
+ db_open_local();
10551056
db_begin_transaction();
10561057
@ <p>This page provides a simple interface to the "fossil setting" command.
10571058
@ See the "fossil help setting" output below for further information on
10581059
@ the meaning of each setting.</p><hr />
10591060
@ <form action="%s(g.zTop)/setup_settings" method="post"><div>
@@ -1062,25 +1063,34 @@
10621063
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
10631064
if( pSet->width==0 ){
10641065
onoff_attribute(pSet->name, pSet->name,
10651066
pSet->var!=0 ? pSet->var : pSet->name,
10661067
is_truth(pSet->def));
1067
- @ <br />
1068
+ if( pSet->versionable ){
1069
+ @ (v)<br />
1070
+ } else {
1071
+ @ <br />
1072
+ }
10681073
}
10691074
}
10701075
@ </td><td style="width: 30;"></td><td valign="top">
10711076
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
10721077
if( pSet->width!=0 ){
10731078
entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name,
10741079
pSet->var!=0 ? pSet->var : pSet->name,
10751080
(char*)pSet->def);
1076
- @ <br />
1081
+ if( pSet->versionable ){
1082
+ @ (v)<br />
1083
+ } else {
1084
+ @ <br />
1085
+ }
10771086
}
10781087
}
10791088
@ </td></tr></table>
10801089
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
10811090
@ </div></form>
1091
+ @ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p>
10821092
@ <hr /><p>
10831093
@ These settings work in the same way, as the <kbd>set</kbd> commandline:<br />
10841094
@ </p><pre>%s(zHelp_setting_cmd)</pre>
10851095
db_end_transaction(0);
10861096
style_footer();
10871097
--- src/setup.c
+++ src/setup.c
@@ -1050,10 +1050,11 @@
1050 if( !g.okSetup ){
1051 login_needed();
1052 }
1053
1054 style_header("Settings");
 
1055 db_begin_transaction();
1056 @ <p>This page provides a simple interface to the "fossil setting" command.
1057 @ See the "fossil help setting" output below for further information on
1058 @ the meaning of each setting.</p><hr />
1059 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
@@ -1062,25 +1063,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
@@ -1050,10 +1050,11 @@
1050 if( !g.okSetup ){
1051 login_needed();
1052 }
1053
1054 style_header("Settings");
1055 db_open_local();
1056 db_begin_transaction();
1057 @ <p>This page provides a simple interface to the "fossil setting" command.
1058 @ See the "fossil help setting" output below for further information on
1059 @ the meaning of each setting.</p><hr />
1060 @ <form action="%s(g.zTop)/setup_settings" method="post"><div>
@@ -1062,25 +1063,34 @@
1063 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1064 if( pSet->width==0 ){
1065 onoff_attribute(pSet->name, pSet->name,
1066 pSet->var!=0 ? pSet->var : pSet->name,
1067 is_truth(pSet->def));
1068 if( pSet->versionable ){
1069 @ (v)<br />
1070 } else {
1071 @ <br />
1072 }
1073 }
1074 }
1075 @ </td><td style="width: 30;"></td><td valign="top">
1076 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1077 if( pSet->width!=0 ){
1078 entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name,
1079 pSet->var!=0 ? pSet->var : pSet->name,
1080 (char*)pSet->def);
1081 if( pSet->versionable ){
1082 @ (v)<br />
1083 } else {
1084 @ <br />
1085 }
1086 }
1087 }
1088 @ </td></tr></table>
1089 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1090 @ </div></form>
1091 @ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p>
1092 @ <hr /><p>
1093 @ These settings work in the same way, as the <kbd>set</kbd> commandline:<br />
1094 @ </p><pre>%s(zHelp_setting_cmd)</pre>
1095 db_end_transaction(0);
1096 style_footer();
1097
+3777 -1278
--- 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.
@@ -385,23 +385,29 @@
385385
/*
386386
** Exactly one of the following macros must be defined in order to
387387
** specify which memory allocation subsystem to use.
388388
**
389389
** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
390
+** SQLITE_WIN32_MALLOC // Use Win32 native heap API
390391
** SQLITE_MEMDEBUG // Debugging version of system malloc()
392
+**
393
+** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the
394
+** assert() macro is enabled, each call into the Win32 native heap subsystem
395
+** will cause HeapValidate to be called. If heap validation should fail, an
396
+** assertion will be triggered.
391397
**
392398
** (Historical note: There used to be several other options, but we've
393399
** pared it down to just these two.)
394400
**
395401
** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
396402
** the default.
397403
*/
398
-#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)>1
404
+#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)>1
399405
# error "At most one of the following compile-time configuration options\
400
- is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG"
406
+ is allows: SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG"
401407
#endif
402
-#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)==0
408
+#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)==0
403409
# define SQLITE_SYSTEM_MALLOC 1
404410
#endif
405411
406412
/*
407413
** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
@@ -648,13 +654,13 @@
648654
**
649655
** See also: [sqlite3_libversion()],
650656
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
651657
** [sqlite_version()] and [sqlite_source_id()].
652658
*/
653
-#define SQLITE_VERSION "3.7.7"
654
-#define SQLITE_VERSION_NUMBER 3007007
655
-#define SQLITE_SOURCE_ID "2011-06-15 13:11:06 f9750870ee04935f338e4d808900fee5a8b2b389"
659
+#define SQLITE_VERSION "3.7.8"
660
+#define SQLITE_VERSION_NUMBER 3007008
661
+#define SQLITE_SOURCE_ID "2011-08-29 11:56:14 639cc85a911454bffdcccb33f2976c683953ae64"
656662
657663
/*
658664
** CAPI3REF: Run-Time Library Version Numbers
659665
** KEYWORDS: sqlite3_version, sqlite3_sourceid
660666
**
@@ -851,11 +857,11 @@
851857
** semicolon-separate SQL statements passed into its 2nd argument,
852858
** in the context of the [database connection] passed in as its 1st
853859
** argument. ^If the callback function of the 3rd argument to
854860
** sqlite3_exec() is not NULL, then it is invoked for each result row
855861
** coming out of the evaluated SQL statements. ^The 4th argument to
856
-** to sqlite3_exec() is relayed through to the 1st argument of each
862
+** sqlite3_exec() is relayed through to the 1st argument of each
857863
** callback invocation. ^If the callback pointer to sqlite3_exec()
858864
** is NULL, then no callback is ever invoked and result rows are
859865
** ignored.
860866
**
861867
** ^If an error occurs while evaluating the SQL statements passed into
@@ -1282,20 +1288,52 @@
12821288
** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
12831289
** VFSes do not need this signal and should silently ignore this opcode.
12841290
** Applications should not call [sqlite3_file_control()] with this
12851291
** opcode as doing so may disrupt the operation of the specialized VFSes
12861292
** that do require it.
1293
+**
1294
+** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
1295
+** retry counts and intervals for certain disk I/O operations for the
1296
+** windows [VFS] in order to work to provide robustness against
1297
+** anti-virus programs. By default, the windows VFS will retry file read,
1298
+** file write, and file delete opertions up to 10 times, with a delay
1299
+** of 25 milliseconds before the first retry and with the delay increasing
1300
+** by an additional 25 milliseconds with each subsequent retry. This
1301
+** opcode allows those to values (10 retries and 25 milliseconds of delay)
1302
+** to be adjusted. The values are changed for all database connections
1303
+** within the same process. The argument is a pointer to an array of two
1304
+** integers where the first integer i the new retry count and the second
1305
+** integer is the delay. If either integer is negative, then the setting
1306
+** is not changed but instead the prior value of that setting is written
1307
+** into the array entry, allowing the current retry settings to be
1308
+** interrogated. The zDbName parameter is ignored.
1309
+**
1310
+** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
1311
+** persistent [WAL | Write AHead Log] setting. By default, the auxiliary
1312
+** write ahead log and shared memory files used for transaction control
1313
+** are automatically deleted when the latest connection to the database
1314
+** closes. Setting persistent WAL mode causes those files to persist after
1315
+** close. Persisting the files is useful when other processes that do not
1316
+** have write permission on the directory containing the database file want
1317
+** to read the database file, as the WAL and shared memory files must exist
1318
+** in order for the database to be readable. The fourth parameter to
1319
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
1320
+** That integer is 0 to disable persistent WAL mode or 1 to enable persistent
1321
+** WAL mode. If the integer is -1, then it is overwritten with the current
1322
+** WAL persistence setting.
1323
+**
12871324
*/
12881325
#define SQLITE_FCNTL_LOCKSTATE 1
12891326
#define SQLITE_GET_LOCKPROXYFILE 2
12901327
#define SQLITE_SET_LOCKPROXYFILE 3
12911328
#define SQLITE_LAST_ERRNO 4
12921329
#define SQLITE_FCNTL_SIZE_HINT 5
12931330
#define SQLITE_FCNTL_CHUNK_SIZE 6
12941331
#define SQLITE_FCNTL_FILE_POINTER 7
12951332
#define SQLITE_FCNTL_SYNC_OMITTED 8
1296
-
1333
+#define SQLITE_FCNTL_WIN32_AV_RETRY 9
1334
+#define SQLITE_FCNTL_PERSIST_WAL 10
12971335
12981336
/*
12991337
** CAPI3REF: Mutex Handle
13001338
**
13011339
** The mutex module within SQLite defines [sqlite3_mutex] to be an
@@ -1443,11 +1481,11 @@
14431481
** The xSleep() method causes the calling thread to sleep for at
14441482
** least the number of microseconds given. ^The xCurrentTime()
14451483
** method returns a Julian Day Number for the current date and time as
14461484
** a floating point value.
14471485
** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
1448
-** Day Number multipled by 86400000 (the number of milliseconds in
1486
+** Day Number multiplied by 86400000 (the number of milliseconds in
14491487
** a 24-hour day).
14501488
** ^SQLite will use the xCurrentTimeInt64() method to get the current
14511489
** date and time if that method is available (if iVersion is 2 or
14521490
** greater and the function pointer is not NULL) and will fall back
14531491
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
@@ -1719,20 +1757,14 @@
17191757
** also used during testing of SQLite in order to specify an alternative
17201758
** memory allocator that simulates memory out-of-memory conditions in
17211759
** order to verify that SQLite recovers gracefully from such
17221760
** conditions.
17231761
**
1724
-** The xMalloc and xFree methods must work like the
1725
-** malloc() and free() functions from the standard C library.
1726
-** The xRealloc method must work like realloc() from the standard C library
1727
-** with the exception that if the second argument to xRealloc is zero,
1728
-** xRealloc must be a no-op - it must not perform any allocation or
1729
-** deallocation. ^SQLite guarantees that the second argument to
1762
+** The xMalloc, xRealloc, and xFree methods must work like the
1763
+** malloc(), realloc() and free() functions from the standard C library.
1764
+** ^SQLite guarantees that the second argument to
17301765
** xRealloc is always a value returned by a prior call to xRoundup.
1731
-** And so in cases where xRoundup always returns a positive number,
1732
-** xRealloc can perform exactly as the standard library realloc() and
1733
-** still be in compliance with this specification.
17341766
**
17351767
** xSize should return the allocated size of a memory allocation
17361768
** previously obtained from xMalloc or xRealloc. The allocated size
17371769
** is always at least as big as the requested size but may be larger.
17381770
**
@@ -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
@@ -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
@@ -7599,10 +7632,18 @@
75997632
*/
76007633
#ifndef SQLITE_TEMP_STORE
76017634
# define SQLITE_TEMP_STORE 1
76027635
#endif
76037636
7637
+/*
7638
+** If all temporary storage is in-memory, then omit the external merge-sort
7639
+** logic since it is superfluous.
7640
+*/
7641
+#if SQLITE_TEMP_STORE==3 && !defined(SQLITE_OMIT_MERGE_SORT)
7642
+# define SQLITE_OMIT_MERGE_SORT
7643
+#endif
7644
+
76047645
/*
76057646
** GCC does not define the offsetof() macro so we'll have to do it
76067647
** ourselves.
76077648
*/
76087649
#ifndef offsetof
@@ -7941,10 +7982,11 @@
79417982
#define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */
79427983
#define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */
79437984
#define BTREE_MEMORY 4 /* This is an in-memory DB */
79447985
#define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */
79457986
#define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */
7987
+#define BTREE_SORTER 32 /* Used as accumulator in external merge sort */
79467988
79477989
SQLITE_PRIVATE int sqlite3BtreeClose(Btree*);
79487990
SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int);
79497991
SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int);
79507992
SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*);
@@ -8143,10 +8185,11 @@
81438185
** or VDBE. The VDBE implements an abstract machine that runs a
81448186
** simple program to access and modify the underlying database.
81458187
*/
81468188
#ifndef _SQLITE_VDBE_H_
81478189
#define _SQLITE_VDBE_H_
8190
+/* #include <stdio.h> */
81488191
81498192
/*
81508193
** A single VDBE is an opaque structure named "Vdbe". Only routines
81518194
** in the source file sqliteVdbe.c are allowed to see the insides
81528195
** of this structure.
@@ -8186,10 +8229,11 @@
81868229
Mem *pMem; /* Used when p4type is P4_MEM */
81878230
VTable *pVtab; /* Used when p4type is P4_VTAB */
81888231
KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */
81898232
int *ai; /* Used when p4type is P4_INTARRAY */
81908233
SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */
8234
+ int (*xAdvance)(BtCursor *, int *);
81918235
} p4;
81928236
#ifdef SQLITE_DEBUG
81938237
char *zComment; /* Comment to improve readability */
81948238
#endif
81958239
#ifdef VDBE_PROFILE
@@ -8241,10 +8285,11 @@
82418285
#define P4_REAL (-12) /* P4 is a 64-bit floating point value */
82428286
#define P4_INT64 (-13) /* P4 is a 64-bit signed integer */
82438287
#define P4_INT32 (-14) /* P4 is a 32-bit signed integer */
82448288
#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */
82458289
#define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */
8290
+#define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */
82468291
82478292
/* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure
82488293
** is made. That copy is freed when the Vdbe is finalized. But if the
82498294
** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used. It still
82508295
** gets freed when the Vdbe is finalized so it still should be obtained
@@ -8354,89 +8399,89 @@
83548399
#define OP_ReadCookie 35
83558400
#define OP_SetCookie 36
83568401
#define OP_VerifyCookie 37
83578402
#define OP_OpenRead 38
83588403
#define OP_OpenWrite 39
8359
-#define OP_OpenAutoindex 40
8360
-#define OP_OpenEphemeral 41
8361
-#define OP_OpenPseudo 42
8362
-#define OP_Close 43
8363
-#define OP_SeekLt 44
8364
-#define OP_SeekLe 45
8365
-#define OP_SeekGe 46
8366
-#define OP_SeekGt 47
8367
-#define OP_Seek 48
8368
-#define OP_NotFound 49
8369
-#define OP_Found 50
8370
-#define OP_IsUnique 51
8371
-#define OP_NotExists 52
8372
-#define OP_Sequence 53
8373
-#define OP_NewRowid 54
8374
-#define OP_Insert 55
8375
-#define OP_InsertInt 56
8376
-#define OP_Delete 57
8377
-#define OP_ResetCount 58
8378
-#define OP_RowKey 59
8379
-#define OP_RowData 60
8380
-#define OP_Rowid 61
8381
-#define OP_NullRow 62
8382
-#define OP_Last 63
8383
-#define OP_Sort 64
8384
-#define OP_Rewind 65
8385
-#define OP_Prev 66
8386
-#define OP_Next 67
8387
-#define OP_IdxInsert 70
8388
-#define OP_IdxDelete 71
8389
-#define OP_IdxRowid 72
8390
-#define OP_IdxLT 81
8391
-#define OP_IdxGE 92
8392
-#define OP_Destroy 95
8393
-#define OP_Clear 96
8394
-#define OP_CreateIndex 97
8395
-#define OP_CreateTable 98
8396
-#define OP_ParseSchema 99
8397
-#define OP_LoadAnalysis 100
8398
-#define OP_DropTable 101
8399
-#define OP_DropIndex 102
8400
-#define OP_DropTrigger 103
8401
-#define OP_IntegrityCk 104
8402
-#define OP_RowSetAdd 105
8403
-#define OP_RowSetRead 106
8404
-#define OP_RowSetTest 107
8405
-#define OP_Program 108
8406
-#define OP_Param 109
8407
-#define OP_FkCounter 110
8408
-#define OP_FkIfZero 111
8409
-#define OP_MemMax 112
8410
-#define OP_IfPos 113
8411
-#define OP_IfNeg 114
8412
-#define OP_IfZero 115
8413
-#define OP_AggStep 116
8414
-#define OP_AggFinal 117
8415
-#define OP_Checkpoint 118
8416
-#define OP_JournalMode 119
8417
-#define OP_Vacuum 120
8418
-#define OP_IncrVacuum 121
8419
-#define OP_Expire 122
8420
-#define OP_TableLock 123
8421
-#define OP_VBegin 124
8422
-#define OP_VCreate 125
8423
-#define OP_VDestroy 126
8424
-#define OP_VOpen 127
8425
-#define OP_VFilter 128
8426
-#define OP_VColumn 129
8427
-#define OP_VNext 131
8428
-#define OP_VRename 132
8429
-#define OP_VUpdate 133
8430
-#define OP_Pagecount 134
8431
-#define OP_MaxPgcnt 135
8432
-#define OP_Trace 136
8433
-#define OP_Noop 137
8434
-#define OP_Explain 138
8435
-
8436
-/* The following opcode values are never used */
8437
-#define OP_NotUsed_139 139
8404
+#define OP_OpenSorter 40
8405
+#define OP_OpenAutoindex 41
8406
+#define OP_OpenEphemeral 42
8407
+#define OP_OpenPseudo 43
8408
+#define OP_Close 44
8409
+#define OP_SeekLt 45
8410
+#define OP_SeekLe 46
8411
+#define OP_SeekGe 47
8412
+#define OP_SeekGt 48
8413
+#define OP_Seek 49
8414
+#define OP_NotFound 50
8415
+#define OP_Found 51
8416
+#define OP_IsUnique 52
8417
+#define OP_NotExists 53
8418
+#define OP_Sequence 54
8419
+#define OP_NewRowid 55
8420
+#define OP_Insert 56
8421
+#define OP_InsertInt 57
8422
+#define OP_Delete 58
8423
+#define OP_ResetCount 59
8424
+#define OP_RowKey 60
8425
+#define OP_RowData 61
8426
+#define OP_Rowid 62
8427
+#define OP_NullRow 63
8428
+#define OP_Last 64
8429
+#define OP_Sort 65
8430
+#define OP_Rewind 66
8431
+#define OP_Prev 67
8432
+#define OP_Next 70
8433
+#define OP_IdxInsert 71
8434
+#define OP_IdxDelete 72
8435
+#define OP_IdxRowid 81
8436
+#define OP_IdxLT 92
8437
+#define OP_IdxGE 95
8438
+#define OP_Destroy 96
8439
+#define OP_Clear 97
8440
+#define OP_CreateIndex 98
8441
+#define OP_CreateTable 99
8442
+#define OP_ParseSchema 100
8443
+#define OP_LoadAnalysis 101
8444
+#define OP_DropTable 102
8445
+#define OP_DropIndex 103
8446
+#define OP_DropTrigger 104
8447
+#define OP_IntegrityCk 105
8448
+#define OP_RowSetAdd 106
8449
+#define OP_RowSetRead 107
8450
+#define OP_RowSetTest 108
8451
+#define OP_Program 109
8452
+#define OP_Param 110
8453
+#define OP_FkCounter 111
8454
+#define OP_FkIfZero 112
8455
+#define OP_MemMax 113
8456
+#define OP_IfPos 114
8457
+#define OP_IfNeg 115
8458
+#define OP_IfZero 116
8459
+#define OP_AggStep 117
8460
+#define OP_AggFinal 118
8461
+#define OP_Checkpoint 119
8462
+#define OP_JournalMode 120
8463
+#define OP_Vacuum 121
8464
+#define OP_IncrVacuum 122
8465
+#define OP_Expire 123
8466
+#define OP_TableLock 124
8467
+#define OP_VBegin 125
8468
+#define OP_VCreate 126
8469
+#define OP_VDestroy 127
8470
+#define OP_VOpen 128
8471
+#define OP_VFilter 129
8472
+#define OP_VColumn 131
8473
+#define OP_VNext 132
8474
+#define OP_VRename 133
8475
+#define OP_VUpdate 134
8476
+#define OP_Pagecount 135
8477
+#define OP_MaxPgcnt 136
8478
+#define OP_Trace 137
8479
+#define OP_Noop 138
8480
+#define OP_Explain 139
8481
+
8482
+/* The following opcode values are never used */
84388483
#define OP_NotUsed_140 140
84398484
84408485
84418486
/* Properties such as "out2" or "jump" that are specified in
84428487
** comments following the "case" for each opcode in the vdbe.c
@@ -8453,23 +8498,23 @@
84538498
/* 0 */ 0x00, 0x01, 0x05, 0x04, 0x04, 0x10, 0x00, 0x02,\
84548499
/* 8 */ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x24, 0x24,\
84558500
/* 16 */ 0x00, 0x00, 0x00, 0x24, 0x04, 0x05, 0x04, 0x00,\
84568501
/* 24 */ 0x00, 0x01, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02,\
84578502
/* 32 */ 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00,\
8458
-/* 40 */ 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,\
8459
-/* 48 */ 0x08, 0x11, 0x11, 0x11, 0x11, 0x02, 0x02, 0x00,\
8460
-/* 56 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,\
8461
-/* 64 */ 0x01, 0x01, 0x01, 0x01, 0x4c, 0x4c, 0x08, 0x00,\
8462
-/* 72 */ 0x02, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
8463
-/* 80 */ 0x15, 0x01, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,\
8464
-/* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x01, 0x24, 0x02, 0x02,\
8465
-/* 96 */ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\
8466
-/* 104 */ 0x00, 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00, 0x01,\
8467
-/* 112 */ 0x08, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02,\
8468
-/* 120 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
8469
-/* 128 */ 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x02, 0x02,\
8470
-/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
8503
+/* 40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11,\
8504
+/* 48 */ 0x11, 0x08, 0x11, 0x11, 0x11, 0x11, 0x02, 0x02,\
8505
+/* 56 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,\
8506
+/* 64 */ 0x01, 0x01, 0x01, 0x01, 0x4c, 0x4c, 0x01, 0x08,\
8507
+/* 72 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
8508
+/* 80 */ 0x15, 0x02, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,\
8509
+/* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x01, 0x24, 0x02, 0x01,\
8510
+/* 96 */ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,\
8511
+/* 104 */ 0x00, 0x00, 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00,\
8512
+/* 112 */ 0x01, 0x08, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00,\
8513
+/* 120 */ 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\
8514
+/* 128 */ 0x00, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00, 0x02,\
8515
+/* 136 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
84718516
/* 144 */ 0x04, 0x04,}
84728517
84738518
/************** End of opcodes.h *********************************************/
84748519
/************** Continuing where we left off in vdbe.h ***********************/
84758520
@@ -8484,13 +8529,13 @@
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);
84888533
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
8489
-SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
8490
-SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
8491
-SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
8534
+SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);
8535
+SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2);
8536
+SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3);
84928537
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5);
84938538
SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);
84948539
SQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N);
84958540
SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);
84968541
SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int);
@@ -8608,10 +8653,11 @@
86088653
** NOTE: These values must match the corresponding BTREE_ values in btree.h.
86098654
*/
86108655
#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
86118656
#define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
86128657
#define PAGER_MEMORY 0x0004 /* In-memory database */
8658
+#define PAGER_SORTER 0x0020 /* Accumulator in external merge sort */
86138659
86148660
/*
86158661
** Valid values for the second argument to sqlite3PagerLockingMode().
86168662
*/
86178663
#define PAGER_LOCKINGMODE_QUERY -1
@@ -8703,10 +8749,13 @@
87038749
SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*);
87048750
SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*);
87058751
SQLITE_PRIVATE int sqlite3PagerNosync(Pager*);
87068752
SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*);
87078753
SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*);
8754
+#ifndef SQLITE_OMIT_MERGE_SORT
8755
+SQLITE_PRIVATE int sqlite3PagerUnderStress(Pager*);
8756
+#endif
87088757
87098758
/* Functions used to truncate the database file. */
87108759
SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno);
87118760
87128761
#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)
@@ -9556,10 +9605,12 @@
95569605
#define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */
95579606
#define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */
95589607
#define SQLITE_IndexCover 0x10 /* Disable index covering table */
95599608
#define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */
95609609
#define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */
9610
+#define SQLITE_IdxRealAsInt 0x80 /* Store REAL as INT in indices */
9611
+#define SQLITE_DistinctOpt 0x80 /* DISTINCT using indexes */
95619612
#define SQLITE_OptMask 0xff /* Mask of all disablable opts */
95629613
95639614
/*
95649615
** Possible values for the sqlite.magic field.
95659616
** The numbers are obtained at random and have no special meaning, other
@@ -10447,10 +10498,11 @@
1044710498
Table *pTab; /* An SQL table corresponding to zName */
1044810499
Select *pSelect; /* A SELECT statement used in place of a table name */
1044910500
u8 isPopulated; /* Temporary table associated with SELECT is populated */
1045010501
u8 jointype; /* Type of join between this able and the previous */
1045110502
u8 notIndexed; /* True if there is a NOT INDEXED clause */
10503
+ u8 isCorrelated; /* True if sub-query is correlated */
1045210504
#ifndef SQLITE_OMIT_EXPLAIN
1045310505
u8 iSelectId; /* If pSelect!=0, the id of the sub-select in EQP */
1045410506
#endif
1045510507
int iCursor; /* The VDBE cursor number used to access this table */
1045610508
Expr *pOn; /* The ON clause of a join */
@@ -10566,10 +10618,11 @@
1056610618
struct WhereInfo {
1056710619
Parse *pParse; /* Parsing and code generating context */
1056810620
u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */
1056910621
u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE or DELETE */
1057010622
u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */
10623
+ u8 eDistinct;
1057110624
SrcList *pTabList; /* List of tables in the join */
1057210625
int iTop; /* The very beginning of the WHERE loop */
1057310626
int iContinue; /* Jump here to continue with next record */
1057410627
int iBreak; /* Jump here to break out of the loop */
1057510628
int nLevel; /* Number of nested loop */
@@ -10577,10 +10630,13 @@
1057710630
double savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */
1057810631
double nRowOut; /* Estimated number of output rows */
1057910632
WhereLevel a[1]; /* Information about each nest loop in WHERE */
1058010633
};
1058110634
10635
+#define WHERE_DISTINCT_UNIQUE 1
10636
+#define WHERE_DISTINCT_ORDERED 2
10637
+
1058210638
/*
1058310639
** A NameContext defines a context in which to resolve table and column
1058410640
** names. The context consists of a list of tables (the pSrcList) field and
1058510641
** a list of named expression (pEList). The named expression list may
1058610642
** be NULL. The pSrc corresponds to the FROM clause of a SELECT or
@@ -11053,10 +11109,11 @@
1105311109
int isPCacheInit; /* True after malloc is initialized */
1105411110
sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */
1105511111
int nRefInitMutex; /* Number of users of pInitMutex */
1105611112
void (*xLog)(void*,int,const char*); /* Function for logging */
1105711113
void *pLogArg; /* First argument to xLog() */
11114
+ int bLocaltimeFault; /* True to fail localtime() calls */
1105811115
};
1105911116
1106011117
/*
1106111118
** Context pointer passed down through the tree-walk.
1106211119
*/
@@ -11337,11 +11394,11 @@
1133711394
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
1133811395
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *, char *);
1133911396
#endif
1134011397
SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*);
1134111398
SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
11342
-SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16);
11399
+SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**,ExprList*,u16);
1134311400
SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*);
1134411401
SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int);
1134511402
SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
1134611403
SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int);
1134711404
SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int);
@@ -12013,10 +12070,11 @@
1201312070
0, /* isPCacheInit */
1201412071
0, /* pInitMutex */
1201512072
0, /* nRefInitMutex */
1201612073
0, /* xLog */
1201712074
0, /* pLogArg */
12075
+ 0, /* bLocaltimeFault */
1201812076
};
1201912077
1202012078
1202112079
/*
1202212080
** Hash table for global functions - functions common to all
@@ -12321,10 +12379,13 @@
1232112379
#ifdef SQLITE_OMIT_LOOKASIDE
1232212380
"OMIT_LOOKASIDE",
1232312381
#endif
1232412382
#ifdef SQLITE_OMIT_MEMORYDB
1232512383
"OMIT_MEMORYDB",
12384
+#endif
12385
+#ifdef SQLITE_OMIT_MERGE_SORT
12386
+ "OMIT_MERGE_SORT",
1232612387
#endif
1232712388
#ifdef SQLITE_OMIT_OR_OPTIMIZATION
1232812389
"OMIT_OR_OPTIMIZATION",
1232912390
#endif
1233012391
#ifdef SQLITE_OMIT_PAGER_PRAGMAS
@@ -12387,10 +12448,13 @@
1238712448
#ifdef SQLITE_OMIT_WSD
1238812449
"OMIT_WSD",
1238912450
#endif
1239012451
#ifdef SQLITE_OMIT_XFER_OPT
1239112452
"OMIT_XFER_OPT",
12453
+#endif
12454
+#ifdef SQLITE_PAGECACHE_BLOCKALLOC
12455
+ "PAGECACHE_BLOCKALLOC",
1239212456
#endif
1239312457
#ifdef SQLITE_PERFORMANCE_TRACE
1239412458
"PERFORMANCE_TRACE",
1239512459
#endif
1239612460
#ifdef SQLITE_PROXY_DEBUG
@@ -12508,10 +12572,13 @@
1250812572
/*
1250912573
** Boolean values
1251012574
*/
1251112575
typedef unsigned char Bool;
1251212576
12577
+/* Opaque type used by code in vdbesort.c */
12578
+typedef struct VdbeSorter VdbeSorter;
12579
+
1251312580
/*
1251412581
** A cursor is a pointer into a single BTree within a database file.
1251512582
** The cursor can seek to a BTree entry with a particular key, or
1251612583
** loop over all entries of the Btree. You can also insert new BTree
1251712584
** entries or retrieve the key or data from the entry that the cursor
@@ -12539,10 +12606,11 @@
1253912606
sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */
1254012607
const sqlite3_module *pModule; /* Module for cursor pVtabCursor */
1254112608
i64 seqCount; /* Sequence counter */
1254212609
i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */
1254312610
i64 lastRowid; /* Last rowid from a Next or NextIdx operation */
12611
+ VdbeSorter *pSorter; /* Sorter object for OP_OpenSorter cursors */
1254412612
1254512613
/* Result of last sqlite3BtreeMoveto() done by an OP_NotExists or
1254612614
** OP_IsUnique opcode on this cursor. */
1254712615
int seekResult;
1254812616
@@ -12858,17 +12926,36 @@
1285812926
SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
1285912927
SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*);
1286012928
SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
1286112929
SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);
1286212930
SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p);
12931
+#define MemReleaseExt(X) \
12932
+ if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \
12933
+ sqlite3VdbeMemReleaseExternal(X);
1286312934
SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
1286412935
SQLITE_PRIVATE const char *sqlite3OpcodeName(int);
1286512936
SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
1286612937
SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
1286712938
SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*);
1286812939
SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *);
1286912940
SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);
12941
+
12942
+#ifdef SQLITE_OMIT_MERGE_SORT
12943
+# define sqlite3VdbeSorterInit(Y,Z) SQLITE_OK
12944
+# define sqlite3VdbeSorterWrite(X,Y,Z) SQLITE_OK
12945
+# define sqlite3VdbeSorterClose(Y,Z)
12946
+# define sqlite3VdbeSorterRowkey(Y,Z) SQLITE_OK
12947
+# define sqlite3VdbeSorterRewind(X,Y,Z) SQLITE_OK
12948
+# define sqlite3VdbeSorterNext(X,Y,Z) SQLITE_OK
12949
+#else
12950
+SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *);
12951
+SQLITE_PRIVATE int sqlite3VdbeSorterWrite(sqlite3 *, VdbeCursor *, int);
12952
+SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);
12953
+SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(VdbeCursor *, Mem *);
12954
+SQLITE_PRIVATE int sqlite3VdbeSorterRewind(sqlite3 *, VdbeCursor *, int *);
12955
+SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, VdbeCursor *, int *);
12956
+#endif
1287012957
1287112958
#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
1287212959
SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe*);
1287312960
SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe*);
1287412961
#else
@@ -13159,30 +13246,16 @@
1315913246
** Astronomical Algorithms, 2nd Edition, 1998
1316013247
** ISBM 0-943396-61-1
1316113248
** Willmann-Bell, Inc
1316213249
** Richmond, Virginia (USA)
1316313250
*/
13251
+/* #include <stdlib.h> */
13252
+/* #include <assert.h> */
1316413253
#include <time.h>
1316513254
1316613255
#ifndef SQLITE_OMIT_DATETIME_FUNCS
1316713256
13168
-/*
13169
-** On recent Windows platforms, the localtime_s() function is available
13170
-** as part of the "Secure CRT". It is essentially equivalent to
13171
-** localtime_r() available under most POSIX platforms, except that the
13172
-** order of the parameters is reversed.
13173
-**
13174
-** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
13175
-**
13176
-** If the user has not indicated to use localtime_r() or localtime_s()
13177
-** already, check for an MSVC build environment that provides
13178
-** localtime_s().
13179
-*/
13180
-#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
13181
- defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
13182
-#define HAVE_LOCALTIME_S 1
13183
-#endif
1318413257
1318513258
/*
1318613259
** A structure for holding a single date and time.
1318713260
*/
1318813261
typedef struct DateTime DateTime;
@@ -13523,20 +13596,90 @@
1352313596
static void clearYMD_HMS_TZ(DateTime *p){
1352413597
p->validYMD = 0;
1352513598
p->validHMS = 0;
1352613599
p->validTZ = 0;
1352713600
}
13601
+
13602
+/*
13603
+** On recent Windows platforms, the localtime_s() function is available
13604
+** as part of the "Secure CRT". It is essentially equivalent to
13605
+** localtime_r() available under most POSIX platforms, except that the
13606
+** order of the parameters is reversed.
13607
+**
13608
+** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
13609
+**
13610
+** If the user has not indicated to use localtime_r() or localtime_s()
13611
+** already, check for an MSVC build environment that provides
13612
+** localtime_s().
13613
+*/
13614
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
13615
+ defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
13616
+#define HAVE_LOCALTIME_S 1
13617
+#endif
13618
+
13619
+#ifndef SQLITE_OMIT_LOCALTIME
13620
+/*
13621
+** The following routine implements the rough equivalent of localtime_r()
13622
+** using whatever operating-system specific localtime facility that
13623
+** is available. This routine returns 0 on success and
13624
+** non-zero on any kind of error.
13625
+**
13626
+** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this
13627
+** routine will always fail.
13628
+*/
13629
+static int osLocaltime(time_t *t, struct tm *pTm){
13630
+ int rc;
13631
+#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \
13632
+ && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S)
13633
+ struct tm *pX;
13634
+#if SQLITE_THREADSAFE>0
13635
+ sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
13636
+#endif
13637
+ sqlite3_mutex_enter(mutex);
13638
+ pX = localtime(t);
13639
+#ifndef SQLITE_OMIT_BUILTIN_TEST
13640
+ if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
13641
+#endif
13642
+ if( pX ) *pTm = *pX;
13643
+ sqlite3_mutex_leave(mutex);
13644
+ rc = pX==0;
13645
+#else
13646
+#ifndef SQLITE_OMIT_BUILTIN_TEST
13647
+ if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
13648
+#endif
13649
+#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R
13650
+ rc = localtime_r(t, pTm)==0;
13651
+#else
13652
+ rc = localtime_s(pTm, t);
13653
+#endif /* HAVE_LOCALTIME_R */
13654
+#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */
13655
+ return rc;
13656
+}
13657
+#endif /* SQLITE_OMIT_LOCALTIME */
13658
+
1352813659
1352913660
#ifndef SQLITE_OMIT_LOCALTIME
1353013661
/*
13531
-** Compute the difference (in milliseconds)
13532
-** between localtime and UTC (a.k.a. GMT)
13533
-** for the time value p where p is in UTC.
13662
+** Compute the difference (in milliseconds) between localtime and UTC
13663
+** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs,
13664
+** return this value and set *pRc to SQLITE_OK.
13665
+**
13666
+** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value
13667
+** is undefined in this case.
1353413668
*/
13535
-static sqlite3_int64 localtimeOffset(DateTime *p){
13669
+static sqlite3_int64 localtimeOffset(
13670
+ DateTime *p, /* Date at which to calculate offset */
13671
+ sqlite3_context *pCtx, /* Write error here if one occurs */
13672
+ int *pRc /* OUT: Error code. SQLITE_OK or ERROR */
13673
+){
1353613674
DateTime x, y;
1353713675
time_t t;
13676
+ struct tm sLocal;
13677
+
13678
+ /* Initialize the contents of sLocal to avoid a compiler warning. */
13679
+ memset(&sLocal, 0, sizeof(sLocal));
13680
+
1353813681
x = *p;
1353913682
computeYMD_HMS(&x);
1354013683
if( x.Y<1971 || x.Y>=2038 ){
1354113684
x.Y = 2000;
1354213685
x.M = 1;
@@ -13550,51 +13693,27 @@
1355013693
}
1355113694
x.tz = 0;
1355213695
x.validJD = 0;
1355313696
computeJD(&x);
1355413697
t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);
13555
-#ifdef HAVE_LOCALTIME_R
13556
- {
13557
- struct tm sLocal;
13558
- localtime_r(&t, &sLocal);
13559
- y.Y = sLocal.tm_year + 1900;
13560
- y.M = sLocal.tm_mon + 1;
13561
- y.D = sLocal.tm_mday;
13562
- y.h = sLocal.tm_hour;
13563
- y.m = sLocal.tm_min;
13564
- y.s = sLocal.tm_sec;
13565
- }
13566
-#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
13567
- {
13568
- struct tm sLocal;
13569
- localtime_s(&sLocal, &t);
13570
- y.Y = sLocal.tm_year + 1900;
13571
- y.M = sLocal.tm_mon + 1;
13572
- y.D = sLocal.tm_mday;
13573
- y.h = sLocal.tm_hour;
13574
- y.m = sLocal.tm_min;
13575
- y.s = sLocal.tm_sec;
13576
- }
13577
-#else
13578
- {
13579
- struct tm *pTm;
13580
- sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
13581
- pTm = localtime(&t);
13582
- y.Y = pTm->tm_year + 1900;
13583
- y.M = pTm->tm_mon + 1;
13584
- y.D = pTm->tm_mday;
13585
- y.h = pTm->tm_hour;
13586
- y.m = pTm->tm_min;
13587
- y.s = pTm->tm_sec;
13588
- sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
13589
- }
13590
-#endif
13698
+ if( osLocaltime(&t, &sLocal) ){
13699
+ sqlite3_result_error(pCtx, "local time unavailable", -1);
13700
+ *pRc = SQLITE_ERROR;
13701
+ return 0;
13702
+ }
13703
+ y.Y = sLocal.tm_year + 1900;
13704
+ y.M = sLocal.tm_mon + 1;
13705
+ y.D = sLocal.tm_mday;
13706
+ y.h = sLocal.tm_hour;
13707
+ y.m = sLocal.tm_min;
13708
+ y.s = sLocal.tm_sec;
1359113709
y.validYMD = 1;
1359213710
y.validHMS = 1;
1359313711
y.validJD = 0;
1359413712
y.validTZ = 0;
1359513713
computeJD(&y);
13714
+ *pRc = SQLITE_OK;
1359613715
return y.iJD - x.iJD;
1359713716
}
1359813717
#endif /* SQLITE_OMIT_LOCALTIME */
1359913718
1360013719
/*
@@ -13614,13 +13733,16 @@
1361413733
** weekday N
1361513734
** unixepoch
1361613735
** localtime
1361713736
** utc
1361813737
**
13619
-** Return 0 on suc