0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20 /*.** Copyright
0010: 28 63 29 20 32 30 30 37 20 44 2e 20 52 69 63 68 (c) 2007 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54 ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20 te it and/or.**
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20 modify it under
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 the terms of the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76 lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65 ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69 ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 tributed in the
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20 l be useful,.**
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20 but WITHOUT ANY
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20 RPOSE. See the
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50 GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20 d have received
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72 g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69 ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65 te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 ation, Inc., 59
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53 Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73 uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31 ton, MA 02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20 307, USA..**.**
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69 Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20 nformation:.**
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68 * http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65 .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 75 contains code u
0380: 73 65 64 20 74 6f 20 70 61 72 73 65 72 20 74 69 sed to parser ti
0390: 63 6b 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 cket configurati
03a0: 6f 6e 0a 2a 2a 20 61 72 74 69 66 69 63 61 74 65 on.** artificate
03b0: 73 2e 0a 2a 2f 0a 23 69 6e 63 6c 75 64 65 20 22 s..*/.#include "
03c0: 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e 63 6c 75 config.h".#inclu
03d0: 64 65 20 22 74 6b 74 63 6f 6e 66 2e 68 22 0a 23 de "tktconf.h".#
03e0: 69 6e 63 6c 75 64 65 20 3c 61 73 73 65 72 74 2e include <assert.
03f0: 68 3e 0a 0a 2f 2a 0a 2a 2a 20 52 65 74 75 72 6e h>../*.** Return
0400: 20 54 52 55 45 20 69 66 20 74 68 65 20 67 69 76 TRUE if the giv
0410: 65 6e 20 74 6f 6b 65 6e 20 69 73 20 61 20 76 61 en token is a va
0420: 6c 69 64 20 66 69 65 6c 64 20 6e 61 6d 65 20 66 lid field name f
0430: 6f 72 0a 2a 2a 20 74 68 65 20 74 69 63 6b 65 74 or.** the ticket
0440: 20 74 61 62 6c 65 2e 20 20 54 68 65 20 6e 61 6d table. The nam
0450: 65 20 6d 75 73 74 20 62 65 20 61 6c 6c 20 6c 65 e must be all le
0460: 74 74 65 72 73 2c 20 64 69 67 69 74 73 2c 20 0a tters, digits, .
0470: 2a 2a 20 61 6e 64 20 75 6e 64 65 72 73 63 6f 72 ** and underscor
0480: 65 73 2e 0a 2a 2f 0a 73 74 61 74 69 63 20 69 6e es..*/.static in
0490: 74 20 69 73 5f 76 61 6c 69 64 5f 6e 61 6d 65 28 t is_valid_name(
04a0: 42 6c 6f 62 20 2a 70 29 7b 0a 20 20 63 6f 6e 73 Blob *p){. cons
04b0: 74 20 63 68 61 72 20 2a 7a 20 3d 20 62 6c 6f 62 t char *z = blob
04c0: 5f 62 75 66 66 65 72 28 70 29 3b 0a 20 20 69 6e _buffer(p);. in
04d0: 74 20 6e 20 3d 20 62 6c 6f 62 5f 73 69 7a 65 28 t n = blob_size(
04e0: 70 29 3b 0a 20 20 69 6e 74 20 69 3b 0a 0a 20 20 p);. int i;..
04f0: 66 6f 72 28 69 3d 30 3b 20 69 3c 6e 3b 20 69 2b for(i=0; i<n; i+
0500: 2b 29 7b 0a 20 20 20 20 69 66 28 20 21 69 73 61 +){. if( !isa
0510: 6c 6e 75 6d 28 7a 5b 69 5d 29 20 26 26 20 7a 5b lnum(z[i]) && z[
0520: 69 5d 21 3d 27 5f 27 20 29 7b 0a 20 20 20 20 20 i]!='_' ){.
0530: 20 72 65 74 75 72 6e 20 30 3b 0a 20 20 20 20 7d return 0;. }
0540: 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 31 3b . }. return 1;
0550: 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 52 65 74 75 72 6e .}../*.** Return
0560: 20 54 52 55 45 20 69 66 20 74 68 65 20 67 69 76 TRUE if the giv
0570: 65 6e 20 74 6f 6b 65 6e 20 69 73 20 61 20 76 61 en token is a va
0580: 6c 69 64 20 65 6e 75 6d 65 72 61 74 69 6f 6e 20 lid enumeration
0590: 76 61 6c 75 65 2e 0a 2a 2a 20 54 68 65 20 74 6f value..** The to
05a0: 6b 65 6e 20 6d 75 73 74 20 63 6f 6e 73 69 73 74 ken must consist
05b0: 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e of the followin
05c0: 67 20 63 68 61 72 61 63 74 65 72 73 3a 0a 2a 2a g characters:.**
05d0: 0a 2a 2a 20 61 2d 7a 41 2d 5a 30 2d 39 5f 25 2f .** a-zA-Z0-9_%/
05e0: 2e 2d 0a 2a 2f 0a 73 74 61 74 69 63 20 69 6e 74 .-.*/.static int
05f0: 20 69 73 5f 76 61 6c 69 64 5f 65 6e 75 6d 28 42 is_valid_enum(B
0600: 6c 6f 62 20 2a 70 29 7b 0a 20 20 63 6f 6e 73 74 lob *p){. const
0610: 20 63 68 61 72 20 2a 7a 20 3d 20 62 6c 6f 62 5f char *z = blob_
0620: 62 75 66 66 65 72 28 70 29 3b 0a 20 20 69 6e 74 buffer(p);. int
0630: 20 6e 20 3d 20 62 6c 6f 62 5f 73 69 7a 65 28 70 n = blob_size(p
0640: 29 3b 0a 20 20 69 6e 74 20 69 3b 0a 0a 20 20 66 );. int i;.. f
0650: 6f 72 28 69 3d 30 3b 20 69 3c 6e 3b 20 69 2b 2b or(i=0; i<n; i++
0660: 29 7b 0a 20 20 20 20 69 6e 74 20 63 20 3d 20 7a ){. int c = z
0670: 5b 69 5d 3b 0a 20 20 20 20 69 66 28 20 21 69 73 [i];. if( !is
0680: 61 6c 6e 75 6d 28 63 29 20 26 26 20 63 21 3d 27 alnum(c) && c!='
0690: 5f 27 20 26 26 20 63 21 3d 27 25 27 20 26 26 20 _' && c!='%' &&
06a0: 63 21 3d 27 2f 27 20 26 26 20 63 21 3d 27 2e 27 c!='/' && c!='.'
06b0: 20 26 26 20 63 21 3d 27 2d 27 20 29 7b 0a 20 20 && c!='-' ){.
06c0: 20 20 20 20 72 65 74 75 72 6e 20 30 3b 0a 20 20 return 0;.
06d0: 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e }. }. return
06e0: 20 31 3b 0a 7d 0a 0a 0a 2f 2a 0a 2a 2a 20 41 20 1;.}.../*.** A
06f0: 74 69 63 6b 65 74 20 63 6f 6e 66 69 67 75 72 61 ticket configura
0700: 74 69 6f 6e 20 72 65 63 6f 72 64 20 69 73 20 61 tion record is a
0710: 20 73 69 6e 67 6c 65 20 61 72 74 69 66 61 63 74 single artifact
0720: 20 74 68 61 74 20 64 65 66 69 6e 65 73 0a 2a 2a that defines.**
0730: 20 74 68 65 20 74 69 63 6b 65 74 20 63 6f 6e 66 the ticket conf
0740: 69 67 75 72 61 74 69 6f 6e 20 66 6f 72 20 61 20 iguration for a
0750: 73 65 72 76 65 72 2e 20 20 54 68 65 20 66 69 6c server. The fil
0760: 65 20 66 6f 72 6d 61 74 20 69 73 20 61 73 0a 2a e format is as.*
0770: 2a 20 66 6f 6c 6c 6f 77 73 3a 0a 2a 2a 0a 2a 2a * follows:.**.**
0780: 20 20 20 20 20 74 69 63 6b 65 74 2d 63 6f 6e 66 ticket-conf
0790: 69 67 75 72 61 74 69 6f 6e 0a 2a 2a 20 20 20 20 iguration.**
07a0: 20 66 69 65 6c 64 20 3c 66 69 65 6c 64 6e 61 6d field <fieldnam
07b0: 65 3e 20 3c 66 69 65 6c 64 74 79 70 65 3e 20 3c e> <fieldtype> <
07c0: 77 69 64 74 68 3e 20 3c 70 61 72 61 6d 3e 20 2e width> <param> .
07d0: 2e 2e 0a 2a 2a 20 20 20 20 20 74 65 6d 70 6c 61 ...** templa
07e0: 74 65 20 3c 74 79 70 65 3e 20 3c 64 65 6c 69 6d te <type> <delim
07f0: 69 74 65 72 3e 0a 2a 2a 20 20 20 20 20 3c 74 65 iter>.** <te
0800: 78 74 3e 0a 2a 2a 20 20 20 20 20 64 65 73 63 72 xt>.** descr
0810: 69 70 74 69 6f 6e 20 3c 64 65 6c 69 6d 69 74 65 iption <delimite
0820: 72 3e 0a 2a 2a 20 20 20 20 20 3c 74 65 78 74 3e r>.** <text>
0830: 0a 2a 2a 0a 2a 2a 20 41 6c 6c 20 6c 69 6e 65 73 .**.** All lines
0840: 20 61 72 65 20 73 65 70 61 72 61 74 65 64 20 62 are separated b
0850: 79 20 5c 6e 2e 20 20 54 72 61 69 6c 69 6e 67 20 y \n. Trailing
0860: 77 68 69 74 65 73 70 61 63 65 20 69 73 0a 2a 2a whitespace is.**
0870: 20 69 67 6e 6f 72 65 64 2e 20 20 54 68 65 20 66 ignored. The f
0880: 69 72 73 74 20 6c 69 6e 65 20 6d 75 73 74 20 62 irst line must b
0890: 65 20 22 74 69 63 6b 65 74 2d 63 6f 6e 66 69 67 e "ticket-config
08a0: 75 72 61 74 69 6f 6e 22 2e 0a 2a 2a 20 53 75 62 uration"..** Sub
08b0: 73 65 71 75 65 6e 74 20 6c 69 6e 65 73 20 61 72 sequent lines ar
08c0: 65 20 65 69 74 68 65 72 20 22 66 69 65 6c 64 22 e either "field"
08d0: 20 6f 72 20 22 74 65 6d 70 6c 61 74 65 22 20 6c or "template" l
08e0: 69 6e 65 73 2e 0a 2a 2a 20 54 68 65 72 65 20 6d ines..** There m
08f0: 75 73 74 20 62 65 20 65 78 61 63 74 6c 79 20 74 ust be exactly t
0900: 68 72 65 65 20 74 65 6d 70 6c 61 74 65 20 6c 69 hree template li
0910: 6e 65 73 20 61 6e 64 20 6f 6e 65 20 6f 72 20 6d nes and one or m
0920: 6f 72 65 0a 2a 2a 20 66 69 65 6c 64 20 6c 69 6e ore.** field lin
0930: 65 73 20 28 75 73 75 61 6c 6c 79 20 6d 6f 72 65 es (usually more
0940: 29 2e 0a 2a 2a 0a 2a 2a 20 46 69 65 6c 64 20 6c )..**.** Field l
0950: 69 6e 65 73 20 64 65 66 69 6e 65 20 74 68 65 20 ines define the
0960: 66 69 65 6c 64 73 20 6f 66 20 74 68 65 20 22 74 fields of the "t
0970: 69 63 6b 65 74 22 20 74 61 62 6c 65 20 69 6e 20 icket" table in
0980: 74 68 65 0a 2a 2a 20 64 61 74 61 62 61 73 65 2e the.** database.
0990: 20 20 54 68 65 20 66 69 65 6c 64 73 20 61 70 70 The fields app
09a0: 65 61 72 20 69 6e 20 74 68 65 20 74 61 62 6c 65 ear in the table
09b0: 20 69 6e 20 74 68 65 20 6f 72 64 65 72 20 69 6e in the order in
09c0: 20 0a 2a 2a 20 77 68 69 63 68 20 74 68 65 79 20 .** which they
09d0: 61 70 70 65 61 72 20 69 6e 20 74 68 65 20 63 6f appear in the co
09e0: 6e 66 69 67 75 72 61 74 69 6f 6e 20 61 72 74 69 nfiguration arti
09f0: 66 61 63 74 2e 20 20 54 68 65 20 3c 66 69 65 6c fact. The <fiel
0a00: 64 6e 61 6d 65 3e 0a 2a 2a 20 6d 75 73 74 20 63 dname>.** must c
0a10: 6f 6e 73 69 73 74 20 6f 66 20 61 6c 70 68 61 6e onsist of alphan
0a20: 75 6d 65 72 69 63 73 20 61 6e 64 20 75 6e 64 65 umerics and unde
0a30: 72 73 63 6f 72 65 73 2e 20 20 3c 66 69 65 6c 64 rscores. <field
0a40: 74 79 70 65 3e 0a 2a 2a 20 69 73 20 6f 6e 65 20 type>.** is one
0a50: 6f 66 3a 20 20 74 65 78 74 2c 20 63 74 65 78 74 of: text, ctext
0a60: 2c 20 65 6e 75 6d 2c 20 64 61 74 65 2c 20 75 75 , enum, date, uu
0a70: 69 64 2c 20 62 61 73 65 6c 69 6e 65 2c 20 70 72 id, baseline, pr
0a80: 69 76 61 74 65 2e 20 20 41 6c 6c 0a 2a 2a 20 74 ivate. All.** t
0a90: 79 70 65 73 20 68 61 76 65 20 61 74 20 6c 65 61 ypes have at lea
0aa0: 73 74 20 61 20 3c 77 69 64 74 68 3e 20 70 61 72 st a <width> par
0ab0: 61 6d 65 74 65 72 2e 20 20 54 65 78 74 20 61 6e ameter. Text an
0ac0: 64 20 43 74 65 78 74 20 74 79 70 65 73 0a 2a 2a d Ctext types.**
0ad0: 20 68 61 76 65 20 61 20 68 65 69 67 68 74 20 70 have a height p
0ae0: 61 72 61 6d 65 74 65 72 2e 20 20 45 6e 75 6d 20 arameter. Enum
0af0: 68 61 73 20 61 20 6c 69 73 74 20 6f 66 20 61 6c has a list of al
0b00: 6c 6f 77 65 64 20 76 61 6c 75 65 73 2e 0a 2a 2a lowed values..**
0b10: 0a 2a 2a 20 54 68 65 20 3c 74 79 70 65 3e 20 6f .** The <type> o
0b20: 66 20 61 20 74 65 6d 70 6c 61 74 65 20 69 73 20 f a template is
0b30: 6f 6e 65 20 6f 66 3a 20 6e 65 77 2c 20 76 69 65 one of: new, vie
0b40: 77 2c 20 65 64 69 74 2e 20 20 54 68 65 72 65 20 w, edit. There
0b50: 6d 75 73 74 0a 2a 2a 20 62 65 20 6f 6e 65 20 74 must.** be one t
0b60: 65 6d 70 6c 61 74 65 20 6f 66 20 65 61 63 68 20 emplate of each
0b70: 74 79 70 65 2e 20 20 3c 64 65 6c 69 6d 69 74 65 type. <delimite
0b80: 72 3e 20 69 73 20 61 6e 20 61 72 62 69 74 72 61 r> is an arbitra
0b90: 72 79 20 73 74 72 69 6e 67 0a 2a 2a 20 74 68 61 ry string.** tha
0ba0: 74 20 74 65 72 6d 69 6e 61 74 65 73 20 74 68 65 t terminates the
0bb0: 20 74 65 6d 70 6c 61 74 65 2e 20 20 54 68 65 20 template. The
0bc0: 62 6f 64 79 20 6f 66 20 74 68 65 20 74 65 6d 70 body of the temp
0bd0: 6c 61 74 65 20 69 73 20 73 75 62 73 65 71 75 65 late is subseque
0be0: 6e 74 0a 2a 2a 20 6c 69 6e 65 73 20 6f 66 20 74 nt.** lines of t
0bf0: 65 78 74 20 75 70 20 74 6f 20 62 75 74 20 6e 6f ext up to but no
0c00: 74 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 t including the
0c10: 3c 64 65 6c 69 6d 69 74 65 72 3e 2e 20 20 54 72 <delimiter>. Tr
0c20: 61 69 6c 69 6e 67 0a 2a 2a 20 77 68 69 74 65 73 ailing.** whites
0c30: 70 61 63 65 20 6f 6e 20 74 68 65 20 64 65 6c 69 pace on the deli
0c40: 6d 69 74 65 72 20 69 73 20 69 67 6e 6f 72 65 64 miter is ignored
0c50: 2e 0a 2a 2a 0a 2a 2a 20 54 68 65 72 65 20 73 68 ..**.** There sh
0c60: 6f 75 6c 64 20 62 65 20 6f 6e 65 20 64 65 73 63 ould be one desc
0c70: 72 69 70 74 69 6f 6e 20 65 6e 74 72 79 2e 20 20 ription entry.
0c80: 54 68 65 20 74 65 78 74 20 74 68 61 74 20 66 6f The text that fo
0c90: 6c 6c 6f 77 73 0a 2a 2a 20 69 73 20 61 20 68 75 llows.** is a hu
0ca0: 6d 61 6e 2d 72 65 61 64 61 62 6c 65 20 70 6c 61 man-readable pla
0cb0: 69 6e 74 65 78 74 20 64 65 73 63 72 69 70 74 69 intext descripti
0cc0: 6f 6e 20 6f 66 20 74 68 69 73 20 74 69 63 6b 65 on of this ticke
0cd0: 74 0a 2a 2a 20 63 6f 6e 66 69 67 75 72 61 74 69 t.** configurati
0ce0: 6f 6e 2e 20 20 54 68 65 20 64 65 73 63 72 69 70 on. The descrip
0cf0: 74 69 6f 6e 20 69 73 20 76 69 73 69 62 6c 65 20 tion is visible
0d00: 74 6f 20 74 68 65 20 61 64 6d 69 6e 69 73 74 72 to the administr
0d10: 61 74 6f 72 0a 2a 2a 20 61 6e 64 20 69 73 20 75 ator.** and is u
0d20: 73 65 64 20 74 6f 20 68 65 6c 70 20 69 64 65 6e sed to help iden
0d30: 74 69 66 79 20 74 68 69 73 20 63 6f 6e 66 69 67 tify this config
0d40: 75 72 61 74 69 6f 6e 20 61 6d 6f 6e 67 20 73 65 uration among se
0d50: 76 65 72 61 6c 0a 2a 2a 20 6f 70 74 69 6f 6e 73 veral.** options
0d60: 2e 20 20 54 68 65 20 66 69 72 73 74 20 6c 69 6e . The first lin
0d70: 65 20 6f 66 20 74 68 65 20 64 65 73 63 72 69 70 e of the descrip
0d80: 74 69 6f 6e 20 69 73 20 61 20 6f 6e 65 2d 6c 69 tion is a one-li
0d90: 6e 65 0a 2a 2a 20 73 75 6d 6d 61 72 79 2e 20 20 ne.** summary.
0da0: 53 75 62 73 65 71 75 65 6e 74 20 6c 69 6e 65 73 Subsequent lines
0db0: 20 61 72 65 20 64 65 74 61 69 6c 73 2e 0a 2a 2a are details..**
0dc0: 0a 2a 2a 20 54 68 65 20 70 43 6f 6e 66 69 67 20 .** The pConfig
0dd0: 70 61 72 61 6d 65 74 65 72 20 69 73 20 74 68 65 parameter is the
0de0: 20 63 6f 6d 70 6c 65 74 65 20 74 65 78 74 20 6f complete text o
0df0: 66 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 f the configurat
0e00: 69 6f 6e 0a 2a 2a 20 66 69 6c 65 20 74 6f 20 62 ion.** file to b
0e10: 65 20 70 61 72 73 65 64 2e 20 20 74 65 73 74 46 e parsed. testF
0e20: 6c 61 67 20 69 73 20 31 20 74 6f 20 63 61 75 73 lag is 1 to caus
0e30: 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 74 6f e the results to
0e40: 20 62 65 20 70 72 69 6e 74 65 64 0a 2a 2a 20 6f be printed.** o
0e50: 6e 20 73 74 64 6f 75 74 20 6f 72 20 30 20 74 6f n stdout or 0 to
0e60: 20 63 61 75 73 65 20 72 65 73 75 6c 74 73 20 74 cause results t
0e70: 6f 20 75 70 64 61 74 65 20 74 68 65 20 64 61 74 o update the dat
0e80: 61 62 61 73 65 2e 0a 2a 2a 0a 2a 2a 20 52 65 74 abase..**.** Ret
0e90: 75 72 6e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f urn the number o
0ea0: 66 20 65 72 72 6f 72 73 2e 20 20 49 66 20 74 68 f errors. If th
0eb0: 65 72 65 20 69 73 20 61 6e 20 65 72 72 6f 72 20 ere is an error
0ec0: 61 6e 64 20 70 45 72 72 21 3d 4e 55 4c 4c 0a 2a and pErr!=NULL.*
0ed0: 2a 20 74 68 65 6e 20 6c 65 61 76 65 20 61 6e 20 * then leave an
0ee0: 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 69 6e error message in
0ef0: 20 70 45 72 72 2e 20 20 57 65 20 61 73 73 75 6d pErr. We assum
0f00: 65 20 74 68 61 74 20 70 45 72 72 20 68 61 73 20 e that pErr has
0f10: 61 6c 72 65 61 64 79 0a 2a 2a 20 62 65 65 6e 20 already.** been
0f20: 69 6e 69 74 69 61 6c 69 7a 65 64 2e 0a 2a 2f 0a initialized..*/.
0f30: 69 6e 74 20 74 69 63 6b 65 74 5f 63 6f 6e 66 69 int ticket_confi
0f40: 67 5f 70 61 72 73 65 28 42 6c 6f 62 20 2a 70 43 g_parse(Blob *pC
0f50: 6f 6e 66 69 67 2c 20 69 6e 74 20 74 65 73 74 46 onfig, int testF
0f60: 6c 61 67 2c 20 42 6c 6f 62 20 2a 70 45 72 72 29 lag, Blob *pErr)
0f70: 7b 0a 20 20 69 6e 74 20 72 63 20 3d 20 31 3b 0a {. int rc = 1;.
0f80: 20 20 42 6c 6f 62 20 6c 69 6e 65 3b 0a 20 20 42 Blob line;. B
0f90: 6c 6f 62 20 74 6f 6b 65 6e 3b 0a 20 20 42 6c 6f lob token;. Blo
0fa0: 62 20 6e 61 6d 65 3b 0a 20 20 42 6c 6f 62 20 74 b name;. Blob t
0fb0: 79 70 65 3b 0a 20 20 42 6c 6f 62 20 61 72 67 3b ype;. Blob arg;
0fc0: 0a 20 20 42 6c 6f 62 20 73 71 6c 3b 0a 20 20 42 . Blob sql;. B
0fd0: 6c 6f 62 20 74 62 6c 64 65 66 3b 0a 20 20 42 6c lob tbldef;. Bl
0fe0: 6f 62 20 65 72 72 3b 0a 20 20 69 6e 74 20 73 65 ob err;. int se
0ff0: 65 6e 5f 74 65 6d 70 6c 61 74 65 20 3d 20 30 3b en_template = 0;
1000: 0a 20 20 69 6e 74 20 6c 69 6e 65 6e 6f 20 3d 20 . int lineno =
1010: 30 3b 0a 0a 20 20 62 6c 6f 62 5f 7a 65 72 6f 28 0;.. blob_zero(
1020: 26 73 71 6c 29 3b 0a 20 20 62 6c 6f 62 5f 7a 65 &sql);. blob_ze
1030: 72 6f 28 26 74 62 6c 64 65 66 29 3b 0a 20 20 62 ro(&tbldef);. b
1040: 6c 6f 62 5f 7a 65 72 6f 28 26 74 6f 6b 65 6e 29 lob_zero(&token)
1050: 3b 0a 20 20 62 6c 6f 62 5f 7a 65 72 6f 28 26 6e ;. blob_zero(&n
1060: 61 6d 65 29 3b 0a 20 20 62 6c 6f 62 5f 7a 65 72 ame);. blob_zer
1070: 6f 28 26 74 79 70 65 29 3b 0a 20 20 62 6c 6f 62 o(&type);. blob
1080: 5f 7a 65 72 6f 28 26 61 72 67 29 3b 0a 20 20 62 _zero(&arg);. b
1090: 6c 6f 62 5f 7a 65 72 6f 28 26 65 72 72 29 3b 0a lob_zero(&err);.
10a0: 0a 20 20 2f 2a 20 54 68 65 20 63 6f 6e 66 69 67 . /* The config
10b0: 75 72 61 74 69 6f 6e 20 66 69 6c 65 20 6d 75 73 uration file mus
10c0: 74 20 62 65 67 69 6e 20 77 69 74 68 20 61 20 6c t begin with a l
10d0: 69 6e 65 20 74 68 61 74 0a 20 20 2a 2a 20 73 61 ine that. ** sa
10e0: 79 73 20 22 74 69 63 6b 65 74 2d 63 6f 6e 66 69 ys "ticket-confi
10f0: 67 75 72 61 74 69 6f 6e 22 0a 20 20 2a 2f 0a 20 guration". */.
1100: 20 62 6c 6f 62 5f 6c 69 6e 65 28 70 43 6f 6e 66 blob_line(pConf
1110: 69 67 2c 20 26 6c 69 6e 65 29 3b 0a 20 20 62 6c ig, &line);. bl
1120: 6f 62 5f 74 6f 6b 65 6e 28 26 6c 69 6e 65 2c 20 ob_token(&line,
1130: 26 74 6f 6b 65 6e 29 3b 0a 20 20 69 66 28 20 21 &token);. if( !
1140: 62 6c 6f 62 5f 65 71 28 26 74 6f 6b 65 6e 2c 20 blob_eq(&token,
1150: 22 74 69 63 6b 65 74 2d 63 6f 6e 66 69 67 75 72 "ticket-configur
1160: 61 74 69 6f 6e 22 29 20 29 7b 0a 20 20 20 20 62 ation") ){. b
1170: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 65 72 72 lob_appendf(&err
1180: 2c 20 22 6d 69 73 73 69 6e 67 20 69 6e 69 74 69 , "missing initi
1190: 61 6c 69 7a 61 74 69 6f 6e 20 6b 65 79 77 6f 72 alization keywor
11a0: 64 22 29 3b 0a 20 20 20 20 67 6f 74 6f 20 62 61 d");. goto ba
11b0: 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3b 0a 20 d_config_file;.
11c0: 20 7d 0a 20 20 6c 69 6e 65 6e 6f 2b 2b 3b 0a 0a }. lineno++;..
11d0: 20 20 2f 2a 20 42 65 67 69 6e 20 61 63 63 75 6d /* Begin accum
11e0: 75 6c 61 74 69 6e 67 20 53 51 4c 20 74 65 78 74 ulating SQL text
11f0: 20 74 68 61 74 20 77 69 6c 6c 20 69 6d 70 6c 65 that will imple
1200: 6d 65 6e 74 20 74 68 65 20 0a 20 20 2a 2a 20 74 ment the . ** t
1210: 69 63 6b 65 74 20 63 6f 6e 66 69 67 75 72 61 74 icket configurat
1220: 69 6f 6e 2e 20 20 74 62 6c 64 65 66 20 77 69 6c ion. tbldef wil
1230: 6c 20 68 6f 6c 64 20 74 68 65 20 74 69 63 6b 65 l hold the ticke
1240: 74 20 74 61 62 6c 65 0a 20 20 2a 2a 20 64 65 66 t table. ** def
1250: 69 6e 69 74 69 6f 6e 2e 20 20 73 71 6c 20 77 69 inition. sql wi
1260: 6c 6c 20 68 6f 6c 64 20 74 65 78 74 20 74 6f 20 ll hold text to
1270: 69 6e 69 74 69 61 6c 69 7a 65 20 61 6e 64 20 64 initialize and d
1280: 65 66 69 6e 65 0a 20 20 2a 2a 20 74 68 65 20 74 efine. ** the t
1290: 6b 74 66 69 65 6c 64 20 74 61 62 6c 65 20 61 6e ktfield table an
12a0: 64 20 74 6f 20 69 6e 73 65 72 74 20 74 65 6d 70 d to insert temp
12b0: 6c 61 74 65 20 74 65 78 74 20 69 6e 74 6f 20 74 late text into t
12c0: 68 65 0a 20 20 2a 2a 20 63 6f 6e 66 69 67 20 74 he. ** config t
12d0: 61 62 6c 65 0a 20 20 2a 2f 0a 20 20 62 6c 6f 62 able. */. blob
12e0: 5f 61 70 70 65 6e 64 66 28 26 74 62 6c 64 65 66 _appendf(&tbldef
12f0: 2c 20 0a 20 20 20 20 20 22 44 52 4f 50 20 54 41 , . "DROP TA
1300: 42 4c 45 20 49 46 20 45 58 49 53 54 53 20 74 69 BLE IF EXISTS ti
1310: 63 6b 65 74 3b 5c 6e 22 0a 20 20 20 20 20 22 43 cket;\n". "C
1320: 52 45 41 54 45 20 54 41 42 4c 45 20 72 65 70 6f REATE TABLE repo
1330: 73 69 74 6f 72 79 2e 74 69 63 6b 65 74 28 5c 6e sitory.ticket(\n
1340: 22 0a 20 20 20 20 20 22 20 20 74 6b 74 69 64 20 ". " tktid
1350: 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 INTEGER PRIMARY
1360: 4b 45 59 2c 5c 6e 22 0a 20 20 20 20 20 22 20 20 KEY,\n". "
1370: 74 6b 74 75 75 69 64 20 54 45 58 54 20 55 4e 49 tktuuid TEXT UNI
1380: 51 55 45 2c 5c 6e 22 0a 20 20 20 20 20 22 20 20 QUE,\n". "
1390: 73 74 61 72 74 74 69 6d 65 20 44 41 54 45 54 49 starttime DATETI
13a0: 4d 45 2c 5c 6e 22 0a 20 20 20 20 20 22 20 20 6c ME,\n". " l
13b0: 61 73 74 6d 6f 64 20 44 41 54 45 54 49 4d 45 22 astmod DATETIME"
13c0: 0a 20 20 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 . );. blob_app
13d0: 65 6e 64 66 28 26 73 71 6c 2c 0a 20 20 20 20 20 endf(&sql,.
13e0: 22 44 52 4f 50 20 54 41 42 4c 45 20 49 46 20 45 "DROP TABLE IF E
13f0: 58 49 53 54 53 20 74 6b 74 66 69 65 6c 64 3b 5c XISTS tktfield;\
1400: 6e 22 0a 20 20 20 20 20 22 43 52 45 41 54 45 20 n". "CREATE
1410: 54 41 42 4c 45 20 72 65 70 6f 73 69 74 6f 72 79 TABLE repository
1420: 2e 74 6b 74 66 69 65 6c 64 28 5c 6e 22 0a 20 20 .tktfield(\n".
1430: 20 20 20 22 20 20 66 69 64 78 20 49 4e 54 45 47 " fidx INTEG
1440: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 5c ER PRIMARY KEY,\
1450: 6e 22 0a 20 20 20 20 20 22 20 20 6e 61 6d 65 20 n". " name
1460: 54 45 58 54 20 55 4e 49 51 55 45 2c 5c 6e 22 0a TEXT UNIQUE,\n".
1470: 20 20 20 20 20 22 20 20 74 79 70 65 20 54 45 58 " type TEX
1480: 54 2c 5c 6e 22 0a 20 20 20 20 20 22 20 20 77 69 T,\n". " wi
1490: 64 74 68 20 49 4e 54 45 47 45 52 2c 5c 6e 22 0a dth INTEGER,\n".
14a0: 20 20 20 20 20 22 20 20 61 72 67 5c 6e 22 0a 20 " arg\n".
14b0: 20 20 20 20 22 29 3b 5c 6e 22 0a 20 20 29 3b 0a ");\n". );.
14c0: 0a 20 20 2f 2a 20 50 72 6f 63 65 73 73 20 74 68 . /* Process th
14d0: 65 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 e remainder of t
14e0: 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e he configuration
14f0: 20 66 69 6c 65 20 28 74 68 65 20 70 61 72 74 20 file (the part
1500: 74 68 61 74 0a 20 20 2a 2a 20 63 6f 6d 65 73 20 that. ** comes
1510: 61 66 74 65 72 20 74 68 65 20 22 74 69 63 6b 65 after the "ticke
1520: 74 2d 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 t-configuration"
1530: 20 68 65 61 64 65 72 29 20 6c 69 6e 65 20 62 79 header) line by
1540: 20 6c 69 6e 65 0a 20 20 2a 2f 0a 20 20 77 68 69 line. */. whi
1550: 6c 65 28 20 62 6c 6f 62 5f 6c 69 6e 65 28 70 43 le( blob_line(pC
1560: 6f 6e 66 69 67 2c 20 26 6c 69 6e 65 29 20 29 7b onfig, &line) ){
1570: 0a 20 20 20 20 63 68 61 72 20 2a 7a 3b 0a 20 20 . char *z;.
1580: 20 20 6c 69 6e 65 6e 6f 2b 2b 3b 0a 20 20 20 20 lineno++;.
1590: 69 66 28 20 62 6c 6f 62 5f 74 6f 6b 65 6e 28 26 if( blob_token(&
15a0: 6c 69 6e 65 2c 20 26 74 6f 6b 65 6e 29 3d 3d 30 line, &token)==0
15b0: 20 29 7b 0a 20 20 20 20 20 20 2f 2a 20 49 67 6e ){. /* Ign
15c0: 6f 72 65 20 62 6c 61 6e 6b 20 6c 69 6e 65 73 20 ore blank lines
15d0: 2a 2f 0a 20 20 20 20 20 20 63 6f 6e 74 69 6e 75 */. continu
15e0: 65 3b 0a 20 20 20 20 7d 0a 20 20 20 20 7a 20 3d e;. }. z =
15f0: 20 62 6c 6f 62 5f 62 75 66 66 65 72 28 26 74 6f blob_buffer(&to
1600: 6b 65 6e 29 3b 0a 20 20 20 20 69 66 28 20 7a 5b ken);. if( z[
1610: 30 5d 3d 3d 27 23 27 20 29 7b 0a 20 20 20 20 20 0]=='#' ){.
1620: 20 2f 2a 20 49 67 6e 6f 72 65 20 63 6f 6d 6d 65 /* Ignore comme
1630: 6e 74 20 6c 69 6e 65 73 20 2a 2f 0a 20 20 20 20 nt lines */.
1640: 20 20 63 6f 6e 74 69 6e 75 65 3b 0a 20 20 20 20 continue;.
1650: 7d 0a 0a 20 20 20 20 2f 2a 0a 20 20 20 20 2a 2a }.. /*. **
1660: 20 20 20 20 66 69 65 6c 64 20 3c 6e 61 6d 65 3e field <name>
1670: 20 3c 74 79 70 65 3e 20 3c 77 69 64 74 68 3e 20 <type> <width>
1680: 3c 61 72 67 73 2e 2e 2e 3e 0a 20 20 20 20 2a 2f <args...>. */
1690: 0a 20 20 20 20 69 66 28 20 62 6c 6f 62 5f 65 71 . if( blob_eq
16a0: 28 26 74 6f 6b 65 6e 2c 20 22 66 69 65 6c 64 22 (&token, "field"
16b0: 29 0a 20 20 20 20 20 26 26 20 62 6c 6f 62 5f 74 ). && blob_t
16c0: 6f 6b 65 6e 28 26 6c 69 6e 65 2c 26 6e 61 6d 65 oken(&line,&name
16d0: 29 0a 20 20 20 20 20 26 26 20 62 6c 6f 62 5f 74 ). && blob_t
16e0: 6f 6b 65 6e 28 26 6c 69 6e 65 2c 26 74 79 70 65 oken(&line,&type
16f0: 29 0a 20 20 20 20 20 26 26 20 62 6c 6f 62 5f 74 ). && blob_t
1700: 6f 6b 65 6e 28 26 6c 69 6e 65 2c 26 61 72 67 29 oken(&line,&arg)
1710: 0a 20 20 20 20 29 7b 0a 20 20 20 20 20 20 69 6e . ){. in
1720: 74 20 77 69 64 74 68 3b 0a 0a 20 20 20 20 20 20 t width;..
1730: 69 66 28 20 21 69 73 5f 76 61 6c 69 64 5f 6e 61 if( !is_valid_na
1740: 6d 65 28 26 6e 61 6d 65 29 20 29 7b 0a 20 20 20 me(&name) ){.
1750: 20 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 blob_append
1760: 66 28 26 65 72 72 2c 20 22 69 6e 76 61 6c 69 64 f(&err, "invalid
1770: 20 66 69 65 6c 64 20 6e 61 6d 65 3a 20 25 62 22 field name: %b"
1780: 2c 20 26 6e 61 6d 65 29 3b 0a 20 20 20 20 20 20 , &name);.
1790: 20 20 67 6f 74 6f 20 62 61 64 5f 63 6f 6e 66 69 goto bad_confi
17a0: 67 5f 66 69 6c 65 3b 0a 20 20 20 20 20 20 7d 0a g_file;. }.
17b0: 20 20 20 20 20 20 69 66 28 20 21 62 6c 6f 62 5f if( !blob_
17c0: 69 73 5f 69 6e 74 28 26 61 72 67 2c 20 26 77 69 is_int(&arg, &wi
17d0: 64 74 68 29 20 29 7b 0a 20 20 20 20 20 20 20 20 dth) ){.
17e0: 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 65 72 blob_appendf(&er
17f0: 72 2c 20 22 69 6e 76 61 6c 69 64 20 66 69 65 6c r, "invalid fiel
1800: 64 20 77 69 64 74 68 3a 20 25 62 22 2c 20 26 61 d width: %b", &a
1810: 72 67 29 3b 0a 20 20 20 20 20 20 20 20 67 6f 74 rg);. got
1820: 6f 20 62 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c o bad_config_fil
1830: 65 3b 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 e;. }.
1840: 20 69 66 28 20 77 69 64 74 68 3c 31 20 7c 7c 20 if( width<1 ||
1850: 77 69 64 74 68 3e 32 30 30 20 29 7b 0a 20 20 20 width>200 ){.
1860: 20 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 blob_append
1870: 66 28 26 65 72 72 2c 20 22 77 69 64 74 68 20 6c f(&err, "width l
1880: 65 73 73 20 74 68 61 6e 20 31 20 6f 72 20 67 72 ess than 1 or gr
1890: 65 61 74 65 72 20 74 68 61 6e 20 32 30 30 22 29 eater than 200")
18a0: 3b 0a 20 20 20 20 20 20 20 20 67 6f 74 6f 20 62 ;. goto b
18b0: 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3b 0a ad_config_file;.
18c0: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 62 6c }. bl
18d0: 6f 62 5f 61 70 70 65 6e 64 66 28 26 74 62 6c 64 ob_appendf(&tbld
18e0: 65 66 2c 20 22 2c 5c 6e 20 20 74 6b 74 5f 25 62 ef, ",\n tkt_%b
18f0: 22 2c 20 26 6e 61 6d 65 29 3b 0a 20 20 20 20 20 ", &name);.
1900: 20 69 66 28 20 62 6c 6f 62 5f 65 71 28 26 74 79 if( blob_eq(&ty
1910: 70 65 2c 22 74 65 78 74 22 29 20 7c 7c 20 62 6c pe,"text") || bl
1920: 6f 62 5f 65 71 28 26 74 79 70 65 2c 22 63 74 65 ob_eq(&type,"cte
1930: 78 74 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 xt").
1940: 20 7c 7c 20 62 6c 6f 62 5f 65 71 28 26 74 79 70 || blob_eq(&typ
1950: 65 2c 22 70 72 69 76 61 74 65 22 29 20 29 7b 0a e,"private") ){.
1960: 20 20 20 20 20 20 20 20 69 6e 74 20 68 65 69 67 int heig
1970: 68 74 3b 0a 20 20 20 20 20 20 20 20 69 66 28 20 ht;. if(
1980: 21 62 6c 6f 62 5f 74 6f 6b 65 6e 28 26 6c 69 6e !blob_token(&lin
1990: 65 2c 20 26 61 72 67 29 20 7c 7c 20 21 62 6c 6f e, &arg) || !blo
19a0: 62 5f 69 73 5f 69 6e 74 28 26 61 72 67 2c 20 26 b_is_int(&arg, &
19b0: 68 65 69 67 68 74 29 20 29 7b 0a 20 20 20 20 20 height) ){.
19c0: 20 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 blob_append
19d0: 66 28 26 65 72 72 2c 20 22 69 6e 76 61 6c 69 64 f(&err, "invalid
19e0: 20 68 65 69 67 68 74 3a 20 25 62 22 2c 20 26 61 height: %b", &a
19f0: 72 67 29 3b 0a 20 20 20 20 20 20 20 20 20 20 67 rg);. g
1a00: 6f 74 6f 20 62 61 64 5f 63 6f 6e 66 69 67 5f 66 oto bad_config_f
1a10: 69 6c 65 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 ile;. }.
1a20: 20 20 20 20 20 20 20 69 66 28 20 68 65 69 67 68 if( heigh
1a30: 74 3c 31 20 7c 7c 20 68 65 69 67 68 74 3e 31 30 t<1 || height>10
1a40: 30 30 20 29 7b 0a 20 20 20 20 20 20 20 20 20 20 00 ){.
1a50: 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 65 72 blob_appendf(&er
1a60: 72 2c 20 22 68 65 69 67 68 74 20 6c 65 73 73 20 r, "height less
1a70: 74 68 61 6e 20 31 20 6f 72 20 67 72 65 61 74 65 than 1 or greate
1a80: 72 20 74 68 61 6e 20 31 30 30 30 22 29 3b 0a 20 r than 1000");.
1a90: 20 20 20 20 20 20 20 20 20 67 6f 74 6f 20 62 61 goto ba
1aa0: 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3b 0a 20 d_config_file;.
1ab0: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 }.
1ac0: 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 73 blob_appendf(&s
1ad0: 71 6c 2c 0a 20 20 20 20 20 20 20 20 20 20 22 49 ql,. "I
1ae0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 6b 74 66 69 NSERT INTO tktfi
1af0: 65 6c 64 28 6e 61 6d 65 2c 74 79 70 65 2c 77 69 eld(name,type,wi
1b00: 64 74 68 2c 61 72 67 29 22 0a 20 20 20 20 20 20 dth,arg)".
1b10: 20 20 20 20 22 56 41 4c 55 45 53 28 27 25 62 27 "VALUES('%b'
1b20: 2c 27 25 62 27 2c 25 64 2c 25 64 29 3b 5c 6e 22 ,'%b',%d,%d);\n"
1b30: 2c 0a 20 20 20 20 20 20 20 20 20 20 26 6e 61 6d ,. &nam
1b40: 65 2c 20 26 74 79 70 65 2c 20 77 69 64 74 68 2c e, &type, width,
1b50: 20 68 65 69 67 68 74 0a 20 20 20 20 20 20 20 20 height.
1b60: 29 3b 0a 20 20 20 20 20 20 7d 65 6c 73 65 20 69 );. }else i
1b70: 66 28 20 62 6c 6f 62 5f 65 71 28 26 74 79 70 65 f( blob_eq(&type
1b80: 2c 22 65 6e 75 6d 22 29 20 29 7b 0a 20 20 20 20 ,"enum") ){.
1b90: 20 20 20 20 69 6e 74 20 63 6e 74 20 3d 20 30 3b int cnt = 0;
1ba0: 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 . const c
1bb0: 68 61 72 20 2a 7a 44 65 6c 69 6d 20 3d 20 22 27 har *zDelim = "'
1bc0: 22 3b 0a 20 20 20 20 20 20 20 20 62 6c 6f 62 5f ";. blob_
1bd0: 61 70 70 65 6e 64 66 28 26 73 71 6c 2c 0a 20 20 appendf(&sql,.
1be0: 20 20 20 20 20 20 20 20 22 49 4e 53 45 52 54 20 "INSERT
1bf0: 49 4e 54 4f 20 74 6b 74 66 69 65 6c 64 28 6e 61 INTO tktfield(na
1c00: 6d 65 2c 74 79 70 65 2c 77 69 64 74 68 2c 61 72 me,type,width,ar
1c10: 67 29 22 0a 20 20 20 20 20 20 20 20 20 20 22 56 g)". "V
1c20: 41 4c 55 45 53 28 27 25 62 27 2c 27 25 62 27 2c ALUES('%b','%b',
1c30: 25 64 2c 22 2c 0a 20 20 20 20 20 20 20 20 20 20 %d,",.
1c40: 26 6e 61 6d 65 2c 20 26 74 79 70 65 2c 20 77 69 &name, &type, wi
1c50: 64 74 68 0a 20 20 20 20 20 20 20 20 29 3b 0a 20 dth. );.
1c60: 20 20 20 20 20 20 20 77 68 69 6c 65 28 20 62 6c while( bl
1c70: 6f 62 5f 74 6f 6b 65 6e 28 26 6c 69 6e 65 2c 20 ob_token(&line,
1c80: 26 61 72 67 29 20 29 7b 0a 20 20 20 20 20 20 20 &arg) ){.
1c90: 20 20 20 69 66 28 20 21 69 73 5f 76 61 6c 69 64 if( !is_valid
1ca0: 5f 65 6e 75 6d 28 26 61 72 67 29 20 29 7b 0a 20 _enum(&arg) ){.
1cb0: 20 20 20 20 20 20 20 20 20 20 20 62 6c 6f 62 5f blob_
1cc0: 61 70 70 65 6e 64 66 28 26 65 72 72 2c 20 22 69 appendf(&err, "i
1cd0: 6e 76 61 6c 69 64 20 65 6e 75 6d 65 72 61 74 69 nvalid enumerati
1ce0: 6f 6e 20 76 61 6c 75 65 3a 20 25 62 22 2c 20 26 on value: %b", &
1cf0: 61 72 67 29 3b 0a 20 20 20 20 20 20 20 20 20 20 arg);.
1d00: 20 20 67 6f 74 6f 20 62 61 64 5f 63 6f 6e 66 69 goto bad_confi
1d10: 67 5f 66 69 6c 65 3b 0a 20 20 20 20 20 20 20 20 g_file;.
1d20: 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 63 6e }. cn
1d30: 74 2b 2b 3b 0a 20 20 20 20 20 20 20 20 20 20 62 t++;. b
1d40: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 73 71 6c lob_appendf(&sql
1d50: 2c 20 22 25 73 25 62 22 2c 20 7a 44 65 6c 69 6d , "%s%b", zDelim
1d60: 2c 20 26 61 72 67 29 3b 0a 20 20 20 20 20 20 20 , &arg);.
1d70: 20 20 20 7a 44 65 6c 69 6d 20 3d 20 22 20 22 3b zDelim = " ";
1d80: 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 . }.
1d90: 20 20 20 69 66 28 20 63 6e 74 3c 32 20 29 7b 0a if( cnt<2 ){.
1da0: 20 20 20 20 20 20 20 20 20 20 62 6c 6f 62 5f 61 blob_a
1db0: 70 70 65 6e 64 66 28 26 65 72 72 2c 20 22 6c 65 ppendf(&err, "le
1dc0: 73 73 20 74 68 61 6e 20 32 20 65 6e 75 6d 65 72 ss than 2 enumer
1dd0: 61 74 69 6f 6e 20 76 61 6c 75 65 73 22 29 3b 0a ation values");.
1de0: 20 20 20 20 20 20 20 20 20 20 67 6f 74 6f 20 62 goto b
1df0: 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3b 0a ad_config_file;.
1e00: 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 }.
1e10: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 blob_appendf(&
1e20: 73 71 6c 2c 22 27 29 3b 5c 6e 22 29 3b 0a 20 20 sql,"');\n");.
1e30: 20 20 20 20 7d 65 6c 73 65 20 69 66 28 20 62 6c }else if( bl
1e40: 6f 62 5f 65 71 28 26 74 79 70 65 2c 22 75 75 69 ob_eq(&type,"uui
1e50: 64 22 29 20 7c 7c 20 62 6c 6f 62 5f 65 71 28 26 d") || blob_eq(&
1e60: 74 79 70 65 2c 22 62 61 73 65 6c 69 6e 65 22 29 type,"baseline")
1e70: 20 7c 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 ||.
1e80: 20 20 20 20 62 6c 6f 62 5f 65 71 28 26 74 79 70 blob_eq(&typ
1e90: 65 2c 22 64 61 74 65 22 29 20 29 7b 0a 20 20 20 e,"date") ){.
1ea0: 20 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 blob_append
1eb0: 66 28 26 73 71 6c 2c 0a 20 20 20 20 20 20 20 20 f(&sql,.
1ec0: 20 20 22 49 4e 53 45 52 54 20 49 4e 54 4f 20 74 "INSERT INTO t
1ed0: 6b 74 66 69 65 6c 64 28 6e 61 6d 65 2c 74 79 70 ktfield(name,typ
1ee0: 65 2c 77 69 64 74 68 29 22 0a 20 20 20 20 20 20 e,width)".
1ef0: 20 20 20 20 22 56 41 4c 55 45 53 28 27 25 62 27 "VALUES('%b'
1f00: 2c 27 25 62 27 2c 25 64 29 3b 5c 6e 22 2c 0a 20 ,'%b',%d);\n",.
1f10: 20 20 20 20 20 20 20 20 20 26 6e 61 6d 65 2c 20 &name,
1f20: 26 74 79 70 65 2c 20 77 69 64 74 68 0a 20 20 20 &type, width.
1f30: 20 20 20 20 20 29 3b 0a 20 20 20 20 20 20 7d 65 );. }e
1f40: 6c 73 65 7b 0a 20 20 20 20 20 20 20 20 62 6c 6f lse{. blo
1f50: 62 5f 61 70 70 65 6e 64 66 28 26 65 72 72 2c 20 b_appendf(&err,
1f60: 22 75 6e 6b 6e 6f 77 6e 20 66 69 65 6c 64 20 74 "unknown field t
1f70: 79 70 65 3a 20 25 62 22 2c 20 26 74 79 70 65 29 ype: %b", &type)
1f80: 3b 0a 20 20 20 20 20 20 20 20 67 6f 74 6f 20 62 ;. goto b
1f90: 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3b 0a ad_config_file;.
1fa0: 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 65 6c 73 }. }els
1fb0: 65 20 20 20 20 0a 20 20 0a 20 20 20 20 2f 2a 0a e . . /*.
1fc0: 20 20 20 20 2a 2a 20 20 74 65 6d 70 6c 61 74 65 ** template
1fd0: 20 3c 74 79 70 65 3e 20 3c 64 65 6c 69 6d 69 74 <type> <delimit
1fe0: 65 72 3e 0a 20 20 20 20 2a 2a 20 20 3c 74 65 78 er>. ** <tex
1ff0: 74 3e 0a 20 20 20 20 2a 2f 20 20 20 20 20 20 0a t>. */ .
2000: 20 20 20 20 69 66 28 20 62 6c 6f 62 5f 65 71 28 if( blob_eq(
2010: 26 74 6f 6b 65 6e 2c 20 22 74 65 6d 70 6c 61 74 &token, "templat
2020: 65 22 29 0a 20 20 20 20 20 26 26 20 62 6c 6f 62 e"). && blob
2030: 5f 74 6f 6b 65 6e 28 26 6c 69 6e 65 2c 20 26 74 _token(&line, &t
2040: 79 70 65 29 0a 20 20 20 20 20 26 26 20 62 6c 6f ype). && blo
2050: 62 5f 74 6f 6b 65 6e 28 26 6c 69 6e 65 2c 20 26 b_token(&line, &
2060: 61 72 67 29 0a 20 20 20 20 29 7b 0a 20 20 20 20 arg). ){.
2070: 20 20 69 6e 74 20 69 64 78 3b 0a 20 20 20 20 20 int idx;.
2080: 20 42 6c 6f 62 20 63 6f 6e 74 65 6e 74 3b 0a 20 Blob content;.
2090: 20 20 20 20 20 69 6e 74 20 73 74 61 72 74 3b 0a int start;.
20a0: 20 20 20 20 20 20 69 6e 74 20 65 6e 64 3b 0a 0a int end;..
20b0: 20 20 20 20 20 20 69 66 28 20 62 6c 6f 62 5f 65 if( blob_e
20c0: 71 28 26 74 79 70 65 2c 22 6e 65 77 22 29 20 29 q(&type,"new") )
20d0: 7b 0a 20 20 20 20 20 20 20 20 69 64 78 20 3d 20 {. idx =
20e0: 30 3b 0a 20 20 20 20 20 20 7d 65 6c 73 65 20 69 0;. }else i
20f0: 66 28 20 62 6c 6f 62 5f 65 71 28 26 74 79 70 65 f( blob_eq(&type
2100: 2c 20 22 76 69 65 77 22 29 20 29 7b 0a 20 20 20 , "view") ){.
2110: 20 20 20 20 20 69 64 78 20 3d 20 31 3b 0a 20 20 idx = 1;.
2120: 20 20 20 20 7d 65 6c 73 65 20 69 66 28 20 62 6c }else if( bl
2130: 6f 62 5f 65 71 28 26 74 79 70 65 2c 20 22 65 64 ob_eq(&type, "ed
2140: 69 74 22 29 20 29 7b 0a 20 20 20 20 20 20 20 20 it") ){.
2150: 69 64 78 20 3d 20 32 3b 0a 20 20 20 20 20 20 7d idx = 2;. }
2160: 65 6c 73 65 7b 0a 20 20 20 20 20 20 20 20 62 6c else{. bl
2170: 6f 62 5f 61 70 70 65 6e 64 66 28 26 65 72 72 2c ob_appendf(&err,
2180: 20 22 75 6e 6b 6e 6f 77 6e 20 74 65 6d 70 6c 61 "unknown templa
2190: 74 65 20 74 79 70 65 3a 20 25 62 22 2c 20 26 74 te type: %b", &t
21a0: 79 70 65 29 3b 0a 20 20 20 20 20 20 20 20 67 6f ype);. go
21b0: 74 6f 20 62 61 64 5f 63 6f 6e 66 69 67 5f 66 69 to bad_config_fi
21c0: 6c 65 3b 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 le;. }.
21d0: 20 20 69 66 28 20 28 73 65 65 6e 5f 74 65 6d 70 if( (seen_temp
21e0: 6c 61 74 65 20 26 20 28 31 3c 3c 69 64 78 29 29 late & (1<<idx))
21f0: 21 3d 30 20 29 7b 0a 20 20 20 20 20 20 20 20 62 !=0 ){. b
2200: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26 65 72 72 lob_appendf(&err
2210: 2c 20 22 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 , "more than one
2220: 20 25 62 20 74 65 6d 70 6c 61 74 65 22 2c 20 26 %b template", &
2230: 74 79 70 65 29 3b 0a 20 20 20 20 20 20 20 20 67 type);. g
2240: 6f 74 6f 20 62 61 64 5f 63 6f 6e 66 69 67 5f 66 oto bad_config_f
2250: 69 6c 65 3b 0a 20 20 20 20 20 20 7d 0a 20 20 20 ile;. }.
2260: 20 20 20 73 65 65 6e 5f 74 65 6d 70 6c 61 74 65 seen_template
2270: 20 7c 3d 20 31 3c 3c 69 64 78 3b 0a 20 20 20 20 |= 1<<idx;.
2280: 20 20 73 74 61 72 74 20 3d 20 65 6e 64 20 3d 20 start = end =
2290: 62 6c 6f 62 5f 74 65 6c 6c 28 70 43 6f 6e 66 69 blob_tell(pConfi
22a0: 67 29 3b 0a 20 20 20 20 20 20 77 68 69 6c 65 28 g);. while(
22b0: 20 62 6c 6f 62 5f 6c 69 6e 65 28 70 43 6f 6e 66 blob_line(pConf
22c0: 69 67 2c 20 26 6c 69 6e 65 29 20 29 7b 0a 20 20 ig, &line) ){.
22d0: 20 20 20 20 20 20 20 62 6c 6f 62 5f 74 6f 6b 65 blob_toke
22e0: 6e 28 26 6c 69 6e 65 2c 20 26 74 6f 6b 65 6e 29 n(&line, &token)
22f0: 3b 0a 20 20 20 20 20 20 20 20 20 69 66 28 20 62 ;. if( b
2300: 6c 6f 62 5f 63 6f 6d 70 61 72 65 28 26 74 6f 6b lob_compare(&tok
2310: 65 6e 2c 20 26 61 72 67 29 3d 3d 30 20 29 20 62 en, &arg)==0 ) b
2320: 72 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 65 reak;. e
2330: 6e 64 20 3d 20 62 6c 6f 62 5f 74 65 6c 6c 28 70 nd = blob_tell(p
2340: 43 6f 6e 66 69 67 29 3b 0a 20 20 20 20 20 20 7d Config);. }
2350: 0a 20 20 20 20 20 20 62 6c 6f 62 5f 69 6e 69 74 . blob_init
2360: 28 26 63 6f 6e 74 65 6e 74 2c 20 26 62 6c 6f 62 (&content, &blob
2370: 5f 62 75 66 66 65 72 28 70 43 6f 6e 66 69 67 29 _buffer(pConfig)
2380: 5b 73 74 61 72 74 5d 2c 20 65 6e 64 20 2d 20 73 [start], end - s
2390: 74 61 72 74 29 3b 0a 20 20 20 20 20 20 62 6c 6f tart);. blo
23a0: 62 5f 61 70 70 65 6e 64 66 28 26 73 71 6c 2c 20 b_appendf(&sql,
23b0: 0a 20 20 20 20 20 20 20 20 22 52 45 50 4c 41 43 . "REPLAC
23c0: 45 20 49 4e 54 4f 20 63 6f 6e 66 69 67 28 6e 61 E INTO config(na
23d0: 6d 65 2c 20 76 61 6c 75 65 29 20 56 41 4c 55 45 me, value) VALUE
23e0: 53 28 27 74 6b 74 2d 25 62 2d 74 65 6d 70 6c 61 S('tkt-%b-templa
23f0: 74 65 27 2c 25 42 29 3b 5c 6e 22 2c 0a 20 20 20 te',%B);\n",.
2400: 20 20 20 20 20 26 74 79 70 65 2c 20 26 63 6f 6e &type, &con
2410: 74 65 6e 74 0a 20 20 20 20 20 20 29 3b 0a 20 20 tent. );.
2420: 20 20 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 26 blob_reset(&
2430: 63 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 20 7d 65 content);. }e
2440: 6c 73 65 0a 0a 20 20 20 20 2f 2a 0a 20 20 20 20 lse.. /*.
2450: 2a 2a 20 20 64 65 73 63 72 69 70 74 69 6f 6e 20 ** description
2460: 3c 64 65 6c 69 6d 69 74 65 72 3e 0a 20 20 20 20 <delimiter>.
2470: 2a 2a 20 20 3c 74 65 78 74 3e 0a 20 20 20 20 2a ** <text>. *
2480: 2f 20 20 20 20 20 20 0a 20 20 20 20 69 66 28 20 / . if(
2490: 62 6c 6f 62 5f 65 71 28 26 74 6f 6b 65 6e 2c 20 blob_eq(&token,
24a0: 22 64 65 73 63 72 69 70 74 69 6f 6e 22 29 0a 20 "description").
24b0: 20 20 20 20 26 26 20 62 6c 6f 62 5f 74 6f 6b 65 && blob_toke
24c0: 6e 28 26 6c 69 6e 65 2c 20 26 61 72 67 29 0a 20 n(&line, &arg).
24d0: 20 20 20 29 7b 0a 20 20 20 20 20 20 42 6c 6f 62 ){. Blob
24e0: 20 63 6f 6e 74 65 6e 74 3b 0a 20 20 20 20 20 20 content;.
24f0: 69 6e 74 20 73 74 61 72 74 3b 0a 20 20 20 20 20 int start;.
2500: 20 69 6e 74 20 65 6e 64 3b 0a 0a 20 20 20 20 20 int end;..
2510: 20 73 74 61 72 74 20 3d 20 65 6e 64 20 3d 20 62 start = end = b
2520: 6c 6f 62 5f 74 65 6c 6c 28 70 43 6f 6e 66 69 67 lob_tell(pConfig
2530: 29 3b 0a 20 20 20 20 20 20 77 68 69 6c 65 28 20 );. while(
2540: 62 6c 6f 62 5f 6c 69 6e 65 28 70 43 6f 6e 66 69 blob_line(pConfi
2550: 67 2c 20 26 6c 69 6e 65 29 20 29 7b 0a 20 20 20 g, &line) ){.
2560: 20 20 20 20 20 20 62 6c 6f 62 5f 74 6f 6b 65 6e blob_token
2570: 28 26 6c 69 6e 65 2c 20 26 74 6f 6b 65 6e 29 3b (&line, &token);
2580: 0a 20 20 20 20 20 20 20 20 20 69 66 28 20 62 6c . if( bl
2590: 6f 62 5f 63 6f 6d 70 61 72 65 28 26 74 6f 6b 65 ob_compare(&toke
25a0: 6e 2c 20 26 61 72 67 29 3d 3d 30 20 29 20 62 72 n, &arg)==0 ) br
25b0: 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 65 6e eak;. en
25c0: 64 20 3d 20 62 6c 6f 62 5f 74 65 6c 6c 28 70 43 d = blob_tell(pC
25d0: 6f 6e 66 69 67 29 3b 0a 20 20 20 20 20 20 7d 0a onfig);. }.
25e0: 20 20 20 20 20 20 62 6c 6f 62 5f 69 6e 69 74 28 blob_init(
25f0: 26 63 6f 6e 74 65 6e 74 2c 20 26 62 6c 6f 62 5f &content, &blob_
2600: 62 75 66 66 65 72 28 70 43 6f 6e 66 69 67 29 5b buffer(pConfig)[
2610: 73 74 61 72 74 5d 2c 20 65 6e 64 20 2d 20 73 74 start], end - st
2620: 61 72 74 29 3b 0a 20 20 20 20 20 20 62 6c 6f 62 art);. blob
2630: 5f 61 70 70 65 6e 64 66 28 26 73 71 6c 2c 20 0a _appendf(&sql, .
2640: 20 20 20 20 20 20 20 20 22 52 45 50 4c 41 43 45 "REPLACE
2650: 20 49 4e 54 4f 20 63 6f 6e 66 69 67 28 6e 61 6d INTO config(nam
2660: 65 2c 20 76 61 6c 75 65 29 20 56 41 4c 55 45 53 e, value) VALUES
2670: 28 27 74 6b 74 2d 64 65 73 63 27 2c 25 42 29 3b ('tkt-desc',%B);
2680: 5c 6e 22 2c 0a 20 20 20 20 20 20 20 20 20 26 63 \n",. &c
2690: 6f 6e 74 65 6e 74 0a 20 20 20 20 20 20 29 3b 0a ontent. );.
26a0: 20 20 20 20 20 20 62 6c 6f 62 5f 72 65 73 65 74 blob_reset
26b0: 28 26 63 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 20 (&content);.
26c0: 7d 65 6c 73 65 0a 0a 20 20 20 20 7b 0a 20 20 20 }else.. {.
26d0: 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 blob_appendf(
26e0: 26 65 72 72 2c 20 22 75 6e 6b 6e 6f 77 6e 20 63 &err, "unknown c
26f0: 6f 6d 6d 61 6e 64 3a 20 25 62 22 2c 20 26 74 6f ommand: %b", &to
2700: 6b 65 6e 29 3b 0a 20 20 20 20 20 20 67 6f 74 6f ken);. goto
2710: 20 62 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 bad_config_file
2720: 3b 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 ;. }. }. if
2730: 28 20 73 65 65 6e 5f 74 65 6d 70 6c 61 74 65 20 ( seen_template
2740: 21 3d 20 30 78 37 20 29 7b 0a 20 20 20 20 62 6c != 0x7 ){. bl
2750: 6f 62 5f 61 70 70 65 6e 64 66 28 26 65 72 72 2c ob_appendf(&err,
2760: 20 22 6d 69 73 73 69 6e 67 20 74 65 6d 70 6c 61 "missing templa
2770: 74 65 73 22 29 3b 0a 20 20 20 20 67 6f 74 6f 20 tes");. goto
2780: 62 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3b bad_config_file;
2790: 0a 20 20 7d 0a 0a 20 20 2f 2a 20 49 66 20 77 65 . }.. /* If we
27a0: 20 72 65 61 63 68 20 74 68 69 73 20 70 6f 69 6e reach this poin
27b0: 74 20 69 74 20 6d 65 61 6e 73 20 74 68 65 20 70 t it means the p
27c0: 61 72 73 65 20 77 61 73 20 73 75 63 63 65 73 73 arse was success
27d0: 66 75 6c 0a 20 20 2a 2f 0a 20 20 72 63 20 3d 20 ful. */. rc =
27e0: 30 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 0;. blob_append
27f0: 66 28 26 74 62 6c 64 65 66 2c 20 22 5c 6e 29 3b f(&tbldef, "\n);
2800: 5c 6e 22 29 3b 0a 20 20 69 66 28 20 74 65 73 74 \n");. if( test
2810: 46 6c 61 67 20 29 7b 0a 20 20 20 20 62 6c 6f 62 Flag ){. blob
2820: 5f 77 72 69 74 65 5f 74 6f 5f 66 69 6c 65 28 26 _write_to_file(&
2830: 74 62 6c 64 65 66 2c 20 22 2d 22 29 3b 0a 20 20 tbldef, "-");.
2840: 20 20 62 6c 6f 62 5f 77 72 69 74 65 5f 74 6f 5f blob_write_to_
2850: 66 69 6c 65 28 26 73 71 6c 2c 20 22 2d 22 29 3b file(&sql, "-");
2860: 0a 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 64 62 . }else{. db
2870: 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 25 62 22 _multi_exec("%b"
2880: 2c 20 26 74 62 6c 64 65 66 29 3b 0a 20 20 20 20 , &tbldef);.
2890: 64 62 5f 6d 75 6c 74 69 5f 65 78 65 63 28 22 25 db_multi_exec("%
28a0: 62 22 2c 20 26 73 71 6c 29 3b 0a 20 20 7d 0a 0a b", &sql);. }..
28b0: 62 61 64 5f 63 6f 6e 66 69 67 5f 66 69 6c 65 3a bad_config_file:
28c0: 0a 20 20 69 66 28 20 72 63 20 26 26 20 70 45 72 . if( rc && pEr
28d0: 72 20 29 7b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 r ){. blob_ap
28e0: 70 65 6e 64 66 28 70 45 72 72 2c 20 22 6c 69 6e pendf(pErr, "lin
28f0: 65 20 25 64 3a 20 25 62 22 2c 20 6c 69 6e 65 6e e %d: %b", linen
2900: 6f 2c 20 26 65 72 72 29 3b 0a 20 20 7d 0a 20 20 o, &err);. }.
2910: 62 6c 6f 62 5f 72 65 73 65 74 28 26 74 6f 6b 65 blob_reset(&toke
2920: 6e 29 3b 0a 20 20 62 6c 6f 62 5f 72 65 73 65 74 n);. blob_reset
2930: 28 26 6c 69 6e 65 29 3b 0a 20 20 62 6c 6f 62 5f (&line);. blob_
2940: 72 65 73 65 74 28 26 6e 61 6d 65 29 3b 0a 20 20 reset(&name);.
2950: 62 6c 6f 62 5f 72 65 73 65 74 28 26 74 79 70 65 blob_reset(&type
2960: 29 3b 0a 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 );. blob_reset(
2970: 26 61 72 67 29 3b 0a 20 20 62 6c 6f 62 5f 72 65 &arg);. blob_re
2980: 73 65 74 28 26 73 71 6c 29 3b 0a 20 20 62 6c 6f set(&sql);. blo
2990: 62 5f 72 65 73 65 74 28 26 74 62 6c 64 65 66 29 b_reset(&tbldef)
29a0: 3b 0a 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 26 ;. blob_reset(&
29b0: 65 72 72 29 3b 0a 20 20 72 65 74 75 72 6e 20 72 err);. return r
29c0: 63 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 43 4f 4d 4d c;.}../*.** COMM
29d0: 41 4e 44 3a 20 74 65 73 74 2d 74 6b 74 63 6f 6e AND: test-tktcon
29e0: 66 69 67 2d 70 61 72 73 65 0a 2a 2f 0a 76 6f 69 fig-parse.*/.voi
29f0: 64 20 74 65 73 74 5f 74 6b 74 63 6f 6e 66 69 67 d test_tktconfig
2a00: 5f 70 61 72 73 65 5f 63 6d 64 28 76 6f 69 64 29 _parse_cmd(void)
2a10: 7b 0a 20 20 42 6c 6f 62 20 63 6f 6e 66 69 67 2c {. Blob config,
2a20: 20 65 72 72 3b 0a 20 20 69 66 28 20 67 2e 61 72 err;. if( g.ar
2a30: 67 63 21 3d 33 20 29 7b 0a 20 20 20 20 75 73 61 gc!=3 ){. usa
2a40: 67 65 28 22 46 49 4c 45 4e 41 4d 45 22 29 3b 0a ge("FILENAME");.
2a50: 20 20 7d 0a 20 20 62 6c 6f 62 5f 72 65 61 64 5f }. blob_read_
2a60: 66 72 6f 6d 5f 66 69 6c 65 28 26 63 6f 6e 66 69 from_file(&confi
2a70: 67 2c 20 67 2e 61 72 67 76 5b 32 5d 29 3b 0a 20 g, g.argv[2]);.
2a80: 20 62 6c 6f 62 5f 7a 65 72 6f 28 26 65 72 72 29 blob_zero(&err)
2a90: 3b 0a 20 20 74 69 63 6b 65 74 5f 63 6f 6e 66 69 ;. ticket_confi
2aa0: 67 5f 70 61 72 73 65 28 26 63 6f 6e 66 69 67 2c g_parse(&config,
2ab0: 20 31 2c 20 26 65 72 72 29 3b 0a 20 20 69 66 28 1, &err);. if(
2ac0: 20 62 6c 6f 62 5f 73 69 7a 65 28 26 65 72 72 29 blob_size(&err)
2ad0: 20 29 7b 0a 20 20 20 20 62 6c 6f 62 5f 77 72 69 ){. blob_wri
2ae0: 74 65 5f 74 6f 5f 66 69 6c 65 28 26 65 72 72 2c te_to_file(&err,
2af0: 20 22 2d 22 29 3b 0a 20 20 7d 0a 7d 0a 2f 2a 0a "-");. }.}./*.
2b00: 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 74 65 73 74 ** COMMAND: test
2b10: 2d 74 6b 74 63 6f 6e 66 69 67 2d 69 6d 70 6f 72 -tktconfig-impor
2b20: 74 0a 2a 2f 0a 76 6f 69 64 20 74 65 73 74 5f 74 t.*/.void test_t
2b30: 6b 74 63 6f 6e 66 69 67 5f 69 6d 70 6f 72 74 5f ktconfig_import_
2b40: 63 6d 64 28 76 6f 69 64 29 7b 0a 20 20 42 6c 6f cmd(void){. Blo
2b50: 62 20 63 6f 6e 66 69 67 2c 20 65 72 72 3b 0a 20 b config, err;.
2b60: 20 64 62 5f 6d 75 73 74 5f 62 65 5f 77 69 74 68 db_must_be_with
2b70: 69 6e 5f 74 72 65 65 28 29 3b 0a 20 20 69 66 28 in_tree();. if(
2b80: 20 67 2e 61 72 67 63 21 3d 33 20 29 7b 0a 20 20 g.argc!=3 ){.
2b90: 20 20 75 73 61 67 65 28 22 46 49 4c 45 4e 41 4d usage("FILENAM
2ba0: 45 22 29 3b 0a 20 20 7d 0a 20 20 62 6c 6f 62 5f E");. }. blob_
2bb0: 72 65 61 64 5f 66 72 6f 6d 5f 66 69 6c 65 28 26 read_from_file(&
2bc0: 63 6f 6e 66 69 67 2c 20 67 2e 61 72 67 76 5b 32 config, g.argv[2
2bd0: 5d 29 3b 0a 20 20 62 6c 6f 62 5f 7a 65 72 6f 28 ]);. blob_zero(
2be0: 26 65 72 72 29 3b 0a 20 20 64 62 5f 62 65 67 69 &err);. db_begi
2bf0: 6e 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 29 3b n_transaction();
2c00: 0a 20 20 74 69 63 6b 65 74 5f 63 6f 6e 66 69 67 . ticket_config
2c10: 5f 70 61 72 73 65 28 26 63 6f 6e 66 69 67 2c 20 _parse(&config,
2c20: 30 2c 20 26 65 72 72 29 3b 0a 20 20 64 62 5f 65 0, &err);. db_e
2c30: 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e 28 30 nd_transaction(0
2c40: 29 3b 0a 20 20 69 66 28 20 62 6c 6f 62 5f 73 69 );. if( blob_si
2c50: 7a 65 28 26 65 72 72 29 20 29 7b 0a 20 20 20 20 ze(&err) ){.
2c60: 62 6c 6f 62 5f 77 72 69 74 65 5f 74 6f 5f 66 69 blob_write_to_fi
2c70: 6c 65 28 26 65 72 72 2c 20 22 2d 22 29 3b 0a 20 le(&err, "-");.
2c80: 20 7d 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 4c 6f 61 64 }.}../*.** Load
2c90: 20 74 68 65 20 64 65 66 61 75 6c 74 20 74 69 63 the default tic
2ca0: 6b 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ket configuratio
2cb0: 6e 2e 0a 2a 2f 0a 76 6f 69 64 20 74 69 63 6b 65 n..*/.void ticke
2cc0: 74 5f 6c 6f 61 64 5f 64 65 66 61 75 6c 74 5f 63 t_load_default_c
2cd0: 6f 6e 66 69 67 28 76 6f 69 64 29 7b 0a 20 20 73 onfig(void){. s
2ce0: 74 61 74 69 63 20 63 6f 6e 73 74 20 63 68 61 72 tatic const char
2cf0: 20 7a 44 65 66 61 75 6c 74 43 6f 6e 66 69 67 5b zDefaultConfig[
2d00: 5d 20 3d 20 0a 20 20 20 20 40 20 74 69 63 6b 65 ] = . @ ticke
2d10: 74 2d 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a t-configuration.
2d20: 20 20 20 20 40 20 64 65 73 63 72 69 70 74 69 6f @ descriptio
2d30: 6e 20 45 4e 44 2d 4f 46 2d 44 45 53 43 52 49 50 n END-OF-DESCRIP
2d40: 54 49 4f 4e 0a 20 20 20 20 40 20 44 65 66 61 75 TION. @ Defau
2d50: 6c 74 20 54 69 63 6b 65 74 20 43 6f 6e 66 69 67 lt Ticket Config
2d60: 75 72 61 74 69 6f 6e 0a 20 20 20 20 40 20 54 68 uration. @ Th
2d70: 65 20 64 65 66 61 75 6c 74 20 74 69 63 6b 65 74 e default ticket
2d80: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 configuration f
2d90: 6f 72 20 6e 65 77 20 70 72 6f 6a 65 63 74 73 0a or new projects.
2da0: 20 20 20 20 40 20 45 4e 44 2d 4f 46 2d 44 45 53 @ END-OF-DES
2db0: 43 52 49 50 54 49 4f 4e 0a 20 20 20 20 40 20 23 CRIPTION. @ #
2dc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2dd0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2de0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2df0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2e00: 23 23 23 23 0a 20 20 20 20 40 20 66 69 65 6c 64 ####. @ field
2e10: 20 74 69 74 6c 65 20 74 65 78 74 20 36 30 20 31 title text 60 1
2e20: 0a 20 20 20 20 40 20 66 69 65 6c 64 20 63 6f 6d . @ field com
2e30: 6d 65 6e 74 20 63 74 65 78 74 20 38 30 20 32 30 ment ctext 80 20
2e40: 0a 20 20 20 20 40 20 66 69 65 6c 64 20 61 73 73 . @ field ass
2e50: 69 67 6e 65 64 74 6f 20 74 65 78 74 20 32 30 20 ignedto text 20
2e60: 31 0a 20 20 20 20 40 20 66 69 65 6c 64 20 73 75 1. @ field su
2e70: 62 73 79 73 74 65 6d 20 74 65 78 74 20 32 30 20 bsystem text 20
2e80: 31 0a 20 20 20 20 40 20 66 69 65 6c 64 20 74 79 1. @ field ty
2e90: 70 65 20 65 6e 75 6d 20 31 32 20 43 6f 64 65 20 pe enum 12 Code
2ea0: 42 75 69 6c 64 5f 50 72 6f 62 6c 65 6d 20 44 6f Build_Problem Do
2eb0: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 46 65 61 74 cumentation Feat
2ec0: 75 72 65 5f 52 65 71 75 65 73 74 20 49 6e 63 69 ure_Request Inci
2ed0: 64 65 6e 74 0a 20 20 20 20 40 20 66 69 65 6c 64 dent. @ field
2ee0: 20 70 72 69 6f 72 69 74 79 20 65 6e 75 6d 20 31 priority enum 1
2ef0: 30 20 48 69 67 68 20 4d 65 64 69 75 6d 20 4c 6f 0 High Medium Lo
2f00: 77 0a 20 20 20 20 40 20 66 69 65 6c 64 20 73 65 w. @ field se
2f10: 76 65 72 69 74 79 20 65 6e 75 6d 20 31 30 20 43 verity enum 10 C
2f20: 72 69 74 69 63 61 6c 20 53 65 76 65 72 65 20 49 ritical Severe I
2f30: 6d 70 6f 72 74 61 6e 74 20 4d 69 6e 6f 72 20 43 mportant Minor C
2f40: 6f 73 6d 65 74 69 63 0a 20 20 20 20 40 20 66 69 osmetic. @ fi
2f50: 65 6c 64 20 73 65 73 6f 6c 75 74 69 6f 6e 20 65 eld sesolution e
2f60: 6e 75 6d 20 32 30 20 4f 70 65 6e 20 46 69 78 65 num 20 Open Fixe
2f70: 64 20 52 65 6a 65 63 74 65 64 20 55 6e 61 62 6c d Rejected Unabl
2f80: 65 5f 54 6f 5f 52 65 70 72 6f 64 75 63 65 20 57 e_To_Reproduce W
2f90: 6f 72 6b 73 5f 41 73 5f 44 65 73 69 67 6e 65 64 orks_As_Designed
2fa0: 20 45 78 74 65 72 6e 61 6c 5f 42 75 67 20 4e 6f External_Bug No
2fb0: 74 5f 41 5f 42 75 67 20 44 75 70 6c 69 63 61 74 t_A_Bug Duplicat
2fc0: 65 20 4f 76 65 72 63 6f 6d 65 5f 42 79 5f 45 76 e Overcome_By_Ev
2fd0: 65 6e 74 73 20 44 72 69 76 65 5f 42 79 5f 50 61 ents Drive_By_Pa
2fe0: 74 63 68 0a 20 20 20 20 40 20 66 69 65 6c 64 20 tch. @ field
2ff0: 73 74 61 74 75 73 20 65 6e 75 6d 20 31 30 20 4f status enum 10 O
3000: 70 65 6e 20 56 65 72 69 66 69 65 64 20 49 6e 5f pen Verified In_
3010: 50 72 6f 63 65 73 73 20 44 65 66 65 72 72 65 64 Process Deferred
3020: 20 46 69 78 65 64 20 54 65 73 74 65 64 20 43 6c Fixed Tested Cl
3030: 6f 73 65 64 0a 20 20 20 20 40 20 66 69 65 6c 64 osed. @ field
3040: 20 63 6f 6e 74 61 63 74 20 70 72 69 76 61 74 65 contact private
3050: 20 35 30 20 31 0a 20 20 20 20 40 20 66 69 65 6c 50 1. @ fiel
3060: 64 20 66 6f 75 6e 64 69 6e 20 74 65 78 74 20 33 d foundin text 3
3070: 30 20 31 0a 20 20 20 20 40 20 66 69 65 6c 64 20 0 1. @ field
3080: 61 73 73 6f 63 76 65 72 73 20 62 61 73 65 6c 69 assocvers baseli
3090: 6e 65 20 35 30 0a 20 20 20 20 40 20 66 69 65 6c ne 50. @ fiel
30a0: 64 20 70 72 65 73 65 6e 74 69 6e 20 75 75 69 64 d presentin uuid
30b0: 20 35 30 0a 20 20 20 20 40 20 66 69 65 6c 64 20 50. @ field
30c0: 66 69 78 65 64 69 6e 20 75 75 69 64 20 35 30 0a fixedin uuid 50.
30d0: 20 20 20 20 40 20 66 69 65 6c 64 20 64 75 65 62 @ field dueb
30e0: 79 20 64 61 74 65 20 32 30 0a 20 20 20 20 40 20 y date 20. @
30f0: 66 69 65 6c 64 20 64 65 66 65 72 75 6e 74 69 6c field deferuntil
3100: 20 64 61 74 65 20 32 30 0a 20 20 20 20 40 20 23 date 20. @ #
3110: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3120: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3130: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3140: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3150: 23 23 23 23 23 0a 20 20 20 20 40 20 74 65 6d 70 #####. @ temp
3160: 6c 61 74 65 20 6e 65 77 20 45 4e 44 2d 4f 46 2d late new END-OF-
3170: 4e 45 57 2d 54 45 4d 50 4c 41 54 45 0a 20 20 20 NEW-TEMPLATE.
3180: 20 40 20 3c 74 61 62 6c 65 20 63 65 6c 6c 70 61 @ <table cellpa
3190: 64 64 69 6e 67 3d 22 35 22 3e 0a 20 20 20 20 40 dding="5">. @
31a0: 20 3c 74 72 3e 0a 20 20 20 20 40 20 3c 74 64 20 <tr>. @ <td
31b0: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 32 22 3e cellpadding="2">
31c0: 0a 20 20 20 20 40 20 45 6e 74 65 72 20 61 20 6f . @ Enter a o
31d0: 6e 65 2d 6c 69 6e 65 20 73 75 6d 6d 61 72 79 20 ne-line summary
31e0: 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 6d 3a 3c of the problem:<
31f0: 62 72 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 br>. @ [entry
3200: 77 69 64 67 65 74 20 74 69 74 6c 65 5d 0a 20 20 widget title].
3210: 20 20 40 20 3c 2f 74 64 3e 0a 20 20 20 20 40 20 @ </td>. @
3220: 3c 2f 74 72 3e 0a 20 20 20 20 40 20 0a 20 20 20 </tr>. @ .
3230: 20 40 20 3c 74 72 3e 0a 20 20 20 20 40 20 3c 74 @ <tr>. @ <t
3240: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
3250: 54 79 70 65 3a 0a 20 20 20 20 40 20 5b 65 6e 74 Type:. @ [ent
3260: 72 79 77 69 64 67 65 74 20 74 79 70 65 5d 0a 20 rywidget type].
3270: 20 20 20 40 20 3c 2f 74 64 3e 0a 20 20 20 20 40 @ </td>. @
3280: 20 3c 74 64 3e 57 68 61 74 20 74 79 70 65 20 6f <td>What type o
3290: 66 20 74 69 63 6b 65 74 20 69 73 20 74 68 69 73 f ticket is this
32a0: 3f 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c 2f 74 ?</td>. @ </t
32b0: 72 3e 0a 20 20 20 20 40 20 0a 20 20 20 20 40 20 r>. @ . @
32c0: 3c 74 72 3e 0a 20 20 20 20 40 20 3c 74 64 20 61 <tr>. @ <td a
32d0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 56 65 72 lign="right">Ver
32e0: 73 69 6f 6e 3a 20 0a 20 20 20 20 40 20 5b 65 6e sion: . @ [en
32f0: 74 72 79 77 69 64 67 65 74 20 66 6f 75 6e 64 69 trywidget foundi
3300: 6e 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 0a 20 n]. @ </td>.
3310: 20 20 20 40 20 3c 74 64 3e 49 6e 20 77 68 61 74 @ <td>In what
3320: 20 76 65 72 73 69 6f 6e 20 6f 72 20 62 75 69 6c version or buil
3330: 64 20 6e 75 6d 62 65 72 20 64 6f 20 79 6f 75 20 d number do you
3340: 6f 62 73 65 72 76 65 72 20 74 68 65 20 70 72 6f observer the pro
3350: 62 6c 65 6d 3f 3c 2f 74 64 3e 0a 20 20 20 20 40 blem?</td>. @
3360: 20 3c 2f 74 72 3e 0a 20 20 20 20 40 20 0a 20 20 </tr>. @ .
3370: 20 20 40 20 3c 74 72 3e 0a 20 20 20 20 40 20 3c @ <tr>. @ <
3380: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
3390: 3e 53 65 76 65 72 69 74 79 3a 0a 20 20 20 20 40 >Severity:. @
33a0: 20 5b 65 6e 74 72 79 77 69 64 67 65 74 20 73 65 [entrywidget se
33b0: 76 65 72 69 74 79 5d 0a 20 20 20 20 40 20 3c 2f verity]. @ </
33c0: 74 64 3e 0a 20 20 20 20 40 20 3c 74 64 3e 48 6f td>. @ <td>Ho
33d0: 77 20 64 65 62 69 6c 69 74 61 74 69 6e 67 20 69 w debilitating i
33e0: 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 3f 20 20 s the problem?
33f0: 48 6f 77 20 62 61 64 6c 79 20 64 6f 65 73 20 74 How badly does t
3400: 68 65 20 70 72 6f 62 6c 65 6d 0a 20 20 20 20 40 he problem. @
3410: 20 65 66 66 65 63 74 20 74 68 65 20 6f 70 65 72 effect the oper
3420: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 72 6f ation of the pro
3430: 64 75 63 74 3f 3c 2f 74 64 3e 0a 20 20 20 20 40 duct?</td>. @
3440: 20 3c 2f 74 72 3e 0a 20 20 20 20 40 20 0a 20 20 </tr>. @ .
3450: 20 20 40 20 3c 74 72 3e 0a 20 20 20 20 40 20 3c @ <tr>. @ <
3460: 74 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22 3e 0a td colspan="2">.
3470: 20 20 20 20 40 20 45 6e 74 65 72 20 61 20 64 65 @ Enter a de
3480: 74 61 69 6c 65 64 20 64 65 73 63 72 69 70 74 69 tailed descripti
3490: 6f 6e 20 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 on of the proble
34a0: 6d 2e 0a 20 20 20 20 40 20 46 6f 72 20 63 6f 64 m.. @ For cod
34b0: 65 20 64 65 66 65 63 74 73 2c 20 62 65 20 73 75 e defects, be su
34c0: 72 65 20 74 6f 20 70 72 6f 76 69 64 65 20 64 65 re to provide de
34d0: 74 61 69 6c 73 20 6f 6e 20 65 78 61 63 74 6c 79 tails on exactly
34e0: 20 68 6f 77 0a 20 20 20 20 40 20 74 68 65 20 70 how. @ the p
34f0: 72 6f 62 6c 65 6d 20 63 61 6e 20 62 65 20 72 65 roblem can be re
3500: 70 72 6f 64 75 63 65 64 2e 20 20 50 72 6f 76 69 produced. Provi
3510: 64 65 20 61 73 20 6d 75 63 68 20 64 65 74 61 69 de as much detai
3520: 6c 20 61 73 0a 20 20 20 20 40 20 70 6f 73 73 69 l as. @ possi
3530: 62 6c 65 2e 0a 20 20 20 20 40 20 3c 62 72 3e 0a ble.. @ <br>.
3540: 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 67 @ [entrywidg
3550: 65 74 20 63 6f 6d 6d 65 6e 74 20 6e 6f 61 70 70 et comment noapp
3560: 65 6e 64 5d 0a 20 20 20 20 40 20 5b 69 66 70 72 end]. @ [ifpr
3570: 65 76 69 65 77 20 63 6f 6d 6d 65 6e 74 5d 0a 20 eview comment].
3580: 20 20 20 40 20 3c 68 72 3e 0a 20 20 20 20 40 20 @ <hr>. @
3590: 5b 76 69 65 77 77 69 64 67 65 74 20 63 6f 6d 6d [viewwidget comm
35a0: 65 6e 74 5d 0a 20 20 20 20 40 20 3c 2f 68 72 3e ent]. @ </hr>
35b0: 0a 20 20 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 . @ </tr>.
35c0: 20 40 20 0a 20 20 20 20 40 20 3c 74 72 3e 0a 20 @ . @ <tr>.
35d0: 20 20 20 40 20 3c 74 64 20 61 6c 69 67 6e 3d 22 @ <td align="
35e0: 72 69 67 68 74 22 3e 0a 20 20 20 20 40 20 5b 73 right">. @ [s
35f0: 75 62 6d 69 74 62 75 74 74 6f 6e 5d 0a 20 20 20 ubmitbutton].
3600: 20 40 20 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c @ </td>. @ <
3610: 74 64 3e 41 66 74 65 72 20 66 69 6c 6c 69 6e 67 td>After filling
3620: 20 69 6e 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 in the informat
3630: 69 6f 6e 20 61 62 6f 76 65 2c 20 70 72 65 73 73 ion above, press
3640: 20 74 68 69 73 20 62 75 74 74 6f 6e 20 74 6f 20 this button to
3650: 63 72 65 61 74 65 0a 20 20 20 20 40 20 74 68 65 create. @ the
3660: 20 6e 65 77 20 74 69 63 6b 65 74 3c 2f 74 64 3e new ticket</td>
3670: 0a 20 20 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 . @ </tr>.
3680: 20 40 20 3c 2f 74 61 62 6c 65 3e 0a 20 20 20 20 @ </table>.
3690: 40 20 5b 64 65 66 61 75 6c 74 76 61 6c 75 65 20 @ [defaultvalue
36a0: 73 74 61 74 75 73 20 4f 70 65 6e 5d 0a 20 20 20 status Open].
36b0: 20 40 20 5b 64 65 66 61 75 6c 74 76 61 6c 75 65 @ [defaultvalue
36c0: 20 72 65 73 6f 6c 75 74 69 6f 6e 20 4f 70 65 6e resolution Open
36d0: 5d 0a 20 20 20 20 40 20 45 4e 44 2d 4f 46 2d 4e ]. @ END-OF-N
36e0: 45 57 2d 54 45 4d 50 4c 41 54 45 0a 20 20 20 20 EW-TEMPLATE.
36f0: 40 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 @ ##############
3700: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3710: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3720: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3730: 23 23 23 23 23 23 23 23 0a 20 20 20 20 40 20 74 ########. @ t
3740: 65 6d 70 6c 61 74 65 20 65 64 69 74 20 45 4e 44 emplate edit END
3750: 2d 4f 46 2d 45 44 49 54 2d 54 45 4d 50 4c 41 54 -OF-EDIT-TEMPLAT
3760: 45 0a 20 20 20 20 40 20 3c 74 61 62 6c 65 20 63 E. @ <table c
3770: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 35 22 3e 0a ellpadding="5">.
3780: 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c @ <tr><td al
3790: 69 67 6e 3d 22 72 69 67 68 74 22 3e 54 69 74 6c ign="right">Titl
37a0: 65 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 e:</td><td>.
37b0: 40 20 5b 65 6e 74 72 79 77 69 64 67 65 74 20 74 @ [entrywidget t
37c0: 69 74 6c 65 5d 0a 20 20 20 20 40 20 3c 2f 74 64 itle]. @ </td
37d0: 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 ></tr>. @ <tr
37e0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
37f0: 74 22 3e 53 74 61 74 75 73 3a 3c 2f 74 64 3e 3c t">Status:</td><
3800: 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 td>. @ [entry
3810: 77 69 64 67 65 74 20 73 74 61 74 75 73 5d 0a 20 widget status].
3820: 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a @ </td></tr>.
3830: 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c @ <tr><td al
3840: 69 67 6e 3d 22 72 69 67 68 74 22 3e 54 79 70 65 ign="right">Type
3850: 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 :</td><td>. @
3860: 20 5b 65 6e 74 72 79 77 69 64 67 65 74 20 74 79 [entrywidget ty
3870: 70 65 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c pe]. @ </td><
3880: 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c /tr>. @ <tr><
3890: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
38a0: 3e 53 65 76 65 72 69 74 79 3a 3c 2f 74 64 3e 3c >Severity:</td><
38b0: 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 td>. @ [entry
38c0: 77 69 64 67 65 74 20 73 65 76 65 72 69 74 79 5d widget severity]
38d0: 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 . @ </td></tr
38e0: 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 >. @ <tr><td
38f0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 50 72 align="right">Pr
3900: 69 6f 72 69 74 79 3a 3c 2f 74 64 3e 3c 74 64 3e iority:</td><td>
3910: 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 . @ [entrywid
3920: 67 65 74 20 70 72 69 6f 72 69 74 79 5d 0a 20 20 get priority].
3930: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
3940: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 @ <tr><td ali
3950: 67 6e 3d 22 72 69 67 68 74 22 3e 52 65 73 6f 6c gn="right">Resol
3960: 75 74 69 6f 6e 3a 3c 2f 74 64 3e 3c 74 64 3e 0a ution:</td><td>.
3970: 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 67 @ [entrywidg
3980: 65 74 20 72 65 73 6f 6c 75 74 69 6f 6e 5d 0a 20 et resolution].
3990: 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a @ </td></tr>.
39a0: 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c @ <tr><td al
39b0: 69 67 6e 3d 22 72 69 67 68 74 22 3e 53 75 62 73 ign="right">Subs
39c0: 79 73 74 65 6d 3a 3c 2f 74 64 3e 3c 74 64 3e 0a ystem:</td><td>.
39d0: 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 67 @ [entrywidg
39e0: 65 74 20 73 75 62 73 79 73 74 65 6d 5d 0a 20 20 et subsystem].
39f0: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
3a00: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 @ <tr><td ali
3a10: 67 6e 3d 22 72 69 67 68 74 22 3e 41 73 73 69 67 gn="right">Assig
3a20: 6e 65 64 26 6e 62 73 70 3b 54 6f 3a 3c 2f 74 64 ned To:</td
3a30: 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 ><td>. @ [ent
3a40: 72 79 77 69 64 67 65 74 20 61 73 73 69 67 6e 65 rywidget assigne
3a50: 64 74 6f 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e dto]. @ </td>
3a60: 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e </tr>. @ <tr>
3a70: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
3a80: 22 3e 43 6f 6e 74 61 63 74 3a 3c 2f 74 64 3e 3c ">Contact:</td><
3a90: 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 td>. @ [entry
3aa0: 77 69 64 67 65 74 20 63 6f 6e 74 61 63 74 5d 0a widget contact].
3ab0: 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e @ </td></tr>
3ac0: 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 . @ <tr><td a
3ad0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 56 65 72 lign="right">Ver
3ae0: 73 69 6f 6e 26 6e 62 73 70 3b 46 6f 75 6e 64 26 sion Found&
3af0: 6e 62 73 70 3b 49 6e 3a 3c 2f 74 64 3e 3c 74 64 nbsp;In:</td><td
3b00: 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 >. @ [entrywi
3b10: 64 67 65 74 20 66 6f 75 6e 64 69 6e 5d 0a 20 20 dget foundin].
3b20: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
3b30: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 63 6f 6c @ <tr><td col
3b40: 73 70 61 6e 3d 22 32 22 3e 0a 20 20 20 20 40 20 span="2">. @
3b50: 5b 69 66 61 70 70 65 6e 64 20 63 6f 6d 6d 65 6e [ifappend commen
3b60: 74 5d 0a 20 20 20 20 40 20 20 20 4e 65 77 20 52 t]. @ New R
3b70: 65 6d 61 72 6b 73 3a 3c 62 72 3e 0a 20 20 20 20 emarks:<br>.
3b80: 40 20 20 20 5b 61 70 70 65 6e 64 77 69 64 67 65 @ [appendwidge
3b90: 74 20 63 6f 6d 6d 65 6e 74 5d 0a 20 20 20 20 40 t comment]. @
3ba0: 20 5b 65 6c 73 65 5d 0a 20 20 20 20 40 20 20 20 [else]. @
3bb0: 44 65 73 63 72 69 70 74 69 6f 6e 20 41 6e 64 20 Description And
3bc0: 43 6f 6d 6d 65 6e 74 73 3a 3c 62 72 3e 0a 20 20 Comments:<br>.
3bd0: 20 20 40 20 20 20 5b 65 6e 74 72 79 77 69 64 67 @ [entrywidg
3be0: 65 74 20 63 6f 6d 6d 65 6e 74 5d 0a 20 20 20 20 et comment].
3bf0: 40 20 5b 65 6e 64 69 66 5d 0a 20 20 20 20 40 20 @ [endif]. @
3c00: 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 </td></tr>. @
3c10: 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 <tr><td align="
3c20: 72 69 67 68 74 22 3e 3c 2f 74 64 3e 3c 74 64 3e right"></td><td>
3c30: 0a 20 20 20 20 40 20 5b 73 75 62 6d 69 74 62 75 . @ [submitbu
3c40: 74 74 6f 6e 5d 0a 20 20 20 20 40 20 3c 2f 74 64 tton]. @ </td
3c50: 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 2f 74 ></tr>. @ </t
3c60: 61 62 6c 65 3e 0a 20 20 20 20 40 20 45 4e 44 2d able>. @ END-
3c70: 4f 46 2d 45 44 49 54 2d 54 45 4d 50 4c 41 54 45 OF-EDIT-TEMPLATE
3c80: 0a 20 20 20 20 40 20 23 23 23 23 23 23 23 23 23 . @ #########
3c90: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3ca0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3cb0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
3cc0: 23 23 23 23 23 23 23 23 23 23 23 23 23 0a 20 20 #############.
3cd0: 20 20 40 20 74 65 6d 70 6c 61 74 65 20 76 69 65 @ template vie
3ce0: 77 20 45 4e 44 2d 4f 46 2d 56 49 45 57 2d 54 45 w END-OF-VIEW-TE
3cf0: 4d 50 4c 41 54 45 0a 20 20 20 20 40 20 3c 74 61 MPLATE. @ <ta
3d00: 62 6c 65 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d ble cellpadding=
3d10: 22 35 22 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c "5">. @ <tr><
3d20: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
3d30: 3e 54 69 74 6c 65 3a 3c 2f 74 64 3e 3c 74 64 3e >Title:</td><td>
3d40: 0a 20 20 20 20 40 20 5b 76 69 65 77 77 69 64 67 . @ [viewwidg
3d50: 65 74 20 74 69 74 6c 65 5d 0a 20 20 20 20 40 20 et title]. @
3d60: 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 </td></tr>. @
3d70: 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 <tr><td align="
3d80: 72 69 67 68 74 22 3e 53 74 61 74 75 73 3a 3c 2f right">Status:</
3d90: 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 76 td><td>. @ [v
3da0: 69 65 77 77 69 64 67 65 74 20 73 74 61 74 75 73 iewwidget status
3db0: 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 ]. @ </td></t
3dc0: 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 r>. @ <tr><td
3dd0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 54 align="right">T
3de0: 79 70 65 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 ype:</td><td>.
3df0: 20 20 40 20 5b 76 69 65 77 77 69 64 67 65 74 20 @ [viewwidget
3e00: 74 79 70 65 5d 0a 20 20 20 20 40 20 3c 2f 74 64 type]. @ </td
3e10: 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 ></tr>. @ <tr
3e20: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
3e30: 74 22 3e 53 65 76 65 72 69 74 79 3a 3c 2f 74 64 t">Severity:</td
3e40: 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 ><td>. @ [vie
3e50: 77 77 69 64 67 65 74 20 73 65 76 65 72 69 74 79 wwidget severity
3e60: 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 ]. @ </td></t
3e70: 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 r>. @ <tr><td
3e80: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 50 align="right">P
3e90: 72 69 6f 72 69 74 79 3a 3c 2f 74 64 3e 3c 74 64 riority:</td><td
3ea0: 3e 0a 20 20 20 20 40 20 5b 76 69 65 77 77 69 64 >. @ [viewwid
3eb0: 67 65 74 20 70 72 69 6f 72 69 74 79 5d 0a 20 20 get priority].
3ec0: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
3ed0: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 @ <tr><td ali
3ee0: 67 6e 3d 22 72 69 67 68 74 22 3e 52 65 73 6f 6c gn="right">Resol
3ef0: 75 74 69 6f 6e 3a 3c 2f 74 64 3e 3c 74 64 3e 0a ution:</td><td>.
3f00: 20 20 20 20 40 20 5b 76 69 65 77 77 69 64 67 65 @ [viewwidge
3f10: 74 20 72 65 73 6f 6c 75 74 69 6f 6e 5d 0a 20 20 t resolution].
3f20: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
3f30: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 @ <tr><td ali
3f40: 67 6e 3d 22 72 69 67 68 74 22 3e 53 75 62 73 79 gn="right">Subsy
3f50: 73 74 65 6d 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 stem:</td><td>.
3f60: 20 20 20 40 20 5b 76 69 65 77 77 69 64 67 65 74 @ [viewwidget
3f70: 20 73 75 62 73 79 73 74 65 6d 5d 0a 20 20 20 20 subsystem].
3f80: 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 @ </td></tr>.
3f90: 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e @ <tr><td align
3fa0: 3d 22 72 69 67 68 74 22 3e 41 73 73 69 67 6e 65 ="right">Assigne
3fb0: 64 26 6e 62 73 70 3b 54 6f 3a 3c 2f 74 64 3e 3c d To:</td><
3fc0: 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 77 77 td>. @ [vieww
3fd0: 69 64 67 65 74 20 61 73 73 69 67 6e 65 64 74 6f idget assignedto
3fe0: 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 ]. @ </td></t
3ff0: 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 r>. @ <tr><td
4000: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 43 align="right">C
4010: 6f 6e 74 61 63 74 3a 3c 2f 74 64 3e 3c 74 64 3e ontact:</td><td>
4020: 0a 20 20 20 20 40 20 5b 76 69 65 77 77 69 64 67 . @ [viewwidg
4030: 65 74 20 63 6f 6e 74 61 63 74 5d 0a 20 20 20 20 et contact].
4040: 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 @ </td></tr>.
4050: 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e @ <tr><td align
4060: 3d 22 72 69 67 68 74 22 3e 56 65 72 73 69 6f 6e ="right">Version
4070: 26 6e 62 73 70 3b 46 6f 75 6e 64 26 6e 62 73 70 Found 
4080: 3b 49 6e 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 ;In:</td><td>.
4090: 20 20 40 20 5b 76 69 65 77 77 69 64 67 65 74 20 @ [viewwidget
40a0: 66 6f 75 6e 64 69 6e 5d 0a 20 20 20 20 40 20 3c foundin]. @ <
40b0: 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 /td></tr>. @
40c0: 3c 74 72 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d <tr><td colspan=
40d0: 22 32 22 3e 0a 20 20 20 20 40 20 44 65 73 63 72 "2">. @ Descr
40e0: 69 70 74 69 6f 6e 20 41 6e 64 20 43 6f 6d 6d 65 iption And Comme
40f0: 6e 74 73 3a 3c 62 72 3e 0a 20 20 20 20 40 20 5b nts:<br>. @ [
4100: 76 69 65 77 77 69 64 67 65 74 20 63 6f 6d 6d 65 viewwidget comme
4110: 6e 74 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c nt]. @ </td><
4120: 2f 74 72 3e 0a 20 20 20 20 40 20 3c 2f 74 61 62 /tr>. @ </tab
4130: 6c 65 3e 0a 20 20 20 20 40 20 45 4e 44 2d 4f 46 le>. @ END-OF
4140: 2d 56 49 45 57 2d 54 45 4d 50 4c 41 54 45 0a 20 -VIEW-TEMPLATE.
4150: 20 3b 0a 20 20 42 6c 6f 62 20 63 6f 6e 66 69 67 ;. Blob config
4160: 2c 20 65 72 72 6d 73 67 3b 0a 20 20 62 6c 6f 62 , errmsg;. blob
4170: 5f 69 6e 69 74 28 26 63 6f 6e 66 69 67 2c 20 7a _init(&config, z
4180: 44 65 66 61 75 6c 74 43 6f 6e 66 69 67 2c 20 73 DefaultConfig, s
4190: 69 7a 65 6f 66 28 7a 44 65 66 61 75 6c 74 43 6f izeof(zDefaultCo
41a0: 6e 66 69 67 29 2d 31 29 3b 0a 20 20 64 62 5f 62 nfig)-1);. db_b
41b0: 65 67 69 6e 5f 74 72 61 6e 73 61 63 74 69 6f 6e egin_transaction
41c0: 28 29 3b 0a 20 20 62 6c 6f 62 5f 7a 65 72 6f 28 ();. blob_zero(
41d0: 26 65 72 72 6d 73 67 29 3b 0a 20 20 74 69 63 6b &errmsg);. tick
41e0: 65 74 5f 63 6f 6e 66 69 67 5f 70 61 72 73 65 28 et_config_parse(
41f0: 26 63 6f 6e 66 69 67 2c 20 30 2c 20 26 65 72 72 &config, 0, &err
4200: 6d 73 67 29 3b 0a 20 20 69 66 28 20 62 6c 6f 62 msg);. if( blob
4210: 5f 73 69 7a 65 28 26 65 72 72 6d 73 67 29 20 29 _size(&errmsg) )
4220: 7b 0a 20 20 20 20 66 6f 73 73 69 6c 5f 66 61 74 {. fossil_fat
4230: 61 6c 28 22 25 62 22 2c 20 26 65 72 72 6d 73 67 al("%b", &errmsg
4240: 29 3b 0a 20 20 7d 0a 20 20 64 62 5f 65 6e 64 5f );. }. db_end_
4250: 74 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b 0a transaction(0);.
4260: 7d 0a 0a 2f 2a 0a 2a 2a 20 52 65 74 75 72 6e 20 }../*.** Return
4270: 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 61 20 the length of a
4280: 73 74 72 69 6e 67 20 77 69 74 68 6f 75 74 20 69 string without i
4290: 74 73 20 74 72 61 69 6c 69 6e 67 20 77 68 69 74 ts trailing whit
42a0: 65 73 70 61 63 65 2e 0a 2a 2f 0a 73 74 61 74 69 espace..*/.stati
42b0: 63 20 69 6e 74 20 6e 6f 6e 5f 77 68 69 74 65 73 c int non_whites
42c0: 70 61 63 65 5f 6c 65 6e 67 74 68 28 63 6f 6e 73 pace_length(cons
42d0: 74 20 63 68 61 72 20 2a 7a 29 7b 0a 20 20 69 6e t char *z){. in
42e0: 74 20 6e 20 3d 20 73 74 72 6c 65 6e 28 7a 29 3b t n = strlen(z);
42f0: 0a 20 20 77 68 69 6c 65 28 20 6e 3e 30 20 26 26 . while( n>0 &&
4300: 20 69 73 73 70 61 63 65 28 7a 5b 6e 2d 31 5d 29 isspace(z[n-1])
4310: 20 29 7b 20 6e 2d 2d 3b 20 7d 0a 20 20 72 65 74 ){ n--; }. ret
4320: 75 72 6e 20 6e 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 urn n;.}../*.**
4330: 46 69 6c 6c 20 74 68 65 20 67 69 76 65 6e 20 42 Fill the given B
4340: 6c 6f 62 20 77 69 74 68 20 74 65 78 74 20 74 68 lob with text th
4350: 61 74 20 64 65 73 63 72 69 62 65 73 20 74 68 65 at describes the
4360: 20 63 75 72 72 65 6e 74 0a 2a 2a 20 74 69 63 6b current.** tick
4370: 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e et configuration
4380: 2e 20 20 54 68 69 73 20 69 73 20 74 68 65 20 69 . This is the i
4390: 6e 76 65 72 73 65 20 6f 66 20 74 69 63 6b 65 74 nverse of ticket
43a0: 5f 63 6f 6e 66 69 67 5f 70 61 72 73 65 28 29 0a _config_parse().
43b0: 2a 2f 0a 76 6f 69 64 20 74 69 63 6b 65 74 5f 63 */.void ticket_c
43c0: 6f 6e 66 69 67 5f 72 65 6e 64 65 72 28 42 6c 6f onfig_render(Blo
43d0: 62 20 2a 70 4f 75 74 29 7b 0a 20 20 63 68 61 72 b *pOut){. char
43e0: 20 2a 7a 44 65 6c 69 6d 3b 0a 20 20 63 68 61 72 *zDelim;. char
43f0: 20 2a 7a 43 6f 6e 74 65 6e 74 3b 0a 20 20 53 74 *zContent;. St
4400: 6d 74 20 71 3b 0a 20 20 69 6e 74 20 6e 3b 0a 0a mt q;. int n;..
4410: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 blob_appendf(p
4420: 4f 75 74 2c 20 22 74 69 63 6b 65 74 2d 63 6f 6e Out, "ticket-con
4430: 66 69 67 75 72 61 74 69 6f 6e 5c 6e 22 29 3b 0a figuration\n");.
4440: 20 20 7a 44 65 6c 69 6d 20 3d 20 64 62 5f 74 65 zDelim = db_te
4450: 78 74 28 30 2c 20 22 53 45 4c 45 43 54 20 27 2d xt(0, "SELECT '-
4460: 2d 65 6e 64 2d 6f 66 2d 74 65 78 74 2d 2d 27 20 -end-of-text--'
4470: 7c 7c 20 68 65 78 28 72 61 6e 64 6f 6d 28 32 30 || hex(random(20
4480: 29 29 22 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 ))");. blob_app
4490: 65 6e 64 66 28 70 4f 75 74 2c 20 22 23 23 23 23 endf(pOut, "####
44a0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
44b0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
44c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 5c ###############\
44d0: 6e 22 29 3b 0a 20 20 64 62 5f 70 72 65 70 61 72 n");. db_prepar
44e0: 65 28 26 71 2c 20 22 53 45 4c 45 43 54 20 6e 61 e(&q, "SELECT na
44f0: 6d 65 2c 20 74 79 70 65 2c 20 77 69 64 74 68 2c me, type, width,
4500: 20 61 72 67 20 46 52 4f 4d 20 74 6b 74 66 69 65 arg FROM tktfie
4510: 6c 64 22 29 3b 0a 20 20 77 68 69 6c 65 28 20 64 ld");. while( d
4520: 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 51 4c 49 b_step(&q)==SQLI
4530: 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 20 63 6f TE_ROW ){. co
4540: 6e 73 74 20 63 68 61 72 20 2a 7a 4e 61 6d 65 20 nst char *zName
4550: 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 = db_column_text
4560: 28 26 71 2c 20 30 29 3b 0a 20 20 20 20 63 6f 6e (&q, 0);. con
4570: 73 74 20 63 68 61 72 20 2a 7a 54 79 70 65 20 3d st char *zType =
4580: 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 28 db_column_text(
4590: 26 71 2c 20 31 29 3b 0a 20 20 20 20 69 6e 74 20 &q, 1);. int
45a0: 77 69 64 74 68 20 3d 20 64 62 5f 63 6f 6c 75 6d width = db_colum
45b0: 6e 5f 69 6e 74 28 26 71 2c 20 32 29 3b 0a 20 20 n_int(&q, 2);.
45c0: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 41 const char *zA
45d0: 72 67 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 rg = db_column_t
45e0: 65 78 74 28 26 71 2c 20 33 29 3b 0a 20 20 20 20 ext(&q, 3);.
45f0: 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 blob_appendf(pOu
4600: 74 2c 20 22 66 69 65 6c 64 20 25 73 20 25 73 20 t, "field %s %s
4610: 25 64 20 25 73 5c 6e 22 2c 20 7a 4e 61 6d 65 2c %d %s\n", zName,
4620: 20 7a 54 79 70 65 2c 20 77 69 64 74 68 2c 20 7a zType, width, z
4630: 41 72 67 29 3b 0a 20 20 7d 0a 20 20 64 62 5f 66 Arg);. }. db_f
4640: 69 6e 61 6c 69 7a 65 28 26 71 29 3b 0a 20 20 62 inalize(&q);. b
4650: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 lob_appendf(pOut
4660: 2c 20 22 23 23 23 23 23 23 23 23 23 23 23 23 23 , "#############
4670: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4680: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4690: 23 23 23 23 23 23 5c 6e 22 29 3b 0a 20 20 62 6c ######\n");. bl
46a0: 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c ob_appendf(pOut,
46b0: 20 22 74 65 6d 70 6c 61 74 65 20 6e 65 77 20 25 "template new %
46c0: 73 5c 6e 22 2c 20 7a 44 65 6c 69 6d 29 3b 0a 20 s\n", zDelim);.
46d0: 20 7a 43 6f 6e 74 65 6e 74 20 3d 20 64 62 5f 67 zContent = db_g
46e0: 65 74 28 22 74 6b 74 2d 6e 65 77 2d 74 65 6d 70 et("tkt-new-temp
46f0: 6c 61 74 65 22 2c 20 30 29 3b 0a 20 20 69 66 28 late", 0);. if(
4700: 20 7a 43 6f 6e 74 65 6e 74 20 29 7b 0a 20 20 20 zContent ){.
4710: 20 6e 20 3d 20 6e 6f 6e 5f 77 68 69 74 65 73 70 n = non_whitesp
4720: 61 63 65 5f 6c 65 6e 67 74 68 28 7a 43 6f 6e 74 ace_length(zCont
4730: 65 6e 74 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 61 ent);. blob_a
4740: 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 25 2e ppendf(pOut, "%.
4750: 2a 73 5c 6e 22 2c 20 6e 2c 20 7a 43 6f 6e 74 65 *s\n", n, zConte
4760: 6e 74 29 3b 0a 20 20 20 20 66 72 65 65 28 7a 43 nt);. free(zC
4770: 6f 6e 74 65 6e 74 29 3b 0a 20 20 7d 0a 20 20 62 ontent);. }. b
4780: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 lob_appendf(pOut
4790: 2c 20 22 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 6d , "%s\n", zDelim
47a0: 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 );. blob_append
47b0: 66 28 70 4f 75 74 2c 20 22 23 23 23 23 23 23 23 f(pOut, "#######
47c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
47d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
47e0: 23 23 23 23 23 23 23 23 23 23 23 23 5c 6e 22 29 ############\n")
47f0: 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 ;. blob_appendf
4800: 28 70 4f 75 74 2c 20 22 74 65 6d 70 6c 61 74 65 (pOut, "template
4810: 20 65 64 69 74 20 25 73 5c 6e 22 2c 20 7a 44 65 edit %s\n", zDe
4820: 6c 69 6d 29 3b 0a 20 20 7a 43 6f 6e 74 65 6e 74 lim);. zContent
4830: 20 3d 20 64 62 5f 67 65 74 28 22 74 6b 74 2d 65 = db_get("tkt-e
4840: 64 69 74 2d 74 65 6d 70 6c 61 74 65 22 2c 20 30 dit-template", 0
4850: 29 3b 0a 20 20 69 66 28 20 7a 43 6f 6e 74 65 6e );. if( zConten
4860: 74 20 29 7b 0a 20 20 20 20 6e 20 3d 20 6e 6f 6e t ){. n = non
4870: 5f 77 68 69 74 65 73 70 61 63 65 5f 6c 65 6e 67 _whitespace_leng
4880: 74 68 28 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 th(zContent);.
4890: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 blob_appendf(p
48a0: 4f 75 74 2c 20 22 25 2e 2a 73 5c 6e 22 2c 20 6e Out, "%.*s\n", n
48b0: 2c 20 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 , zContent);.
48c0: 20 66 72 65 65 28 7a 43 6f 6e 74 65 6e 74 29 3b free(zContent);
48d0: 0a 20 20 7d 0a 20 20 62 6c 6f 62 5f 61 70 70 65 . }. blob_appe
48e0: 6e 64 66 28 70 4f 75 74 2c 20 22 25 73 5c 6e 22 ndf(pOut, "%s\n"
48f0: 2c 20 7a 44 65 6c 69 6d 29 3b 0a 20 20 62 6c 6f , zDelim);. blo
4900: 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 b_appendf(pOut,
4910: 22 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 "###############
4920: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4930: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4940: 23 23 23 23 5c 6e 22 29 3b 0a 20 20 62 6c 6f 62 ####\n");. blob
4950: 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 _appendf(pOut, "
4960: 74 65 6d 70 6c 61 74 65 20 76 69 65 77 20 25 73 template view %s
4970: 5c 6e 22 2c 20 7a 44 65 6c 69 6d 29 3b 0a 20 20 \n", zDelim);.
4980: 7a 43 6f 6e 74 65 6e 74 20 3d 20 64 62 5f 67 65 zContent = db_ge
4990: 74 28 22 74 6b 74 2d 76 69 65 77 2d 74 65 6d 70 t("tkt-view-temp
49a0: 6c 61 74 65 22 2c 20 30 29 3b 0a 20 20 69 66 28 late", 0);. if(
49b0: 20 7a 43 6f 6e 74 65 6e 74 20 29 7b 0a 20 20 20 zContent ){.
49c0: 20 6e 20 3d 20 6e 6f 6e 5f 77 68 69 74 65 73 70 n = non_whitesp
49d0: 61 63 65 5f 6c 65 6e 67 74 68 28 7a 43 6f 6e 74 ace_length(zCont
49e0: 65 6e 74 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 61 ent);. blob_a
49f0: 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 25 2e ppendf(pOut, "%.
4a00: 2a 73 5c 6e 22 2c 20 6e 2c 20 7a 43 6f 6e 74 65 *s\n", n, zConte
4a10: 6e 74 29 3b 0a 20 20 20 20 66 72 65 65 28 7a 43 nt);. free(zC
4a20: 6f 6e 74 65 6e 74 29 3b 0a 20 20 7d 0a 20 20 62 ontent);. }. b
4a30: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 lob_appendf(pOut
4a40: 2c 20 22 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 6d , "%s\n", zDelim
4a50: 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 );. blob_append
4a60: 66 28 70 4f 75 74 2c 20 22 23 23 23 23 23 23 23 f(pOut, "#######
4a70: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4a80: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
4a90: 23 23 23 23 23 23 23 23 23 23 23 23 5c 6e 22 29 ############\n")
4aa0: 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 ;. blob_appendf
4ab0: 28 70 4f 75 74 2c 20 22 64 65 73 63 72 69 70 74 (pOut, "descript
4ac0: 69 6f 6e 20 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 ion %s\n", zDeli
4ad0: 6d 29 3b 0a 20 20 7a 43 6f 6e 74 65 6e 74 20 3d m);. zContent =
4ae0: 20 64 62 5f 67 65 74 28 22 74 6b 74 2d 64 65 73 db_get("tkt-des
4af0: 63 22 2c 20 30 29 3b 0a 20 20 69 66 28 20 7a 43 c", 0);. if( zC
4b00: 6f 6e 74 65 6e 74 20 29 7b 0a 20 20 20 20 6e 20 ontent ){. n
4b10: 3d 20 6e 6f 6e 5f 77 68 69 74 65 73 70 61 63 65 = non_whitespace
4b20: 5f 6c 65 6e 67 74 68 28 7a 43 6f 6e 74 65 6e 74 _length(zContent
4b30: 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 );. blob_appe
4b40: 6e 64 66 28 70 4f 75 74 2c 20 22 25 2e 2a 73 5c ndf(pOut, "%.*s\
4b50: 6e 22 2c 20 6e 2c 20 7a 43 6f 6e 74 65 6e 74 29 n", n, zContent)
4b60: 3b 0a 20 20 20 20 66 72 65 65 28 7a 43 6f 6e 74 ;. free(zCont
4b70: 65 6e 74 29 3b 0a 20 20 7d 0a 20 20 62 6c 6f 62 ent);. }. blob
4b80: 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 _appendf(pOut, "
4b90: 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 6d 29 3b 0a %s\n", zDelim);.
4ba0: 7d 0a 0a 2f 2a 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 }../*.** COMMAND
4bb0: 3a 20 74 65 73 74 2d 74 6b 74 63 6f 6e 66 69 67 : test-tktconfig
4bc0: 2d 65 78 70 6f 72 74 0a 2a 2a 20 57 72 69 74 65 -export.** Write
4bd0: 20 74 68 65 20 63 75 72 72 65 6e 74 20 74 69 63 the current tic
4be0: 6b 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ket configuratio
4bf0: 6e 20 6f 75 74 20 74 6f 20 61 20 66 69 6c 65 2e n out to a file.
4c00: 0a 2a 2f 0a 76 6f 69 64 20 74 6b 74 63 6f 6e 66 .*/.void tktconf
4c10: 69 67 5f 72 65 6e 64 65 72 5f 63 6d 64 28 76 6f ig_render_cmd(vo
4c20: 69 64 29 7b 0a 20 20 42 6c 6f 62 20 63 6f 6e 66 id){. Blob conf
4c30: 69 67 3b 0a 0a 20 20 64 62 5f 6d 75 73 74 5f 62 ig;.. db_must_b
4c40: 65 5f 77 69 74 68 69 6e 5f 74 72 65 65 28 29 3b e_within_tree();
4c50: 0a 20 20 69 66 28 20 67 2e 61 72 67 63 21 3d 33 . if( g.argc!=3
4c60: 20 29 7b 0a 20 20 20 20 75 73 61 67 65 28 22 46 ){. usage("F
4c70: 49 4c 45 4e 41 4d 45 22 29 3b 0a 20 20 7d 0a 20 ILENAME");. }.
4c80: 20 62 6c 6f 62 5f 7a 65 72 6f 28 26 63 6f 6e 66 blob_zero(&conf
4c90: 69 67 29 3b 0a 20 20 74 69 63 6b 65 74 5f 63 6f ig);. ticket_co
4ca0: 6e 66 69 67 5f 72 65 6e 64 65 72 28 26 63 6f 6e nfig_render(&con
4cb0: 66 69 67 29 3b 0a 20 20 62 6c 6f 62 5f 77 72 69 fig);. blob_wri
4cc0: 74 65 5f 74 6f 5f 66 69 6c 65 28 26 63 6f 6e 66 te_to_file(&conf
4cd0: 69 67 2c 20 67 2e 61 72 67 76 5b 32 5d 29 3b 0a ig, g.argv[2]);.
4ce0: 20 20 62 6c 6f 62 5f 72 65 73 65 74 28 26 63 6f blob_reset(&co
4cf0: 6e 66 69 67 29 3b 0a 7d 0a nfig);.}.