Hex Artifact Content
Not logged in

Artifact ebeebd8a01ccc3945857af98118d78b85f68619a:

File src/configure.c part of check-in [86db6fa150] - Split of the ticket configuratio into separately editable pieces. by drh on 2008-05-28 15:29:16.

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 38 20 44 2e 20 52 69 63 68  (c) 2008 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 6d 61 6e 61 67 65 20 72 65  sed to manage re
0390: 70 6f 73 69 74 6f 72 79 20 63 6f 6e 66 69 67 75  pository configu
03a0: 72 61 74 69 6f 6e 73 2e 0a 2a 2a 20 42 79 20 22  rations..** By "
03b0: 72 65 73 70 6f 6e 73 69 74 6f 72 79 20 63 6f 6e  responsitory con
03c0: 66 69 67 75 72 65 22 20 77 65 20 6d 65 61 6e 20  figure" we mean 
03d0: 74 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20  the local state 
03e0: 6f 66 20 61 20 72 65 70 6f 73 69 74 6f 72 79 0a  of a repository.
03f0: 2a 2a 20 64 69 73 74 69 6e 63 74 20 66 72 6f 6d  ** distinct from
0400: 20 74 68 65 20 76 65 72 73 69 6f 6e 65 64 20 66   the versioned f
0410: 69 6c 65 73 2e 0a 2a 2f 0a 23 69 6e 63 6c 75 64  iles..*/.#includ
0420: 65 20 22 63 6f 6e 66 69 67 2e 68 22 0a 23 69 6e  e "config.h".#in
0430: 63 6c 75 64 65 20 22 63 6f 6e 66 69 67 75 72 65  clude "configure
0440: 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 61 73  .h".#include <as
0450: 73 65 72 74 2e 68 3e 0a 0a 23 69 66 20 49 4e 54  sert.h>..#if INT
0460: 45 52 46 41 43 45 0a 2f 2a 0a 2a 2a 20 43 6f 6e  ERFACE./*.** Con
0470: 66 69 67 75 72 61 74 69 6f 6e 20 74 72 61 6e 73  figuration trans
0480: 66 65 72 73 20 6f 63 63 75 72 20 69 6e 20 67 72  fers occur in gr
0490: 6f 75 70 73 2e 20 20 54 68 65 73 65 20 61 72 65  oups.  These are
04a0: 20 74 68 65 20 61 6c 6c 6f 77 65 64 0a 2a 2a 20   the allowed.** 
04b0: 67 72 6f 75 70 69 6e 67 73 3a 0a 2a 2f 0a 23 64  groupings:.*/.#d
04c0: 65 66 69 6e 65 20 43 4f 4e 46 49 47 53 45 54 5f  efine CONFIGSET_
04d0: 53 4b 49 4e 20 20 20 30 78 30 30 30 30 30 31 20  SKIN   0x000001 
04e0: 20 20 20 20 2f 2a 20 57 57 57 20 69 6e 74 65 72      /* WWW inter
04f0: 66 61 63 65 20 61 70 70 65 61 72 61 6e 63 65 20  face appearance 
0500: 2a 2f 0a 23 64 65 66 69 6e 65 20 43 4f 4e 46 49  */.#define CONFI
0510: 47 53 45 54 5f 54 4b 54 20 20 20 20 30 78 30 30  GSET_TKT    0x00
0520: 30 30 30 32 20 20 20 20 20 2f 2a 20 54 69 63 6b  0002     /* Tick
0530: 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  et configuration
0540: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 43 4f 4e 46   */.#define CONF
0550: 49 47 53 45 54 5f 50 52 4f 4a 20 20 20 30 78 30  IGSET_PROJ   0x0
0560: 30 30 30 30 34 20 20 20 20 20 2f 2a 20 50 72 6f  00004     /* Pro
0570: 6a 65 63 74 20 6e 61 6d 65 20 2a 2f 0a 0a 23 64  ject name */..#d
0580: 65 66 69 6e 65 20 43 4f 4e 46 49 47 53 45 54 5f  efine CONFIGSET_
0590: 41 4c 4c 20 20 20 20 30 78 66 66 66 66 66 66 20  ALL    0xffffff 
05a0: 20 20 20 20 2f 2a 20 45 76 65 72 79 74 68 69 6e      /* Everythin
05b0: 67 20 2a 2f 0a 0a 23 65 6e 64 69 66 20 2f 2a 20  g */..#endif /* 
05c0: 49 4e 54 45 52 46 41 43 45 20 2a 2f 0a 0a 2f 2a  INTERFACE */../*
05d0: 0a 2a 2a 20 4e 61 6d 65 73 20 6f 66 20 74 68 65  .** Names of the
05e0: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 73   configuration s
05f0: 65 74 73 0a 2a 2f 0a 73 74 61 74 69 63 20 73 74  ets.*/.static st
0600: 72 75 63 74 20 7b 0a 20 20 63 6f 6e 73 74 20 63  ruct {.  const c
0610: 68 61 72 20 2a 7a 4e 61 6d 65 3b 20 20 20 2f 2a  har *zName;   /*
0620: 20 4e 61 6d 65 20 6f 66 20 74 68 65 20 63 6f 6e   Name of the con
0630: 66 69 67 75 72 61 74 69 6f 6e 20 73 65 74 20 2a  figuration set *
0640: 2f 0a 20 20 69 6e 74 20 67 72 6f 75 70 4d 61 73  /.  int groupMas
0650: 6b 3b 20 20 20 20 20 20 20 2f 2a 20 4d 61 73 6b  k;       /* Mask
0660: 20 66 6f 72 20 74 68 61 74 20 63 6f 6e 66 69 67   for that config
0670: 75 72 61 74 69 6f 6e 20 73 65 74 20 2a 2f 0a 7d  uration set */.}
0680: 20 61 47 72 6f 75 70 4e 61 6d 65 5b 5d 20 3d 20   aGroupName[] = 
0690: 7b 0a 20 20 7b 20 22 73 6b 69 6e 22 2c 20 20 20  {.  { "skin",   
06a0: 20 20 20 20 20 20 43 4f 4e 46 49 47 53 45 54 5f        CONFIGSET_
06b0: 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74 69 63  SKIN },.  { "tic
06c0: 6b 65 74 22 2c 20 20 20 20 20 20 20 43 4f 4e 46  ket",       CONF
06d0: 49 47 53 45 54 5f 54 4b 54 20 20 7d 2c 0a 20 20  IGSET_TKT  },.  
06e0: 7b 20 22 70 72 6f 6a 65 63 74 22 2c 20 20 20 20  { "project",    
06f0: 20 20 43 4f 4e 46 49 47 53 45 54 5f 50 52 4f 4a    CONFIGSET_PROJ
0700: 20 7d 2c 0a 20 20 7b 20 22 61 6c 6c 22 2c 20 20   },.  { "all",  
0710: 20 20 20 20 20 20 20 20 43 4f 4e 46 49 47 53 45          CONFIGSE
0720: 54 5f 41 4c 4c 20 20 7d 2c 0a 7d 3b 0a 0a 0a 2f  T_ALL  },.};.../
0730: 2a 0a 2a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69  *.** The followi
0740: 6e 67 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20  ng is a list of 
0750: 73 65 74 74 69 6e 67 73 20 74 68 61 74 20 77 65  settings that we
0760: 20 61 72 65 20 77 69 6c 6c 69 6e 67 20 74 6f 0a   are willing to.
0770: 2a 2a 20 74 72 61 6e 73 66 65 72 2e 0a 2a 2f 0a  ** transfer..*/.
0780: 73 74 61 74 69 63 20 73 74 72 75 63 74 20 7b 0a  static struct {.
0790: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e    const char *zN
07a0: 61 6d 65 3b 20 20 20 2f 2a 20 4e 61 6d 65 20 6f  ame;   /* Name o
07b0: 66 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74  f the configurat
07c0: 69 6f 6e 20 70 61 72 61 6d 65 74 65 72 20 2a 2f  ion parameter */
07d0: 0a 20 20 69 6e 74 20 67 72 6f 75 70 4d 61 73 6b  .  int groupMask
07e0: 3b 20 20 20 20 20 20 20 2f 2a 20 57 68 69 63 68  ;       /* Which
07f0: 20 63 6f 6e 66 69 67 20 67 72 6f 75 70 73 20 69   config groups i
0800: 73 20 69 74 20 70 61 72 74 20 6f 66 20 2a 2f 0a  s it part of */.
0810: 7d 20 61 43 6f 6e 66 69 67 5b 5d 20 3d 20 7b 0a  } aConfig[] = {.
0820: 20 20 7b 20 22 63 73 73 22 2c 20 20 20 20 20 20    { "css",      
0830: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e               CON
0840: 46 49 47 53 45 54 5f 53 4b 49 4e 20 7d 2c 0a 20  FIGSET_SKIN },. 
0850: 20 7b 20 22 68 65 61 64 65 72 22 2c 20 20 20 20   { "header",    
0860: 20 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e 46              CONF
0870: 49 47 53 45 54 5f 53 4b 49 4e 20 7d 2c 0a 20 20  IGSET_SKIN },.  
0880: 7b 20 22 66 6f 6f 74 65 72 22 2c 20 20 20 20 20  { "footer",     
0890: 20 20 20 20 20 20 20 20 20 20 20 43 4f 4e 46 49             CONFI
08a0: 47 53 45 54 5f 53 4b 49 4e 20 7d 2c 0a 20 20 7b  GSET_SKIN },.  {
08b0: 20 22 70 72 6f 6a 65 63 74 2d 6e 61 6d 65 22 2c   "project-name",
08c0: 20 20 20 20 20 20 20 20 20 20 43 4f 4e 46 49 47            CONFIG
08d0: 53 45 54 5f 50 52 4f 4a 20 7d 2c 0a 20 20 7b 20  SET_PROJ },.  { 
08e0: 22 70 72 6f 6a 65 63 74 2d 64 65 73 63 72 69 70  "project-descrip
08f0: 74 69 6f 6e 22 2c 20 20 20 43 4f 4e 46 49 47 53  tion",   CONFIGS
0900: 45 54 5f 50 52 4f 4a 20 7d 2c 0a 20 20 7b 20 22  ET_PROJ },.  { "
0910: 69 6e 64 65 78 2d 70 61 67 65 22 2c 20 20 20 20  index-page",    
0920: 20 20 20 20 20 20 20 20 43 4f 4e 46 49 47 53 45          CONFIGSE
0930: 54 5f 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74  T_SKIN },.  { "t
0940: 69 6d 65 6c 69 6e 65 2d 62 6c 6f 63 6b 2d 6d 61  imeline-block-ma
0950: 72 6b 75 70 22 2c 20 43 4f 4e 46 49 47 53 45 54  rkup", CONFIGSET
0960: 5f 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74 69  _SKIN },.  { "ti
0970: 6d 65 6c 69 6e 65 2d 6d 61 78 2d 63 6f 6d 6d 65  meline-max-comme
0980: 6e 74 22 2c 20 20 43 4f 4e 46 49 47 53 45 54 5f  nt",  CONFIGSET_
0990: 53 4b 49 4e 20 7d 2c 0a 20 20 7b 20 22 74 69 63  SKIN },.  { "tic
09a0: 6b 65 74 2d 74 61 62 6c 65 22 2c 20 20 20 20 20  ket-table",     
09b0: 20 20 20 20 20 43 4f 4e 46 49 47 53 45 54 5f 54       CONFIGSET_T
09c0: 4b 54 20 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b  KT  },.  { "tick
09d0: 65 74 2d 63 6f 6d 6d 6f 6e 22 2c 20 20 20 20 20  et-common",     
09e0: 20 20 20 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b      CONFIGSET_TK
09f0: 54 20 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65  T  },.  { "ticke
0a00: 74 2d 6e 65 77 70 61 67 65 22 2c 20 20 20 20 20  t-newpage",     
0a10: 20 20 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54     CONFIGSET_TKT
0a20: 20 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65 74    },.  { "ticket
0a30: 2d 76 69 65 77 70 61 67 65 22 2c 20 20 20 20 20  -viewpage",     
0a40: 20 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54 20    CONFIGSET_TKT 
0a50: 20 7d 2c 0a 20 20 7b 20 22 74 69 63 6b 65 74 2d   },.  { "ticket-
0a60: 65 64 69 74 70 61 67 65 22 2c 20 20 20 20 20 20  editpage",      
0a70: 20 43 4f 4e 46 49 47 53 45 54 5f 54 4b 54 20 20   CONFIGSET_TKT  
0a80: 7d 2c 0a 7d 3b 0a 73 74 61 74 69 63 20 69 6e 74  },.};.static int
0a90: 20 69 43 6f 6e 66 69 67 20 3d 20 30 3b 0a 0a 2f   iConfig = 0;../
0aa0: 2a 0a 2a 2a 20 52 65 74 75 72 6e 20 6e 61 6d 65  *.** Return name
0ab0: 20 6f 66 20 66 69 72 73 74 20 63 6f 6e 66 69 67   of first config
0ac0: 75 72 61 74 69 6f 6e 20 70 72 6f 70 65 72 74 79  uration property
0ad0: 20 6d 61 74 63 68 69 6e 67 20 74 68 65 20 67 69   matching the gi
0ae0: 76 65 6e 20 6d 61 73 6b 2e 0a 2a 2f 0a 63 6f 6e  ven mask..*/.con
0af0: 73 74 20 63 68 61 72 20 2a 63 6f 6e 66 69 67 75  st char *configu
0b00: 72 65 5f 66 69 72 73 74 5f 6e 61 6d 65 28 69 6e  re_first_name(in
0b10: 74 20 69 4d 61 73 6b 29 7b 0a 20 20 69 43 6f 6e  t iMask){.  iCon
0b20: 66 69 67 20 3d 20 30 3b 0a 20 20 72 65 74 75 72  fig = 0;.  retur
0b30: 6e 20 63 6f 6e 66 69 67 75 72 65 5f 6e 65 78 74  n configure_next
0b40: 5f 6e 61 6d 65 28 69 4d 61 73 6b 29 3b 0a 7d 0a  _name(iMask);.}.
0b50: 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6e 66  const char *conf
0b60: 69 67 75 72 65 5f 6e 65 78 74 5f 6e 61 6d 65 28  igure_next_name(
0b70: 69 6e 74 20 69 4d 61 73 6b 29 7b 0a 20 20 77 68  int iMask){.  wh
0b80: 69 6c 65 28 20 69 43 6f 6e 66 69 67 3c 63 6f 75  ile( iConfig<cou
0b90: 6e 74 28 61 43 6f 6e 66 69 67 29 20 29 7b 0a 20  nt(aConfig) ){. 
0ba0: 20 20 20 69 66 28 20 61 43 6f 6e 66 69 67 5b 69     if( aConfig[i
0bb0: 43 6f 6e 66 69 67 5d 2e 67 72 6f 75 70 4d 61 73  Config].groupMas
0bc0: 6b 20 26 20 69 4d 61 73 6b 20 29 7b 0a 20 20 20  k & iMask ){.   
0bd0: 20 20 20 72 65 74 75 72 6e 20 61 43 6f 6e 66 69     return aConfi
0be0: 67 5b 69 43 6f 6e 66 69 67 2b 2b 5d 2e 7a 4e 61  g[iConfig++].zNa
0bf0: 6d 65 3b 0a 20 20 20 20 7d 65 6c 73 65 7b 0a 20  me;.    }else{. 
0c00: 20 20 20 20 20 69 43 6f 6e 66 69 67 2b 2b 3b 0a       iConfig++;.
0c10: 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75      }.  }.  retu
0c20: 72 6e 20 30 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 52  rn 0;.}../*.** R
0c30: 65 74 75 72 6e 20 54 52 55 45 20 69 66 20 61 20  eturn TRUE if a 
0c40: 70 61 72 74 69 63 75 6c 61 72 20 63 6f 6e 66 69  particular confi
0c50: 67 75 72 61 74 69 6f 6e 20 70 61 72 61 6d 65 74  guration paramet
0c60: 65 72 20 7a 4e 61 6d 65 20 69 73 0a 2a 2a 20 73  er zName is.** s
0c70: 61 66 65 6c 79 20 65 78 70 6f 72 74 61 62 6c 65  afely exportable
0c80: 2e 0a 2a 2f 0a 69 6e 74 20 63 6f 6e 66 69 67 75  ..*/.int configu
0c90: 72 65 5f 69 73 5f 65 78 70 6f 72 74 61 62 6c 65  re_is_exportable
0ca0: 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4e 61  (const char *zNa
0cb0: 6d 65 29 7b 0a 20 20 69 6e 74 20 69 3b 0a 20 20  me){.  int i;.  
0cc0: 66 6f 72 28 69 3d 30 3b 20 69 3c 63 6f 75 6e 74  for(i=0; i<count
0cd0: 28 61 43 6f 6e 66 69 67 29 3b 20 69 2b 2b 29 7b  (aConfig); i++){
0ce0: 0a 20 20 20 20 69 66 28 20 73 74 72 63 6d 70 28  .    if( strcmp(
0cf0: 7a 4e 61 6d 65 2c 20 61 43 6f 6e 66 69 67 5b 69  zName, aConfig[i
0d00: 5d 2e 7a 4e 61 6d 65 29 3d 3d 30 20 29 7b 0a 20  ].zName)==0 ){. 
0d10: 20 20 20 20 20 72 65 74 75 72 6e 20 61 43 6f 6e       return aCon
0d20: 66 69 67 5b 69 5d 2e 67 72 6f 75 70 4d 61 73 6b  fig[i].groupMask
0d30: 3b 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65  ;.    }.  }.  re
0d40: 74 75 72 6e 20 30 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a  turn 0;.}../*.**
0d50: 20 49 64 65 6e 74 69 66 79 20 61 20 63 6f 6e 66   Identify a conf
0d60: 69 67 75 72 61 74 69 6f 6e 20 67 72 6f 75 70 20  iguration group 
0d70: 62 79 20 6e 61 6d 65 2e 20 20 52 65 74 75 72 6e  by name.  Return
0d80: 20 69 74 73 20 6d 61 73 6b 2e 0a 2a 2a 20 54 68   its mask..** Th
0d90: 72 6f 77 20 61 6e 20 65 72 72 6f 72 20 69 66 20  row an error if 
0da0: 6e 6f 20 6d 61 74 63 68 2e 0a 2a 2f 0a 73 74 61  no match..*/.sta
0db0: 74 69 63 20 69 6e 74 20 66 69 6e 64 5f 61 72 65  tic int find_are
0dc0: 61 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 29  a(const char *z)
0dd0: 7b 0a 20 20 69 6e 74 20 69 3b 0a 20 20 69 6e 74  {.  int i;.  int
0de0: 20 6e 20 3d 20 73 74 72 6c 65 6e 28 7a 29 3b 0a   n = strlen(z);.
0df0: 20 20 66 6f 72 28 69 3d 30 3b 20 69 3c 63 6f 75    for(i=0; i<cou
0e00: 6e 74 28 61 47 72 6f 75 70 4e 61 6d 65 29 3b 20  nt(aGroupName); 
0e10: 69 2b 2b 29 7b 0a 20 20 20 20 69 66 28 20 73 74  i++){.    if( st
0e20: 72 6e 63 6d 70 28 7a 2c 20 61 47 72 6f 75 70 4e  rncmp(z, aGroupN
0e30: 61 6d 65 5b 69 5d 2e 7a 4e 61 6d 65 2c 20 6e 29  ame[i].zName, n)
0e40: 3d 3d 30 20 29 7b 0a 20 20 20 20 20 20 72 65 74  ==0 ){.      ret
0e50: 75 72 6e 20 61 47 72 6f 75 70 4e 61 6d 65 5b 69  urn aGroupName[i
0e60: 5d 2e 67 72 6f 75 70 4d 61 73 6b 3b 0a 20 20 20  ].groupMask;.   
0e70: 20 7d 0a 20 20 7d 0a 20 20 66 6f 73 73 69 6c 5f   }.  }.  fossil_
0e80: 66 61 74 61 6c 28 22 6e 6f 20 73 75 63 68 20 63  fatal("no such c
0e90: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 61 72 65  onfiguration are
0ea0: 61 3a 20 5c 22 25 73 5c 22 22 2c 20 7a 29 3b 0a  a: \"%s\"", z);.
0eb0: 20 20 72 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 0a    return 0;.}...
0ec0: 2f 2a 0a 2a 2a 20 43 4f 4d 4d 41 4e 44 3a 20 63  /*.** COMMAND: c
0ed0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0a 2a 2a 0a  onfiguration.**.
0ee0: 2a 2a 20 55 73 61 67 65 3a 20 25 66 6f 73 73 69  ** Usage: %fossi
0ef0: 6c 20 63 6f 6e 66 69 67 75 72 65 20 4d 45 54 48  l configure METH
0f00: 4f 44 20 2e 2e 2e 0a 2a 2a 0a 2a 2a 20 57 68 65  OD ....**.** Whe
0f10: 72 65 20 4d 45 54 48 4f 44 20 69 73 20 6f 6e 65  re METHOD is one
0f20: 20 6f 66 3a 20 65 78 70 6f 72 74 20 69 6d 70 6f   of: export impo
0f30: 72 74 20 70 75 6c 6c 20 72 65 73 65 74 2e 20 20  rt pull reset.  
0f40: 41 6c 6c 20 6d 65 74 68 6f 64 73 0a 2a 2a 20 61  All methods.** a
0f50: 63 63 65 70 74 20 74 68 65 20 2d 52 20 6f 72 20  ccept the -R or 
0f60: 2d 2d 72 65 70 6f 73 69 74 6f 72 79 20 6f 70 74  --repository opt
0f70: 69 6f 6e 20 74 6f 20 73 70 65 63 69 66 69 63 20  ion to specific 
0f80: 61 20 72 65 70 6f 73 69 74 6f 72 79 2e 0a 2a 2a  a repository..**
0f90: 0a 2a 2a 20 20 20 20 25 66 6f 73 73 69 6c 20 63  .**    %fossil c
0fa0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 65 78 70  onfiguration exp
0fb0: 6f 72 74 20 41 52 45 41 20 46 49 4c 45 4e 41 4d  ort AREA FILENAM
0fc0: 45 0a 2a 2a 0a 2a 2a 20 20 20 20 20 20 20 20 20  E.**.**         
0fd0: 57 72 69 74 65 20 74 6f 20 46 49 4c 45 4e 41 4d  Write to FILENAM
0fe0: 45 20 65 78 70 6f 72 74 65 64 20 63 6f 6e 66 69  E exported confi
0ff0: 67 75 72 61 74 6f 6e 20 69 6e 66 6f 72 6d 61 74  guraton informat
1000: 69 6f 6e 20 66 6f 72 20 41 52 45 41 2e 0a 2a 2a  ion for AREA..**
1010: 20 20 20 20 20 20 20 20 20 41 52 45 41 20 63 61           AREA ca
1020: 6e 20 62 65 20 6f 6e 65 20 6f 66 3a 20 20 61 6c  n be one of:  al
1030: 6c 20 74 69 63 6b 65 74 20 73 6b 69 6e 20 70 72  l ticket skin pr
1040: 6f 6a 65 63 74 0a 2a 2a 0a 2a 2a 20 20 20 20 25  oject.**.**    %
1050: 66 6f 73 73 69 6c 20 63 6f 6e 66 69 67 75 72 61  fossil configura
1060: 74 69 6f 6e 20 69 6d 70 6f 72 74 20 46 49 4c 45  tion import FILE
1070: 4e 41 4d 45 0a 2a 2a 0a 2a 2a 20 20 20 20 20 20  NAME.**.**      
1080: 20 20 20 52 65 61 64 20 61 20 63 6f 6e 66 69 67     Read a config
1090: 75 72 61 74 69 6f 6e 20 66 72 6f 6d 20 46 49 4c  uration from FIL
10a0: 45 4e 41 4d 45 2c 20 6f 76 65 72 77 72 69 74 69  ENAME, overwriti
10b0: 6e 67 20 74 68 65 20 63 75 72 72 65 6e 74 0a 2a  ng the current.*
10c0: 2a 20 20 20 20 20 20 20 20 20 63 6f 6e 66 69 67  *         config
10d0: 75 72 61 74 69 6f 6e 2e 20 20 57 61 72 6e 69 6e  uration.  Warnin
10e0: 67 3a 20 20 44 6f 20 6e 6f 74 20 72 65 61 64 20  g:  Do not read 
10f0: 61 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20  a configuration 
1100: 66 72 6f 6d 0a 2a 2a 20 20 20 20 20 20 20 20 20  from.**         
1110: 61 6e 20 75 6e 74 72 75 73 74 65 64 20 73 6f 75  an untrusted sou
1120: 72 63 65 20 73 69 6e 63 65 20 74 68 65 20 63 6f  rce since the co
1130: 6e 66 69 67 75 72 61 74 69 6f 6e 20 69 73 20 6e  nfiguration is n
1140: 6f 74 20 63 68 65 63 6b 65 64 0a 2a 2a 20 20 20  ot checked.**   
1150: 20 20 20 20 20 20 66 6f 72 20 73 61 66 65 74 79        for safety
1160: 20 61 6e 64 20 63 61 6e 20 69 6e 74 72 6f 64 75   and can introdu
1170: 63 65 20 73 65 63 75 72 69 74 79 20 74 68 72 65  ce security thre
1180: 61 74 73 2e 0a 2a 2a 0a 2a 2a 20 20 20 20 25 66  ats..**.**    %f
1190: 6f 73 73 69 6c 20 63 6f 6e 66 69 67 75 72 61 74  ossil configurat
11a0: 69 6f 6e 20 70 75 6c 6c 20 41 52 45 41 20 55 52  ion pull AREA UR
11b0: 4c 0a 2a 2a 0a 2a 2a 20 20 20 20 20 20 20 20 20  L.**.**         
11c0: 50 75 6c 6c 20 61 6e 64 20 69 6e 73 74 61 6c 6c  Pull and install
11d0: 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69   the configurati
11e0: 6f 6e 20 66 72 6f 6d 20 61 20 64 69 66 66 65 72  on from a differ
11f0: 65 6e 74 20 73 65 72 76 65 72 0a 2a 2a 20 20 20  ent server.**   
1200: 20 20 20 20 20 20 69 64 65 6e 74 69 66 69 65 64        identified
1210: 20 62 79 20 55 52 4c 2e 20 20 41 52 45 41 20 69   by URL.  AREA i
1220: 73 20 61 73 20 69 6e 20 22 65 78 70 6f 72 74 22  s as in "export"
1230: 2e 0a 2a 2a 0a 2a 2a 20 20 20 20 25 66 6f 73 73  ..**.**    %foss
1240: 69 6c 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  il configuration
1250: 20 72 65 73 65 74 20 41 52 45 41 0a 2a 2a 0a 2a   reset AREA.**.*
1260: 2a 20 20 20 20 20 20 20 20 20 52 65 73 74 6f 72  *         Restor
1270: 65 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74  e the configurat
1280: 69 6f 6e 20 74 6f 20 74 68 65 20 64 65 66 61 75  ion to the defau
1290: 6c 74 2e 20 20 41 52 45 41 20 61 73 20 61 62 6f  lt.  AREA as abo
12a0: 76 65 2e 0a 2a 2f 0a 76 6f 69 64 20 63 6f 6e 66  ve..*/.void conf
12b0: 69 67 75 72 61 74 69 6f 6e 5f 63 6d 64 28 76 6f  iguration_cmd(vo
12c0: 69 64 29 7b 0a 20 20 69 6e 74 20 6e 3b 0a 20 20  id){.  int n;.  
12d0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 4d 65 74  const char *zMet
12e0: 68 6f 64 3b 0a 20 20 69 66 28 20 67 2e 61 72 67  hod;.  if( g.arg
12f0: 63 3c 33 20 29 7b 0a 20 20 20 20 75 73 61 67 65  c<3 ){.    usage
1300: 28 22 4d 45 54 48 4f 44 20 2e 2e 2e 22 29 3b 0a  ("METHOD ...");.
1310: 20 20 7d 0a 20 20 64 62 5f 66 69 6e 64 5f 61 6e    }.  db_find_an
1320: 64 5f 6f 70 65 6e 5f 72 65 70 6f 73 69 74 6f 72  d_open_repositor
1330: 79 28 31 29 3b 0a 20 20 7a 4d 65 74 68 6f 64 20  y(1);.  zMethod 
1340: 3d 20 67 2e 61 72 67 76 5b 32 5d 3b 0a 20 20 6e  = g.argv[2];.  n
1350: 20 3d 20 73 74 72 6c 65 6e 28 7a 4d 65 74 68 6f   = strlen(zMetho
1360: 64 29 3b 0a 20 20 69 66 28 20 73 74 72 6e 63 6d  d);.  if( strncm
1370: 70 28 7a 4d 65 74 68 6f 64 2c 20 22 65 78 70 6f  p(zMethod, "expo
1380: 72 74 22 2c 20 6e 29 3d 3d 30 20 29 7b 0a 20 20  rt", n)==0 ){.  
1390: 20 20 69 6e 74 20 69 3b 0a 20 20 20 20 69 6e 74    int i;.    int
13a0: 20 6d 61 73 6b 3b 0a 20 20 20 20 63 6f 6e 73 74   mask;.    const
13b0: 20 63 68 61 72 20 2a 7a 53 65 70 3b 0a 20 20 20   char *zSep;.   
13c0: 20 42 6c 6f 62 20 73 71 6c 3b 0a 20 20 20 20 53   Blob sql;.    S
13d0: 74 6d 74 20 71 3b 0a 20 20 20 20 42 6c 6f 62 20  tmt q;.    Blob 
13e0: 6f 75 74 3b 0a 20 20 20 20 69 66 28 20 67 2e 61  out;.    if( g.a
13f0: 72 67 63 21 3d 35 20 29 7b 0a 20 20 20 20 20 20  rgc!=5 ){.      
1400: 75 73 61 67 65 28 22 65 78 70 6f 72 74 20 41 52  usage("export AR
1410: 45 41 20 46 49 4c 45 4e 41 4d 45 22 29 3b 0a 20  EA FILENAME");. 
1420: 20 20 20 7d 0a 20 20 20 20 6d 61 73 6b 20 3d 20     }.    mask = 
1430: 66 69 6e 64 5f 61 72 65 61 28 67 2e 61 72 67 76  find_area(g.argv
1440: 5b 33 5d 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 7a  [3]);.    blob_z
1450: 65 72 6f 28 26 73 71 6c 29 3b 0a 20 20 20 20 62  ero(&sql);.    b
1460: 6c 6f 62 5f 7a 65 72 6f 28 26 6f 75 74 29 3b 0a  lob_zero(&out);.
1470: 20 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66      blob_appendf
1480: 28 26 73 71 6c 2c 20 0a 20 20 20 20 20 20 20 22  (&sql, .       "
1490: 53 45 4c 45 43 54 20 27 52 45 50 4c 41 43 45 20  SELECT 'REPLACE 
14a0: 49 4e 54 4f 20 63 6f 6e 66 69 67 28 6e 61 6d 65  INTO config(name
14b0: 2c 76 61 6c 75 65 29 20 56 41 4c 55 45 53 28 27  ,value) VALUES('
14c0: 27 27 22 0a 20 20 20 20 20 20 20 22 20 20 20 20  ''".       "    
14d0: 20 20 20 20 20 7c 7c 20 6e 61 6d 65 20 7c 7c 20       || name || 
14e0: 27 27 27 2c 27 20 7c 7c 20 71 75 6f 74 65 28 76  ''',' || quote(v
14f0: 61 6c 75 65 29 20 7c 7c 20 27 29 3b 27 22 0a 20  alue) || ');'". 
1500: 20 20 20 20 20 20 22 20 20 46 52 4f 4d 20 63 6f        "  FROM co
1510: 6e 66 69 67 20 57 48 45 52 45 20 6e 61 6d 65 20  nfig WHERE name 
1520: 49 4e 20 22 0a 20 20 20 20 29 3b 0a 20 20 20 20  IN ".    );.    
1530: 7a 53 65 70 20 3d 20 22 28 22 3b 0a 20 20 20 20  zSep = "(";.    
1540: 66 6f 72 28 69 3d 30 3b 20 69 3c 63 6f 75 6e 74  for(i=0; i<count
1550: 28 61 43 6f 6e 66 69 67 29 3b 20 69 2b 2b 29 7b  (aConfig); i++){
1560: 0a 20 20 20 20 20 20 69 66 28 20 61 43 6f 6e 66  .      if( aConf
1570: 69 67 5b 69 5d 2e 67 72 6f 75 70 4d 61 73 6b 20  ig[i].groupMask 
1580: 26 20 6d 61 73 6b 20 29 7b 0a 20 20 20 20 20 20  & mask ){.      
1590: 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 26    blob_appendf(&
15a0: 73 71 6c 2c 20 22 25 73 27 25 73 27 22 2c 20 7a  sql, "%s'%s'", z
15b0: 53 65 70 2c 20 61 43 6f 6e 66 69 67 5b 69 5d 2e  Sep, aConfig[i].
15c0: 7a 4e 61 6d 65 29 3b 0a 20 20 20 20 20 20 20 20  zName);.        
15d0: 7a 53 65 70 20 3d 20 22 2c 22 3b 0a 20 20 20 20  zSep = ",";.    
15e0: 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 62 6c    }.    }.    bl
15f0: 6f 62 5f 61 70 70 65 6e 64 66 28 26 73 71 6c 2c  ob_appendf(&sql,
1600: 20 22 29 20 4f 52 44 45 52 20 42 59 20 6e 61 6d   ") ORDER BY nam
1610: 65 22 29 3b 0a 20 20 20 20 64 62 5f 70 72 65 70  e");.    db_prep
1620: 61 72 65 28 26 71 2c 20 62 6c 6f 62 5f 73 74 72  are(&q, blob_str
1630: 28 26 73 71 6c 29 29 3b 0a 20 20 20 20 62 6c 6f  (&sql));.    blo
1640: 62 5f 72 65 73 65 74 28 26 73 71 6c 29 3b 0a 20  b_reset(&sql);. 
1650: 20 20 20 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28     blob_appendf(
1660: 26 6f 75 74 2c 20 0a 20 20 20 20 20 20 20 20 22  &out, .        "
1670: 2d 2d 20 54 68 65 20 5c 22 25 73 5c 22 20 63 6f  -- The \"%s\" co
1680: 6e 66 69 67 75 72 61 74 69 6f 6e 20 65 78 70 6f  nfiguration expo
1690: 72 74 65 64 20 66 72 6f 6d 5c 6e 22 0a 20 20 20  rted from\n".   
16a0: 20 20 20 20 20 22 2d 2d 20 72 65 70 6f 73 69 74       "-- reposit
16b0: 6f 72 79 20 5c 22 25 73 5c 22 5c 6e 22 0a 20 20  ory \"%s\"\n".  
16c0: 20 20 20 20 20 20 22 2d 2d 20 6f 6e 20 25 73 5c        "-- on %s\
16d0: 6e 22 2c 0a 20 20 20 20 20 20 20 20 67 2e 61 72  n",.        g.ar
16e0: 67 76 5b 33 5d 2c 20 67 2e 7a 52 65 70 6f 73 69  gv[3], g.zReposi
16f0: 74 6f 72 79 4e 61 6d 65 2c 0a 20 20 20 20 20 20  toryName,.      
1700: 20 20 64 62 5f 74 65 78 74 28 30 2c 20 22 53 45    db_text(0, "SE
1710: 4c 45 43 54 20 64 61 74 65 74 69 6d 65 28 27 6e  LECT datetime('n
1720: 6f 77 27 29 22 29 0a 20 20 20 20 29 3b 0a 20 20  ow')").    );.  
1730: 20 20 77 68 69 6c 65 28 20 64 62 5f 73 74 65 70    while( db_step
1740: 28 26 71 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57  (&q)==SQLITE_ROW
1750: 20 29 7b 0a 20 20 20 20 20 20 62 6c 6f 62 5f 61   ){.      blob_a
1760: 70 70 65 6e 64 66 28 26 6f 75 74 2c 20 22 25 73  ppendf(&out, "%s
1770: 5c 6e 22 2c 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74  \n", db_column_t
1780: 65 78 74 28 26 71 2c 20 30 29 29 3b 0a 20 20 20  ext(&q, 0));.   
1790: 20 7d 0a 20 20 20 20 64 62 5f 66 69 6e 61 6c 69   }.    db_finali
17a0: 7a 65 28 26 71 29 3b 0a 20 20 20 20 62 6c 6f 62  ze(&q);.    blob
17b0: 5f 77 72 69 74 65 5f 74 6f 5f 66 69 6c 65 28 26  _write_to_file(&
17c0: 6f 75 74 2c 20 67 2e 61 72 67 76 5b 34 5d 29 3b  out, g.argv[4]);
17d0: 0a 20 20 20 20 62 6c 6f 62 5f 72 65 73 65 74 28  .    blob_reset(
17e0: 26 6f 75 74 29 3b 0a 20 20 7d 65 6c 73 65 0a 20  &out);.  }else. 
17f0: 20 69 66 28 20 73 74 72 6e 63 6d 70 28 7a 4d 65   if( strncmp(zMe
1800: 74 68 6f 64 2c 20 22 69 6d 70 6f 72 74 22 2c 20  thod, "import", 
1810: 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20 42 6c 6f  n)==0 ){.    Blo
1820: 62 20 69 6e 3b 0a 20 20 20 20 69 66 28 20 67 2e  b in;.    if( g.
1830: 61 72 67 63 21 3d 34 20 29 20 75 73 61 67 65 28  argc!=4 ) usage(
1840: 22 69 6d 70 6f 72 74 20 46 49 4c 45 4e 41 4d 45  "import FILENAME
1850: 22 29 3b 0a 20 20 20 20 62 6c 6f 62 5f 72 65 61  ");.    blob_rea
1860: 64 5f 66 72 6f 6d 5f 66 69 6c 65 28 26 69 6e 2c  d_from_file(&in,
1870: 20 67 2e 61 72 67 76 5b 33 5d 29 3b 0a 20 20 20   g.argv[3]);.   
1880: 20 64 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61   db_begin_transa
1890: 63 74 69 6f 6e 28 29 3b 0a 20 20 20 20 64 62 5f  ction();.    db_
18a0: 6d 75 6c 74 69 5f 65 78 65 63 28 22 25 73 22 2c  multi_exec("%s",
18b0: 20 62 6c 6f 62 5f 73 74 72 28 26 69 6e 29 29 3b   blob_str(&in));
18c0: 0a 20 20 20 20 64 62 5f 65 6e 64 5f 74 72 61 6e  .    db_end_tran
18d0: 73 61 63 74 69 6f 6e 28 30 29 3b 0a 20 20 7d 65  saction(0);.  }e
18e0: 6c 73 65 0a 20 20 69 66 28 20 73 74 72 6e 63 6d  lse.  if( strncm
18f0: 70 28 7a 4d 65 74 68 6f 64 2c 20 22 70 75 6c 6c  p(zMethod, "pull
1900: 22 2c 20 6e 29 3d 3d 30 20 29 7b 0a 20 20 20 20  ", n)==0 ){.    
1910: 69 6e 74 20 6d 61 73 6b 3b 0a 20 20 20 20 75 72  int mask;.    ur
1920: 6c 5f 70 72 6f 78 79 5f 6f 70 74 69 6f 6e 73 28  l_proxy_options(
1930: 29 3b 0a 20 20 20 20 69 66 28 20 67 2e 61 72 67  );.    if( g.arg
1940: 63 21 3d 35 20 29 20 75 73 61 67 65 28 22 70 75  c!=5 ) usage("pu
1950: 6c 6c 20 41 52 45 41 20 55 52 4c 22 29 3b 0a 20  ll AREA URL");. 
1960: 20 20 20 6d 61 73 6b 20 3d 20 66 69 6e 64 5f 61     mask = find_a
1970: 72 65 61 28 67 2e 61 72 67 76 5b 33 5d 29 3b 0a  rea(g.argv[3]);.
1980: 20 20 20 20 75 72 6c 5f 70 61 72 73 65 28 67 2e      url_parse(g.
1990: 61 72 67 76 5b 34 5d 29 3b 0a 20 20 20 20 69 66  argv[4]);.    if
19a0: 28 20 67 2e 75 72 6c 49 73 46 69 6c 65 20 29 7b  ( g.urlIsFile ){
19b0: 0a 20 20 20 20 20 20 66 6f 73 73 69 6c 5f 66 61  .      fossil_fa
19c0: 74 61 6c 28 22 6e 65 74 77 6f 72 6b 20 73 79 6e  tal("network syn
19d0: 63 20 6f 6e 6c 79 22 29 3b 0a 20 20 20 20 7d 0a  c only");.    }.
19e0: 20 20 20 20 75 73 65 72 5f 73 65 6c 65 63 74 28      user_select(
19f0: 29 3b 0a 20 20 20 20 63 6c 69 65 6e 74 5f 73 79  );.    client_sy
1a00: 6e 63 28 30 2c 30 2c 30 2c 6d 61 73 6b 29 3b 0a  nc(0,0,0,mask);.
1a10: 20 20 7d 65 6c 73 65 0a 20 20 69 66 28 20 73 74    }else.  if( st
1a20: 72 6e 63 6d 70 28 7a 4d 65 74 68 6f 64 2c 20 22  rncmp(zMethod, "
1a30: 72 65 73 65 74 22 2c 20 6e 29 3d 3d 30 20 29 7b  reset", n)==0 ){
1a40: 0a 20 20 20 20 69 6e 74 20 6d 61 73 6b 2c 20 69  .    int mask, i
1a50: 3b 0a 20 20 20 20 69 66 28 20 67 2e 61 72 67 63  ;.    if( g.argc
1a60: 21 3d 34 20 29 20 75 73 61 67 65 28 22 72 65 73  !=4 ) usage("res
1a70: 65 74 20 41 52 45 41 22 29 3b 0a 20 20 20 20 6d  et AREA");.    m
1a80: 61 73 6b 20 3d 20 66 69 6e 64 5f 61 72 65 61 28  ask = find_area(
1a90: 67 2e 61 72 67 76 5b 33 5d 29 3b 0a 20 20 20 20  g.argv[3]);.    
1aa0: 64 62 5f 62 65 67 69 6e 5f 74 72 61 6e 73 61 63  db_begin_transac
1ab0: 74 69 6f 6e 28 29 3b 0a 20 20 20 20 66 6f 72 28  tion();.    for(
1ac0: 69 3d 30 3b 20 69 3c 63 6f 75 6e 74 28 61 43 6f  i=0; i<count(aCo
1ad0: 6e 66 69 67 29 3b 20 69 2b 2b 29 7b 0a 20 20 20  nfig); i++){.   
1ae0: 20 20 20 69 66 28 20 28 61 43 6f 6e 66 69 67 5b     if( (aConfig[
1af0: 69 5d 2e 67 72 6f 75 70 4d 61 73 6b 20 26 20 6d  i].groupMask & m
1b00: 61 73 6b 29 3d 3d 30 20 29 20 63 6f 6e 74 69 6e  ask)==0 ) contin
1b10: 75 65 3b 0a 20 20 20 20 20 20 64 62 5f 6d 75 6c  ue;.      db_mul
1b20: 74 69 5f 65 78 65 63 28 22 44 45 4c 45 54 45 20  ti_exec("DELETE 
1b30: 46 52 4f 4d 20 63 6f 6e 66 69 67 20 57 48 45 52  FROM config WHER
1b40: 45 20 6e 61 6d 65 3d 25 51 22 2c 20 61 43 6f 6e  E name=%Q", aCon
1b50: 66 69 67 5b 69 5d 2e 7a 4e 61 6d 65 29 3b 0a 20  fig[i].zName);. 
1b60: 20 20 20 7d 0a 20 20 20 20 64 62 5f 65 6e 64 5f     }.    db_end_
1b70: 74 72 61 6e 73 61 63 74 69 6f 6e 28 30 29 3b 0a  transaction(0);.
1b80: 20 20 7d 65 6c 73 65 0a 20 20 7b 0a 20 20 20 20    }else.  {.    
1b90: 66 6f 73 73 69 6c 5f 66 61 74 61 6c 28 22 4d 45  fossil_fatal("ME
1ba0: 54 48 4f 44 20 73 68 6f 75 6c 64 20 62 65 20 6f  THOD should be o
1bb0: 6e 65 20 6f 66 3a 20 20 65 78 70 6f 72 74 20 69  ne of:  export i
1bc0: 6d 70 6f 72 74 20 70 75 6c 6c 20 72 65 73 65 74  mport pull reset
1bd0: 22 29 3b 0a 20 20 7d 0a 7d 0a                    ");.  }.}.