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 2f 74 69 74 6c br>. @ [/titl
3200: 65 20 36 30 20 31 20 74 65 78 74 65 6e 74 72 79 e 60 1 textentry
3210: 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 0a 20 20 ]. @ </td>.
3220: 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 20 40 20 @ </tr>. @
3230: 0a 20 20 20 20 40 20 3c 74 72 3e 0a 20 20 20 20 . @ <tr>.
3240: 40 20 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 @ <td align="rig
3250: 68 74 22 3e 54 79 70 65 3a 0a 20 20 20 20 40 20 ht">Type:. @
3260: 5b 2f 74 79 70 65 20 65 6e 74 72 79 77 69 64 67 [/type entrywidg
3270: 65 74 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 0a et]. @ </td>.
3280: 20 20 20 20 40 20 3c 74 64 3e 57 68 61 74 20 74 @ <td>What t
3290: 79 70 65 20 6f 66 20 74 69 63 6b 65 74 20 69 73 ype of ticket is
32a0: 20 74 68 69 73 3f 3c 2f 74 64 3e 0a 20 20 20 20 this?</td>.
32b0: 40 20 3c 2f 74 72 3e 0a 20 20 20 20 40 20 0a 20 @ </tr>. @ .
32c0: 20 20 20 40 20 3c 74 72 3e 0a 20 20 20 20 40 20 @ <tr>. @
32d0: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
32e0: 22 3e 56 65 72 73 69 6f 6e 3a 20 0a 20 20 20 20 ">Version: .
32f0: 40 20 5b 65 6e 74 72 79 77 69 64 67 65 74 20 66 @ [entrywidget f
3300: 6f 75 6e 64 69 6e 5d 0a 20 20 20 20 40 20 3c 2f oundin]. @ </
3310: 74 64 3e 0a 20 20 20 20 40 20 3c 74 64 3e 49 6e td>. @ <td>In
3320: 20 77 68 61 74 20 76 65 72 73 69 6f 6e 20 6f 72 what version or
3330: 20 62 75 69 6c 64 20 6e 75 6d 62 65 72 20 64 6f build number do
3340: 20 79 6f 75 20 6f 62 73 65 72 76 65 72 20 74 68 you observer th
3350: 65 20 70 72 6f 62 6c 65 6d 3f 3c 2f 74 64 3e 0a e problem?</td>.
3360: 20 20 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 20 @ </tr>.
3370: 40 20 0a 20 20 20 20 40 20 3c 74 72 3e 0a 20 20 @ . @ <tr>.
3380: 20 20 40 20 3c 74 64 20 61 6c 69 67 6e 3d 22 72 @ <td align="r
3390: 69 67 68 74 22 3e 53 65 76 65 72 69 74 79 3a 0a ight">Severity:.
33a0: 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 67 @ [entrywidg
33b0: 65 74 20 73 65 76 65 72 69 74 79 5d 0a 20 20 20 et severity].
33c0: 20 40 20 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c @ </td>. @ <
33d0: 74 64 3e 48 6f 77 20 64 65 62 69 6c 69 74 61 74 td>How debilitat
33e0: 69 6e 67 20 69 73 20 74 68 65 20 70 72 6f 62 6c ing is the probl
33f0: 65 6d 3f 20 20 48 6f 77 20 62 61 64 6c 79 20 64 em? How badly d
3400: 6f 65 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 0a oes the problem.
3410: 20 20 20 20 40 20 65 66 66 65 63 74 20 74 68 65 @ effect the
3420: 20 6f 70 65 72 61 74 69 6f 6e 20 6f 66 20 74 68 operation of th
3430: 65 20 70 72 6f 64 75 63 74 3f 3c 2f 74 64 3e 0a e product?</td>.
3440: 20 20 20 20 40 20 3c 2f 74 72 3e 0a 20 20 20 20 @ </tr>.
3450: 40 20 0a 20 20 20 20 40 20 3c 74 72 3e 0a 20 20 @ . @ <tr>.
3460: 20 20 40 20 3c 74 64 20 63 6f 6c 73 70 61 6e 3d @ <td colspan=
3470: 22 32 22 3e 0a 20 20 20 20 40 20 45 6e 74 65 72 "2">. @ Enter
3480: 20 61 20 64 65 74 61 69 6c 65 64 20 64 65 73 63 a detailed desc
3490: 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 ription of the p
34a0: 72 6f 62 6c 65 6d 2e 0a 20 20 20 20 40 20 46 6f roblem.. @ Fo
34b0: 72 20 63 6f 64 65 20 64 65 66 65 63 74 73 2c 20 r code defects,
34c0: 62 65 20 73 75 72 65 20 74 6f 20 70 72 6f 76 69 be sure to provi
34d0: 64 65 20 64 65 74 61 69 6c 73 20 6f 6e 20 65 78 de details on ex
34e0: 61 63 74 6c 79 20 68 6f 77 0a 20 20 20 20 40 20 actly how. @
34f0: 74 68 65 20 70 72 6f 62 6c 65 6d 20 63 61 6e 20 the problem can
3500: 62 65 20 72 65 70 72 6f 64 75 63 65 64 2e 20 20 be reproduced.
3510: 50 72 6f 76 69 64 65 20 61 73 20 6d 75 63 68 20 Provide as much
3520: 64 65 74 61 69 6c 20 61 73 0a 20 20 20 20 40 20 detail as. @
3530: 70 6f 73 73 69 62 6c 65 2e 0a 20 20 20 20 40 20 possible.. @
3540: 3c 62 72 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 <br>. @ [entr
3550: 79 77 69 64 67 65 74 20 63 6f 6d 6d 65 6e 74 20 ywidget comment
3560: 6e 6f 61 70 70 65 6e 64 5d 0a 20 20 20 20 40 20 noappend]. @
3570: 5b 69 66 70 72 65 76 69 65 77 20 63 6f 6d 6d 65 [ifpreview comme
3580: 6e 74 5d 0a 20 20 20 20 40 20 3c 68 72 3e 0a 20 nt]. @ <hr>.
3590: 20 20 20 40 20 5b 76 69 65 77 77 69 64 67 65 74 @ [viewwidget
35a0: 20 63 6f 6d 6d 65 6e 74 5d 0a 20 20 20 20 40 20 comment]. @
35b0: 3c 2f 68 72 3e 0a 20 20 20 20 40 20 3c 2f 74 72 </hr>. @ </tr
35c0: 3e 0a 20 20 20 20 40 20 0a 20 20 20 20 40 20 3c >. @ . @ <
35d0: 74 72 3e 0a 20 20 20 20 40 20 3c 74 64 20 61 6c tr>. @ <td al
35e0: 69 67 6e 3d 22 72 69 67 68 74 22 3e 0a 20 20 20 ign="right">.
35f0: 20 40 20 5b 73 75 62 6d 69 74 62 75 74 74 6f 6e @ [submitbutton
3600: 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 0a 20 20 ]. @ </td>.
3610: 20 20 40 20 3c 74 64 3e 41 66 74 65 72 20 66 69 @ <td>After fi
3620: 6c 6c 69 6e 67 20 69 6e 20 74 68 65 20 69 6e 66 lling in the inf
3630: 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 76 65 2c 20 ormation above,
3640: 70 72 65 73 73 20 74 68 69 73 20 62 75 74 74 6f press this butto
3650: 6e 20 74 6f 20 63 72 65 61 74 65 0a 20 20 20 20 n to create.
3660: 40 20 74 68 65 20 6e 65 77 20 74 69 63 6b 65 74 @ the new ticket
3670: 3c 2f 74 64 3e 0a 20 20 20 20 40 20 3c 2f 74 72 </td>. @ </tr
3680: 3e 0a 20 20 20 20 40 20 3c 2f 74 61 62 6c 65 3e >. @ </table>
3690: 0a 20 20 20 20 40 20 5b 64 65 66 61 75 6c 74 76 . @ [defaultv
36a0: 61 6c 75 65 20 73 74 61 74 75 73 20 4f 70 65 6e alue status Open
36b0: 5d 0a 20 20 20 20 40 20 5b 64 65 66 61 75 6c 74 ]. @ [default
36c0: 76 61 6c 75 65 20 72 65 73 6f 6c 75 74 69 6f 6e value resolution
36d0: 20 4f 70 65 6e 5d 0a 20 20 20 20 40 20 45 4e 44 Open]. @ END
36e0: 2d 4f 46 2d 4e 45 57 2d 54 45 4d 50 4c 41 54 45 -OF-NEW-TEMPLATE
36f0: 0a 20 20 20 20 40 20 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 23 23 23 23 23 0a 20 20 #############.
3740: 20 20 40 20 74 65 6d 70 6c 61 74 65 20 65 64 69 @ template edi
3750: 74 20 45 4e 44 2d 4f 46 2d 45 44 49 54 2d 54 45 t END-OF-EDIT-TE
3760: 4d 50 4c 41 54 45 0a 20 20 20 20 40 20 3c 74 61 MPLATE. @ <ta
3770: 62 6c 65 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d ble cellpadding=
3780: 22 35 22 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c "5">. @ <tr><
3790: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
37a0: 3e 54 69 74 6c 65 3a 3c 2f 74 64 3e 3c 74 64 3e >Title:</td><td>
37b0: 0a 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 . @ [entrywid
37c0: 67 65 74 20 74 69 74 6c 65 5d 0a 20 20 20 20 40 get title]. @
37d0: 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 </td></tr>.
37e0: 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d @ <tr><td align=
37f0: 22 72 69 67 68 74 22 3e 53 74 61 74 75 73 3a 3c "right">Status:<
3800: 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b /td><td>. @ [
3810: 65 6e 74 72 79 77 69 64 67 65 74 20 73 74 61 74 entrywidget stat
3820: 75 73 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c us]. @ </td><
3830: 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c /tr>. @ <tr><
3840: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
3850: 3e 54 79 70 65 3a 3c 2f 74 64 3e 3c 74 64 3e 0a >Type:</td><td>.
3860: 20 20 20 20 40 20 5b 65 6e 74 72 79 77 69 64 67 @ [entrywidg
3870: 65 74 20 74 79 70 65 5d 0a 20 20 20 20 40 20 3c et type]. @ <
3880: 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 /td></tr>. @
3890: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 <tr><td align="r
38a0: 69 67 68 74 22 3e 53 65 76 65 72 69 74 79 3a 3c ight">Severity:<
38b0: 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b /td><td>. @ [
38c0: 65 6e 74 72 79 77 69 64 67 65 74 20 73 65 76 65 entrywidget seve
38d0: 72 69 74 79 5d 0a 20 20 20 20 40 20 3c 2f 74 64 rity]. @ </td
38e0: 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 ></tr>. @ <tr
38f0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
3900: 74 22 3e 50 72 69 6f 72 69 74 79 3a 3c 2f 74 64 t">Priority:</td
3910: 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 ><td>. @ [ent
3920: 72 79 77 69 64 67 65 74 20 70 72 69 6f 72 69 74 rywidget priorit
3930: 79 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f y]. @ </td></
3940: 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 tr>. @ <tr><t
3950: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
3960: 52 65 73 6f 6c 75 74 69 6f 6e 3a 3c 2f 74 64 3e Resolution:</td>
3970: 3c 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 <td>. @ [entr
3980: 79 77 69 64 67 65 74 20 72 65 73 6f 6c 75 74 69 ywidget resoluti
3990: 6f 6e 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c on]. @ </td><
39a0: 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c /tr>. @ <tr><
39b0: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
39c0: 3e 53 75 62 73 79 73 74 65 6d 3a 3c 2f 74 64 3e >Subsystem:</td>
39d0: 3c 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e 74 72 <td>. @ [entr
39e0: 79 77 69 64 67 65 74 20 73 75 62 73 79 73 74 65 ywidget subsyste
39f0: 6d 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f m]. @ </td></
3a00: 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 tr>. @ <tr><t
3a10: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
3a20: 41 73 73 69 67 6e 65 64 26 6e 62 73 70 3b 54 6f Assigned To
3a30: 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 :</td><td>. @
3a40: 20 5b 65 6e 74 72 79 77 69 64 67 65 74 20 61 73 [entrywidget as
3a50: 73 69 67 6e 65 64 74 6f 5d 0a 20 20 20 20 40 20 signedto]. @
3a60: 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 </td></tr>. @
3a70: 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 <tr><td align="
3a80: 72 69 67 68 74 22 3e 43 6f 6e 74 61 63 74 3a 3c right">Contact:<
3a90: 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b /td><td>. @ [
3aa0: 65 6e 74 72 79 77 69 64 67 65 74 20 63 6f 6e 74 entrywidget cont
3ab0: 61 63 74 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e act]. @ </td>
3ac0: 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e </tr>. @ <tr>
3ad0: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
3ae0: 22 3e 56 65 72 73 69 6f 6e 26 6e 62 73 70 3b 46 ">Version F
3af0: 6f 75 6e 64 26 6e 62 73 70 3b 49 6e 3a 3c 2f 74 ound In:</t
3b00: 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 65 6e d><td>. @ [en
3b10: 74 72 79 77 69 64 67 65 74 20 66 6f 75 6e 64 69 trywidget foundi
3b20: 6e 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f n]. @ </td></
3b30: 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 tr>. @ <tr><t
3b40: 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22 3e 0a 20 d colspan="2">.
3b50: 20 20 20 40 20 5b 69 66 61 70 70 65 6e 64 20 63 @ [ifappend c
3b60: 6f 6d 6d 65 6e 74 5d 0a 20 20 20 20 40 20 20 20 omment]. @
3b70: 4e 65 77 20 52 65 6d 61 72 6b 73 3a 3c 62 72 3e New Remarks:<br>
3b80: 0a 20 20 20 20 40 20 20 20 5b 61 70 70 65 6e 64 . @ [append
3b90: 77 69 64 67 65 74 20 63 6f 6d 6d 65 6e 74 5d 0a widget comment].
3ba0: 20 20 20 20 40 20 5b 65 6c 73 65 5d 0a 20 20 20 @ [else].
3bb0: 20 40 20 20 20 44 65 73 63 72 69 70 74 69 6f 6e @ Description
3bc0: 20 41 6e 64 20 43 6f 6d 6d 65 6e 74 73 3a 3c 62 And Comments:<b
3bd0: 72 3e 0a 20 20 20 20 40 20 20 20 5b 65 6e 74 72 r>. @ [entr
3be0: 79 77 69 64 67 65 74 20 63 6f 6d 6d 65 6e 74 5d ywidget comment]
3bf0: 0a 20 20 20 20 40 20 5b 65 6e 64 69 66 5d 0a 20 . @ [endif].
3c00: 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a @ </td></tr>.
3c10: 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c @ <tr><td al
3c20: 69 67 6e 3d 22 72 69 67 68 74 22 3e 3c 2f 74 64 ign="right"></td
3c30: 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 73 75 62 ><td>. @ [sub
3c40: 6d 69 74 62 75 74 74 6f 6e 5d 0a 20 20 20 20 40 mitbutton]. @
3c50: 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 </td></tr>.
3c60: 40 20 3c 2f 74 61 62 6c 65 3e 0a 20 20 20 20 40 @ </table>. @
3c70: 20 45 4e 44 2d 4f 46 2d 45 44 49 54 2d 54 45 4d END-OF-EDIT-TEM
3c80: 50 4c 41 54 45 0a 20 20 20 20 40 20 23 23 23 23 PLATE. @ ####
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 23 23 23 ################
3cd0: 23 23 0a 20 20 20 20 40 20 74 65 6d 70 6c 61 74 ##. @ templat
3ce0: 65 20 76 69 65 77 20 45 4e 44 2d 4f 46 2d 56 49 e view END-OF-VI
3cf0: 45 57 2d 54 45 4d 50 4c 41 54 45 0a 20 20 20 20 EW-TEMPLATE.
3d00: 40 20 3c 74 61 62 6c 65 20 63 65 6c 6c 70 61 64 @ <table cellpad
3d10: 64 69 6e 67 3d 22 35 22 3e 0a 20 20 20 20 40 20 ding="5">. @
3d20: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 <tr><td align="r
3d30: 69 67 68 74 22 3e 54 69 74 6c 65 3a 3c 2f 74 64 ight">Title:</td
3d40: 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 ><td>. @ [vie
3d50: 77 77 69 64 67 65 74 20 74 69 74 6c 65 5d 0a 20 wwidget title].
3d60: 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a @ </td></tr>.
3d70: 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 61 6c @ <tr><td al
3d80: 69 67 6e 3d 22 72 69 67 68 74 22 3e 53 74 61 74 ign="right">Stat
3d90: 75 73 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 us:</td><td>.
3da0: 20 40 20 5b 76 69 65 77 77 69 64 67 65 74 20 73 @ [viewwidget s
3db0: 74 61 74 75 73 5d 0a 20 20 20 20 40 20 3c 2f 74 tatus]. @ </t
3dc0: 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 d></tr>. @ <t
3dd0: 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 r><td align="rig
3de0: 68 74 22 3e 54 79 70 65 3a 3c 2f 74 64 3e 3c 74 ht">Type:</td><t
3df0: 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 77 77 69 d>. @ [viewwi
3e00: 64 67 65 74 20 74 79 70 65 5d 0a 20 20 20 20 40 dget type]. @
3e10: 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 </td></tr>.
3e20: 40 20 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d @ <tr><td align=
3e30: 22 72 69 67 68 74 22 3e 53 65 76 65 72 69 74 79 "right">Severity
3e40: 3a 3c 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 :</td><td>. @
3e50: 20 5b 76 69 65 77 77 69 64 67 65 74 20 73 65 76 [viewwidget sev
3e60: 65 72 69 74 79 5d 0a 20 20 20 20 40 20 3c 2f 74 erity]. @ </t
3e70: 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 d></tr>. @ <t
3e80: 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 r><td align="rig
3e90: 68 74 22 3e 50 72 69 6f 72 69 74 79 3a 3c 2f 74 ht">Priority:</t
3ea0: 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 d><td>. @ [vi
3eb0: 65 77 77 69 64 67 65 74 20 70 72 69 6f 72 69 74 ewwidget priorit
3ec0: 79 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f y]. @ </td></
3ed0: 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 tr>. @ <tr><t
3ee0: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
3ef0: 52 65 73 6f 6c 75 74 69 6f 6e 3a 3c 2f 74 64 3e Resolution:</td>
3f00: 3c 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 77 <td>. @ [view
3f10: 77 69 64 67 65 74 20 72 65 73 6f 6c 75 74 69 6f widget resolutio
3f20: 6e 5d 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f n]. @ </td></
3f30: 74 72 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 tr>. @ <tr><t
3f40: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
3f50: 53 75 62 73 79 73 74 65 6d 3a 3c 2f 74 64 3e 3c Subsystem:</td><
3f60: 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 77 77 td>. @ [vieww
3f70: 69 64 67 65 74 20 73 75 62 73 79 73 74 65 6d 5d idget subsystem]
3f80: 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 . @ </td></tr
3f90: 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 >. @ <tr><td
3fa0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 41 73 align="right">As
3fb0: 73 69 67 6e 65 64 26 6e 62 73 70 3b 54 6f 3a 3c signed To:<
3fc0: 2f 74 64 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b /td><td>. @ [
3fd0: 76 69 65 77 77 69 64 67 65 74 20 61 73 73 69 67 viewwidget assig
3fe0: 6e 65 64 74 6f 5d 0a 20 20 20 20 40 20 3c 2f 74 nedto]. @ </t
3ff0: 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 3c 74 d></tr>. @ <t
4000: 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 r><td align="rig
4010: 68 74 22 3e 43 6f 6e 74 61 63 74 3a 3c 2f 74 64 ht">Contact:</td
4020: 3e 3c 74 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 ><td>. @ [vie
4030: 77 77 69 64 67 65 74 20 63 6f 6e 74 61 63 74 5d wwidget contact]
4040: 0a 20 20 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 . @ </td></tr
4050: 3e 0a 20 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 >. @ <tr><td
4060: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 56 65 align="right">Ve
4070: 72 73 69 6f 6e 26 6e 62 73 70 3b 46 6f 75 6e 64 rsion Found
4080: 26 6e 62 73 70 3b 49 6e 3a 3c 2f 74 64 3e 3c 74 In:</td><t
4090: 64 3e 0a 20 20 20 20 40 20 5b 76 69 65 77 77 69 d>. @ [viewwi
40a0: 64 67 65 74 20 66 6f 75 6e 64 69 6e 5d 0a 20 20 dget foundin].
40b0: 20 20 40 20 3c 2f 74 64 3e 3c 2f 74 72 3e 0a 20 @ </td></tr>.
40c0: 20 20 20 40 20 3c 74 72 3e 3c 74 64 20 63 6f 6c @ <tr><td col
40d0: 73 70 61 6e 3d 22 32 22 3e 0a 20 20 20 20 40 20 span="2">. @
40e0: 44 65 73 63 72 69 70 74 69 6f 6e 20 41 6e 64 20 Description And
40f0: 43 6f 6d 6d 65 6e 74 73 3a 3c 62 72 3e 0a 20 20 Comments:<br>.
4100: 20 20 40 20 5b 76 69 65 77 77 69 64 67 65 74 20 @ [viewwidget
4110: 63 6f 6d 6d 65 6e 74 5d 0a 20 20 20 20 40 20 3c comment]. @ <
4120: 2f 74 64 3e 3c 2f 74 72 3e 0a 20 20 20 20 40 20 /td></tr>. @
4130: 3c 2f 74 61 62 6c 65 3e 0a 20 20 20 20 40 20 45 </table>. @ E
4140: 4e 44 2d 4f 46 2d 56 49 45 57 2d 54 45 4d 50 4c ND-OF-VIEW-TEMPL
4150: 41 54 45 0a 20 20 3b 0a 20 20 42 6c 6f 62 20 63 ATE. ;. Blob c
4160: 6f 6e 66 69 67 2c 20 65 72 72 6d 73 67 3b 0a 20 onfig, errmsg;.
4170: 20 62 6c 6f 62 5f 69 6e 69 74 28 26 63 6f 6e 66 blob_init(&conf
4180: 69 67 2c 20 7a 44 65 66 61 75 6c 74 43 6f 6e 66 ig, zDefaultConf
4190: 69 67 2c 20 73 69 7a 65 6f 66 28 7a 44 65 66 61 ig, sizeof(zDefa
41a0: 75 6c 74 43 6f 6e 66 69 67 29 2d 31 29 3b 0a 20 ultConfig)-1);.
41b0: 20 64 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 db_begin_transa
41c0: 63 74 69 6f 6e 28 29 3b 0a 20 20 62 6c 6f 62 5f ction();. blob_
41d0: 7a 65 72 6f 28 26 65 72 72 6d 73 67 29 3b 0a 20 zero(&errmsg);.
41e0: 20 74 69 63 6b 65 74 5f 63 6f 6e 66 69 67 5f 70 ticket_config_p
41f0: 61 72 73 65 28 26 63 6f 6e 66 69 67 2c 20 30 2c arse(&config, 0,
4200: 20 26 65 72 72 6d 73 67 29 3b 0a 20 20 69 66 28 &errmsg);. if(
4210: 20 62 6c 6f 62 5f 73 69 7a 65 28 26 65 72 72 6d blob_size(&errm
4220: 73 67 29 20 29 7b 0a 20 20 20 20 66 6f 73 73 69 sg) ){. fossi
4230: 6c 5f 66 61 74 61 6c 28 22 25 62 22 2c 20 26 65 l_fatal("%b", &e
4240: 72 72 6d 73 67 29 3b 0a 20 20 7d 0a 20 20 64 62 rrmsg);. }. db
4250: 5f 65 6e 64 5f 74 72 61 6e 73 61 63 74 69 6f 6e _end_transaction
4260: 28 30 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 52 65 (0);.}../*.** Re
4270: 74 75 72 6e 20 74 68 65 20 6c 65 6e 67 74 68 20 turn the length
4280: 6f 66 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 of a string with
4290: 6f 75 74 20 69 74 73 20 74 72 61 69 6c 69 6e 67 out its trailing
42a0: 20 77 68 69 74 65 73 70 61 63 65 2e 0a 2a 2f 0a whitespace..*/.
42b0: 73 74 61 74 69 63 20 69 6e 74 20 6e 6f 6e 5f 77 static int non_w
42c0: 68 69 74 65 73 70 61 63 65 5f 6c 65 6e 67 74 68 hitespace_length
42d0: 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 29 7b (const char *z){
42e0: 0a 20 20 69 6e 74 20 6e 20 3d 20 73 74 72 6c 65 . int n = strle
42f0: 6e 28 7a 29 3b 0a 20 20 77 68 69 6c 65 28 20 6e n(z);. while( n
4300: 3e 30 20 26 26 20 69 73 73 70 61 63 65 28 7a 5b >0 && isspace(z[
4310: 6e 2d 31 5d 29 20 29 7b 20 6e 2d 2d 3b 20 7d 0a n-1]) ){ n--; }.
4320: 20 20 72 65 74 75 72 6e 20 6e 3b 0a 7d 0a 0a 2f return n;.}../
4330: 2a 0a 2a 2a 20 46 69 6c 6c 20 74 68 65 20 67 69 *.** Fill the gi
4340: 76 65 6e 20 42 6c 6f 62 20 77 69 74 68 20 74 65 ven Blob with te
4350: 78 74 20 74 68 61 74 20 64 65 73 63 72 69 62 65 xt that describe
4360: 73 20 74 68 65 20 63 75 72 72 65 6e 74 0a 2a 2a s the current.**
4370: 20 74 69 63 6b 65 74 20 63 6f 6e 66 69 67 75 72 ticket configur
4380: 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 69 73 20 ation. This is
4390: 74 68 65 20 69 6e 76 65 72 73 65 20 6f 66 20 74 the inverse of t
43a0: 69 63 6b 65 74 5f 63 6f 6e 66 69 67 5f 70 61 72 icket_config_par
43b0: 73 65 28 29 0a 2a 2f 0a 76 6f 69 64 20 74 69 63 se().*/.void tic
43c0: 6b 65 74 5f 63 6f 6e 66 69 67 5f 72 65 6e 64 65 ket_config_rende
43d0: 72 28 42 6c 6f 62 20 2a 70 4f 75 74 29 7b 0a 20 r(Blob *pOut){.
43e0: 20 63 68 61 72 20 2a 7a 44 65 6c 69 6d 3b 0a 20 char *zDelim;.
43f0: 20 63 68 61 72 20 2a 7a 43 6f 6e 74 65 6e 74 3b char *zContent;
4400: 0a 20 20 53 74 6d 74 20 71 3b 0a 20 20 69 6e 74 . Stmt q;. int
4410: 20 6e 3b 0a 0a 20 20 62 6c 6f 62 5f 61 70 70 65 n;.. blob_appe
4420: 6e 64 66 28 70 4f 75 74 2c 20 22 74 69 63 6b 65 ndf(pOut, "ticke
4430: 74 2d 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5c t-configuration\
4440: 6e 22 29 3b 0a 20 20 7a 44 65 6c 69 6d 20 3d 20 n");. zDelim =
4450: 64 62 5f 74 65 78 74 28 30 2c 20 22 53 45 4c 45 db_text(0, "SELE
4460: 43 54 20 27 2d 2d 65 6e 64 2d 6f 66 2d 74 65 78 CT '--end-of-tex
4470: 74 2d 2d 27 20 7c 7c 20 68 65 78 28 72 61 6e 64 t--' || hex(rand
4480: 6f 6d 28 32 30 29 29 22 29 3b 0a 20 20 62 6c 6f om(20))");. blo
4490: 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 b_appendf(pOut,
44a0: 22 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 23 ################
44d0: 23 23 23 23 5c 6e 22 29 3b 0a 20 20 64 62 5f 70 ####\n");. db_p
44e0: 72 65 70 61 72 65 28 26 71 2c 20 22 53 45 4c 45 repare(&q, "SELE
44f0: 43 54 20 6e 61 6d 65 2c 20 74 79 70 65 2c 20 77 CT name, type, w
4500: 69 64 74 68 2c 20 61 72 67 20 46 52 4f 4d 20 74 idth, arg FROM t
4510: 6b 74 66 69 65 6c 64 22 29 3b 0a 20 20 77 68 69 ktfield");. whi
4520: 6c 65 28 20 64 62 5f 73 74 65 70 28 26 71 29 3d le( db_step(&q)=
4530: 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20 =SQLITE_ROW ){.
4540: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a const char *z
4550: 4e 61 6d 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e Name = db_column
4560: 5f 74 65 78 74 28 26 71 2c 20 30 29 3b 0a 20 20 _text(&q, 0);.
4570: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 54 const char *zT
4580: 79 70 65 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f ype = db_column_
4590: 74 65 78 74 28 26 71 2c 20 31 29 3b 0a 20 20 20 text(&q, 1);.
45a0: 20 69 6e 74 20 77 69 64 74 68 20 3d 20 64 62 5f int width = db_
45b0: 63 6f 6c 75 6d 6e 5f 69 6e 74 28 26 71 2c 20 32 column_int(&q, 2
45c0: 29 3b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 );. const cha
45d0: 72 20 2a 7a 41 72 67 20 3d 20 64 62 5f 63 6f 6c r *zArg = db_col
45e0: 75 6d 6e 5f 74 65 78 74 28 26 71 2c 20 33 29 3b umn_text(&q, 3);
45f0: 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 . blob_append
4600: 66 28 70 4f 75 74 2c 20 22 66 69 65 6c 64 20 25 f(pOut, "field %
4610: 73 20 25 73 20 25 64 20 25 73 5c 6e 22 2c 20 7a s %s %d %s\n", z
4620: 4e 61 6d 65 2c 20 7a 54 79 70 65 2c 20 77 69 64 Name, zType, wid
4630: 74 68 2c 20 7a 41 72 67 29 3b 0a 20 20 7d 0a 20 th, zArg);. }.
4640: 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 26 71 29 db_finalize(&q)
4650: 3b 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 ;. blob_appendf
4660: 28 70 4f 75 74 2c 20 22 23 23 23 23 23 23 23 23 (pOut, "########
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 23 23 23 23 23 5c 6e 22 29 3b ###########\n");
46a0: 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 . blob_appendf(
46b0: 70 4f 75 74 2c 20 22 74 65 6d 70 6c 61 74 65 20 pOut, "template
46c0: 6e 65 77 20 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 new %s\n", zDeli
46d0: 6d 29 3b 0a 20 20 7a 43 6f 6e 74 65 6e 74 20 3d m);. zContent =
46e0: 20 64 62 5f 67 65 74 28 22 74 6b 74 2d 6e 65 77 db_get("tkt-new
46f0: 2d 74 65 6d 70 6c 61 74 65 22 2c 20 30 29 3b 0a -template", 0);.
4700: 20 20 69 66 28 20 7a 43 6f 6e 74 65 6e 74 20 29 if( zContent )
4710: 7b 0a 20 20 20 20 6e 20 3d 20 6e 6f 6e 5f 77 68 {. n = non_wh
4720: 69 74 65 73 70 61 63 65 5f 6c 65 6e 67 74 68 28 itespace_length(
4730: 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 20 62 zContent);. b
4740: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 lob_appendf(pOut
4750: 2c 20 22 25 2e 2a 73 5c 6e 22 2c 20 6e 2c 20 7a , "%.*s\n", n, z
4760: 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 20 66 72 Content);. fr
4770: 65 65 28 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 ee(zContent);.
4780: 7d 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 }. blob_appendf
4790: 28 70 4f 75 74 2c 20 22 25 73 5c 6e 22 2c 20 7a (pOut, "%s\n", z
47a0: 44 65 6c 69 6d 29 3b 0a 20 20 62 6c 6f 62 5f 61 Delim);. blob_a
47b0: 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 23 23 ppendf(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 23 23 23 23 ################
47f0: 23 5c 6e 22 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 #\n");. blob_ap
4800: 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 74 65 6d pendf(pOut, "tem
4810: 70 6c 61 74 65 20 65 64 69 74 20 25 73 5c 6e 22 plate edit %s\n"
4820: 2c 20 7a 44 65 6c 69 6d 29 3b 0a 20 20 7a 43 6f , zDelim);. zCo
4830: 6e 74 65 6e 74 20 3d 20 64 62 5f 67 65 74 28 22 ntent = db_get("
4840: 74 6b 74 2d 65 64 69 74 2d 74 65 6d 70 6c 61 74 tkt-edit-templat
4850: 65 22 2c 20 30 29 3b 0a 20 20 69 66 28 20 7a 43 e", 0);. if( zC
4860: 6f 6e 74 65 6e 74 20 29 7b 0a 20 20 20 20 6e 20 ontent ){. n
4870: 3d 20 6e 6f 6e 5f 77 68 69 74 65 73 70 61 63 65 = non_whitespace
4880: 5f 6c 65 6e 67 74 68 28 7a 43 6f 6e 74 65 6e 74 _length(zContent
4890: 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 );. blob_appe
48a0: 6e 64 66 28 70 4f 75 74 2c 20 22 25 2e 2a 73 5c ndf(pOut, "%.*s\
48b0: 6e 22 2c 20 6e 2c 20 7a 43 6f 6e 74 65 6e 74 29 n", n, zContent)
48c0: 3b 0a 20 20 20 20 66 72 65 65 28 7a 43 6f 6e 74 ;. free(zCont
48d0: 65 6e 74 29 3b 0a 20 20 7d 0a 20 20 62 6c 6f 62 ent);. }. blob
48e0: 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 _appendf(pOut, "
48f0: 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 6d 29 3b 0a %s\n", zDelim);.
4900: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 blob_appendf(p
4910: 4f 75 74 2c 20 22 23 23 23 23 23 23 23 23 23 23 Out, "##########
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 23 23 23 23 23 5c 6e 22 29 3b 0a 20 #########\n");.
4950: 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f blob_appendf(pO
4960: 75 74 2c 20 22 74 65 6d 70 6c 61 74 65 20 76 69 ut, "template vi
4970: 65 77 20 25 73 5c 6e 22 2c 20 7a 44 65 6c 69 6d ew %s\n", zDelim
4980: 29 3b 0a 20 20 7a 43 6f 6e 74 65 6e 74 20 3d 20 );. zContent =
4990: 64 62 5f 67 65 74 28 22 74 6b 74 2d 76 69 65 77 db_get("tkt-view
49a0: 2d 74 65 6d 70 6c 61 74 65 22 2c 20 30 29 3b 0a -template", 0);.
49b0: 20 20 69 66 28 20 7a 43 6f 6e 74 65 6e 74 20 29 if( zContent )
49c0: 7b 0a 20 20 20 20 6e 20 3d 20 6e 6f 6e 5f 77 68 {. n = non_wh
49d0: 69 74 65 73 70 61 63 65 5f 6c 65 6e 67 74 68 28 itespace_length(
49e0: 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 20 62 zContent);. b
49f0: 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 lob_appendf(pOut
4a00: 2c 20 22 25 2e 2a 73 5c 6e 22 2c 20 6e 2c 20 7a , "%.*s\n", n, z
4a10: 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 20 20 66 72 Content);. fr
4a20: 65 65 28 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 ee(zContent);.
4a30: 7d 0a 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 }. blob_appendf
4a40: 28 70 4f 75 74 2c 20 22 25 73 5c 6e 22 2c 20 7a (pOut, "%s\n", z
4a50: 44 65 6c 69 6d 29 3b 0a 20 20 62 6c 6f 62 5f 61 Delim);. blob_a
4a60: 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 23 23 ppendf(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 23 23 23 23 ################
4aa0: 23 5c 6e 22 29 3b 0a 20 20 62 6c 6f 62 5f 61 70 #\n");. blob_ap
4ab0: 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 64 65 73 pendf(pOut, "des
4ac0: 63 72 69 70 74 69 6f 6e 20 25 73 5c 6e 22 2c 20 cription %s\n",
4ad0: 7a 44 65 6c 69 6d 29 3b 0a 20 20 7a 43 6f 6e 74 zDelim);. zCont
4ae0: 65 6e 74 20 3d 20 64 62 5f 67 65 74 28 22 74 6b ent = db_get("tk
4af0: 74 2d 64 65 73 63 22 2c 20 30 29 3b 0a 20 20 69 t-desc", 0);. i
4b00: 66 28 20 7a 43 6f 6e 74 65 6e 74 20 29 7b 0a 20 f( zContent ){.
4b10: 20 20 20 6e 20 3d 20 6e 6f 6e 5f 77 68 69 74 65 n = non_white
4b20: 73 70 61 63 65 5f 6c 65 6e 67 74 68 28 7a 43 6f space_length(zCo
4b30: 6e 74 65 6e 74 29 3b 0a 20 20 20 20 62 6c 6f 62 ntent);. blob
4b40: 5f 61 70 70 65 6e 64 66 28 70 4f 75 74 2c 20 22 _appendf(pOut, "
4b50: 25 2e 2a 73 5c 6e 22 2c 20 6e 2c 20 7a 43 6f 6e %.*s\n", n, zCon
4b60: 74 65 6e 74 29 3b 0a 20 20 20 20 66 72 65 65 28 tent);. free(
4b70: 7a 43 6f 6e 74 65 6e 74 29 3b 0a 20 20 7d 0a 20 zContent);. }.
4b80: 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70 4f blob_appendf(pO
4b90: 75 74 2c 20 22 25 73 5c 6e 22 2c 20 7a 44 65 6c ut, "%s\n", zDel
4ba0: 69 6d 29 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 43 4f im);.}../*.** CO
4bb0: 4d 4d 41 4e 44 3a 20 74 65 73 74 2d 74 6b 74 63 MMAND: test-tktc
4bc0: 6f 6e 66 69 67 2d 65 78 70 6f 72 74 0a 2a 2a 20 onfig-export.**
4bd0: 57 72 69 74 65 20 74 68 65 20 63 75 72 72 65 6e Write the curren
4be0: 74 20 74 69 63 6b 65 74 20 63 6f 6e 66 69 67 75 t ticket configu
4bf0: 72 61 74 69 6f 6e 20 6f 75 74 20 74 6f 20 61 20 ration out to a
4c00: 66 69 6c 65 2e 0a 2a 2f 0a 76 6f 69 64 20 74 6b file..*/.void tk
4c10: 74 63 6f 6e 66 69 67 5f 72 65 6e 64 65 72 5f 63 tconfig_render_c
4c20: 6d 64 28 76 6f 69 64 29 7b 0a 20 20 42 6c 6f 62 md(void){. Blob
4c30: 20 63 6f 6e 66 69 67 3b 0a 0a 20 20 64 62 5f 6d config;.. db_m
4c40: 75 73 74 5f 62 65 5f 77 69 74 68 69 6e 5f 74 72 ust_be_within_tr
4c50: 65 65 28 29 3b 0a 20 20 69 66 28 20 67 2e 61 72 ee();. if( g.ar
4c60: 67 63 21 3d 33 20 29 7b 0a 20 20 20 20 75 73 61 gc!=3 ){. usa
4c70: 67 65 28 22 46 49 4c 45 4e 41 4d 45 22 29 3b 0a ge("FILENAME");.
4c80: 20 20 7d 0a 20 20 62 6c 6f 62 5f 7a 65 72 6f 28 }. blob_zero(
4c90: 26 63 6f 6e 66 69 67 29 3b 0a 20 20 74 69 63 6b &config);. tick
4ca0: 65 74 5f 63 6f 6e 66 69 67 5f 72 65 6e 64 65 72 et_config_render
4cb0: 28 26 63 6f 6e 66 69 67 29 3b 0a 20 20 62 6c 6f (&config);. blo
4cc0: 62 5f 77 72 69 74 65 5f 74 6f 5f 66 69 6c 65 28 b_write_to_file(
4cd0: 26 63 6f 6e 66 69 67 2c 20 67 2e 61 72 67 76 5b &config, g.argv[
4ce0: 32 5d 29 3b 0a 20 20 62 6c 6f 62 5f 72 65 73 65 2]);. blob_rese
4cf0: 74 28 26 63 6f 6e 66 69 67 29 3b 0a 7d 0a t(&config);.}.