Changes to reflect recent change in stable branch commit policy (hopefully
[privoxy.git] / doc / source / developer-manual.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[
2 <!entity % dummy "IGNORE"> 
3 <!entity supported SYSTEM "supported.sgml">
4 <!entity newfeatures SYSTEM "newfeatures.sgml">
5 <!entity p-intro SYSTEM "privoxy.sgml">
6 <!entity history SYSTEM "history.sgml">
7 <!entity seealso SYSTEM "seealso.sgml">
8 <!entity contacting SYSTEM "contacting.sgml">
9 <!entity copyright SYSTEM "copyright.sgml">
10 <!entity license SYSTEM "license.sgml">
11 <!entity p-version SYSTEM "doc_version.tmp">
12 <!entity p-status SYSTEM "doc_status.tmp">
13 <!entity % p-not-stable "IGNORE">
14 <!entity % p-stable "IGNORE">
15 <!entity % p-text "IGNORE">        <!-- define we are not a text only doc -->
16 <!entity % p-doc "INCLUDE">        <!-- and we are a formal doc           -->
17 <!entity  my-copy "&copy;">        <!-- kludge for docbook2man            -->
18 ]>
19 <!--
20  File        :  $Source: /cvsroot/ijbswa/current/doc/source/developer-manual.sgml,v $
21
22  Purpose     :  developer manual
23                 This file belongs into
24                 ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
25                 
26  $Id: developer-manual.sgml,v 2.4 2002/09/26 05:57:14 hal9 Exp $
27
28  Copyright (C) 2001, 2002 Privoxy Developers <developers@privoxy.org>
29  See LICENSE.
30
31  ========================================================================
32  NOTE: Please read developer-manual/documentation.html before touching 
33  anything in this, or other Privoxy documentation. 
34  ========================================================================
35
36 -->
37
38 <article id="index">
39   <artheader>
40     <title>Privoxy Developer Manual</title>
41     <pubdate>
42      <subscript>
43     <!-- Completely the wrong markup, but very little is allowed  -->
44     <!-- in this part of an article. FIXME -->
45       <link linkend="copyright">Copyright</link> &my-copy; 2001, 2002 by 
46       <ulink url="http://www.privoxy.org">Privoxy Developers</ulink>
47      </subscript>
48     </pubdate>
49
50
51     <pubdate>$Id: developer-manual.sgml,v 2.4 2002/09/26 05:57:14 hal9 Exp $</pubdate>
52
53 <!--
54
55 Note: this should generate a separate page, and a live link to it. 
56 But it doesn't for some mysterious reason. Please leave commented
57 unless it can be fixed proper. For the time being, the copyright 
58 statement will be in copyright.smgl.
59
60 Hal.
61
62 <legalnotice id="legalnotice"> 
63  <para>
64   text goes here ........
65  </para>
66 </legalnotice>
67
68 -->
69
70     <abstract>
71
72 <![%dummy;[
73  <para>
74  <comment>
75   This is here to keep vim syntax file from breaking :/
76   If I knew enough to fix it, I would.
77   PLEASE DO NOT REMOVE! HB: hal@foobox.net
78  </comment>
79  </para>
80  ]]>
81 <para>
82  The developer manual provides guidance on coding, testing, packaging, documentation
83  and other issues of importance to those involved with
84  <application>Privoxy</application> development. It is mandatory (and helpful!) reading
85  for anyone who wants to join the team.
86 </para>
87
88 <!-- Include privoxy.sgml boilerplate text: -->
89
90 <!--  &p-intro; Someone interested enough in the project to contribute
91                 will already know at this point what Privoxy is. -->
92
93 <!-- end boilerplate -->
94
95 <para>
96  <![%p-stable;[
97  Please note that this document is constantly evolving. This copy represents
98  the state at the release of version &p-version;. ]]>
99  You can find the latest version of the this manual at <ulink
100  url="http://www.privoxy.org/developer-manual/">http://www.privoxy.org/developer-manual/</ulink>.
101  Please see <link linkend="contact">the Contact section</link> 
102  on how to contact the developers.
103 </para>
104 <!--        <para> -->
105 <!--    Feel free to send a note to the developers at <email>ijbswa-developers@lists.sourceforge.net</email>. -->
106 <!--   </para> -->
107
108     </abstract>
109   </artheader>
110
111
112 <!--   ~~~~~       New section      ~~~~~     -->
113   <sect1 id="introduction"><title>Introduction</title>
114 <!--
115
116  I don't like seeing blank space :) So added *something* here.
117
118  --> 
119     <para>
120      <application>Privoxy</application>, as an heir to
121      <application>Junkbuster</application>, is an Open Source project 
122      and licensed under the GPL. As such, <application>Privoxy</application>
123      development is potentially open to anyone who has the time, knowledge,
124      and desire to contribute in any capacity. Our goals are simply to
125      continue the mission, to improve <application>Privoxy</application>, and
126      to make it available to as wide an audience as possible. 
127     </para>
128     <para>
129      One does not have to be a programmer to contribute. Packaging, testing,
130      and porting, are all important jobs as well.
131     </para>
132
133   <!--   ~~~~~       New section      ~~~~~     -->
134   <sect2 id="quickstart"><title>Quickstart to Privoxy Development</title>
135     <para>
136       You'll need an account on <ulink
137       url="http://sourceforge.net/">Sourceforge</ulink> to support our
138       development.  Mail your ID to <ulink
139       url="mailto:developers@privoxy.org">the list</ulink> and wait until a
140       project manager has added you.
141     </para>
142     <para>
143      You will also need to have a cvs package installed, which will 
144      entail having ssh installed as well (which seems to be a requirement of
145      SourceForge), in order to access the cvs repository. Having the GNU build
146      tools is also going to be important (particularly, autoconf and gmake).
147     </para>
148     <para>
149       For the time being (read, this section is under construction), please
150       refer to the extensive comments in the source code.
151     </para>
152    </sect2>
153   </sect1>
154
155   <!--   ~~~~~       New section      ~~~~~     -->
156   <sect1 id="cvs"><title>The CVS Repository</title>
157     <para>
158       If you intend to help us with programming, documentation or packaging
159       you will need write access to our holy grail, the CVS repository.
160       Please read this chapter completely before accessing via CVS.
161     </para>
162
163     <sect2 id="cvsaccess"><title>Access to CVS</title>
164       <para>
165         The project's CVS repository is hosted on
166         <ulink url="http://sourceforge.net/">SourceForge.</ulink>
167         Please refer to the chapters 6 and 7 in
168         <ulink url="http://sourceforge.net/docman/?group_id=1">SF's site
169         documentation</ulink> for the technical access details for your
170         operating system. For historical reasons, the CVS server is
171         called <literal>cvs.ijbswa.sourceforge.net</literal>, the repository is
172         called <literal>ijbswa</literal>, and the source tree module is called
173         <literal>current</literal>.
174       </para>
175     </sect2>
176
177     <sect2 id="cvsbranches">
178     <title>Branches</title>
179      <para>
180        Within the CVS repository, there are modules and branches. As
181        mentioned, the sources are in the <literal>current</literal>
182        <quote>module</quote>. Other modules are present for platform specific
183        issues. There is a webview of the CVS hierarchy at <ulink
184        url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/</ulink>,
185        which might help with visualizing how these pieces fit together.
186      </para>
187      <para>
188        Branches are used to fork a sub-development path from the main trunk.
189        Within the <literal>current</literal> module where the sources are, there
190        is always at least one <quote>branch</quote> from the main trunk
191        devoted to a stable release series. The main trunk is where active
192        development takes place for the next stable series (e.g. 3.2.x).
193        And for testing bugfixes for the stable series. Just prior to each
194        stable series (e.g. 3.0.x), a branch is created just for stable series
195        releases (e.g. 3.0.0 -> 3.0.1 -> 3.0.2, etc). Once the initial stable
196        release of any stable branch has taken place, this branch is
197        <emphasis>only used for bugfixes</emphasis>, which have had prior
198        testing before being committed to CVS. (See <link
199        linkend="versionnumbers">Version Numbers</link> below for details on
200        versioning.)
201      </para>
202      <para>
203        This will result in at least two active branches, which means there may
204        be occasions that require the same (or similar) item to be 
205        checked into to two different places (assuming its a bugfix and needs 
206        fixing in both the stable and unstable trees). This also means that in
207        order to have access to both trees, both will have to be checked out 
208        separately. Use the <literal>cvs -r</literal> flag to check out a 
209        branch, e.g: <literal>cvs co -r v_3_0_branch current</literal>.
210      </para>
211     </sect2>
212
213     <sect2 id="cvscommit"><title>CVS Commit Guidelines</title>
214       <para>
215         The source tree is the heart of every software project. Every effort must
216         be made to ensure that it is readable, compilable and consistent at all
217         times. There are differing guidelines for the stable branch and the
218         main development trunk, and we ask anyone with CVS access to strictly
219         adhere to the following guidelines:
220       </para>
221       
222       <para>
223        Basic Guidelines, for all branches:
224       </para>
225       <para>
226         <itemizedlist>
227           <listitem><para>
228             Never (read: <emphasis>never, ever</emphasis>) be tempted to commit
229             that small change without testing it thoroughly first. When we're
230             close to a public release, ask a fellow developer to review your 
231             changes.
232           </para></listitem>
233           <listitem><para>
234             Your commit message should give a concise overview of <emphasis>what you
235             changed</emphasis> (no big details) and <emphasis>why you changed it</emphasis>
236             Just check previous messages for good examples.
237           </para></listitem>
238           <listitem><para>
239             Don't use the same message on multiple files, unless it equally applies to
240             all those files.
241           </para></listitem>
242           <listitem><para>
243             If your changes span multiple files, and the code won't recompile unless
244             all changes are committed (e.g. when changing the signature of a function),
245             then commit all files one after another, without long delays in between.
246             If necessary, prepare the commit messages in advance.
247           </para></listitem>
248           <listitem><para>
249             Before changing things on CVS, make sure that your changes are in line
250             with the team's general consensus on what should be done.
251           </para></listitem>
252           <listitem>
253            <para>
254             Note that near a major public release, we get more cautious.
255             There is always the possibility to submit a patch to the <ulink
256             url="http://sourceforge.net/tracker/?atid=311118&amp;group_id=11118&amp;func=browse">patch
257             tracker</ulink> instead.
258           </para>
259          </listitem> 
260         </itemizedlist>
261       </para>
262       
263       <para>
264        Stable branches are handled with decidedly more care, especially after
265        the initial *.*.0 release, and we are just in bugfix mode. In addition
266        to the above, the below applies only to the stable branch (currently
267        the <literal>v_3_0_branch</literal> branch):
268       </para>
269       
270       <para>
271        <itemizedlist>
272         <listitem>
273          <para>
274            Do not commit <emphasis>anything</emphasis> unless your proposed
275            changes have been well tested first, preferably by other members of the
276            project, or have prior approval of the project leaders or consensus
277            of the devel list.
278          </para>
279         </listitem> 
280        <listitem>
281         <para>
282          Where possible, bugfixes and changes should be tested in the main 
283          development trunk first. There may be occasions where this is not 
284          feasible, though.
285         </para>
286        </listitem> 
287        <listitem>
288         <para>
289           Alternately, proposed changes can be submitted as patches to the patch tracker on 
290           Sourceforge first: <ulink
291           url="http://sourceforge.net/tracker/?group_id=11118&#38;atid=311118">http://sourceforge.net/tracker/?group_id=11118&#38;atid=311118</ulink>.
292           Then ask for peer review. 
293         </para>
294        </listitem> 
295         <listitem>
296          <para>
297           Do not even think about anything except bugfixes. No new features!
298          </para>
299         </listitem> 
300      
301        </itemizedlist>
302       </para> 
303     </sect2>
304
305 <!--
306  This sounds vague, dated, and out of step with current development style.
307  Removing 09/03/02, HB.
308
309     <sect2 id="cvswhenask"><title>Discussing Changes First</title>
310       <para>
311         We don't have a formal policy for the development branch, just use
312         common sense. Hints: If it is.. 
313        <orderedlist numeration="arabic">
314           <listitem><para>
315             ..a bug-fix / clean-up / cosmetic thing: shoot
316           </para></listitem>
317           <listitem><para>
318             ..a new feature that can be turned off: shoot
319           </para></listitem>
320           <listitem><para>
321             ..a clear improvement w/o side effects on other parts of the code: shoot
322           </para></listitem>
323           <listitem><para>
324             ..a matter of taste: <ulink url="mailto:developers@privoxy.org">ask the list</ulink>
325           </para></listitem>
326           <listitem><para>
327             ..a major redesign of some part of the code: <ulink url="mailto:developers@privoxy.org">ask
328             the list</ulink>
329           </para></listitem>
330         </orderedlist>
331       </para>
332       <para>
333         Note that near a major public release, we get a bit more cautious - if
334         unsure, it doesn't hurt to ask first. There is always the possibility
335         to submit a patch to the <ulink
336         url="http://sourceforge.net/tracker/?atid=311118&amp;group_id=11118&amp;func=browse">patches
337         tracker</ulink> instead.
338       </para>
339     </sect2>
340    --> 
341   </sect1>
342         
343   <!--   ~~~~~       New section      ~~~~~     -->
344 <sect1 id="documentation"><title>Documentation Guidelines</title>
345   <para>
346     All formal documents are maintained in Docbook SGML and located in the
347     <computeroutput>doc/source/*</computeroutput> directory. You will need
348     <ulink url="http://www.docbook.org">Docbook</ulink>, the Docbook 
349     DTD's and the Docbook modular stylesheets (or comparable alternatives),
350     and either <application>jade</application> or
351     <application>openjade</application> (recommended) installed in order to
352     build docs from source. Currently there is <ulink
353     url="../user-manual/index.html"><citetitle>user-manual</citetitle></ulink>,
354     <ulink url="../faq/index.html"><citetitle>FAQ</citetitle></ulink>, and, of
355     course this, the <citetitle>developer-manual</citetitle> in this format.
356     The <citetitle>README</citetitle>, <citetitle>AUTHORS</citetitle>
357     <citetitle>privoxy.1</citetitle> (man page), and
358     <citetitle>config</citetitle> files are also now maintained as Docbook
359     SGML. These files, when built, in the top-level source directory are
360     generated files! Also, the <application>Privoxy</application> <filename>index.html</filename> (and a 
361     variation on this file, <filename>privoxy-index.html</filename>, 
362     meant for inclusion with doc packages), are maintained as SGML as well.
363     <emphasis>DO NOT edit these directly</emphasis>. Edit the SGML source, or
364     contact someone involved in the documentation (at present Hal).
365     </para> 
366     <para>
367      <filename>config</filename> requires some special handling. The reason it
368      is maintained this way is so that the extensive comments in the file
369      mirror those in <citetitle>user-manual</citetitle>. But the conversion 
370      process requires going from SGML to HTML to text to special formatting 
371      required for the embedded comments. Some of this does not survive so
372      well. Especially some of the examples that are longer than 80 characters.
373      The build process for this file outputs to <filename>config.new</filename>, 
374      which should be reviewed for errors and mis-formatting. Once satisfied
375      that it is correct, then it should be hand copied to
376      <filename>config</filename>.
377     </para>
378     <para>
379      Other, less formal documents (e.g. <filename>LICENSE</filename>,
380      <filename>INSTALL</filename>) are maintained as plain text files in the
381      top-level source directory. At least for the time being.
382     </para>
383     <para>
384      Packagers are encouraged to include this documentation. For those without
385      the ability to build the docs locally, text versions of each are kept in
386      CVS. HTML versions are also now being kept in CVS under 
387      <filename>doc/webserver/*</filename>.
388     </para>
389     <para>
390      Formal documents are built with the Makefile targets of
391      <computeroutput>make dok</computeroutput>, or alternately
392      <computeroutput>make redhat-dok</computeroutput>. If you have problems,
393      try both. The build process uses the document SGML sources in
394      <computeroutput>doc/source/*/*</computeroutput> to update all text files in
395      <computeroutput>doc/text/</computeroutput> and to update all HTML
396      documents in <computeroutput>doc/webserver/</computeroutput>.
397     </para>
398     <para>
399      Documentation writers should please make sure documents build
400      successfully before committing to CVS, if possible.
401     </para>
402     <para>
403      How do you update the webserver (i.e. the pages on privoxy.org)?
404      
405      <orderedlist numeration="arabic">
406       <listitem><para>
407         First, build the docs by running <computeroutput>make
408         dok</computeroutput> (or alternately <computeroutput>make
409         redhat-dok</computeroutput>). For PDF docs, do <computeroutput>make
410         dok-pdf</computeroutput>.
411       </para></listitem>
412       <listitem><para>
413         Run <computeroutput>make webserver</computeroutput> which copies all
414         files from <computeroutput>doc/webserver</computeroutput> to the
415         sourceforge webserver via scp.
416       </para></listitem>
417      </orderedlist>
418   </para>
419
420   <para>
421    Finished docs should be occasionally submitted to CVS
422    (<filename>doc/webserver/*/*.html</filename>) so that those without 
423    the ability to build them locally, have access to them if needed.
424    This is especially important just prior to a new release! Please
425    do this <emphasis>after</emphasis> the <literal>$VERSION</literal> and
426    other release specific data in <filename>configure.in</filename> has been
427    updated (this is done just prior to a new release).
428   </para>
429
430 <!--   ~~~~~       New section      ~~~~~     -->
431 <sect2 id="sgml">
432 <title>Quickstart to Docbook and SGML</title>
433 <para>
434  If you are not familiar with SGML, it is a markup language similar to HTML. 
435  Actually, not a mark up language per se, but a language used to define 
436  markup languages. In fact, HTML is an SGML application. Both will use
437  <quote>tags</quote> to format text and other content. SGML tags can be much
438  more varied, and flexible, but do much of the same kinds of things. The tags,
439  or <quote>elements</quote>, are definable in SGML. There is no set
440  <quote>standards</quote>. Since we are using
441  <application>Docbook</application>, our tags are those that are defined by 
442  <application>Docbook</application>. Much of how the finish document is
443  rendered is determined by the <quote>stylesheets</quote>.
444  The stylesheets determine how each tag gets translated to HTML, or other
445  formats.
446 </para>
447
448 <para>
449  Tags in Docbook SGML need to be always <quote>closed</quote>. If not, you
450  will likely generate errors. Example: <literal>&lt;title&gt;My
451  Title&lt;/title&gt;</literal>. They are also case-insensitive, but we
452  strongly suggest using all lower case. This keeps compatibility with
453  [Docbook] <application>XML</application>.
454 </para>
455
456 <para>
457  Our documents use <quote>sections</quote> for the most part. Sections
458  will be processed into HTML headers (e.g. <literal>h1</literal> for 
459  <literal>sect1</literal>). The <application>Docbook</application> stylesheets
460  will use these to also generate the Table of Contents for each doc. Our 
461  TOC's are set to a depth of three. Meaning <literal>sect1</literal>, 
462  <literal>sect2</literal>, and <literal>sect3</literal> will have TOC 
463  entries, but <literal>sect4</literal> will not. Each section requires 
464  a <literal>&lt;title&gt;</literal> element, and at least one 
465  <literal>&lt;para&gt;</literal>. There is a limit of five section 
466  levels in Docbook, but generally three should be sufficient for our 
467  purposes.
468 </para>
469
470 <para>
471  Some common elements that you likely will use: 
472 </para>
473
474 <para>
475   <simplelist>
476     <member>
477       <emphasis>&lt;para&gt;&lt;/para&gt;</emphasis>, paragraph delimiter. Most 
478       text needs to be within paragraph elements (there are some exceptions).
479     </member>
480     <member>
481       <emphasis>&lt;emphasis&gt;&lt;/emphasis&gt;</emphasis>, the stylesheets
482       make this italics.
483     </member>
484     <member>
485       <emphasis>&lt;filename&gt;&lt;/filename&gt;</emphasis>, files and directories.
486     </member>
487     <member>
488       <emphasis>&lt;command&gt;&lt;/command&gt;</emphasis>, command examples.
489     </member>
490     <member>
491       <emphasis>&lt;literallayout&gt;&lt;/literallayout&gt;</emphasis>, like 
492       <literal>&lt;pre&gt;</literal>, more or less.
493     </member>
494     <member>
495       <emphasis>&lt;itemizedlist&gt;&lt;/itemizedlist&gt;</emphasis>, list with bullets.
496     </member>
497     <member>
498       <emphasis>&lt;listitem&gt;&lt;/listitem&gt;</emphasis>, member of the above.
499     </member>
500     <member>
501       <emphasis>&lt;screen&gt;&lt;/screen&gt;</emphasis>, screen output, implies 
502       <literal>&lt;literallayout&gt;</literal>.
503     </member>
504     <member>
505       <emphasis>&lt;ulink url="example.com"&gt;&lt;/ulink&gt;</emphasis>, like 
506       HTML <literal>&lt;a&gt;</literal> tag.
507     </member>
508     <member>
509       <emphasis>&lt;quote&gt;&lt;/quote&gt;</emphasis>, for, doh, quoting text. 
510     </member>
511   </simplelist>
512 </para>
513
514 <para>
515  Look at any of the existing docs for examples of all these and more.
516 </para>
517
518 <para>
519  You might also find <quote><ulink
520  url="http://www.bureau-cornavin.com/opensource/crash-course/">Writing Documentation
521  Using DocBook - A Crash Course</ulink></quote> useful.
522 </para>
523 </sect2>
524
525 <!--   ~~~~~       New section      ~~~~~     -->
526   <sect2 id="docstyle">
527   <title><application>Privoxy</application> Documentation Style</title>
528    <para>
529     It will be easier if everyone follows a similar writing style. This 
530     just makes it easier to read what someone else has written if it 
531     is all done in a similar fashion.
532    </para>
533    <para>
534     Here it is:
535    </para>
536    <para>
537     <itemizedlist>
538      <listitem>
539       <para>
540        All tags should be lower case.
541       </para>
542     </listitem> 
543     <listitem>
544      <para>
545        Tags delimiting a <emphasis>block</emphasis> of text (even small
546        blocks) should be on their own line. Like:
547        <literallayout>
548  &lt;para&gt;
549   Some text goes here.
550  &lt;/para&gt;
551        </literallayout>
552        Tags marking individual words, or few words, should be in-line:
553        <literallayout>
554   Just to &lt;emphasis&gt;emphasize&lt;/emphasis&gt;, some text goes here.
555        </literallayout>
556      </para>
557    </listitem> 
558    <listitem>
559     <para>
560       Tags should be nested and step indented for block text like: (except
561       in-line tags) 
562      <literallayout>
563  &lt;para&gt;
564   &lt;itemizedlist&gt;
565    &lt;para&gt;
566     &lt;listitem&gt;
567       Some text goes here in our list example.
568      &lt;/listitem&gt;
569    &lt;/para&gt;
570   &lt;/itemizedlist&gt;
571  &lt;/para&gt;
572        </literallayout>
573       This makes it easier to find the text amongst the tags ;-)
574     </para>
575    </listitem> 
576    <listitem>
577     <para>
578      Use white space to separate logical divisions within a document, 
579      like between sections. Running everything together consistently 
580      makes it harder to read and work on.
581     </para>
582    </listitem> 
583    <listitem>
584     <para>
585      Do not hesitate to make comments. Comments can either use the 
586      &lt;comment&gt; element, or the &lt;!--  --&gt; style comment 
587      familiar from HTML. (Note in Docbook v4.x &lt;comment&gt; is 
588      replaced by &lt;remark&gt;.)
589     </para>
590   </listitem> 
591   <listitem>
592    <para>
593      We have an international audience. Refrain from slang, or English 
594      idiosyncrasies (too many to list :). Humor also does not translate 
595      well sometimes.
596    </para>
597   </listitem> 
598   <listitem>
599    <para>
600     Try to keep overall line lengths in source files to 80 characters or less
601     for obvious reasons. This is not always possible, with lengthy URLs for
602     instance.
603    </para>
604   </listitem> 
605   <listitem>
606    <para>
607     Our documents are available in differing formats. Right now, they 
608     are just plain text, TML, and PDF, but others are always a 
609     future possibility. Be careful with URLs (&lt;ulink&gt;), and avoid 
610     this mistake:
611    </para>
612    <para>
613      My favorite site is &lt;ulink url="http://example.com"&gt;here&lt;/ulink&gt;.
614    </para>
615    <para>
616      This will render as <quote>My favorite site is here</quote>, which is 
617      not real helpful in a text doc. Better like this:
618    </para>
619    <para>
620      My favorite site is &lt;ulink url="http://example.com"&gt;example.com&lt;/ulink&gt;.
621    </para>
622   </listitem>
623   <listitem>
624    <para>
625     All documents should be spell checked occasionally.
626     <application>aspell</application> can check SGML with the
627     <literal>-H</literal> option. (<application>ispell</application> I think
628     too.)
629    </para>
630   </listitem> 
631
632   </itemizedlist>
633  </para> 
634   
635   </sect2>
636
637   
638  <!--   ~~~~~       New section      ~~~~~     -->
639
640  <sect2><title>Privoxy Custom Entities</title>
641  <para>
642   <application>Privoxy</application> documentation is using 
643   a number of customized <quote>entities</quote> to facilitate 
644   documentation maintenance. 
645  </para>
646  <para>
647   We are using a set of <quote>boilerplate</quote> files with generic text,
648   that is used by multiple docs. This way we can write something once, and use
649   it repeatedly without having to re-write the same content over and over again.
650   If editing such a file, keep in mind that it should be
651   <emphasis>generic</emphasis>. That is the purpose; so it can be used in varying 
652   contexts without additional modifications.
653  </para>
654  <para>
655   We are also using what <application>Docbook</application> calls 
656   <quote>internal entities</quote>. These are like variables in 
657   programming. Well, sort of. For instance, we have the
658   <literal>p-version</literal> entity that contains the current 
659   <application>Privoxy</application> version string. You are strongly 
660   encouraged to use these where possible. Some of these obviously 
661   require re-setting with each release (done by the Makefile). A sampling of
662   custom entities are listed below. See any of the main docs for examples.
663  </para>
664
665  <para>
666   <itemizedlist>
667   <listitem>
668    <para>
669     Re- <quote>boilerplate</quote> text entities are defined like:
670    </para>
671    <para>
672     <literal>&lt;!entity supported SYSTEM "supported.sgml"&gt;</literal>
673    </para>
674    <para>
675      In this example, the contents of the file,
676      <filename>supported.sgml</filename> is available for inclusion anywhere 
677      in the doc. To make this happen, just reference the now defined 
678      entity: <literal>&#38;supported;</literal> (starts with an ampersand 
679      and ends with a semi-colon), and the contents will be dumped into 
680      the finished doc at that point.
681    </para>
682   </listitem> 
683   <listitem>
684    <para>
685     Commonly used <quote>internal entities</quote>:
686   </para>
687   <simplelist>
688    <member>
689     <emphasis>p-version</emphasis>: the <application>Privoxy</application> 
690     version string, e.g. <quote>&p-version;</quote>.
691    </member>
692    <member>
693     <emphasis>p-status</emphasis>: the project status, either 
694     <quote>alpha</quote>, <quote>beta</quote>, or <quote>stable</quote>.
695    </member>
696    <member>
697     <emphasis>p-not-stable</emphasis>: use to conditionally include 
698     text in <quote>not stable</quote> releases (e.g. <quote>beta</quote>).
699    </member>
700    <member>
701     <emphasis>p-stable</emphasis>: just the opposite.
702    </member>
703    <member>
704     <emphasis>p-text</emphasis>: this doc is only generated as text.
705    </member>
706   </simplelist>
707  </listitem> 
708  </itemizedlist>
709  </para> 
710  <para>
711   There are others in various places that are defined for a specific 
712   purpose. Read the source!
713  </para>
714  
715  </sect2>
716   
717  </sect1>
718
719 <!--     <listitem><para>be consistent with the redirect script (i.e. the <application>Privoxy</application> program -->
720 <!--       points via the redirect URL at sf to valid end-points in the document)</para></listitem> -->
721
722   <!--   ~~~~~       New section      ~~~~~     -->
723   <sect1 id="coding"><title>Coding Guidelines</title>
724
725     <sect2 id="s1"><title>Introduction</title>
726
727     <para>This set of standards is designed to make our lives easier.  It is
728     developed with the simple goal of helping us keep the "new and improved
729     <application>Privoxy</application>" consistent and reliable. Thus making
730     maintenance easier and increasing chances of success of the
731     project.</para>
732
733     <para>And that of course comes back to us as individuals. If we can
734     increase our development and product efficiencies then we can solve more
735     of the request for changes/improvements and in general feel good about
736     ourselves. ;-></para>
737
738   </sect2>
739
740     <sect2 id="s2"><title>Using Comments</title>
741  
742
743     <sect3 id="s3"><title>Comment, Comment, Comment</title>
744
745     <para><emphasis>Explanation:</emphasis></para>
746
747     <para>Comment as much as possible without commenting the obvious.
748     For example do not comment "aVariable is equal to bVariable".
749     Instead explain why aVariable should be equal to the bVariable.
750     Just because a person can read code does not mean they will
751     understand why or what is being done. A reader may spend a lot
752     more time figuring out what is going on when a simple comment
753     or explanation would have prevented the extra research. Please
754     help your brother IJB'ers out!</para>
755
756     <para>The comments will also help justify the intent of the code.
757     If the comment describes something different than what the code
758     is doing then maybe a programming error is occurring.</para>
759
760     <para><emphasis>Example:</emphasis></para>
761 <programlisting>
762 /* if page size greater than 1k ... */
763 if ( PageLength() > 1024 )
764 {
765     ... "block" the page up ...
766 }
767
768 /* if page size is small, send it in blocks */
769 if ( PageLength() > 1024 )
770 {
771     ... "block" the page up ...
772 }
773
774 This demonstrates 2 cases of "what not to do".  The first is a
775 "syntax comment".  The second is a comment that does not fit what
776 is actually being done.
777 </programlisting>
778   </sect3>
779
780     
781
782     <sect3 id="s4"><title>Use blocks for comments</title>
783
784     <para><emphasis>Explanation:</emphasis></para>
785
786     <para>Comments can help or they can clutter. They help when they
787     are differentiated from the code they describe. One line
788     comments do not offer effective separation between the comment
789     and the code. Block identifiers do, by surrounding the code
790     with a clear, definable pattern.</para>
791
792     <para><emphasis>Example:</emphasis></para>
793 <programlisting>
794 /*********************************************************************
795  * This will stand out clearly in your code!
796  *********************************************************************/
797 if ( thisVariable == thatVariable )
798 {
799    DoSomethingVeryImportant();
800 }
801
802
803 /* unfortunately, this may not */
804 if ( thisVariable == thatVariable )
805 {
806    DoSomethingVeryImportant();
807 }
808
809
810 if ( thisVariable == thatVariable ) /* this may not either */
811 {
812    DoSomethingVeryImportant();
813 }</programlisting>
814
815     <para><emphasis>Exception:</emphasis></para>
816
817     <para>If you are trying to add a small logic comment and do not
818     wish to "disrupt" the flow of the code, feel free to use a 1
819     line comment which is NOT on the same line as the code.</para>
820
821     
822   </sect3>
823     
824
825     <sect3 id="s5"><title>Keep Comments on their own line</title>
826
827     <para><emphasis>Explanation:</emphasis></para>
828
829     <para>It goes back to the question of readability. If the comment
830     is on the same line as the code it will be harder to read than
831     the comment that is on its own line.</para>
832
833     <para>There are three exceptions to this rule, which should be
834     violated freely and often: during the definition of variables,
835     at the end of closing braces, when used to comment
836     parameters.</para>
837
838     <para><emphasis>Example:</emphasis></para>
839 <programlisting>
840 /*********************************************************************
841  * This will stand out clearly in your code,
842  * But the second example won't.
843  *********************************************************************/
844 if ( thisVariable == thatVariable )
845 {
846    DoSomethingVeryImportant();
847 }
848
849 if ( thisVariable == thatVariable ) /*can you see me?*/
850 {
851    DoSomethingVeryImportant(); /*not easily*/
852 }
853
854
855 /*********************************************************************
856  * But, the encouraged exceptions:
857  *********************************************************************/
858 int urls_read     = 0;     /* # of urls read + rejected */
859 int urls_rejected = 0;     /* # of urls rejected */
860
861 if ( 1 == X )
862 {
863    DoSomethingVeryImportant();
864 }
865
866
867 short DoSomethingVeryImportant(
868    short firstparam,   /* represents something */
869    short nextparam     /* represents something else */ )
870 {
871    ...code here...
872
873 }   /* -END- DoSomethingVeryImportant */
874 </programlisting>
875   </sect3>
876     
877
878     <sect3 id="s6"><title>Comment each logical step</title>
879
880     <para><emphasis>Explanation:</emphasis></para>
881
882     <para>Logical steps should be commented to help others follow the
883     intent of the written code and comments will make the code more
884     readable.</para>
885
886     <para>If you have 25 lines of code without a comment, you should
887     probably go back into it to see where you forgot to put
888     one.</para>
889
890     <para>Most "for", "while", "do", etc... loops _probably_ need a
891     comment. After all, these are usually major logic
892     containers.</para>
893
894     
895   </sect3>
896     
897
898     <sect3 id="s7"><title>Comment All Functions Thoroughly</title>
899
900     <para><emphasis>Explanation:</emphasis></para>
901
902     <para>A reader of the code should be able to look at the comments
903     just prior to the beginning of a function and discern the
904     reason for its existence and the consequences of using it. The
905     reader should not have to read through the code to determine if
906     a given function is safe for a desired use. The proper
907     information thoroughly presented at the introduction of a
908     function not only saves time for subsequent maintenance or
909     debugging, it more importantly aids in code reuse by allowing a
910     user to determine the safety and applicability of any function
911     for the problem at hand. As a result of such benefits, all
912     functions should contain the information presented in the
913     addendum section of this document.</para>
914
915     
916   </sect3>
917     
918
919     <sect3 id="s8"><title>Comment at the end of braces if the
920     content is more than one screen length</title>
921
922     <para><emphasis>Explanation:</emphasis></para>
923
924     <para>Each closing brace should be followed on the same line by a
925     comment that describes the origination of the brace if the
926     original brace is off of the screen, or otherwise far away from
927     the closing brace. This will simplify the debugging,
928     maintenance, and readability of the code.</para>
929
930     <para>As a suggestion , use the following flags to make the
931     comment and its brace more readable:</para>
932
933     <para>use following a closing brace: } /* -END- if() or while ()
934     or etc... */</para>
935
936     <para><emphasis>Example:</emphasis></para>
937 <programlisting>
938 if ( 1 == X )
939 {
940    DoSomethingVeryImportant();
941    ...some long list of commands...
942 } /* -END- if x is 1 */
943
944 or:
945
946 if ( 1 == X )
947 {
948    DoSomethingVeryImportant();
949    ...some long list of commands...
950 } /* -END- if ( 1 == X ) */
951 </programlisting>
952   </sect3>
953     
954   </sect2>
955
956     <sect2 id="s9"><title>Naming Conventions</title>
957
958     
959
960     <sect3 id="s10"><title>Variable Names</title>
961
962     <para><emphasis>Explanation:</emphasis></para>
963
964     <para>Use all lowercase, and separate words via an underscore
965     ('_'). Do not start an identifier with an underscore. (ANSI C
966     reserves these for use by the compiler and system headers.) Do
967     not use identifiers which are reserved in ANSI C++. (E.g.
968     template, class, true, false, ...). This is in case we ever
969     decide to port Privoxy to C++.</para>
970
971     <para><emphasis>Example:</emphasis></para>
972 <programlisting>
973 int ms_iis5_hack = 0;</programlisting>
974
975     <para><emphasis>Instead of:</emphasis></para>
976
977     <para>
978 <programlisting>
979 int msiis5hack = 0; int msIis5Hack = 0;
980 </programlisting>
981 </para>
982
983     
984
985   </sect3>    
986
987     <sect3 id="s11"><title>Function Names</title>
988
989     <para><emphasis>Explanation:</emphasis></para>
990
991     <para>Use all lowercase, and separate words via an underscore
992     ('_'). Do not start an identifier with an underscore. (ANSI C
993     reserves these for use by the compiler and system headers.) Do
994     not use identifiers which are reserved in ANSI C++. (E.g.
995     template, class, true, false, ...). This is in case we ever
996     decide to port Privoxy to C++.</para>
997
998     <para><emphasis>Example:</emphasis></para>
999 <programlisting>
1000 int load_some_file( struct client_state *csp )</programlisting>
1001
1002     <para><emphasis>Instead of:</emphasis></para>
1003
1004     <para>
1005 <programlisting>
1006 int loadsomefile( struct client_state *csp )
1007 int loadSomeFile( struct client_state *csp )
1008 </programlisting>
1009 </para>
1010
1011     
1012   </sect3>
1013     
1014
1015     <sect3 id="s12"><title>Header file prototypes</title>
1016
1017     <para><emphasis>Explanation:</emphasis></para>
1018
1019     <para>Use a descriptive parameter name in the function prototype
1020     in header files. Use the same parameter name in the header file
1021     that you use in the c file.</para>
1022
1023     <para><emphasis>Example:</emphasis></para>
1024 <programlisting>
1025 (.h) extern int load_aclfile( struct client_state *csp );
1026 (.c) int load_aclfile( struct client_state *csp )</programlisting>
1027
1028     <para><emphasis>Instead of:</emphasis>
1029 <programlisting>
1030 (.h) extern int load_aclfile( struct client_state * ); or 
1031 (.h) extern int load_aclfile(); 
1032 (.c) int load_aclfile( struct client_state *csp )
1033 </programlisting>
1034 </para>
1035
1036     
1037   </sect3>
1038     
1039
1040     <sect3 id="s13"><title>Enumerations, and #defines</title>
1041
1042     <para><emphasis>Explanation:</emphasis></para>
1043
1044     <para>Use all capital letters, with underscores between words. Do
1045     not start an identifier with an underscore. (ANSI C reserves
1046     these for use by the compiler and system headers.)</para>
1047
1048     <para><emphasis>Example:</emphasis></para>
1049 <programlisting>
1050 (enumeration) : enum Boolean { FALSE, TRUE };
1051 (#define) : #define DEFAULT_SIZE 100;</programlisting>
1052
1053     <para><emphasis>Note:</emphasis> We have a standard naming scheme for #defines
1054     that toggle a feature in the preprocessor: FEATURE_>, where
1055     > is a short (preferably 1 or 2 word) description.</para>
1056
1057     <para><emphasis>Example:</emphasis></para>
1058 <programlisting>
1059 #define FEATURE_FORCE 1
1060
1061 #ifdef FEATURE_FORCE
1062 #define FORCE_PREFIX blah
1063 #endif /* def FEATURE_FORCE */
1064 </programlisting>
1065   </sect3>
1066     
1067
1068     <sect3 id="s14"><title>Constants</title>
1069
1070     <para><emphasis>Explanation:</emphasis></para>
1071
1072     <para>Spell common words out entirely (do not remove vowels).</para>
1073
1074     <para>Use only widely-known domain acronyms and abbreviations.
1075     Capitalize all letters of an acronym.</para>
1076
1077     <para>Use underscore (_) to separate adjacent acronyms and
1078     abbreviations. Never terminate a name with an underscore.</para>
1079
1080     <para><emphasis>Example:</emphasis></para>
1081 <programlisting>
1082 #define USE_IMAGE_LIST 1</programlisting>
1083
1084     <para><emphasis>Instead of:</emphasis></para>
1085
1086     <para>
1087 <programlisting>
1088 #define USE_IMG_LST 1 or 
1089 #define _USE_IMAGE_LIST 1 or
1090 #define USE_IMAGE_LIST_ 1 or 
1091 #define use_image_list 1 or
1092 #define UseImageList 1
1093 </programlisting>
1094 </para>
1095
1096     
1097   </sect3>
1098
1099   </sect2>
1100     
1101
1102     <sect2 id="s15"><title>Using Space</title>
1103
1104     
1105
1106     <sect3 id="s16"><title>Put braces on a line by themselves.</title>
1107
1108     <para><emphasis>Explanation:</emphasis></para>
1109
1110     <para>The brace needs to be on a line all by itself, not at the
1111     end of the statement. Curly braces should line up with the
1112     construct that they're associated with. This practice makes it
1113     easier to identify the opening and closing braces for a
1114     block.</para>
1115
1116     <para><emphasis>Example:</emphasis></para>
1117 <programlisting>
1118 if ( this == that )
1119 {
1120    ...
1121 }</programlisting>
1122
1123     <para><emphasis>Instead of:</emphasis></para>
1124
1125     <para>if ( this == that ) { ... }</para>
1126
1127     <para>or</para>
1128
1129     <para>if ( this == that ) { ... }</para>
1130
1131     <para><emphasis>Note:</emphasis> In the special case that the if-statement is
1132     inside a loop, and it is trivial, i.e. it tests for a
1133     condition that is obvious from the purpose of the block,
1134     one-liners as above may optically preserve the loop structure
1135     and make it easier to read.</para>
1136
1137     <para><emphasis>Status:</emphasis> developer-discretion.</para>
1138
1139     <para><emphasis>Example exception:</emphasis></para>
1140 <programlisting>
1141 while ( more lines are read )
1142 {
1143    /* Please document what is/is not a comment line here */
1144    if ( it's a comment ) continue;
1145
1146    do_something( line );
1147 }
1148 </programlisting>
1149   </sect3>
1150     
1151
1152     <sect3 id="s17"><title>ALL control statements should have a
1153     block</title>
1154
1155     <para><emphasis>Explanation:</emphasis></para>
1156
1157     <para>Using braces to make a block will make your code more
1158     readable and less prone to error. All control statements should
1159     have a block defined.</para>
1160
1161     <para><emphasis>Example:</emphasis></para>
1162 <programlisting>
1163 if ( this == that )
1164 {
1165    DoSomething();
1166    DoSomethingElse();
1167 }</programlisting>
1168
1169     <para><emphasis>Instead of:</emphasis></para>
1170
1171     <para>if ( this == that ) DoSomething(); DoSomethingElse();</para>
1172
1173     <para>or</para>
1174
1175     <para>if ( this == that ) DoSomething();</para>
1176
1177     <para><emphasis>Note:</emphasis> The first example in "Instead of" will execute
1178     in a manner other than that which the developer desired (per
1179     indentation). Using code braces would have prevented this
1180     "feature". The "explanation" and "exception" from the point
1181     above also applies.</para>
1182
1183     
1184   </sect3>
1185     
1186
1187     <sect3 id="s18"><title>Do not belabor/blow-up boolean
1188     expressions</title>
1189
1190     <para><emphasis>Example:</emphasis></para>
1191 <programlisting>
1192 structure->flag = ( condition );</programlisting>
1193
1194     <para><emphasis>Instead of:</emphasis></para>
1195
1196     <para>if ( condition ) { structure->flag = 1; } else {
1197     structure->flag = 0; }</para>
1198
1199     <para><emphasis>Note:</emphasis> The former is readable and concise. The later
1200     is wordy and inefficient. Please assume that any developer new
1201     to the project has at least a "good" knowledge of C/C++. (Hope
1202     I do not offend by that last comment ... 8-)</para>
1203
1204     
1205   </sect3>
1206     
1207
1208     <sect3 id="s19"><title>Use white space freely because it is
1209     free</title>
1210
1211     <para><emphasis>Explanation:</emphasis></para>
1212
1213     <para>Make it readable. The notable exception to using white space
1214     freely is listed in the next guideline.</para>
1215
1216     <para><emphasis>Example:</emphasis></para>
1217 <programlisting>
1218 int firstValue   = 0;
1219 int someValue    = 0;
1220 int anotherValue = 0;
1221 int thisVariable = 0;
1222
1223 if ( thisVariable == thatVariable )
1224
1225 firstValue = oldValue + ( ( someValue - anotherValue ) - whatever )
1226 </programlisting>
1227   </sect3>
1228     
1229
1230     <sect3 id="s20"><title>Don't use white space around structure
1231     operators</title>
1232
1233     <para><emphasis>Explanation:</emphasis></para>
1234
1235     <para>- structure pointer operator ( "->" ) - member operator (
1236     "." ) - functions and parentheses</para>
1237
1238     <para>It is a general coding practice to put pointers, references,
1239     and function parentheses next to names. With spaces, the
1240     connection between the object and variable/function name is not
1241     as clear.</para>
1242
1243     <para><emphasis>Example:</emphasis></para>
1244 <programlisting>
1245 aStruct->aMember;
1246 aStruct.aMember;
1247 FunctionName();</programlisting>
1248
1249     <para><emphasis>Instead of:</emphasis> aStruct -> aMember; aStruct . aMember;
1250     FunctionName ();</para>
1251
1252     
1253   </sect3>
1254     
1255
1256     <sect3 id="s21"><title>Make the last brace of a function stand
1257     out</title>
1258
1259     <para><emphasis>Example:</emphasis></para>
1260 <programlisting>
1261 int function1( ... )
1262 {
1263    ...code...
1264    return( retCode );
1265
1266 }   /* -END- function1 */
1267
1268
1269 int function2( ... )
1270 {
1271 }   /* -END- function2 */
1272 </programlisting>
1273
1274     <para><emphasis>Instead of:</emphasis></para>
1275
1276     <para>int function1( ... ) { ...code... return( retCode ); } int
1277     function2( ... ) { }</para>
1278
1279     <para><emphasis>Note:</emphasis> Use 1 blank line before the closing brace and 2
1280     lines afterward. This makes the end of function standout to
1281     the most casual viewer. Although function comments help
1282     separate functions, this is still a good coding practice. In
1283     fact, I follow these rules when using blocks in "for", "while",
1284     "do" loops, and long if {} statements too. After all whitespace
1285     is free!</para>
1286
1287     <para><emphasis>Status:</emphasis> developer-discretion on the number of blank
1288     lines. Enforced is the end of function comments.</para>
1289
1290     
1291   </sect3>
1292     
1293
1294     <sect3 id="s22"><title>Use 3 character indentions</title>
1295
1296     <para><emphasis>Explanation:</emphasis></para>
1297
1298     <para>If some use 8 character TABs and some use 3 character TABs,
1299     the code can look *very* ragged. So use 3 character indentions
1300     only. If you like to use TABs, pass your code through a filter
1301     such as "expand -t3" before checking in your code.</para>
1302
1303     <para><emphasis>Example:</emphasis></para>
1304 <programlisting>
1305 static const char * const url_code_map[256] =
1306 {
1307    NULL, ...
1308 };
1309
1310
1311 int function1( ... )
1312 {
1313    if ( 1 )
1314    {
1315       return( ALWAYS_TRUE );
1316    }
1317    else
1318    {
1319       return( HOW_DID_YOU_GET_HERE );
1320    }
1321
1322    return( NEVER_GETS_HERE );
1323
1324 }
1325 </programlisting>
1326   </sect3>
1327
1328   </sect2>
1329     
1330
1331     <sect2 id="s23"><title>Initializing</title>
1332
1333     
1334
1335     <sect3 id="s24"><title>Initialize all variables</title>
1336
1337     <para><emphasis>Explanation:</emphasis></para>
1338
1339     <para>Do not assume that the variables declared will not be used
1340     until after they have been assigned a value somewhere else in
1341     the code. Remove the chance of accidentally using an unassigned
1342     variable.</para>
1343
1344     <para><emphasis>Example:</emphasis></para>
1345 <programlisting>
1346 short anShort = 0;
1347 float aFloat  = 0;
1348 struct *ptr = NULL;</programlisting>
1349
1350     <para><emphasis>Note:</emphasis> It is much easier to debug a SIGSEGV if the
1351     message says you are trying to access memory address 00000000
1352     and not 129FA012; or arrayPtr[20] causes a SIGSEV vs.
1353     arrayPtr[0].</para>
1354
1355     <para><emphasis>Status:</emphasis> developer-discretion if and only if the
1356     variable is assigned a value "shortly after" declaration.</para>
1357
1358   </sect3>
1359   </sect2>
1360     
1361
1362     <sect2 id="s25"><title>Functions</title>
1363
1364     
1365
1366     <sect3 id="s26"><title>Name functions that return a boolean as a
1367     question.</title>
1368
1369     <para><emphasis>Explanation:</emphasis></para>
1370
1371     <para>Value should be phrased as a question that would logically
1372     be answered as a true or false statement</para>
1373
1374     <para><emphasis>Example:</emphasis></para>
1375 <programlisting>
1376 ShouldWeBlockThis();
1377 ContainsAnImage();
1378 IsWebPageBlank();
1379 </programlisting>
1380   </sect3>
1381     
1382
1383     <sect3 id="s27"><title>Always specify a return type for a
1384     function.</title>
1385
1386     <para><emphasis>Explanation:</emphasis></para>
1387
1388     <para>The default return for a function is an int. To avoid
1389     ambiguity, create a return for a function when the return has a
1390     purpose, and create a void return type if the function does not
1391     need to return anything.</para>
1392
1393     
1394   </sect3>
1395     
1396
1397     <sect3 id="s28"><title>Minimize function calls when iterating by
1398     using variables</title>
1399
1400     <para><emphasis>Explanation:</emphasis></para>
1401
1402     <para>It is easy to write the following code, and a clear argument
1403     can be made that the code is easy to understand:</para>
1404
1405     <para><emphasis>Example:</emphasis></para>
1406 <programlisting>
1407 for ( size_t cnt = 0; cnt &lt; blockListLength(); cnt ++ )
1408 {
1409    ....
1410 }</programlisting>
1411
1412     <para><emphasis>Note:</emphasis> Unfortunately, this makes a function call for
1413     each and every iteration. This increases the overhead in the
1414     program, because the compiler has to look up the function each
1415     time, call it, and return a value. Depending on what occurs in
1416     the blockListLength() call, it might even be creating and
1417     destroying structures with each iteration, even though in each
1418     case it is comparing "cnt" to the same value, over and over.
1419     Remember too - even a call to blockListLength() is a function
1420     call, with the same overhead.</para>
1421
1422     <para>Instead of using a function call during the iterations,
1423     assign the value to a variable, and evaluate using the
1424     variable.</para>
1425
1426     <para><emphasis>Example:</emphasis></para>
1427 <programlisting>
1428 size_t len = blockListLength();
1429
1430 for ( size_t cnt = 0; cnt &lt; len; cnt ++ )
1431 {
1432    ....
1433 }</programlisting>
1434
1435     <para><emphasis>Exceptions:</emphasis> if the value of blockListLength() *may*
1436     change or could *potentially* change, then you must code the
1437     function call in the for/while loop.</para>
1438
1439     
1440   </sect3>
1441     
1442
1443     <sect3 id="s29"><title>Pass and Return by Const Reference</title>
1444
1445     <para><emphasis>Explanation:</emphasis></para>
1446
1447     <para>This allows a developer to define a const pointer and call
1448     your function. If your function does not have the const
1449     keyword, we may not be able to use your function. Consider
1450     strcmp, if it were defined as: extern int strcmp( char *s1,
1451     char *s2 );</para>
1452
1453     <para>I could then not use it to compare argv's in main: int main(
1454     int argc, const char *argv[] ) { strcmp( argv[0], "privoxy"
1455     ); }</para>
1456
1457     <para>Both these pointers are *const*! If the c runtime library
1458     maintainers do it, we should too.</para>
1459
1460     
1461   </sect3>
1462     
1463
1464     <sect3 id="s30"><title>Pass and Return by Value</title>
1465
1466     <para><emphasis>Explanation:</emphasis></para>
1467
1468     <para>Most structures cannot fit onto a normal stack entry (i.e.
1469     they are not 4 bytes or less). Aka, a function declaration
1470     like: int load_aclfile( struct client_state csp )</para>
1471
1472     <para>would not work. So, to be consistent, we should declare all
1473     prototypes with "pass by value": int load_aclfile( struct
1474     client_state *csp )</para>
1475
1476     
1477   </sect3>
1478     
1479
1480     <sect3 id="s31"><title>Names of include files</title>
1481
1482     <para><emphasis>Explanation:</emphasis></para>
1483
1484     <para>Your include statements should contain the file name without
1485     a path. The path should be listed in the Makefile, using -I as
1486     processor directive to search the indicated paths. An exception
1487     to this would be for some proprietary software that utilizes a
1488     partial path to distinguish their header files from system or
1489     other header files.</para>
1490
1491     <para><emphasis>Example:</emphasis></para>
1492 <programlisting>
1493 #include &lt;iostream.h&gt;     /* This is not a local include */
1494 #include "config.h"       /* This IS a local include */
1495 </programlisting>
1496
1497     <para><emphasis>Exception:</emphasis></para>
1498
1499     <para>
1500 <programlisting>
1501 /* This is not a local include, but requires a path element. */ 
1502 #include &lt;sys/fileName.h&gt;
1503 </programlisting>
1504 </para>
1505
1506     <para><emphasis>Note:</emphasis> Please! do not add "-I." to the Makefile
1507     without a _very_ good reason. This duplicates the #include
1508     "file.h" behavior.</para>
1509
1510     
1511   </sect3>
1512     
1513
1514     <sect3 id="s32"><title>Provide multiple inclusion
1515     protection</title>
1516
1517     <para><emphasis>Explanation:</emphasis></para>
1518
1519     <para>Prevents compiler and linker errors resulting from
1520     redefinition of items.</para>
1521
1522     <para>Wrap each header file with the following syntax to prevent
1523     multiple inclusions of the file. Of course, replace PROJECT_H
1524     with your file name, with "." Changed to "_", and make it
1525     uppercase.</para>
1526
1527     <para><emphasis>Example:</emphasis></para>
1528 <programlisting>
1529 #ifndef PROJECT_H_INCLUDED
1530 #define PROJECT_H_INCLUDED
1531  ...
1532 #endif /* ndef PROJECT_H_INCLUDED */
1533 </programlisting>
1534   </sect3>
1535     
1536
1537     <sect3 id="s33"><title>Use `extern "C"` when appropriate</title>
1538
1539     <para><emphasis>Explanation:</emphasis></para>
1540
1541     <para>If our headers are included from C++, they must declare our
1542     functions as `extern "C"`. This has no cost in C, but increases
1543     the potential re-usability of our code.</para>
1544
1545     <para><emphasis>Example:</emphasis></para>
1546 <programlisting>
1547 #ifdef __cplusplus
1548 extern "C"
1549 {
1550 #endif /* def __cplusplus */
1551
1552 ... function definitions here ...
1553
1554 #ifdef __cplusplus
1555 }
1556 #endif /* def __cplusplus */
1557 </programlisting>
1558   </sect3>
1559     
1560
1561     <sect3 id="s34"><title>Where Possible, Use Forward Struct
1562     Declaration Instead of Includes</title>
1563
1564     <para><emphasis>Explanation:</emphasis></para>
1565
1566     <para>Useful in headers that include pointers to other struct's.
1567     Modifications to excess header files may cause needless
1568     compiles.</para>
1569
1570     <para><emphasis>Example:</emphasis></para>
1571 <programlisting>
1572 /*********************************************************************
1573  * We're avoiding an include statement here!
1574  *********************************************************************/
1575 struct file_list;
1576 extern file_list *xyz;</programlisting>
1577
1578     <para><emphasis>Note:</emphasis> If you declare "file_list xyz;" (without the
1579     pointer), then including the proper header file is necessary.
1580     If you only want to prototype a pointer, however, the header
1581     file is unnecessary.</para>
1582
1583     <para><emphasis>Status:</emphasis> Use with discretion.</para>
1584
1585     
1586   </sect3>
1587   </sect2>
1588
1589     <sect2 id="s35"><title>General Coding Practices</title>
1590
1591     
1592
1593     <sect3 id="s36"><title>Turn on warnings</title>
1594
1595     <para><emphasis>Explanation</emphasis></para>
1596
1597     <para>Compiler warnings are meant to help you find bugs. You
1598     should turn on as many as possible. With GCC, the switch is
1599     "-Wall". Try and fix as many warnings as possible.</para>
1600
1601     
1602   </sect3>
1603     
1604
1605     <sect3 id="s37"><title>Provide a default case for all switch
1606     statements</title>
1607
1608     <para><emphasis>Explanation:</emphasis></para>
1609
1610     <para>What you think is guaranteed is never really guaranteed. The
1611     value that you don't think you need to check is the one that
1612     someday will be passed. So, to protect yourself from the
1613     unknown, always have a default step in a switch statement.</para>
1614
1615     <para><emphasis>Example:</emphasis></para>
1616 <programlisting>
1617 switch( hash_string( cmd ) )
1618 {
1619    case hash_actions_file :
1620       ... code ...
1621       break;
1622
1623    case hash_confdir :
1624       ... code ...
1625       break;
1626
1627    default :
1628       log_error( ... );
1629       ... anomaly code goes here ...
1630       continue; / break; / exit( 1 ); / etc ...
1631
1632 } /* end switch( hash_string( cmd ) ) */</programlisting>
1633
1634     <para><emphasis>Note:</emphasis> If you already have a default condition, you
1635     are obviously exempt from this point. Of note, most of the
1636     WIN32 code calls `DefWindowProc' after the switch statement.
1637     This API call *should* be included in a default statement.</para>
1638
1639     <para><emphasis>Another Note:</emphasis> This is not so much a readability issue
1640     as a robust programming issue. The "anomaly code goes here" may
1641     be no more than a print to the STDERR stream (as in
1642     load_config). Or it may really be an ABEND condition.</para>
1643
1644     <para><emphasis>Status:</emphasis> Programmer discretion is advised.</para>
1645
1646     
1647   </sect3>
1648     
1649
1650     <sect3 id="s38"><title>Try to avoid falling through cases in a
1651     switch statement.</title>
1652
1653     <para><emphasis>Explanation:</emphasis></para>
1654
1655     <para>In general, you will want to have a 'break' statement within
1656     each 'case' of a switch statement. This allows for the code to
1657     be more readable and understandable, and furthermore can
1658     prevent unwanted surprises if someone else later gets creative
1659     and moves the code around.</para>
1660
1661     <para>The language allows you to plan the fall through from one
1662     case statement to another simply by omitting the break
1663     statement within the case statement. This feature does have
1664     benefits, but should only be used in rare cases. In general,
1665     use a break statement for each case statement.</para>
1666
1667     <para>If you choose to allow fall through, you should comment both
1668     the fact of the fall through and reason why you felt it was
1669     necessary.</para>
1670
1671     
1672   </sect3>
1673     
1674
1675     <sect3 id="s39"><title>Use 'long' or 'short' Instead of
1676     'int'</title>
1677
1678     <para><emphasis>Explanation:</emphasis></para>
1679
1680     <para>On 32-bit platforms, int usually has the range of long. On
1681     16-bit platforms, int has the range of short.</para>
1682
1683     <para><emphasis>Status:</emphasis> open-to-debate. In the case of most FSF
1684     projects (including X/GNU-Emacs), there are typedefs to int4,
1685     int8, int16, (or equivalence ... I forget the exact typedefs
1686     now). Should we add these to IJB now that we have a "configure"
1687     script?</para>
1688
1689     
1690   </sect3>
1691     
1692
1693     <sect3 id="s40"><title>Don't mix size_t and other types</title>
1694
1695     <para><emphasis>Explanation:</emphasis></para>
1696
1697     <para>The type of size_t varies across platforms. Do not make
1698     assumptions about whether it is signed or unsigned, or about
1699     how long it is. Do not compare a size_t against another
1700     variable of a different type (or even against a constant)
1701     without casting one of the values. Try to avoid using size_t if
1702     you can.</para>
1703
1704     
1705   </sect3>
1706     
1707
1708     <sect3 id="s41"><title>Declare each variable and struct on its
1709     own line.</title>
1710
1711     <para><emphasis>Explanation:</emphasis></para>
1712
1713     <para>It can be tempting to declare a series of variables all on
1714     one line. Don't.</para>
1715
1716     <para><emphasis>Example:</emphasis></para>
1717 <programlisting>
1718 long a = 0;
1719 long b = 0;
1720 long c = 0;</programlisting>
1721
1722     <para><emphasis>Instead of:</emphasis></para>
1723
1724     <para>long a, b, c;</para>
1725
1726     <para><emphasis>Explanation:</emphasis> - there is more room for comments on the
1727     individual variables - easier to add new variables without
1728     messing up the original ones - when searching on a variable to
1729     find its type, there is less clutter to "visually"
1730     eliminate</para>
1731
1732     <para><emphasis>Exceptions:</emphasis> when you want to declare a bunch of loop
1733     variables or other trivial variables; feel free to declare them
1734     on 1 line. You should, although, provide a good comment on
1735     their functions.</para>
1736
1737     <para><emphasis>Status:</emphasis> developer-discretion.</para>
1738
1739     
1740   </sect3>
1741     
1742
1743     <sect3 id="s42"><title>Use malloc/zalloc sparingly</title>
1744
1745     <para><emphasis>Explanation:</emphasis></para>
1746
1747     <para>Create a local struct (on the stack) if the variable will
1748     live and die within the context of one function call.</para>
1749
1750     <para>Only "malloc" a struct (on the heap) if the variable's life
1751     will extend beyond the context of one function call.</para>
1752
1753     <para><emphasis>Example:</emphasis></para>
1754 <programlisting>
1755 If a function creates a struct and stores a pointer to it in a
1756 list, then it should definitely be allocated via `malloc'.
1757 </programlisting>
1758   </sect3>
1759     
1760
1761     <sect3 id="s43"><title>The Programmer Who Uses 'malloc' is
1762     Responsible for Ensuring 'free'</title>
1763
1764     <para><emphasis>Explanation:</emphasis></para>
1765
1766     <para>If you have to "malloc" an instance, you are responsible for
1767     insuring that the instance is `free'd, even if the deallocation
1768     event falls within some other programmer's code. You are also
1769     responsible for ensuring that deletion is timely (i.e. not too
1770     soon, not too late). This is known as "low-coupling" and is a
1771     "good thing (tm)". You may need to offer a
1772     free/unload/destructor type function to accommodate this.</para>
1773
1774     <para><emphasis>Example:</emphasis></para>
1775 <programlisting>
1776 int load_re_filterfile( struct client_state *csp ) { ... }
1777 static void unload_re_filterfile( void *f ) { ... }</programlisting>
1778
1779     <para><emphasis>Exceptions:</emphasis></para>
1780
1781     <para>The developer cannot be expected to provide `free'ing
1782     functions for C run-time library functions ... such as
1783     `strdup'.</para>
1784
1785     <para><emphasis>Status:</emphasis> developer-discretion. The "main" use of this
1786     standard is for allocating and freeing data structures (complex
1787     or nested).</para>
1788
1789     
1790   </sect3>
1791     
1792
1793     <sect3 id="s44"><title>Add loaders to the `file_list' structure
1794     and in order</title>
1795
1796     <para><emphasis>Explanation:</emphasis></para>
1797
1798     <para>I have ordered all of the "blocker" file code to be in alpha
1799     order. It is easier to add/read new blockers when you expect a
1800     certain order.</para>
1801
1802     <para><emphasis>Note:</emphasis> It may appear that the alpha order is broken in
1803     places by POPUP tests coming before PCRS tests. But since
1804     POPUPs can also be referred to as KILLPOPUPs, it is clear that
1805     it should come first.</para>
1806
1807     
1808   </sect3>
1809     
1810
1811     <sect3 id="s45"><title>"Uncertain" new code and/or changes to
1812     existing code, use FIXME</title>
1813
1814     <para><emphasis>Explanation:</emphasis></para>
1815
1816     <para>If you have enough confidence in new code or confidence in
1817     your changes, but are not *quite* sure of the repercussions,
1818     add this:</para>
1819
1820     <para>/* FIXME: this code has a logic error on platform XYZ, *
1821     attempting to fix */ #ifdef PLATFORM ...changed code here...
1822     #endif</para>
1823
1824     <para>or:</para>
1825
1826     <para>/* FIXME: I think the original author really meant this...
1827     */ ...changed code here...</para>
1828
1829     <para>or:</para>
1830
1831     <para>/* FIXME: new code that *may* break something else... */
1832     ...new code here...</para>
1833
1834     <para><emphasis>Note:</emphasis> If you make it clear that this may or may not
1835     be a "good thing (tm)", it will be easier to identify and
1836     include in the project (or conversely exclude from the
1837     project).</para>
1838
1839     
1840   </sect3>
1841
1842   </sect2>
1843
1844     <sect2 id="s46"><title>Addendum: Template for files and function
1845     comment blocks:</title>
1846
1847     <para><emphasis>Example for file comments:</emphasis></para>
1848 <programlisting>
1849 const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 2.4 2002/09/26 05:57:14 hal9 Exp $";
1850 /*********************************************************************
1851  *
1852  * File        :  $S<!-- Break CVS Substitution -->ource$
1853  *
1854  * Purpose     :  (Fill me in with a good description!)
1855  *
1856  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1857  *                Privoxy team. http://www.privoxy.org/
1858  *
1859  *                Based on the Internet Junkbuster originally written
1860  *                by and Copyright (C) 1997 Anonymous Coders and
1861  *                Junkbusters Corporation.  http://www.junkbusters.com
1862  *
1863  *                This program is free software; you can redistribute it
1864  *                and/or modify it under the terms of the GNU General
1865  *                Public License as published by the Free Software
1866  *                Foundation; either version 2 of the License, or (at
1867  *                your option) any later version.
1868  *
1869  *                This program is distributed in the hope that it will
1870  *                be useful, but WITHOUT ANY WARRANTY; without even the
1871  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1872  *                PARTICULAR PURPOSE.  See the GNU General Public
1873  *                License for more details.
1874  *
1875  *                The GNU General Public License should be included with
1876  *                this file.  If not, you can view it at
1877  *                http://www.gnu.org/copyleft/gpl.html
1878  *                or write to the Free Software Foundation, Inc., 59
1879  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1880  *
1881  * Revisions   :
1882  *    $L<!-- Break CVS Substitution -->og$
1883  *
1884  *********************************************************************/
1885
1886
1887 #include "config.h"
1888
1889    ...necessary include files for us to do our work...
1890
1891 const char FILENAME_h_rcs[] = FILENAME_H_VERSION;
1892 </programlisting>
1893
1894     <para><emphasis>Note:</emphasis> This declares the rcs variables that should be
1895     added to the "show-proxy-args" page. If this is a brand new
1896     creation by you, you are free to change the "Copyright" section
1897     to represent the rights you wish to maintain.</para>
1898
1899     <para><emphasis>Note:</emphasis> The formfeed character that is present right
1900     after the comment flower box is handy for (X|GNU)Emacs users to
1901     skip the verbiage and get to the heart of the code (via
1902     `forward-page' and `backward-page'). Please include it if you
1903     can.</para>
1904
1905     <para><emphasis>Example for file header comments:</emphasis></para>
1906 <programlisting>
1907 #ifndef _FILENAME_H
1908 #define _FILENAME_H
1909 #define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 2.4 2002/09/26 05:57:14 hal9 Exp $"
1910 /*********************************************************************
1911  *
1912  * File        :  $S<!-- Break CVS Substitution -->ource$
1913  *
1914  * Purpose     :  (Fill me in with a good description!)
1915  *
1916  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
1917  *                Privoxy team. http://www.privoxy.org/
1918  *
1919  *                Based on the Internet Junkbuster originally written
1920  *                by and Copyright (C) 1997 Anonymous Coders and
1921  *                Junkbusters Corporation.  http://www.junkbusters.com
1922  *
1923  *                This program is free software; you can redistribute it
1924  *                and/or modify it under the terms of the GNU General
1925  *                Public License as published by the Free Software
1926  *                Foundation; either version 2 of the License, or (at
1927  *                your option) any later version.
1928  *
1929  *                This program is distributed in the hope that it will
1930  *                be useful, but WITHOUT ANY WARRANTY; without even the
1931  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
1932  *                PARTICULAR PURPOSE.  See the GNU General Public
1933  *                License for more details.
1934  *
1935  *                The GNU General Public License should be included with
1936  *                this file.  If not, you can view it at
1937  *                http://www.gnu.org/copyleft/gpl.html
1938  *                or write to the Free Software Foundation, Inc., 59
1939  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
1940  *
1941  * Revisions   :
1942  *    $L<!-- Break CVS Substitution -->og$
1943  *
1944  *********************************************************************/
1945
1946
1947 #include "project.h"
1948
1949 #ifdef __cplusplus
1950 extern "C" {
1951 #endif
1952
1953    ... function headers here ...
1954
1955
1956 /* Revision control strings from this header and associated .c file */
1957 extern const char FILENAME_rcs[];
1958 extern const char FILENAME_h_rcs[];
1959
1960
1961 #ifdef __cplusplus
1962 } /* extern "C" */
1963 #endif
1964
1965 #endif /* ndef _FILENAME_H */
1966
1967 /*
1968   Local Variables:
1969   tab-width: 3
1970   end:
1971 */
1972 </programlisting>
1973
1974     <para><emphasis>Example for function comments:</emphasis></para>
1975 <programlisting>
1976 /*********************************************************************
1977  *
1978  * Function    :  FUNCTION_NAME
1979  *
1980  * Description :  (Fill me in with a good description!)
1981  *
1982  * parameters  :
1983  *          1  :  param1 = pointer to an important thing
1984  *          2  :  x      = pointer to something else
1985  *
1986  * Returns     :  0 => Ok, everything else is an error.
1987  *
1988  *********************************************************************/
1989 int FUNCTION_NAME( void *param1, const char *x )
1990 {
1991    ...
1992    return( 0 );
1993
1994 }
1995 </programlisting>
1996
1997     <para><emphasis>Note:</emphasis> If we all follow this practice, we should be
1998     able to parse our code to create a "self-documenting" web
1999     page.</para>
2000
2001   </sect2>
2002
2003   </sect1>
2004
2005   <!--   ~~~~~       New section      ~~~~~     -->
2006   <sect1 id="testing"><title>Testing Guidelines</title>
2007     <para>To be filled.
2008 </para>
2009
2010     <!--   ~~~~~       New section      ~~~~~     -->
2011     <sect2 id="testing-plan"><title>Testplan for releases</title>
2012       <para>
2013        Explain release numbers. major, minor. developer releases. etc.
2014
2015 <orderedlist numeration="arabic">
2016           <listitem><para>
2017 Remove any existing rpm with rpm -e
2018 </para></listitem>
2019           <listitem><para>
2020 Remove any file that was left over. This includes (but is not limited to)
2021       <itemizedlist>
2022                 <listitem><para>/var/log/privoxy</para></listitem>
2023                 <listitem><para>/etc/privoxy</para></listitem>
2024                 <listitem><para>/usr/sbin/privoxy</para></listitem>
2025                 <listitem><para>/etc/init.d/privoxy</para></listitem>
2026                 <listitem><para>/usr/doc/privoxy*</para></listitem>
2027               </itemizedlist>
2028 </para></listitem>
2029           <listitem><para>
2030 Install the rpm. Any error messages?
2031 </para></listitem>
2032           <listitem><para>start,stop,status <application>Privoxy</application> with the specific script
2033       (e.g. /etc/rc.d/init/privoxy stop). Reboot your machine. Does
2034       autostart work?</para></listitem>
2035           <listitem><para>Start browsing. Does <application>Privoxy</application> work? Logfile written?</para></listitem>
2036           <listitem><para>Remove the rpm. Any error messages? All files removed?</para></listitem>
2037         </orderedlist>
2038 </para>
2039     </sect2>
2040
2041     <!--   ~~~~~       New section      ~~~~~     -->
2042     <sect2 id="testing-report"><title>Test reports</title>
2043       <para>
2044 Please submit test reports only with the <ulink url="http://sourceforge.net/tracker/?func=add&amp;group_id=11118&amp;atid=395005">test form</ulink>
2045 at sourceforge. Three simple steps:
2046         <itemizedlist>
2047           
2048           <listitem><para>Select category: the distribution you test on.</para></listitem>
2049           <listitem><para>Select group: the version of <application>Privoxy</application> that we are about to release.</para></listitem>
2050           <listitem><para>Fill the Summary and Detailed Description with something
2051               intelligent (keep it short and precise).</para>
2052           </listitem>
2053         </itemizedlist>
2054         Do not mail to the mailing list (we cannot keep track on issues there).
2055       </para>
2056     </sect2>
2057     
2058   </sect1>
2059
2060   <!--   ~~~~~       New section      ~~~~~     -->
2061   <sect1 id="newrelease"><title>Releasing a New Version</title>
2062     <para>
2063         When we release versions of <application>Privoxy</application>,
2064         our work leaves our cozy secret lab and has to work in the cold
2065         RealWorld[tm]. Once it is released, there is no way to call it
2066         back, so it is very important that great care is taken to ensure
2067         that everything runs fine, and not to introduce problems in the
2068         very last minute.
2069     </para>
2070     <para>
2071         So when releasing a new version, please adhere exactly to the
2072         procedure outlined in this chapter.
2073     </para>
2074
2075     <para>
2076         The following programs are required to follow this process:
2077         <filename>ncftpput</filename> (ncftp), <filename>scp, ssh</filename> (ssh),
2078         <filename>gmake</filename> (GNU's version of make), autoconf, cvs.
2079     </para>
2080
2081     <sect2 id="versionnumbers">
2082     <title>Version numbers</title>
2083
2084     <para>
2085       First you need to determine which version number the release will have. 
2086       <application>Privoxy</application> version numbers consist of three numbers,
2087       separated by dots, like in X.Y.Z (e.g. <literal>3.0.0</literal>), where:
2088         <itemizedlist>
2089           <listitem>
2090             <para>
2091               X, the version major, is rarely ever changed. It is increased by one if
2092               turning a development branch into stable substantially changes the functionality,
2093               user interface or configuration syntax. Majors 1 and 2 were 
2094               <application>Junkbuster</application>, and 3 will be the first stable
2095               <application>Privoxy</application> release.
2096             </para>
2097           </listitem>
2098           <listitem>
2099             <para>
2100               Y, the version minor, represents the branch within the major version.
2101               At any point in time, there are two branches being maintained:
2102               The stable branch, with an even minor, say, 2N, in which no functionality is
2103               being added and only bug-fixes are made, and 2N+1, the development branch, in
2104               which the further development of <application>Privoxy</application> takes
2105               place.
2106               This enables us to turn the code upside down and inside out, while at the same time
2107               providing and maintaining a stable version.
2108               The minor is reset to zero (and one) when the major is incremented. When a development
2109               branch has matured to the point where it can be turned into stable, the old stable branch
2110               2N is given up (i.e. no longer maintained), the former development branch 2N+1 becomes the
2111               new stable branch 2N+2, and a new development branch 2N+3 is opened.
2112             </para>
2113           </listitem>
2114           <listitem>
2115             <para>
2116               Z, the point or sub version, represents a release of the software within a branch.
2117               It is therefore incremented immediately before each code freeze. 
2118               In development branches, only the even point versions correspond to actual releases,
2119               while the odd ones denote the evolving state of the sources on CVS in between.
2120               It follows that Z is odd on CVS in development branches most of the time. There, it gets
2121               increased to an even number immediately before a code freeze, and is increased to an odd
2122               number again immediately thereafter.
2123               This ensures that builds from CVS snapshots are easily distinguished from released versions.
2124               The point version is reset to zero when the minor changes.
2125             </para>
2126             <para>
2127               Stable branches work a little differently, since there should be
2128               little to no development happening in such branches. Remember,
2129               only bugfixes, which presumably should have had some testing
2130               before being committed. Stable branches will then have their 
2131               version reported as <literal>0.0.0</literal>, during that period 
2132               between releases when changes are being added. This is to denote 
2133               that this code is <emphasis>not for release</emphasis>. Then 
2134               as the release nears, the version is bumped according: e.g. 
2135               <literal>3.0.1 -> 0.0.0 -> 3.0.2</literal>.
2136             </para>
2137           </listitem>
2138         </itemizedlist>
2139     </para>
2140     <para>
2141      In summary, the main CVS trunk is the development branch where new
2142      features are being worked on for the next stable series. This should
2143      almost always be where the most activity takes place. There is always at
2144      least one stable branch from the trunk, e.g now it is
2145      <literal>3.0</literal>, which is only used to release stable versions.
2146      Once the initial *.0 release of the stable branch has been done, then as a
2147      rule, only bugfixes that have had prior testing should be committed to
2148      the stable branch. Once there are enough bugfixes to justify a new
2149      release, the version of this branch is again incremented Example: 3.0.0
2150      -> 3.0.1 -> 3.0.2, etc are all stable releases from within the stable
2151      branch. 3.1.x is currently the main trunk, and where work on 3.2.x is
2152      taking place. If any questions, please post to the devel list
2153      <emphasis>before</emphasis> committing to a stable branch!
2154     </para>
2155     <para>
2156      Developers should remember too that if they commit a bugfix to the stable 
2157      branch, this will more than likely require a separate submission to the 
2158      main trunk, since these are separate development trees within CVS. If you 
2159      are working on both, then this would require at least two separate check
2160      outs (i.e main trunk, <emphasis>and</emphasis> the stable release branch,
2161      which is <literal>v_3_0_branch</literal> at the moment).
2162     </para>
2163
2164     </sect2>
2165      
2166     <sect2 id="beforerelease">
2167     <title>Before the Release: Freeze</title>
2168      <para>
2169        The following <emphasis>must be done by one of the
2170        developers</emphasis> prior to each new release.
2171      </para>
2172      <para>
2173       <itemizedlist>
2174        <listitem>
2175         <para>
2176          Make sure that everybody who has worked on the code in the last
2177          couple of days has had a chance to yell <quote>no!</quote> in case
2178          they have pending changes/fixes in their pipelines. Announce the
2179          freeze so that nobody will interfere with last minute changes.
2180         </para>
2181       </listitem> 
2182       <listitem>
2183        <para>
2184          Increment the version number (point from odd to even in development
2185          branches!) in <filename>configure.in</filename>. (RPM spec files 
2186          will need to be incremented as well.)
2187        </para>
2188       </listitem> 
2189       <listitem>
2190        <para>
2191         If <filename>default.action</filename> has changed since last
2192         release (i.e. software release or standalone actions file release),
2193         bump up its version info to A.B in this line:
2194        </para>
2195        <para> 
2196         <programlisting>
2197   {+add-header{X-Actions-File-Version: A.B} -filter -no-popups}
2198 </programlisting>
2199        </para>
2200        <para> 
2201         Then change the version info in doc/webserver/actions/index.php,
2202         line: '$required_actions_file_version = "A.B";'
2203        </para>
2204       </listitem>
2205       <listitem>
2206        <para>
2207         All documentation should be rebuild after the version bump.
2208         Finished docs should be then be committed to CVS (for those 
2209         without the ability to build these). Some docs may require 
2210         rather obscure processing tools. <filename>config</filename>,
2211         the man page (and the html version of the man page), and the PDF docs
2212         fall in this category. REAMDE, the man page, AUTHORS, and config
2213         should all also be committed to CVS for other packagers. The 
2214         formal docs should be uploaded to the webserver. See the
2215         Section "Updating the webserver" in this manual for details.
2216        </para>
2217       </listitem> 
2218       <listitem>
2219        <para>
2220          The <citetitle>User Manual</citetitle> is also used for context 
2221          sensitive help for the CGI editor. This is version sensitive, so that
2222          the user will get appropriate help for his/her release. So with 
2223          each release a fresh version should be uploaded to the webserver
2224          (this is in addition to the main <citetitle>User Manual</citetitle>
2225          link from the main page since we need to keep manuals for various 
2226          versions available). The CGI pages will link to something like 
2227          <literal>http://privoxy.org/$(VERSION)/user-manual/</literal>. This
2228          will need to be updated for each new release. There is no Makefile
2229          target for this at this time!!! It needs to be done manually.
2230        </para>
2231       </listitem> 
2232       <listitem>
2233        <para>
2234         All developers should look at the <filename>ChangeLog</filename> and
2235         make sure noteworthy changes are referenced.
2236        </para>
2237      </listitem> 
2238       <listitem>
2239        <para>
2240         <emphasis>Commit all files that were changed in the above steps!</emphasis>
2241        </para>
2242       </listitem>
2243       <listitem>
2244        <para>
2245         Tag all files in CVS with the version number with
2246         <quote><command>cvs tag v_X_Y_Z</command></quote>.
2247         Don't use vX_Y_Z, ver_X_Y_Z, v_X.Y.Z (won't work) etc.
2248        </para>
2249       </listitem> 
2250      <listitem>
2251        <para>
2252         If the release was in a development branch, increase the point version
2253         from even to odd (X.Y.(Z+1)) again in <filename>configure.in</filename> and
2254         commit your change.
2255        </para>
2256       </listitem> 
2257      <listitem>
2258        <para>
2259         On the webserver, copy the user manual to a new top-level directory
2260         called <filename>X.Y.Z</filename>. This ensures that help links from the CGI
2261         pages, which have the version as a prefix, will go into the right version of the manual.
2262         If this is a development branch release, also symlink <filename>X.Y.(Z-1)</filename>
2263         to <filename>X.Y.Z</filename> and <filename>X.Y.(Z+1)</filename> to
2264         <filename>.</filename> (i.e. dot). 
2265        </para>
2266       </listitem> 
2267       </itemizedlist>
2268      </para> 
2269     </sect2>
2270     
2271     <sect2 id="therelease">
2272     <title>Building and Releasing the Packages</title>
2273      <para>
2274       Now the individual packages can be built and released. Note that for
2275       GPL reasons the first package to be released is always the source tarball.
2276      </para>
2277  
2278      <para>
2279       For <emphasis>all</emphasis> types of packages, including the source tarball,
2280       <emphasis>you must make sure that you build from clean sources by exporting
2281       the right version from CVS into an empty directory</emphasis> (just press return when
2282       asked for a password):
2283      </para>
2284       
2285      <para>
2286       <programlisting>
2287   mkdir dist # delete or choose different name if it already exists
2288   cd dist
2289   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login
2290   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa export -r v_X_Y_Z current
2291 </programlisting>
2292     </para>
2293   
2294     <para>
2295      <emphasis>Do NOT change</emphasis> a single bit, including, but not limited to
2296      version information after export from CVS. This is to make sure that
2297      all release packages, and with them, all future bug reports, are based
2298      on exactly the same code.
2299     </para>
2300   
2301     <para>
2302      Please find additional instructions for the source tarball and the
2303      individual platform dependent binary packages below. And details 
2304      on the Sourceforge release process below that.
2305     </para>
2306
2307     <sect3 id="pack-guidelines">
2308     <title>Note on Privoxy Packaging</title>
2309      <para>
2310       Please keep these general guidelines in mind when putting together 
2311       your package. These apply to <emphasis>all</emphasis> platforms!
2312      </para>
2313      <para>
2314       <itemizedlist>
2315        <listitem>
2316         <para>
2317           <application>Privoxy</application> <emphasis>requires</emphasis>
2318           write access to: all <filename>*.action</filename> files, all 
2319           logfiles, and the <filename>trust</filename> file. You will 
2320           need to determine the best way to do this for your platform.
2321         </para>
2322        </listitem> 
2323        <listitem>
2324         <para>
2325           Please include up to date documentation. At a bare minimum:
2326         </para>
2327         <simplelist>
2328          <member>
2329           <filename>LICENSE</filename> (top-level directory)
2330          </member>
2331         </simplelist>
2332         <simplelist>
2333          <member>
2334           <filename>README</filename> (top-level directory)
2335          </member>
2336         </simplelist>
2337         <simplelist>
2338          <member>
2339           <filename>AUTHORS</filename> (top-level directory)
2340          </member>
2341         </simplelist>
2342         <simplelist>
2343          <member>
2344           <filename>man page</filename> (top-level directory, Unix-like
2345           platforms only)
2346          </member>
2347         </simplelist>
2348         <simplelist>
2349          <member>
2350           <filename>The User Manual</filename> (doc/webserver/user-manual/)
2351          </member>
2352         </simplelist>
2353         <simplelist>
2354          <member>
2355           <filename>FAQ</filename> (doc/webserver/faq/)
2356          </member>
2357         </simplelist>
2358         <para>
2359           Also suggested: <filename>Developer Manual</filename>
2360           (doc/webserver/developer-manual) and <filename>ChangeLog</filename>
2361           (top-level directory). <filename>FAQ</filename> and the manuals are
2362           HTML docs. There are also text versions in
2363           <filename>doc/text/</filename> which could conceivably also be
2364           included.
2365         </para>
2366         <para>
2367          The documentation has been designed such that the manuals are linked
2368          to each other from parallel directories, and should be packaged 
2369          that way. <filename>privoxy-index.html</filename> can also be
2370          included and can serve as a focal point for docs and other links of
2371          interest (and possibly renamed to <filename>index.html</filename>).
2372          This should be one level up from the manuals. There is a link also 
2373          on this page to an HTMLized version of the man page. To avoid 404 for
2374          this, it is in CVS as
2375          <filename>doc/webserver/man-page/privoxy-man-page.html</filename>,
2376          and should be included along with the manuals. There is also a
2377          css stylesheets that can be included for better presentation:
2378          <filename>p_doc.css</filename>. This should be in the same directory
2379          with <filename>privoxy-index.html</filename>, (i.e. one level up from
2380          the manual directories).
2381         </para>
2382       </listitem> 
2383       <listitem>
2384        <para>
2385         <filename>user.action</filename> is designed for local preferences. 
2386         Make sure this does not get overwritten!
2387        </para>
2388       </listitem> 
2389       <listitem>
2390        <para>
2391         Other configuration files should be installed as the new defaults, 
2392         but all previously installed configuration files should be preserved
2393         as backups. This is just good manners :-)
2394        </para>
2395      </listitem> 
2396      <listitem>
2397       <para>
2398        Please check platform specific notes in this doc, if you haven't 
2399        done <quote>Privoxy</quote> packaging before for other platform 
2400        specific issues. Conversely, please add any notes that you know 
2401        are important for your platform (or contact one of the doc 
2402        maintainers to do this if you can't).
2403       </para>
2404     </listitem> 
2405     <listitem>
2406      <para>
2407        Packagers should do a <quote>clean</quote> install of their 
2408        package after building it. So any previous installs should be 
2409        removed first to ensure the integrity of the newly built package. 
2410        Then run the package for a while to make sure there are no 
2411        obvious problems, before uploading.
2412      </para>
2413     </listitem> 
2414
2415       </itemizedlist>
2416      </para> 
2417     
2418     </sect3>
2419
2420     <sect3 id="newrelease-tarball"><title>Source Tarball</title>
2421         <para>
2422         First, <emphasis>make sure that you have freshly exported the right
2423         version into an empty directory</emphasis>. (See "Building and releasing
2424         packages" above). Then run:
2425         </para>
2426         <para>
2427         <programlisting>
2428   cd current
2429   autoheader && autoconf && ./configure
2430 </programlisting>
2431         </para>
2432         <para>
2433         Then do:
2434         </para>
2435         <para>
2436         <programlisting>
2437   make tarball-dist
2438 </programlisting>
2439         </para>
2440         <para>
2441         To upload the package to Sourceforge, simply issue
2442         </para>
2443         <para>
2444         <programlisting>
2445   make tarball-upload
2446 </programlisting>
2447         </para>
2448         <para>
2449         Go to the displayed URL and release the file publicly on Sourceforge.
2450         For the change log field, use the relevant section of the
2451         <filename>ChangeLog</filename> file.
2452       </para>
2453     </sect3>
2454
2455     <sect3 id="newrelease-rpm"><title>SuSE, Conectiva or Red Hat RPM</title>
2456         <para>
2457         In following text, replace <replaceable class="parameter">dist</replaceable>
2458         with either <quote>rh</quote> for Red Hat or <quote>suse</quote> for SuSE.
2459         </para>
2460         <para>
2461         First, <emphasis>make sure that you have freshly exported the right
2462         version into an empty directory</emphasis>. (See "Building and releasing
2463         packages" above). 
2464         </para>
2465         <para>
2466         As the only exception to not changing anything after export from CVS,
2467         now examine the file <filename>privoxy-</filename><replaceable class="parameter">dist</replaceable><filename>.spec</filename>
2468         and make sure that the version information and the RPM release number are
2469         correct. The RPM release numbers for each version start at one. Hence it must
2470         be reset to one if this is the first RPM for
2471         <replaceable class="parameter">dist</replaceable> which is built from version
2472         X.Y.Z. Check the
2473         <ulink url="http://sourceforge.net/project/showfiles.php?group_id=11118">file
2474         list</ulink> if unsure. Else, it must be set to the highest already available RPM
2475         release number for that version plus one.
2476         </para>
2477         <para>
2478         Then run:
2479         </para>
2480         <para>
2481         <programlisting>
2482   cd current
2483   autoheader && autoconf && ./configure
2484 </programlisting>
2485         </para>
2486         <para>
2487         Then do
2488         </para>
2489         <para>
2490         <programlisting>
2491   make <replaceable class="parameter">dist</replaceable>-dist
2492 </programlisting>
2493         </para>
2494         <para>
2495         To upload the package to Sourceforge, simply issue
2496         </para>
2497         <para>
2498         <programlisting>
2499   make <replaceable class="parameter">dist</replaceable>-upload <replaceable class="parameter">rpm_packagerev</replaceable>
2500 </programlisting>
2501         </para>
2502         <para>
2503         where <replaceable class="parameter">rpm_packagerev</replaceable> is the
2504         RPM release number as determined above.
2505         Go to the displayed URL and release the file publicly on Sourceforge.
2506         Use the release notes and change log from the source tarball package.
2507       </para>
2508     </sect3>
2509
2510     <sect3 id="newrelease-os2"><title>OS/2</title>
2511       <para>
2512         First, <emphasis>make sure that you have freshly exported the right
2513         version into an empty directory</emphasis>. (See "Building and releasing
2514         packages" above). Then get the OS/2 Setup module:
2515         </para>
2516         <para>
2517         <programlisting>
2518   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co os2setup
2519 </programlisting>
2520         </para>
2521         <para>
2522         You will need a mix of development tools.
2523         The main compilation takes place with IBM Visual Age C++.
2524         Some ancillary work takes place with GNU tools, available from
2525         various sources like hobbes.nmsu.edu.
2526         Specificially, you will need <filename>autoheader</filename>,
2527         <filename>autoconf</filename> and <filename>sh</filename> tools.
2528         The packaging takes place with WarpIN, available from various sources, including
2529         its home page: <ulink url="http://www.xworkplace.org/">xworkplace</ulink>.
2530         </para>
2531         <para>
2532         Change directory to the <filename>os2setup</filename> directory.
2533         Edit the os2build.cmd file to set the final executable filename.
2534         For example, 
2535         </para>
2536         <para>
2537         <programlisting>
2538   installExeName='privoxyos2_setup_X.Y.Z.exe'
2539 </programlisting>
2540         </para>
2541         <para>
2542         Next, edit the <filename>IJB.wis</filename> file so the release number matches
2543         in the <filename>PACKAGEID</filename> section:
2544         </para>
2545         <para>
2546         <programlisting>
2547   PACKAGEID="Privoxy Team\Privoxy\Privoxy Package\X\Y\Z"
2548 </programlisting>
2549         </para>
2550         <para>
2551         You're now ready to build.  Run:
2552         </para>
2553         <para>
2554         <programlisting>
2555   os2build
2556 </programlisting>
2557         </para>
2558         <para>
2559          You will find the  WarpIN-installable executable in the
2560         <filename>./files</filename> directory. Upload this anonymously to
2561          <filename>uploads.sourceforge.net/incoming</filename>, create a release
2562          for it, and you're done. Use the release notes and Change Log from the
2563          source tarball package.
2564         </para>
2565     </sect3>
2566
2567     <sect3 id="newrelease-solaris"><title>Solaris</title>
2568       <para>
2569         Login to Sourceforge's compilefarm via ssh:
2570         </para>
2571         <para>
2572         <programlisting>
2573   ssh cf.sourceforge.net
2574 </programlisting>
2575         </para>
2576         <para>
2577         Choose the right operating system (not the Debian one).
2578         When logged in, <emphasis>make sure that you have freshly exported the right
2579         version into an empty directory</emphasis>. (See "Building and releasing
2580         packages" above). Then run:
2581         </para>
2582         <para>
2583         <programlisting>
2584   cd current
2585   autoheader && autoconf && ./configure
2586 </programlisting>
2587         </para>
2588         <para>
2589         Then run
2590         </para>
2591         <para>
2592         <programlisting>
2593   gmake solaris-dist
2594 </programlisting>
2595         </para>
2596         <para>
2597         which creates a gzip'ed tar archive. Sadly, you cannot use <command>make
2598         solaris-upload</command> on the Sourceforge machine (no ncftpput). You now have
2599         to manually upload the archive to Sourceforge's ftp server and release
2600         the file publicly. Use the release notes and Change Log from the
2601         source tarball package.
2602         </para>
2603     </sect3>
2604
2605     <sect3 id="newrelease-windows"><title>Windows</title>
2606       <para>
2607         You should ensure you have the latest version of Cygwin (from
2608         <ulink url="http://www.cygwin.com/">http://www.cygwin.com/</ulink>).
2609         Run the following commands from within a Cygwin bash shell.
2610       </para>
2611       <para>
2612         First, <emphasis>make sure that you have freshly exported the right
2613         version into an empty directory</emphasis>. (See "Building and releasing
2614         packages" above). Then get the Windows setup module:
2615       </para>
2616       <para>
2617       <programlisting>
2618   cvs -z3  -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co winsetup
2619 </programlisting>
2620       </para>
2621       <para>
2622         Then you can build the package.  This is fully automated, and is
2623         controlled by <filename>winsetup/GNUmakefile</filename>.
2624         All you need to do is:
2625       </para>
2626       <para>
2627       <programlisting>
2628   cd winsetup
2629   make
2630 </programlisting>
2631       </para>
2632       <para>
2633         Now you can manually rename <filename>privoxy_setup.exe</filename> to
2634         <filename>privoxy_setup_X_Y_Z.exe</filename>, and upload it to
2635         SourceForge. When releasing the package on SourceForge, use the release notes
2636         and Change Log from the source tarball package.
2637       </para>
2638     </sect3>
2639
2640     <sect3 id="newrelease-debian"><title>Debian</title>
2641       <para>
2642         First, <emphasis>make sure that you have freshly exported the
2643         right version into an empty directory</emphasis>. (See
2644         "Building and releasing packages" above).  Then add a log
2645         entry to <filename>debian/changelog</filename>, if it is not
2646         already there, for example by running:
2647       </para>
2648       <para>
2649         <programlisting>
2650   debchange -v &p-version;-&p-status;-1 "New upstream version"
2651 </programlisting>
2652       </para>
2653       <para>
2654         Then, run: 
2655       </para>
2656       <para>
2657         <programlisting>
2658   dpkg-buildpackage -rfakeroot -us -uc -b
2659 </programlisting>
2660       </para>
2661       <para>
2662         This will create
2663         <filename>../privoxy_&p-version;-&p-status;-1_i386.deb</filename>
2664         which can be uploaded.  To upload the package to Sourceforge, simply
2665         issue
2666       </para>
2667       <para>
2668         <programlisting>
2669   make debian-upload
2670 </programlisting>
2671       </para>
2672     </sect3>
2673
2674     <sect3 id="newrelease-macosx"><title>Mac OSX</title>
2675       <para>
2676         First, <emphasis>make sure that you have freshly exported the right
2677         version into an empty directory</emphasis>. (See "Building and releasing
2678         packages" above). Then get the Mac OSX setup module:
2679         </para>
2680         <para>
2681         <programlisting>
2682   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co osxsetup
2683 </programlisting>
2684         </para>
2685         <para>
2686         Then run:
2687         </para>
2688         <para>
2689         <programlisting>
2690   cd osxsetup
2691   build
2692 </programlisting>
2693         </para>
2694         <para>
2695         This will run <filename>autoheader</filename>, <filename>autoconf</filename> and
2696         <filename>configure</filename> as well as <filename>make</filename>.
2697         Finally, it will copy over the necessary files to the ./osxsetup/files directory
2698         for further processing by <filename>PackageMaker</filename>.
2699         </para>
2700         <para>
2701         Bring up PackageMaker with the PrivoxyPackage.pmsp definition file, modify the package
2702         name to match the release, and hit the "Create package" button.
2703         If you specify ./Privoxy.pkg as the output package name, you can then create
2704         the distributable zip file with the command:
2705         </para>
2706         <para>
2707         <programlisting>
2708   zip -r privoxyosx_setup_x.y.z.zip Privoxy.pkg
2709 </programlisting>
2710         </para>
2711         <para>
2712         You can then upload <filename>privoxyosx_setup_x.y.z.zip</filename> anonymously to 
2713         <filename>uploads.sourceforge.net/incoming</filename>,
2714         create a release for it, and you're done. Use the release notes
2715         and Change Log from the source tarball package.
2716         </para>
2717     </sect3>
2718
2719     <sect3 id="newrelease-freebsd"><title>FreeBSD</title>
2720       <para>
2721         Login to Sourceforge's compile-farm via ssh:
2722         </para>
2723         <para>
2724         <programlisting>
2725   ssh cf.sourceforge.net
2726 </programlisting>
2727         </para>
2728         <para>
2729         Choose the right operating system.
2730         When logged in, <emphasis>make sure that you have freshly exported the right
2731         version into an empty directory</emphasis>. (See "Building and releasing
2732         packages" above). Then run:
2733         </para>
2734         <para>
2735         <programlisting>
2736   cd current
2737   autoheader && autoconf && ./configure
2738 </programlisting>
2739         </para>
2740         <para>
2741         Then run:
2742         </para>
2743         <para>
2744         <programlisting>
2745   gmake freebsd-dist
2746 </programlisting>
2747         </para>
2748         <para>
2749         which creates a gzip'ed tar archive. Sadly, you cannot use <command>make
2750         freebsd-upload</command> on the Sourceforge machine (no ncftpput). You now have
2751         to manually upload the archive to Sourceforge's ftp server and release
2752         the file publicly. Use the release notes and Change Log from the
2753         source tarball package.
2754         </para>
2755     </sect3>
2756
2757     <sect3 id="newrelease-hpux"><title>HP-UX 11</title>
2758       <para>
2759         First, <emphasis>make sure that you have freshly exported the right
2760         version into an empty directory</emphasis>. (See "Building and releasing
2761         packages" above). Then run:
2762         </para>
2763         <para>
2764         <programlisting>
2765   cd current
2766   autoheader && autoconf && ./configure
2767 </programlisting>
2768         </para>
2769         <para>
2770         Then do FIXME.
2771         </para>
2772     </sect3>
2773
2774     <sect3 id="newrelease-amiga"><title>Amiga OS</title>
2775       <para>
2776         First, <emphasis>make sure that you have freshly exported the right
2777         version into an empty directory</emphasis>. (See "Building and releasing
2778         packages" above). Then run:
2779         </para>
2780         <para>
2781         <programlisting>
2782   cd current
2783   autoheader && autoconf && ./configure
2784 </programlisting>
2785         </para>
2786         <para>
2787         Then do FIXME.
2788         </para>
2789     </sect3>
2790
2791     <sect3 id="newrelease-aix"><title>AIX</title>
2792       <para>
2793         Login to Sourceforge's compilefarm via ssh:
2794         </para>
2795         <para>
2796         <programlisting>
2797   ssh cf.sourceforge.net
2798 </programlisting>
2799         </para>
2800         <para>
2801         Choose the right operating system.
2802         When logged in, <emphasis>make sure that you have freshly exported the right
2803         version into an empty directory</emphasis>. (See "Building and releasing
2804         packages" above). Then run:
2805         </para>
2806         <para>
2807         <programlisting>
2808   cd current
2809   autoheader && autoconf && ./configure
2810 </programlisting>
2811         </para>
2812         <para>
2813         Then run:
2814         </para>
2815         <para>
2816         <programlisting>
2817   make aix-dist
2818 </programlisting>
2819         </para>
2820         <para>
2821         which creates a gzip'ed tar archive. Sadly, you cannot use <command>make
2822         aix-upload</command> on the Sourceforge machine (no ncftpput). You now have
2823         to manually upload the archive to Sourceforge's ftp server and release
2824         the file publicly. Use the release notes and Change Log from the
2825         source tarball package.
2826         </para>
2827     </sect3>
2828    </sect2>
2829
2830    <sect2 id="releasing">
2831    <title>Uploading and Releasing Your Package</title>
2832     <para>
2833       After the package is ready, it is time to upload it 
2834       to SourceForge, and go through the release steps. The upload
2835       is done via FTP:
2836     </para>
2837      <para>
2838       <itemizedlist>
2839        <listitem>
2840         <para>
2841           Upload to: <ulink url="ftp://upload.sourceforge.net/incoming">ftp://upload.sourceforge.net/incoming</ulink>
2842         </para>
2843       </listitem> 
2844       <listitem>
2845        <para>
2846          user: <literal>anonymous</literal>
2847        </para>
2848       </listitem> 
2849       <listitem>
2850        <para>
2851          password: <literal>ijbswa-developers@lists.sourceforge.net</literal>
2852        </para>
2853       </listitem> 
2854      </itemizedlist>
2855     </para> 
2856     <para>
2857      Or use the <command>make</command> targets as described above.
2858     </para>
2859     <para>
2860      Once this done go to <ulink url="http://sourceforge.net/project/admin/editpackages.php?group_id=11118">http://sourceforge.net/project/admin/editpackages.php?group_id=11118</ulink>, 
2861      making sure you are logged in. Find your target platform in the 
2862      second column, and click <literal>Add Release</literal>. You will 
2863      then need to create a new release for your package, using the format 
2864      of <literal>$VERSION ($CODE_STATUS)</literal>, e.g. <emphasis>&p-version;
2865      (beta)</emphasis>.
2866     </para>
2867     <para>
2868      Now just follow the prompts. Be sure to add any appropriate Release
2869      notes. You should see your freshly uploaded packages in 
2870      <quote>Step 2. Add Files To This Release</quote>. Check the 
2871      appropriate box(es). Remember at each step to hit the 
2872      <quote>Refresh/Submit</quote> buttons! You should now see your 
2873      file(s) listed in Step 3. Fill out the forms with the appropriate 
2874      information for your platform, being sure to hit <quote>Update</quote>
2875      for each file. If anyone is monitoring your platform, check the 
2876      <quote>email</quote> box at the very bottom to notify them of 
2877      the new package. This should do it!
2878     </para>
2879     <para>
2880      If you have made errors, or need to make changes, you can go through 
2881      essentially the same steps, but select <literal>Edit Release</literal>, 
2882      instead of <literal>Add Release</literal>.
2883     </para>
2884    </sect2>
2885
2886     <sect2 id="afterrelease">
2887     <title>After the Release</title>
2888      <para>
2889       When all (or: most of the) packages have been uploaded and made available,
2890       send an email to the <ulink url="mailto:ijbswa-announce@lists.sourceforge.net">announce
2891       mailing list</ulink>, Subject: "Version X.Y.Z available for download". Be sure to
2892       include the
2893       <ulink url="http://sourceforge.net/project/showfiles.php?group_id=11118">download
2894       location</ulink>, the release notes and the Changelog. Also, post an
2895       updated News item on the project page Sourceforge, and update the Home 
2896       page and docs linked from the Home page (see below).
2897      </para>
2898    </sect2>
2899
2900   </sect1>
2901   
2902   <!--   ~~~~~       New section      ~~~~~     -->
2903   <sect1 id="webserver-update"><title>Update the Webserver</title>
2904    <para>
2905     The webserver should be updated at least with each stable release. When
2906     updating, please follow these steps to make sure that no broken links,
2907     inconsistent contents or permission problems will occur (as it has many 
2908     times in the past!):
2909    </para>
2910    <para>
2911     If you have changed anything in the stable-branch documentation source
2912     SGML files, do:
2913    </para>
2914    <para>
2915     <programlisting>
2916   make dok dok-pdf # (or 'make redhat-dok dok-pdf' if 'make dok' doesn't work for you)
2917 </programlisting>
2918    </para>
2919    <para>
2920     That will generate <filename>doc/webserver/user-manual</filename>,
2921     <filename>doc/webserver/developer-manual</filename>,
2922     <filename>doc/webserver/faq</filename>, 
2923     <filename>doc/pdf/*.pdf</filename> and
2924     <filename>doc/webserver/index.html</filename> automatically.
2925    </para>
2926    <para>
2927     If you changed the manual page sources, generate
2928     <filename>doc/webserver/man-page/privoxy-man-page.html</filename>
2929     by running <quote><command>make man</command></quote>. (This is
2930     a separate target due to dependencies on some obscure perl scripts
2931     [now in CVS, but not well tested]. See comments in <filename>GNUmakefile</filename>.)
2932    </para>
2933    <para>
2934     If you want to add new files to the webserver, create them locally in
2935     the <filename>doc/webserver/*</filename> directory (or
2936     create new directories under <filename>doc/webserver</filename>).
2937    </para>
2938    <para>
2939     Next, commit any changes from the above steps to CVS. All set? 
2940     If these are docs in the stable branch, then do:
2941    </para>
2942    <para>
2943     <programlisting>
2944   make webserver
2945 </programlisting>
2946    </para>
2947    <para>
2948     This will do the upload to <ulink url="http://www.privoxy.org/">the
2949     webserver</ulink> (www.privoxy.org) and ensure all files and directories
2950     there are group writable.
2951    </para>
2952    <para>
2953     Please do <emphasis>NOT</emphasis> use any other means of transferring
2954     files to the webserver to avoid permission problems. Also, please do not
2955     upload docs from development branches or versions. The publicly posted
2956     docs should be in sync with the last official release.
2957    </para>
2958   </sect1>
2959
2960   <!--   ~~~~~       New section      ~~~~~     -->
2961   <sect1 id="contact"><title>Contacting the developers, Bug Reporting and Feature Requests</title>
2962 <!-- Include contacting.sgml  -->
2963  &contacting;
2964 <!-- end contacting -->
2965   </sect1>
2966   
2967
2968 <!--   ~~~~~~~~       New section Header    ~~~~~~~~~     -->
2969 <sect1 id="copyright"><title>Privoxy Copyright, License and History</title>
2970
2971 <!-- Include copyright.sgml -->
2972  &copyright;
2973 <!-- end -->
2974
2975 <!--   ~~~~~       New section      ~~~~~     -->
2976 <sect2><title>License</title>
2977 <!-- Include copyright.sgml: -->
2978  &license;
2979 <!-- end copyright -->
2980 </sect2>
2981 <!--  ~  End section  ~  -->
2982
2983 <!--   ~~~~~       New section      ~~~~~     -->
2984 <sect2><title>History</title>
2985 <!-- Include history.sgml -->
2986  &history;
2987 <!-- end -->
2988 </sect2>
2989
2990 </sect1>
2991   
2992   <!--   ~~~~~       New section      ~~~~~     -->
2993   <sect1 id="seealso"><title>See also</title>
2994 <!-- Include seealso.sgml -->
2995  &seealso;
2996 <!-- end  -->
2997
2998   </sect1>
2999
3000   <!--
3001
3002   This program is free software; you can redistribute it 
3003   and/or modify it under the terms of the GNU General
3004   Public License as published by the Free Software
3005   Foundation; either version 2 of the License, or (at
3006   your option) any later version.
3007
3008   This program is distributed in the hope that it will
3009   be useful, but WITHOUT ANY WARRANTY; without even the
3010   implied warranty of MERCHANTABILITY or FITNESS FOR A
3011   PARTICULAR PURPOSE.  See the GNU General Public
3012   License for more details.
3013
3014   The GNU General Public License should be included with
3015   this file.  If not, you can view it at
3016   http://www.gnu.org/copyleft/gpl.html
3017   or write to the Free Software Foundation, Inc., 59
3018   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3019
3020   $Log: developer-manual.sgml,v $
3021   Revision 2.4  2002/09/26 05:57:14  hal9
3022   Conditionally exclude 'this doc is evolving' comment in intro for non release
3023   situations.
3024
3025   Revision 2.3  2002/09/05 02:27:59  hal9
3026   Mention tested stable branch fixes in main trunk, as alternate to posting
3027   patches.
3028
3029   Revision 2.2  2002/09/04 01:55:44  hal9
3030   Migrating developer manual, and related sgml files from 3.0. Add additional
3031   commentary on cvs, versioning, stable branches, and how to handle stable
3032   branches in cvs.
3033
3034   Revision 1.46.2.8  2002/08/17 00:16:10  hal9
3035   Add note on updating webserver for User-manual/CGI editor, which is version
3036   dependent (and different from main UM link).
3037
3038   Revision 1.46.2.7  2002/08/14 17:29:25  hal9
3039   Add small notes on post-release steps, and uploading docs to webserver.
3040
3041   Revision 1.46.2.6  2002/08/10 11:40:25  oes
3042   Added disclaimer about probably being out-of-date and two small hints
3043
3044   Revision 1.46.2.5  2002/08/09 01:15:12  hal9
3045   Added some notes on pre-release steps (test builds first, update ChangeLog).
3046
3047   Revision 1.46.2.4  2002/05/29 00:30:59  mal0rd
3048   Fixed a little formatting.  Clarified debian section.
3049
3050   Revision 1.46.2.3  2002/05/28 04:32:45  hal9
3051   Change hints on bundling index.html to privoxy-index.html
3052
3053   Revision 1.46.2.2  2002/05/26 17:04:24  hal9
3054   -Spellcheck, very minor edits, and sync across branches
3055
3056   Revision 1.48  2002/05/26 12:48:31  roro
3057   Add releasing information about Debian.
3058
3059   Revision 1.47  2002/05/26 04:55:11  mal0rd
3060   Added debian-dist and debian-upload targets.  Also documented usage.
3061
3062   Revision 1.46  2002/05/22 17:15:00  oes
3063   Updated intro
3064
3065   Revision 1.45  2002/05/19 23:01:54  hal9
3066   Add small section on general packaging guidelines (e.g. actions files must
3067   be writable).
3068
3069   Revision 1.44  2002/05/15 03:55:17  hal9
3070   Fix ulink -> link, and minor modification to release process section for
3071   clarification.
3072
3073   Revision 1.43  2002/05/10 01:48:19  hal9
3074   This is mostly proposed copyright/licensing additions and changes. Docs
3075   are still GPL, but licensing and copyright are more visible. Also, copyright
3076   changed in doc header comments (eliminate references to JB except FAQ).
3077
3078   Revision 1.42  2002/05/05 20:26:02  hal9
3079   Sorting out license vs copyright in these docs.
3080
3081   Revision 1.41  2002/05/04 08:44:44  swa
3082   bumped version
3083
3084   Revision 1.40  2002/05/04 00:43:43  hal9
3085   -Remove TOC/first page kludge with proper stylesheet fix.
3086   -Combined the two very brief sections: Intro and Quickstart.
3087
3088   Revision 1.39  2002/05/02 15:08:25  oes
3089   Added explanation about version numbers and RPM package revisions
3090
3091   Revision 1.38  2002/04/29 02:20:31  hal9
3092   Add info on steps for uploading and the release process on SF.
3093
3094   Revision 1.37  2002/04/26 17:23:29  swa
3095   bookmarks cleaned, changed structure of user manual, screen and programlisting cleanups, and numerous other changes that I forgot
3096
3097   Revision 1.36  2002/04/26 05:25:23  hal9
3098   Mass commit to catch a few scattered fixes.
3099
3100   Revision 1.35  2002/04/17 15:16:15  oes
3101   Added link to docbook crash course
3102
3103   Revision 1.34  2002/04/15 23:39:32  oes
3104    - Extended & fixed the release section
3105    - Added CVS guideline sections
3106    - Separated webserver section from release section
3107    - Commented out boilerplate inclusion (If you don't know yet what it is,
3108      you shouldn't mess with its code ;-)
3109    - Nits & fixes
3110
3111   Revision 1.33  2002/04/12 03:49:53  hal9
3112   Spell checked. Clarification on where docs are kept.
3113
3114   Revision 1.32  2002/04/11 21:29:58  jongfoster
3115   Documenting Win32 release procedure
3116
3117   Revision 1.31  2002/04/11 09:32:52  oes
3118   more nits
3119
3120   Revision 1.30  2002/04/11 09:24:53  oes
3121   nits
3122
3123   Revision 1.29  2002/04/10 18:45:14  swa
3124   generated
3125
3126   Revision 1.28  2002/04/08 22:59:26  hal9
3127   Version update. Spell chkconfig correctly :)
3128
3129   Revision 1.27  2002/04/08 15:31:18  hal9
3130   Touch ups to documentation section.
3131
3132   Revision 1.26  2002/04/07 23:50:08  hal9
3133   Documentation changes to reflect HTML docs now in CVS, and new generated files
3134   list.
3135
3136   Revision 1.25  2002/04/06 05:07:28  hal9
3137   -Add privoxy-man-page.sgml, for man page.
3138   -Add authors.sgml for AUTHORS (and p-authors.sgml)
3139   -Reworked various aspects of various docs.
3140   -Added additional comments to sub-docs.
3141
3142   Revision 1.24  2002/04/04 21:33:37  hal9
3143   More on documenting the documents.
3144
3145   Revision 1.23  2002/04/04 18:46:47  swa
3146   consistent look. reuse of copyright, history et. al.
3147
3148   Revision 1.22  2002/04/04 17:27:56  swa
3149   more single file to be included at multiple points. make maintaining easier
3150
3151   Revision 1.21  2002/04/04 06:48:37  hal9
3152   Structural changes to allow for conditional inclusion/exclusion of content
3153   based on entity toggles, e.g. 'entity % p-not-stable  "INCLUDE"'. And
3154   definition of internal entities, e.g. 'entity p-version "2.9.13"' that will
3155   eventually be set by Makefile.
3156   More boilerplate text for use across multiple docs.
3157
3158   Revision 1.20  2002/04/04 03:28:27  david__schmidt
3159   Add Mac OSX section
3160
3161   Revision 1.19  2002/04/03 15:09:42  david__schmidt
3162   Add OS/2 build section
3163
3164   Revision 1.18  2002/04/03 03:51:48  hal9
3165   Touch ups.
3166
3167   Revision 1.17  2002/04/03 01:21:17  hal9
3168   Implementing Andreas's suggestions for Release sections.
3169
3170   Revision 1.16  2002/03/31 23:04:40  hal9
3171   Fleshed out the doc section, and added something for an intro so it was not
3172   blank.
3173
3174   Revision 1.15  2002/03/30 22:29:47  swa
3175   wrong make flavour
3176
3177   Revision 1.14  2002/03/30 19:04:08  swa
3178   people release differently. no good.
3179   I want to make parts of the docs only.
3180
3181   Revision 1.13  2002/03/27 01:16:41  hal9
3182   ditto
3183
3184   Revision 1.12  2002/03/27 01:02:51  hal9
3185   Touch up on name change...
3186
3187   Revision 1.11  2002/03/26 22:29:55  swa
3188   we have a new homepage!
3189
3190   Revision 1.10  2002/03/24 12:33:01  swa
3191   more additions.
3192
3193   Revision 1.9  2002/03/24 11:01:05  swa
3194   name change
3195
3196   Revision 1.8  2002/03/23 15:13:11  swa
3197   renamed every reference to the old name with foobar.
3198   fixed "application foobar application" tag, fixed
3199   "the foobar" with "foobar". left junkbustser in cvs
3200   comments and remarks to history untouched.
3201
3202   Revision 1.7  2002/03/11 13:13:27  swa
3203   correct feedback channels
3204
3205   Revision 1.6  2002/02/24 14:25:06  jongfoster
3206   Formatting changes.  Now changing the doctype to DocBook XML 4.1
3207   will work - no other changes are needed.
3208
3209   Revision 1.5  2001/10/31 18:16:51  swa
3210   documentation added: howto generate docs in text and html
3211   format, howto move stuff to the webserver.
3212
3213   Revision 1.4  2001/09/23 10:13:48  swa
3214   upload process established. run make webserver and
3215   the documentation is moved to the webserver. documents
3216   are now linked correctly.
3217
3218   Revision 1.3  2001/09/13 15:27:40  swa
3219   cosmetics
3220
3221   Revision 1.2  2001/09/13 15:20:17  swa
3222   merged standards into developer manual
3223
3224   Revision 1.1  2001/09/12 15:36:41  swa
3225   source files for junkbuster documentation
3226
3227   Revision 1.3  2001/09/10 17:43:59  swa
3228   first proposal of a structure.
3229
3230   Revision 1.2  2001/06/13 14:28:31  swa
3231   docs should have an author.
3232
3233   Revision 1.1  2001/06/13 14:20:37  swa
3234   first import of project's documentation for the webserver.
3235
3236   -->
3237
3238 </article>