From: Fabian Keil <fk@fabiankeil.de> Date: Wed, 29 Dec 2021 11:33:51 +0000 (+0100) Subject: Rebuild developer-manual and tidy with 'HTML Tidy for FreeBSD version 5.8.0' X-Git-Tag: v_3_0_34~169 X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/static/quickstart.html?a=commitdiff_plain;h=61a5d3fc15169d9f6b0c21e3a56d893f4d672eb4;p=privoxy.git Rebuild developer-manual and tidy with 'HTML Tidy for FreeBSD version 5.8.0' --- diff --git a/doc/webserver/developer-manual/coding.html b/doc/webserver/developer-manual/coding.html index fb4208fe..d3a94f4f 100644 --- a/doc/webserver/developer-manual/coding.html +++ b/doc/webserver/developer-manual/coding.html @@ -1,161 +1,57 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Coding Guidelines</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Documentation Guidelines" -HREF="documentation.html"><LINK -REL="NEXT" -TITLE="Testing Guidelines" -HREF="testing.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="documentation.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="testing.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="CODING" ->4. Coding Guidelines</A -></H1 -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S1" ->4.1. Introduction</A -></H2 -><P ->This set of standards is designed to make our lives easier. It is - developed with the simple goal of helping us keep the "new and improved - <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN ->" consistent and reliable. Thus making - maintenance easier and increasing chances of success of the - project.</P -><P ->And that of course comes back to us as individuals. If we can - increase our development and product efficiencies then we can solve more - of the request for changes/improvements and in general feel good about - ourselves. ;-></P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S2" ->4.2. Using Comments</A -></H2 -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S3" ->4.2.1. Comment, Comment, Comment</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Comment as much as possible without commenting the obvious. - For example do not comment "variable_a is equal to variable_b". - Instead explain why variable_a should be equal to the variable_b. - Just because a person can read code does not mean they will - understand why or what is being done. A reader may spend a lot - more time figuring out what is going on when a simple comment - or explanation would have prevented the extra research. Please - help your fellow Privoxy developers out!</P -><P ->The comments will also help justify the intent of the code. - If the comment describes something different than what the code - is doing then maybe a programming error is occurring.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /* if page size greater than 1k ... */ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Coding Guidelines</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="Documentation Guidelines" href="documentation.html"> + <link rel="NEXT" title="Testing Guidelines" href="testing.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="documentation.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"><a href="testing.html" accesskey="N">Next</a></td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="CODING" id="CODING">4. Coding Guidelines</a></h1> + <div class="SECT2"> + <h2 class="SECT2"><a name="S1" id="S1">4.1. Introduction</a></h2> + <p>This set of standards is designed to make our lives easier. It is developed with the simple goal of helping us + keep the "new and improved <span class="APPLICATION">Privoxy</span>" consistent and reliable. Thus making + maintenance easier and increasing chances of success of the project.</p> + <p>And that of course comes back to us as individuals. If we can increase our development and product + efficiencies then we can solve more of the request for changes/improvements and in general feel good about + ourselves. ;-></p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S2" id="S2">4.2. Using Comments</a></h2> + <div class="SECT3"> + <h3 class="SECT3"><a name="S3" id="S3">4.2.1. Comment, Comment, Comment</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Comment as much as possible without commenting the obvious. For example do not comment "variable_a is equal + to variable_b". Instead explain why variable_a should be equal to the variable_b. Just because a person can + read code does not mean they will understand why or what is being done. A reader may spend a lot more time + figuring out what is going on when a simple comment or explanation would have prevented the extra research. + Please help your fellow Privoxy developers out!</p> + <p>The comments will also help justify the intent of the code. If the comment describes something different + than what the code is doing then maybe a programming error is occurring.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /* if page size greater than 1k ... */ if (page_length() > 1024) { ... "block" the page up ... @@ -169,50 +65,22 @@ CLASS="PROGRAMLISTING" This demonstrates 2 cases of "what not to do". The first is a "syntax comment". The second is a comment that does not fit what - is actually being done.</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S4" ->4.2.2. Use blocks for comments</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Comments can help or they can clutter. They help when they - are differentiated from the code they describe. One line - comments do not offer effective separation between the comment - and the code. Block identifiers do, by surrounding the code - with a clear, definable pattern.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /********************************************************************* + is actually being done.</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S4" id="S4">4.2.2. Use blocks for comments</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Comments can help or they can clutter. They help when they are differentiated from the code they describe. + One line comments do not offer effective separation between the comment and the code. Block identifiers do, by + surrounding the code with a clear, definable pattern.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /********************************************************************* * This will stand out clearly in your code! *********************************************************************/ if (this_variable == that_variable) @@ -231,65 +99,26 @@ CLASS="PROGRAMLISTING" if (this_variable == that_variable) /* this may not either */ { do_something_very_important(); - }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Exception:</I -></SPAN -></P -><P ->If you are trying to add a small logic comment and do not - wish to "disrupt" the flow of the code, feel free to use a 1 - line comment which is NOT on the same line as the code.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S5" ->4.2.3. Keep Comments on their own line</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->It goes back to the question of readability. If the comment - is on the same line as the code it will be harder to read than - the comment that is on its own line.</P -><P ->There are three exceptions to this rule, which should be - violated freely and often: during the definition of variables, - at the end of closing braces, when used to comment - parameters.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /********************************************************************* + }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Exception:</i></span></p> + <p>If you are trying to add a small logic comment and do not wish to "disrupt" the flow of the code, feel free + to use a 1 line comment which is NOT on the same line as the code.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S5" id="S5">4.2.3. Keep Comments on their own line</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>It goes back to the question of readability. If the comment is on the same line as the code it will be + harder to read than the comment that is on its own line.</p> + <p>There are three exceptions to this rule, which should be violated freely and often: during the definition of + variables, at the end of closing braces, when used to comment parameters.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /********************************************************************* * This will stand out clearly in your code, * But the second example won't. *********************************************************************/ @@ -322,116 +151,46 @@ CLASS="PROGRAMLISTING" { ...code here... - } /* -END- do_something_very_important */</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S6" ->4.2.4. Comment each logical step</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Logical steps should be commented to help others follow the - intent of the written code and comments will make the code more - readable.</P -><P ->If you have 25 lines of code without a comment, you should - probably go back into it to see where you forgot to put - one.</P -><P ->Most "for", "while", "do", etc... loops _probably_ need a - comment. After all, these are usually major logic - containers.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S7" ->4.2.5. Comment All Functions Thoroughly</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->A reader of the code should be able to look at the comments - just prior to the beginning of a function and discern the - reason for its existence and the consequences of using it. The - reader should not have to read through the code to determine if - a given function is safe for a desired use. The proper - information thoroughly presented at the introduction of a - function not only saves time for subsequent maintenance or - debugging, it more importantly aids in code reuse by allowing a - user to determine the safety and applicability of any function - for the problem at hand. As a result of such benefits, all - functions should contain the information presented in the - addendum section of this document.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S8" ->4.2.6. Comment at the end of braces if the - content is more than one screen length</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Each closing brace should be followed on the same line by a - comment that describes the origination of the brace if the - original brace is off of the screen, or otherwise far away from - the closing brace. This will simplify the debugging, - maintenance, and readability of the code.</P -><P ->As a suggestion , use the following flags to make the - comment and its brace more readable:</P -><P ->use following a closing brace: } /* -END- if() or while () - or etc... */</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> if (1 == X) + } /* -END- do_something_very_important */</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S6" id="S6">4.2.4. Comment each logical step</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Logical steps should be commented to help others follow the intent of the written code and comments will + make the code more readable.</p> + <p>If you have 25 lines of code without a comment, you should probably go back into it to see where you forgot + to put one.</p> + <p>Most "for", "while", "do", etc... loops _probably_ need a comment. After all, these are usually major logic + containers.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S7" id="S7">4.2.5. Comment All Functions Thoroughly</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>A reader of the code should be able to look at the comments just prior to the beginning of a function and + discern the reason for its existence and the consequences of using it. The reader should not have to read + through the code to determine if a given function is safe for a desired use. The proper information thoroughly + presented at the introduction of a function not only saves time for subsequent maintenance or debugging, it + more importantly aids in code reuse by allowing a user to determine the safety and applicability of any + function for the problem at hand. As a result of such benefits, all functions should contain the information + presented in the addendum section of this document.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S8" id="S8">4.2.6. Comment at the end of braces if the content is more than one + screen length</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Each closing brace should be followed on the same line by a comment that describes the origination of the + brace if the original brace is off of the screen, or otherwise far away from the closing brace. This will + simplify the debugging, maintenance, and readability of the code.</p> + <p>As a suggestion , use the following flags to make the comment and its brace more readable:</p> + <p>use following a closing brace: } /* -END- if() or while () or etc... */</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> if (1 == X) { do_something_very_important(); ...some long list of commands... @@ -443,724 +202,272 @@ CLASS="PROGRAMLISTING" { do_something_very_important(); ...some long list of commands... - } /* -END- if (1 == X) */</PRE -></TD -></TR -></TABLE -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S9" ->4.3. Naming Conventions</A -></H2 -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S10" ->4.3.1. Variable Names</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Use all lowercase, and separate words via an underscore - ('_'). Do not start an identifier with an underscore. (ANSI C - reserves these for use by the compiler and system headers.) Do - not use identifiers which are reserved in ANSI C++. (E.g. - template, class, true, false, ...). This is in case we ever - decide to port Privoxy to C++.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int ms_iis5_hack = 0;</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int msiis5hack = 0; int msIis5Hack = 0;</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S11" ->4.3.2. Function Names</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Use all lowercase, and separate words via an underscore - ('_'). Do not start an identifier with an underscore. (ANSI C - reserves these for use by the compiler and system headers.) Do - not use identifiers which are reserved in ANSI C++. (E.g. - template, class, true, false, ...). This is in case we ever - decide to port Privoxy to C++.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int load_some_file(struct client_state *csp)</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int loadsomefile(struct client_state *csp) - int loadSomeFile(struct client_state *csp)</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S12" ->4.3.3. Header file prototypes</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Use a descriptive parameter name in the function prototype - in header files. Use the same parameter name in the header file - that you use in the c file.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> (.h) extern int load_aclfile(struct client_state *csp); - (.c) int load_aclfile(struct client_state *csp)</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> (.h) extern int load_aclfile(struct client_state *); or + } /* -END- if (1 == X) */</pre> + </td> + </tr> + </table> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S9" id="S9">4.3. Naming Conventions</a></h2> + <div class="SECT3"> + <h3 class="SECT3"><a name="S10" id="S10">4.3.1. Variable Names</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Use all lowercase, and separate words via an underscore ('_'). Do not start an identifier with an + underscore. (ANSI C reserves these for use by the compiler and system headers.) Do not use identifiers which + are reserved in ANSI C++. (E.g. template, class, true, false, ...). This is in case we ever decide to port + Privoxy to C++.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int ms_iis5_hack = 0;</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int msiis5hack = 0; int msIis5Hack = 0;</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S11" id="S11">4.3.2. Function Names</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Use all lowercase, and separate words via an underscore ('_'). Do not start an identifier with an + underscore. (ANSI C reserves these for use by the compiler and system headers.) Do not use identifiers which + are reserved in ANSI C++. (E.g. template, class, true, false, ...). This is in case we ever decide to port + Privoxy to C++.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int load_some_file(struct client_state *csp)</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int loadsomefile(struct client_state *csp) + int loadSomeFile(struct client_state *csp)</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S12" id="S12">4.3.3. Header file prototypes</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Use a descriptive parameter name in the function prototype in header files. Use the same parameter name in + the header file that you use in the c file.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> (.h) extern int load_aclfile(struct client_state *csp); + (.c) int load_aclfile(struct client_state *csp)</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> (.h) extern int load_aclfile(struct client_state *); or (.h) extern int load_aclfile(); - (.c) int load_aclfile(struct client_state *csp)</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S13" ->4.3.4. Enumerations, and #defines</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Use all capital letters, with underscores between words. Do - not start an identifier with an underscore. (ANSI C reserves - these for use by the compiler and system headers.)</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> (enumeration) : enum Boolean {FALSE, TRUE}; - (#define) : #define DEFAULT_SIZE 100;</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> We have a standard naming scheme for #defines - that toggle a feature in the preprocessor: FEATURE_>, where - > is a short (preferably 1 or 2 word) description.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #define FEATURE_FORCE 1 + (.c) int load_aclfile(struct client_state *csp)</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S13" id="S13">4.3.4. Enumerations, and #defines</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Use all capital letters, with underscores between words. Do not start an identifier with an underscore. + (ANSI C reserves these for use by the compiler and system headers.)</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> (enumeration) : enum Boolean {FALSE, TRUE}; + (#define) : #define DEFAULT_SIZE 100;</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> We have a standard naming scheme for #defines + that toggle a feature in the preprocessor: FEATURE_>, where > is a short (preferably 1 or 2 word) + description.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #define FEATURE_FORCE 1 #ifdef FEATURE_FORCE #define FORCE_PREFIX blah - #endif /* def FEATURE_FORCE */</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S14" ->4.3.5. Constants</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Spell common words out entirely (do not remove vowels).</P -><P ->Use only widely-known domain acronyms and abbreviations. - Capitalize all letters of an acronym.</P -><P ->Use underscore (_) to separate adjacent acronyms and - abbreviations. Never terminate a name with an underscore.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #define USE_IMAGE_LIST 1</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #define USE_IMG_LST 1 or + #endif /* def FEATURE_FORCE */</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S14" id="S14">4.3.5. Constants</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Spell common words out entirely (do not remove vowels).</p> + <p>Use only widely-known domain acronyms and abbreviations. Capitalize all letters of an acronym.</p> + <p>Use underscore (_) to separate adjacent acronyms and abbreviations. Never terminate a name with an + underscore.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #define USE_IMAGE_LIST 1</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #define USE_IMG_LST 1 or #define _USE_IMAGE_LIST 1 or #define USE_IMAGE_LIST_ 1 or #define use_image_list 1 or - #define UseImageList 1</PRE -></TD -></TR -></TABLE -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S15" ->4.4. Using Space</A -></H2 -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S16" ->4.4.1. Put braces on a line by themselves.</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->The brace needs to be on a line all by itself, not at the - end of the statement. Curly braces should line up with the - construct that they're associated with. This practice makes it - easier to identify the opening and closing braces for a - block.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> if (this == that) + #define UseImageList 1</pre> + </td> + </tr> + </table> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S15" id="S15">4.4. Using Space</a></h2> + <div class="SECT3"> + <h3 class="SECT3"><a name="S16" id="S16">4.4.1. Put braces on a line by themselves.</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>The brace needs to be on a line all by itself, not at the end of the statement. Curly braces should line up + with the construct that they're associated with. This practice makes it easier to identify the opening and + closing braces for a block.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> if (this == that) { ... - }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><P ->if (this == that) { ... }</P -><P ->or</P -><P ->if (this == that) { ... }</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> In the special case that the if-statement is - inside a loop, and it is trivial, i.e. it tests for a - condition that is obvious from the purpose of the block, - one-liners as above may optically preserve the loop structure - and make it easier to read.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> developer-discretion.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example exception:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> while (more lines are read) + }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <p>if (this == that) { ... }</p> + <p>or</p> + <p>if (this == that) { ... }</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> In the special case that the if-statement is + inside a loop, and it is trivial, i.e. it tests for a condition that is obvious from the purpose of the block, + one-liners as above may optically preserve the loop structure and make it easier to read.</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> developer-discretion.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example exception:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> while (more lines are read) { /* Please document what is/is not a comment line here */ if (it's a comment) continue; do_something(line); - }</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S17" ->4.4.2. ALL control statements should have a - block</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Using braces to make a block will make your code more - readable and less prone to error. All control statements should - have a block defined.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> if (this == that) + }</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S17" id="S17">4.4.2. ALL control statements should have a block</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Using braces to make a block will make your code more readable and less prone to error. All control + statements should have a block defined.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> if (this == that) { do_something(); do_something_else(); - }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><P ->if (this == that) do_something(); do_something_else();</P -><P ->or</P -><P ->if (this == that) do_something();</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> The first example in "Instead of" will execute - in a manner other than that which the developer desired (per - indentation). Using code braces would have prevented this - "feature". The "explanation" and "exception" from the point - above also applies.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S18" ->4.4.3. Do not belabor/blow-up boolean - expressions</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> structure->flag = (condition);</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><P ->if (condition) { structure->flag = 1; } else { - structure->flag = 0; }</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> The former is readable and concise. The later - is wordy and inefficient. Please assume that any developer new - to the project has at least a "good" knowledge of C/C++. (Hope - I do not offend by that last comment ... 8-)</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S19" ->4.4.4. Use white space freely because it is - free</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Make it readable. The notable exception to using white space - freely is listed in the next guideline.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int first_value = 0; + }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <p>if (this == that) do_something(); do_something_else();</p> + <p>or</p> + <p>if (this == that) do_something();</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> The first example in "Instead of" will execute + in a manner other than that which the developer desired (per indentation). Using code braces would have + prevented this "feature". The "explanation" and "exception" from the point above also applies.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S18" id="S18">4.4.3. Do not belabor/blow-up boolean expressions</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> structure->flag = (condition);</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <p>if (condition) { structure->flag = 1; } else { structure->flag = 0; }</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> The former is readable and concise. The later is + wordy and inefficient. Please assume that any developer new to the project has at least a "good" knowledge of + C/C++. (Hope I do not offend by that last comment ... 8-)</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S19" id="S19">4.4.4. Use white space freely because it is free</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Make it readable. The notable exception to using white space freely is listed in the next guideline.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int first_value = 0; int some_value = 0; int another_value = 0; - int this_variable = 0;</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S20" ->4.4.5. Don't use white space around structure - operators</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->- structure pointer operator ( "->" ) - member operator ( - "." ) - functions and parentheses</P -><P ->It is a general coding practice to put pointers, references, - and function parentheses next to names. With spaces, the - connection between the object and variable/function name is not - as clear.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> a_struct->a_member; + int this_variable = 0;</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S20" id="S20">4.4.5. Don't use white space around structure operators</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>- structure pointer operator ( "->" ) - member operator ( "." ) - functions and parentheses</p> + <p>It is a general coding practice to put pointers, references, and function parentheses next to names. With + spaces, the connection between the object and variable/function name is not as clear.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> a_struct->a_member; a_struct.a_member; - function_name();</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -> a_struct -> a_member; a_struct . a_member; - function_name ();</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S21" ->4.4.6. Make the last brace of a function stand - out</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int function1( ... ) + function_name();</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span> a_struct -> a_member; a_struct . + a_member; function_name ();</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S21" id="S21">4.4.6. Make the last brace of a function stand out</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int function1( ... ) { ...code... return(ret_code); @@ -1170,83 +477,30 @@ CLASS="PROGRAMLISTING" int function2( ... ) { - } /* -END- function2 */</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><P ->int function1( ... ) { ...code... return(ret_code); } int - function2( ... ) { }</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> Use 1 blank line before the closing brace and 2 - lines afterward. This makes the end of function standout to - the most casual viewer. Although function comments help - separate functions, this is still a good coding practice. In - fact, I follow these rules when using blocks in "for", "while", - "do" loops, and long if {} statements too. After all whitespace - is free!</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> developer-discretion on the number of blank - lines. Enforced is the end of function comments.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S22" ->4.4.7. Use 3 character indentions</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->If some use 8 character TABs and some use 3 character TABs, - the code can look *very* ragged. So use 3 character indentions - only. If you like to use TABs, pass your code through a filter - such as "expand -t3" before checking in your code.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> static const char * const url_code_map[256] = + } /* -END- function2 */</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <p>int function1( ... ) { ...code... return(ret_code); } int function2( ... ) { }</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> Use 1 blank line before the closing brace and 2 + lines afterward. This makes the end of function standout to the most casual viewer. Although function comments + help separate functions, this is still a good coding practice. In fact, I follow these rules when using blocks + in "for", "while", "do" loops, and long if {} statements too. After all whitespace is free!</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> developer-discretion on the number of blank + lines. Enforced is the end of function comments.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S22" id="S22">4.4.7. Use 3 character indentions</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>If some use 8 character TABs and some use 3 character TABs, the code can look *very* ragged. So use 3 + character indentions only. If you like to use TABs, pass your code through a filter such as "expand -t3" before + checking in your code.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> static const char * const url_code_map[256] = { NULL, ... }; @@ -1265,475 +519,174 @@ CLASS="PROGRAMLISTING" return NEVER_GETS_HERE; - }</PRE -></TD -></TR -></TABLE -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S23" ->4.5. Initializing</A -></H2 -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S24" ->4.5.1. Initialize all variables</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Do not assume that the variables declared will not be used - until after they have been assigned a value somewhere else in - the code. Remove the chance of accidentally using an unassigned - variable.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> short a_short = 0; + }</pre> + </td> + </tr> + </table> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S23" id="S23">4.5. Initializing</a></h2> + <div class="SECT3"> + <h3 class="SECT3"><a name="S24" id="S24">4.5.1. Initialize all variables</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Do not assume that the variables declared will not be used until after they have been assigned a value + somewhere else in the code. Remove the chance of accidentally using an unassigned variable.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> short a_short = 0; float a_float = 0; - struct *ptr = NULL;</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> It is much easier to debug a SIGSEGV if the - message says you are trying to access memory address 00000000 - and not 129FA012; or array_ptr[20] causes a SIGSEV vs. - array_ptr[0].</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> developer-discretion if and only if the - variable is assigned a value "shortly after" declaration.</P -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S25" ->4.6. Functions</A -></H2 -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S26" ->4.6.1. Name functions that return a boolean as a - question.</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Value should be phrased as a question that would logically - be answered as a true or false statement</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> should_we_block_this(); + struct *ptr = NULL;</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> It is much easier to debug a SIGSEGV if the + message says you are trying to access memory address 00000000 and not 129FA012; or array_ptr[20] causes a + SIGSEV vs. array_ptr[0].</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> developer-discretion if and only if the + variable is assigned a value "shortly after" declaration.</p> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S25" id="S25">4.6. Functions</a></h2> + <div class="SECT3"> + <h3 class="SECT3"><a name="S26" id="S26">4.6.1. Name functions that return a boolean as a question.</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Value should be phrased as a question that would logically be answered as a true or false statement</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> should_we_block_this(); contains_an_image(); - is_web_page_blank();</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S27" ->4.6.2. Always specify a return type for a - function.</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->The default return for a function is an int. To avoid - ambiguity, create a return for a function when the return has a - purpose, and create a void return type if the function does not - need to return anything.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S28" ->4.6.3. Minimize function calls when iterating by - using variables</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->It is easy to write the following code, and a clear argument - can be made that the code is easy to understand:</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> for (size_t cnt = 0; cnt < block_list_length(); cnt++) + is_web_page_blank();</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S27" id="S27">4.6.2. Always specify a return type for a function.</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>The default return for a function is an int. To avoid ambiguity, create a return for a function when the + return has a purpose, and create a void return type if the function does not need to return anything.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S28" id="S28">4.6.3. Minimize function calls when iterating by using + variables</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>It is easy to write the following code, and a clear argument can be made that the code is easy to + understand:</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> for (size_t cnt = 0; cnt < block_list_length(); cnt++) { .... - }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> Unfortunately, this makes a function call for - each and every iteration. This increases the overhead in the - program, because the compiler has to look up the function each - time, call it, and return a value. Depending on what occurs in - the block_list_length() call, it might even be creating and - destroying structures with each iteration, even though in each - case it is comparing "cnt" to the same value, over and over. - Remember too - even a call to block_list_length() is a function - call, with the same overhead.</P -><P ->Instead of using a function call during the iterations, - assign the value to a variable, and evaluate using the - variable.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> size_t len = block_list_length(); + }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> Unfortunately, this makes a function call for + each and every iteration. This increases the overhead in the program, because the compiler has to look up the + function each time, call it, and return a value. Depending on what occurs in the block_list_length() call, it + might even be creating and destroying structures with each iteration, even though in each case it is comparing + "cnt" to the same value, over and over. Remember too - even a call to block_list_length() is a function call, + with the same overhead.</p> + <p>Instead of using a function call during the iterations, assign the value to a variable, and evaluate using + the variable.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> size_t len = block_list_length(); for (size_t cnt = 0; cnt < len; cnt++) { .... - }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Exceptions:</I -></SPAN -> if the value of block_list_length() - *may* change or could *potentially* change, then you must code the - function call in the for/while loop.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S29" ->4.6.4. Pass and Return by Const Reference</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->This allows a developer to define a const pointer and call - your function. If your function does not have the const - keyword, we may not be able to use your function. Consider - strcmp, if it were defined as: extern int strcmp(char *s1, - char *s2);</P -><P ->I could then not use it to compare argv's in main: int - main(int argc, const char *argv[]) { strcmp(argv[0], "privoxy"); - }</P -><P ->Both these pointers are *const*! If the c runtime library - maintainers do it, we should too.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S30" ->4.6.5. Pass and Return by Value</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Most structures cannot fit onto a normal stack entry (i.e. - they are not 4 bytes or less). Aka, a function declaration - like: int load_aclfile(struct client_state csp)</P -><P ->would not work. So, to be consistent, we should declare all - prototypes with "pass by value": int load_aclfile(struct - client_state *csp)</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S31" ->4.6.6. Names of include files</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Your include statements should contain the file name without - a path. The path should be listed in the Makefile, using -I as - processor directive to search the indicated paths. An exception - to this would be for some proprietary software that utilizes a - partial path to distinguish their header files from system or - other header files.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #include <iostream.h> /* This is not a local include */ - #include "config.h" /* This IS a local include */</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Exception:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /* This is not a local include, but requires a path element. */ - #include <sys/fileName.h></PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> Please! do not add "-I." to the Makefile - without a _very_ good reason. This duplicates the #include - "file.h" behavior.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S32" ->4.6.7. Provide multiple inclusion - protection</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Prevents compiler and linker errors resulting from - redefinition of items.</P -><P ->Wrap each header file with the following syntax to prevent - multiple inclusions of the file. Of course, replace PROJECT_H - with your file name, with "." Changed to "_", and make it - uppercase.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #ifndef PROJECT_H_INCLUDED + }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Exceptions:</i></span> if the value of block_list_length() *may* + change or could *potentially* change, then you must code the function call in the for/while loop.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S29" id="S29">4.6.4. Pass and Return by Const Reference</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>This allows a developer to define a const pointer and call your function. If your function does not have the + const keyword, we may not be able to use your function. Consider strcmp, if it were defined as: extern int + strcmp(char *s1, char *s2);</p> + <p>I could then not use it to compare argv's in main: int main(int argc, const char *argv[]) { strcmp(argv[0], + "privoxy"); }</p> + <p>Both these pointers are *const*! If the c runtime library maintainers do it, we should too.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S30" id="S30">4.6.5. Pass and Return by Value</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Most structures cannot fit onto a normal stack entry (i.e. they are not 4 bytes or less). Aka, a function + declaration like: int load_aclfile(struct client_state csp)</p> + <p>would not work. So, to be consistent, we should declare all prototypes with "pass by value": int + load_aclfile(struct client_state *csp)</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S31" id="S31">4.6.6. Names of include files</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Your include statements should contain the file name without a path. The path should be listed in the + Makefile, using -I as processor directive to search the indicated paths. An exception to this would be for some + proprietary software that utilizes a partial path to distinguish their header files from system or other header + files.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #include <iostream.h> /* This is not a local include */ + #include "config.h" /* This IS a local include */</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Exception:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /* This is not a local include, but requires a path element. */ + #include <sys/fileName.h></pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> Please! do not add "-I." to the Makefile without + a _very_ good reason. This duplicates the #include "file.h" behavior.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S32" id="S32">4.6.7. Provide multiple inclusion protection</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Prevents compiler and linker errors resulting from redefinition of items.</p> + <p>Wrap each header file with the following syntax to prevent multiple inclusions of the file. Of course, + replace PROJECT_H with your file name, with "." Changed to "_", and make it uppercase.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #ifndef PROJECT_H_INCLUDED #define PROJECT_H_INCLUDED ... - #endif /* ndef PROJECT_H_INCLUDED */</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S33" ->4.6.8. Use `extern "C"` when appropriate</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->If our headers are included from C++, they must declare our - functions as `extern "C"`. This has no cost in C, but increases - the potential re-usability of our code.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #ifdef __cplusplus + #endif /* ndef PROJECT_H_INCLUDED */</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S33" id="S33">4.6.8. Use `extern "C"` when appropriate</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>If our headers are included from C++, they must declare our functions as `extern "C"`. This has no cost in + C, but increases the potential re-usability of our code.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #ifdef __cplusplus extern "C" { #endif /* def __cplusplus */ @@ -1742,145 +695,54 @@ CLASS="PROGRAMLISTING" #ifdef __cplusplus } - #endif /* def __cplusplus */</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S34" ->4.6.9. Where Possible, Use Forward Struct - Declaration Instead of Includes</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Useful in headers that include pointers to other struct's. - Modifications to excess header files may cause needless - compiles.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /********************************************************************* + #endif /* def __cplusplus */</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S34" id="S34">4.6.9. Where Possible, Use Forward Struct Declaration Instead of + Includes</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Useful in headers that include pointers to other struct's. Modifications to excess header files may cause + needless compiles.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /********************************************************************* * We're avoiding an include statement here! *********************************************************************/ struct file_list; - extern file_list *xyz;</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> If you declare "file_list xyz;" (without the - pointer), then including the proper header file is necessary. - If you only want to prototype a pointer, however, the header - file is unnecessary.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> Use with discretion.</P -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S35" ->4.7. General Coding Practices</A -></H2 -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S36" ->4.7.1. Turn on warnings</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation</I -></SPAN -></P -><P ->Compiler warnings are meant to help you find bugs. You - should turn on as many as possible. With GCC, the switch is - "-Wall". Try and fix as many warnings as possible.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S37" ->4.7.2. Provide a default case for all switch - statements</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->What you think is guaranteed is never really guaranteed. The - value that you don't think you need to check is the one that - someday will be passed. So, to protect yourself from the - unknown, always have a default step in a switch statement.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> switch (hash_string(cmd)) + extern file_list *xyz;</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> If you declare "file_list xyz;" (without the + pointer), then including the proper header file is necessary. If you only want to prototype a pointer, however, + the header file is unnecessary.</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> Use with discretion.</p> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S35" id="S35">4.7. General Coding Practices</a></h2> + <div class="SECT3"> + <h3 class="SECT3"><a name="S36" id="S36">4.7.1. Turn on warnings</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation</i></span></p> + <p>Compiler warnings are meant to help you find bugs. You should turn on as many as possible. With GCC, the + switch is "-Wall". Try and fix as many warnings as possible.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S37" id="S37">4.7.2. Provide a default case for all switch statements</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>What you think is guaranteed is never really guaranteed. The value that you don't think you need to check is + the one that someday will be passed. So, to protect yourself from the unknown, always have a default step in a + switch statement.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> switch (hash_string(cmd)) { case hash_actions_file: ... code ... @@ -1895,402 +757,135 @@ CLASS="PROGRAMLISTING" ... anomaly code goes here ... continue; / break; / exit( 1 ); / etc ... - } /* end switch (hash_string(cmd)) */</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> If you already have a default condition, you - are obviously exempt from this point. Of note, most of the - WIN32 code calls `DefWindowProc' after the switch statement. - This API call *should* be included in a default statement.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Another Note:</I -></SPAN -> This is not so much a readability issue - as a robust programming issue. The "anomaly code goes here" may - be no more than a print to the STDERR stream (as in - load_config). Or it may really be an abort condition.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> Programmer discretion is advised.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S38" ->4.7.3. Try to avoid falling through cases in a - switch statement.</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->In general, you will want to have a 'break' statement within - each 'case' of a switch statement. This allows for the code to - be more readable and understandable, and furthermore can - prevent unwanted surprises if someone else later gets creative - and moves the code around.</P -><P ->The language allows you to plan the fall through from one - case statement to another simply by omitting the break - statement within the case statement. This feature does have - benefits, but should only be used in rare cases. In general, - use a break statement for each case statement.</P -><P ->If you choose to allow fall through, you should comment both - the fact of the fall through and reason why you felt it was - necessary.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S40" ->4.7.4. Don't mix size_t and other types</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->The type of size_t varies across platforms. Do not make - assumptions about whether it is signed or unsigned, or about - how long it is. Do not compare a size_t against another - variable of a different type (or even against a constant) - without casting one of the values.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S41" ->4.7.5. Declare each variable and struct on its - own line.</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->It can be tempting to declare a series of variables all on - one line. Don't.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> long a = 0; + } /* end switch (hash_string(cmd)) */</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> If you already have a default condition, you are + obviously exempt from this point. Of note, most of the WIN32 code calls `DefWindowProc' after the switch + statement. This API call *should* be included in a default statement.</p> + <p><span class="emphasis"><i class="EMPHASIS">Another Note:</i></span> This is not so much a readability issue + as a robust programming issue. The "anomaly code goes here" may be no more than a print to the STDERR stream + (as in load_config). Or it may really be an abort condition.</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> Programmer discretion is advised.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S38" id="S38">4.7.3. Try to avoid falling through cases in a switch + statement.</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>In general, you will want to have a 'break' statement within each 'case' of a switch statement. This allows + for the code to be more readable and understandable, and furthermore can prevent unwanted surprises if someone + else later gets creative and moves the code around.</p> + <p>The language allows you to plan the fall through from one case statement to another simply by omitting the + break statement within the case statement. This feature does have benefits, but should only be used in rare + cases. In general, use a break statement for each case statement.</p> + <p>If you choose to allow fall through, you should comment both the fact of the fall through and reason why you + felt it was necessary.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S40" id="S40">4.7.4. Don't mix size_t and other types</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>The type of size_t varies across platforms. Do not make assumptions about whether it is signed or unsigned, + or about how long it is. Do not compare a size_t against another variable of a different type (or even against + a constant) without casting one of the values.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S41" id="S41">4.7.5. Declare each variable and struct on its own line.</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>It can be tempting to declare a series of variables all on one line. Don't.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> long a = 0; long b = 0; - long c = 0;</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Instead of:</I -></SPAN -></P -><P ->long a, b, c;</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -> - there is more room for comments on the - individual variables - easier to add new variables without - messing up the original ones - when searching on a variable to - find its type, there is less clutter to "visually" - eliminate</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Exceptions:</I -></SPAN -> when you want to declare a bunch of loop - variables or other trivial variables; feel free to declare them - on one line. You should, although, provide a good comment on - their functions.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> developer-discretion.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S42" ->4.7.6. Use malloc/zalloc sparingly</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->Create a local struct (on the stack) if the variable will - live and die within the context of one function call.</P -><P ->Only "malloc" a struct (on the heap) if the variable's life - will extend beyond the context of one function call.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> If a function creates a struct and stores a pointer to it in a - list, then it should definitely be allocated via `malloc'.</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S43" ->4.7.7. The Programmer Who Uses 'malloc' is - Responsible for Ensuring 'free'</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->If you have to "malloc" an instance, you are responsible for - insuring that the instance is `free'd, even if the deallocation - event falls within some other programmer's code. You are also - responsible for ensuring that deletion is timely (i.e. not too - soon, not too late). This is known as "low-coupling" and is a - "good thing (tm)". You may need to offer a - free/unload/destructor type function to accommodate this.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> int load_re_filterfile(struct client_state *csp) { ... } - static void unload_re_filterfile(void *f) { ... }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Exceptions:</I -></SPAN -></P -><P ->The developer cannot be expected to provide `free'ing - functions for C run-time library functions ... such as - `strdup'.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Status:</I -></SPAN -> developer-discretion. The "main" use of this - standard is for allocating and freeing data structures (complex - or nested).</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S44" ->4.7.8. Add loaders to the `file_list' structure - and in order</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->I have ordered all of the "blocker" file code to be in alpha - order. It is easier to add/read new blockers when you expect a - certain order.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> It may appear that the alpha order is broken in - places by POPUP tests coming before PCRS tests. But since - POPUPs can also be referred to as KILLPOPUPs, it is clear that - it should come first.</P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="S45" ->4.7.9. "Uncertain" new code and/or changes to - existing code, use XXX</A -></H3 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Explanation:</I -></SPAN -></P -><P ->If you have enough confidence in new code or confidence in - your changes, but are not *quite* sure of the repercussions, - add this:</P -><P ->/* XXX: this code has a logic error on platform XYZ, * - attempting to fix */ #ifdef PLATFORM ...changed code here... - #endif</P -><P ->or:</P -><P ->/* XXX: I think the original author really meant this... - */ ...changed code here...</P -><P ->or:</P -><P ->/* XXX: new code that *may* break something else... */ - ...new code here...</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> If you make it clear that this may or may not - be a "good thing (tm)", it will be easier to identify and - include in the project (or conversely exclude from the - project).</P -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="S46" ->4.8. Addendum: Template for files and function - comment blocks:</A -></H2 -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example for file comments:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /********************************************************************* + long c = 0;</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Instead of:</i></span></p> + <p>long a, b, c;</p> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span> - there is more room for comments on the + individual variables - easier to add new variables without messing up the original ones - when searching on a + variable to find its type, there is less clutter to "visually" eliminate</p> + <p><span class="emphasis"><i class="EMPHASIS">Exceptions:</i></span> when you want to declare a bunch of loop + variables or other trivial variables; feel free to declare them on one line. You should, although, provide a + good comment on their functions.</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> developer-discretion.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S42" id="S42">4.7.6. Use malloc/zalloc sparingly</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>Create a local struct (on the stack) if the variable will live and die within the context of one function + call.</p> + <p>Only "malloc" a struct (on the heap) if the variable's life will extend beyond the context of one function + call.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> If a function creates a struct and stores a pointer to it in a + list, then it should definitely be allocated via `malloc'.</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S43" id="S43">4.7.7. The Programmer Who Uses 'malloc' is Responsible for Ensuring + 'free'</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>If you have to "malloc" an instance, you are responsible for insuring that the instance is `free'd, even if + the deallocation event falls within some other programmer's code. You are also responsible for ensuring that + deletion is timely (i.e. not too soon, not too late). This is known as "low-coupling" and is a "good thing + (tm)". You may need to offer a free/unload/destructor type function to accommodate this.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> int load_re_filterfile(struct client_state *csp) { ... } + static void unload_re_filterfile(void *f) { ... }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Exceptions:</i></span></p> + <p>The developer cannot be expected to provide `free'ing functions for C run-time library functions ... such as + `strdup'.</p> + <p><span class="emphasis"><i class="EMPHASIS">Status:</i></span> developer-discretion. The "main" use of this + standard is for allocating and freeing data structures (complex or nested).</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S44" id="S44">4.7.8. Add loaders to the `file_list' structure and in order</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>I have ordered all of the "blocker" file code to be in alpha order. It is easier to add/read new blockers + when you expect a certain order.</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> It may appear that the alpha order is broken in + places by POPUP tests coming before PCRS tests. But since POPUPs can also be referred to as KILLPOPUPs, it is + clear that it should come first.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="S45" id="S45">4.7.9. "Uncertain" new code and/or changes to existing code, use + XXX</a></h3> + <p><span class="emphasis"><i class="EMPHASIS">Explanation:</i></span></p> + <p>If you have enough confidence in new code or confidence in your changes, but are not *quite* sure of the + repercussions, add this:</p> + <p>/* XXX: this code has a logic error on platform XYZ, * attempting to fix */ #ifdef PLATFORM ...changed code + here... #endif</p> + <p>or:</p> + <p>/* XXX: I think the original author really meant this... */ ...changed code here...</p> + <p>or:</p> + <p>/* XXX: new code that *may* break something else... */ ...new code here...</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> If you make it clear that this may or may not be + a "good thing (tm)", it will be easier to identify and include in the project (or conversely exclude from the + project).</p> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="S46" id="S46">4.8. Addendum: Template for files and function comment blocks:</a></h2> + <p><span class="emphasis"><i class="EMPHASIS">Example for file comments:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /********************************************************************* * * File : $Source * @@ -2325,50 +920,21 @@ CLASS="PROGRAMLISTING" ...necessary include files for us to do our work... - const char FILENAME_h_rcs[] = FILENAME_H_VERSION;</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> This declares the rcs variables that should be - added to the "show-version" page. If this is a brand new - creation by you, you are free to change the "Copyright" section - to represent the rights you wish to maintain.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> The formfeed character that is present right - after the comment flower box is handy for (X|GNU)Emacs users to - skip the verbiage and get to the heart of the code (via - `forward-page' and `backward-page'). Please include it if you - can.</P -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example for file header comments:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> #ifndef _FILENAME_H + const char FILENAME_h_rcs[] = FILENAME_H_VERSION;</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> This declares the rcs variables that should be + added to the "show-version" page. If this is a brand new creation by you, you are free to change the "Copyright" + section to represent the rights you wish to maintain.</p> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> The formfeed character that is present right after + the comment flower box is handy for (X|GNU)Emacs users to skip the verbiage and get to the heart of the code (via + `forward-page' and `backward-page'). Please include it if you can.</p> + <p><span class="emphasis"><i class="EMPHASIS">Example for file header comments:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> #ifndef _FILENAME_H #define _FILENAME_H /********************************************************************* * @@ -2425,27 +991,15 @@ CLASS="PROGRAMLISTING" Local Variables: tab-width: 3 end: - */</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Example for function comments:</I -></SPAN -></P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> /********************************************************************* + */</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Example for function comments:</i></span></p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> /********************************************************************* * * Function : FUNCTION_NAME * @@ -2463,80 +1017,28 @@ CLASS="PROGRAMLISTING" ... return 0; - }</PRE -></TD -></TR -></TABLE -><P -><SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Note:</I -></SPAN -> If we all follow this practice, we should be - able to parse our code to create a "self-documenting" web - page.</P -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="documentation.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="testing.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Documentation Guidelines</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Testing Guidelines</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file + }</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Note:</i></span> If we all follow this practice, we should be able + to parse our code to create a "self-documenting" web page.</p> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="documentation.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"><a href="testing.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top">Documentation Guidelines</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">Testing Guidelines</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/documentation.html b/doc/webserver/developer-manual/documentation.html index 83a50530..a4a8311a 100644 --- a/doc/webserver/developer-manual/documentation.html +++ b/doc/webserver/developer-manual/documentation.html @@ -1,907 +1,280 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Documentation Guidelines</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="The Git Repository" -HREF="git.html"><LINK -REL="NEXT" -TITLE="Coding Guidelines" -HREF="coding.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="git.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="coding.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="DOCUMENTATION" ->3. Documentation Guidelines</A -></H1 -><P -> All formal documents are maintained in Docbook SGML and located in the - <SAMP -CLASS="COMPUTEROUTPUT" ->doc/source/*</SAMP -> directory. You will need - <A -HREF="https://www.docbook.org/" -TARGET="_top" ->Docbook</A ->, the Docbook - DTD's and the Docbook modular stylesheets (or comparable alternatives), - and either <SPAN -CLASS="APPLICATION" ->jade</SPAN -> or - <SPAN -CLASS="APPLICATION" ->openjade</SPAN -> (recommended) installed in order to - build docs from source. Currently there is <A -HREF="../user-manual/index.html" -TARGET="_top" -><I -CLASS="CITETITLE" ->user-manual</I -></A ->, - <A -HREF="../faq/index.html" -TARGET="_top" -><I -CLASS="CITETITLE" ->FAQ</I -></A ->, and, of - course this, the <I -CLASS="CITETITLE" ->developer-manual</I -> in this format. - The <I -CLASS="CITETITLE" ->README</I ->, <I -CLASS="CITETITLE" ->AUTHORS</I ->, - <I -CLASS="CITETITLE" ->INSTALL</I ->, - <I -CLASS="CITETITLE" ->privoxy.8</I -> (man page), and - <I -CLASS="CITETITLE" ->config</I -> files are also now maintained as Docbook - SGML. These files, when built, in the top-level source directory are - generated files! Also, the <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> <TT -CLASS="FILENAME" ->index.html</TT -> (and a - variation on this file, <TT -CLASS="FILENAME" ->privoxy-index.html</TT ->, - meant for inclusion with doc packages), are maintained as SGML as well. - <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->DO NOT edit these directly</I -></SPAN ->. Edit the SGML source, or - contact someone involved in the documentation. - </P -><P -> <TT -CLASS="FILENAME" ->config</TT -> requires some special handling. The reason it - is maintained this way is so that the extensive comments in the file - mirror those in <I -CLASS="CITETITLE" ->user-manual</I ->. But the conversion - process requires going from SGML to HTML to text to special formatting - required for the embedded comments. Some of this does not survive so - well. Especially some of the examples that are longer than 80 characters. - </P -><P -> Other, less formal documents (e.g. <TT -CLASS="FILENAME" ->LICENSE</TT ->) are - maintained as plain text files in the top-level source directory. - </P -><P -> Packagers are encouraged to include this documentation. For those without - the ability to build the docs locally, text versions of each are kept in - Git. HTML versions are also being kept in Git under - <TT -CLASS="FILENAME" ->doc/webserver/*</TT ->. - </P -><P -> Formal documents are built with the Makefile targets of - <SAMP -CLASS="COMPUTEROUTPUT" ->make dok</SAMP ->. - The build process uses the document SGML sources in - <SAMP -CLASS="COMPUTEROUTPUT" ->doc/source/*/*</SAMP -> to update all text files in - <SAMP -CLASS="COMPUTEROUTPUT" ->doc/text/</SAMP -> and to update all HTML - documents in <SAMP -CLASS="COMPUTEROUTPUT" ->doc/webserver/</SAMP ->. - </P -><P -> Documentation writers should please make sure documents build - successfully before committing to Git, if possible. - </P -><P -> How do you update the webserver (i.e. the pages on privoxy.org)? - </P -><P -></P -><OL -TYPE="1" -><LI -><P -> First, build the docs by running <SAMP -CLASS="COMPUTEROUTPUT" ->make - dok dok-tidy</SAMP ->. - </P -></LI -><LI -><P -> Run <SAMP -CLASS="COMPUTEROUTPUT" ->make webserver</SAMP -> which copies all - files from <SAMP -CLASS="COMPUTEROUTPUT" ->doc/webserver</SAMP -> to the - sourceforge webserver via ssh. - </P -></LI -></OL -><P -> Finished docs should be occasionally submitted to Git - (<TT -CLASS="FILENAME" ->doc/webserver/*/*.html</TT ->) so that those without - the ability to build them locally, have access to them if needed. - This is especially important just prior to a new release! Please - do this <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->after</I -></SPAN -> the <TT -CLASS="LITERAL" ->$VERSION</TT -> and - other release specific data in <TT -CLASS="FILENAME" ->configure.in</TT -> has been - updated (this is done just prior to a new release). - </P -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="SGML" ->3.1. Quickstart to Docbook and SGML</A -></H2 -><P -> If you are not familiar with SGML, it is a markup language similar to HTML. - Actually, not a mark up language per se, but a language used to define - markup languages. In fact, HTML is an SGML application. Both will use - <SPAN -CLASS="QUOTE" ->"tags"</SPAN -> to format text and other content. SGML tags can be much - more varied, and flexible, but do much of the same kinds of things. The tags, - or <SPAN -CLASS="QUOTE" ->"elements"</SPAN ->, are definable in SGML. There is no set - <SPAN -CLASS="QUOTE" ->"standards"</SPAN ->. Since we are using - <SPAN -CLASS="APPLICATION" ->Docbook</SPAN ->, our tags are those that are defined by - <SPAN -CLASS="APPLICATION" ->Docbook</SPAN ->. Much of how the finish document is - rendered is determined by the <SPAN -CLASS="QUOTE" ->"stylesheets"</SPAN ->. - The stylesheets determine how each tag gets translated to HTML, or other - formats.</P -><P -> Tags in Docbook SGML need to be always <SPAN -CLASS="QUOTE" ->"closed"</SPAN ->. If not, you - will likely generate errors. Example: <TT -CLASS="LITERAL" -><title>My - Title</title></TT ->. They are also case-insensitive, but we - strongly suggest using all lower case. This keeps compatibility with - [Docbook] <SPAN -CLASS="APPLICATION" ->XML</SPAN ->.</P -><P -> Our documents use <SPAN -CLASS="QUOTE" ->"sections"</SPAN -> for the most part. Sections - will be processed into HTML headers (e.g. <TT -CLASS="LITERAL" ->h1</TT -> for - <TT -CLASS="LITERAL" ->sect1</TT ->). The <SPAN -CLASS="APPLICATION" ->Docbook</SPAN -> stylesheets - will use these to also generate the Table of Contents for each doc. Our - TOC's are set to a depth of three. Meaning <TT -CLASS="LITERAL" ->sect1</TT ->, - <TT -CLASS="LITERAL" ->sect2</TT ->, and <TT -CLASS="LITERAL" ->sect3</TT -> will have TOC - entries, but <TT -CLASS="LITERAL" ->sect4</TT -> will not. Each section requires - a <TT -CLASS="LITERAL" -><title></TT -> element, and at least one - <TT -CLASS="LITERAL" -><para></TT ->. There is a limit of five section - levels in Docbook, but generally three should be sufficient for our - purposes.</P -><P -> Some common elements that you likely will use:</P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><para></para></I -></SPAN ->, paragraph delimiter. Most - text needs to be within paragraph elements (there are some exceptions). - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><emphasis></emphasis></I -></SPAN ->, the stylesheets - make this italics. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><filename></filename></I -></SPAN ->, files and directories. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><command></command></I -></SPAN ->, command examples. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><literallayout></literallayout></I -></SPAN ->, like - <TT -CLASS="LITERAL" -><pre></TT ->, more or less. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><itemizedlist></itemizedlist></I -></SPAN ->, list with bullets. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><listitem></listitem></I -></SPAN ->, member of the above. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><screen></screen></I -></SPAN ->, screen output, implies - <TT -CLASS="LITERAL" -><literallayout></TT ->. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><ulink url="example.com"></ulink></I -></SPAN ->, like - HTML <TT -CLASS="LITERAL" -><a></TT -> tag. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" -><quote></quote></I -></SPAN ->, for, doh, quoting text. - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -> Look at any of the existing docs for examples of all these and more.</P -><P -> You might also find +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Documentation Guidelines</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="The Git Repository" href="git.html"> + <link rel="NEXT" title="Coding Guidelines" href="coding.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="git.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"><a href="coding.html" accesskey="N">Next</a></td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="DOCUMENTATION" id="DOCUMENTATION">3. Documentation Guidelines</a></h1> + <p>All formal documents are maintained in Docbook SGML and located in the <samp class= + "COMPUTEROUTPUT">doc/source/*</samp> directory. You will need <a href="https://www.docbook.org/" target= + "_top">Docbook</a>, the Docbook DTD's and the Docbook modular stylesheets (or comparable alternatives), and either + <span class="APPLICATION">jade</span> or <span class="APPLICATION">openjade</span> (recommended) installed in order + to build docs from source. Currently there is <a href="../user-manual/index.html" target="_top"><i class= + "CITETITLE">user-manual</i></a>, <a href="../faq/index.html" target="_top"><i class="CITETITLE">FAQ</i></a>, and, + of course this, the <i class="CITETITLE">developer-manual</i> in this format. The <i class="CITETITLE">README</i>, + <i class="CITETITLE">AUTHORS</i>, <i class="CITETITLE">INSTALL</i>, <i class="CITETITLE">privoxy.8</i> (man page), + and <i class="CITETITLE">config</i> files are also now maintained as Docbook SGML. These files, when built, in the + top-level source directory are generated files! Also, the <span class="APPLICATION">Privoxy</span> <tt class= + "FILENAME">index.html</tt> (and a variation on this file, <tt class="FILENAME">privoxy-index.html</tt>, meant for + inclusion with doc packages), are maintained as SGML as well. <span class="emphasis"><i class="EMPHASIS">DO NOT + edit these directly</i></span>. Edit the SGML source, or contact someone involved in the documentation.</p> + <p><tt class="FILENAME">config</tt> requires some special handling. The reason it is maintained this way is so that + the extensive comments in the file mirror those in <i class="CITETITLE">user-manual</i>. But the conversion process + requires going from SGML to HTML to text to special formatting required for the embedded comments. Some of this + does not survive so well. Especially some of the examples that are longer than 80 characters.</p> + <p>Other, less formal documents (e.g. <tt class="FILENAME">LICENSE</tt>) are maintained as plain text files in the + top-level source directory.</p> + <p>Packagers are encouraged to include this documentation. For those without the ability to build the docs locally, + text versions of each are kept in Git. HTML versions are also being kept in Git under <tt class= + "FILENAME">doc/webserver/*</tt>.</p> + <p>Formal documents are built with the Makefile targets of <samp class="COMPUTEROUTPUT">make dok</samp>. The build + process uses the document SGML sources in <samp class="COMPUTEROUTPUT">doc/source/*/*</samp> to update all text + files in <samp class="COMPUTEROUTPUT">doc/text/</samp> and to update all HTML documents in <samp class= + "COMPUTEROUTPUT">doc/webserver/</samp>.</p> + <p>Documentation writers should please make sure documents build successfully before committing to Git, if + possible.</p> + <p>How do you update the webserver (i.e. the pages on privoxy.org)?</p> + <ol type="1"> + <li> + <p>First, build the docs by running <samp class="COMPUTEROUTPUT">make dok dok-tidy</samp>.</p> + </li> + <li> + <p>Run <samp class="COMPUTEROUTPUT">make webserver</samp> which copies all files from <samp class= + "COMPUTEROUTPUT">doc/webserver</samp> to the sourceforge webserver via ssh.</p> + </li> + </ol> + <p>Finished docs should be occasionally submitted to Git (<tt class="FILENAME">doc/webserver/*/*.html</tt>) so that + those without the ability to build them locally, have access to them if needed. This is especially important just + prior to a new release! Please do this <span class="emphasis"><i class="EMPHASIS">after</i></span> the <tt class= + "LITERAL">$VERSION</tt> and other release specific data in <tt class="FILENAME">configure.in</tt> has been updated + (this is done just prior to a new release).</p> + <div class="SECT2"> + <h2 class="SECT2"><a name="SGML" id="SGML">3.1. Quickstart to Docbook and SGML</a></h2> + <p>If you are not familiar with SGML, it is a markup language similar to HTML. Actually, not a mark up language + per se, but a language used to define markup languages. In fact, HTML is an SGML application. Both will use + <span class="QUOTE">"tags"</span> to format text and other content. SGML tags can be much more varied, and + flexible, but do much of the same kinds of things. The tags, or <span class="QUOTE">"elements"</span>, are + definable in SGML. There is no set <span class="QUOTE">"standards"</span>. Since we are using <span class= + "APPLICATION">Docbook</span>, our tags are those that are defined by <span class="APPLICATION">Docbook</span>. + Much of how the finish document is rendered is determined by the <span class="QUOTE">"stylesheets"</span>. The + stylesheets determine how each tag gets translated to HTML, or other formats.</p> + <p>Tags in Docbook SGML need to be always <span class="QUOTE">"closed"</span>. If not, you will likely generate + errors. Example: <tt class="LITERAL"><title>My Title</title></tt>. They are also case-insensitive, + but we strongly suggest using all lower case. This keeps compatibility with [Docbook] <span class= + "APPLICATION">XML</span>.</p> + <p>Our documents use <span class="QUOTE">"sections"</span> for the most part. Sections will be processed into + HTML headers (e.g. <tt class="LITERAL">h1</tt> for <tt class="LITERAL">sect1</tt>). The <span class= + "APPLICATION">Docbook</span> stylesheets will use these to also generate the Table of Contents for each doc. Our + TOC's are set to a depth of three. Meaning <tt class="LITERAL">sect1</tt>, <tt class="LITERAL">sect2</tt>, and + <tt class="LITERAL">sect3</tt> will have TOC entries, but <tt class="LITERAL">sect4</tt> will not. Each section + requires a <tt class="LITERAL"><title></tt> element, and at least one <tt class= + "LITERAL"><para></tt>. There is a limit of five section levels in Docbook, but generally three should be + sufficient for our purposes.</p> + <p>Some common elements that you likely will use:</p> + <table border="0"> + <tbody> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><para></para></i></span>, paragraph delimiter. + Most text needs to be within paragraph elements (there are some exceptions).</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><emphasis></emphasis></i></span>, the + stylesheets make this italics.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><filename></filename></i></span>, files and + directories.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><command></command></i></span>, command + examples.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><literallayout></literallayout></i></span>, like + <tt class="LITERAL"><pre></tt>, more or less.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><itemizedlist></itemizedlist></i></span>, list + with bullets.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><listitem></listitem></i></span>, member of the + above.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><screen></screen></i></span>, screen output, + implies <tt class="LITERAL"><literallayout></tt>.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><ulink url="example.com"></ulink></i></span>, + like HTML <tt class="LITERAL"><a></tt> tag.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS"><quote></quote></i></span>, for, doh, quoting + text.</td> + </tr> + </tbody> + </table> + <p>Look at any of the existing docs for examples of all these and more.</p> + <p>You might also find <span class="QUOTE">" <a href= + "https://web.archive.org/web/20160315230758/http://opensource.bureau-cornavin.com/crash-course/index.html" + target="_top">Writing Documentation Using DocBook - A Crash Course</a>"</span> useful.</p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="DOCSTYLE" id="DOCSTYLE">3.2. <span class="APPLICATION">Privoxy</span> Documentation + Style</a></h2> + <p>It will be easier if everyone follows a similar writing style. This just makes it easier to read what someone + else has written if it is all done in a similar fashion.</p> + <p>Here it is:</p> + <ul> + <li> + <p>All tags should be lower case.</p> + </li> + <li> + <p>Tags delimiting a <span class="emphasis"><i class="EMPHASIS">block</i></span> of text (even small blocks) + should be on their own line. Like:</p> + <p class="LITERALLAYOUT"> <para><br> + Some text goes here.<br> + </para></p> + <p>Tags marking individual words, or few words, should be in-line:</p> + <p class="LITERALLAYOUT"> + Just to <emphasis>emphasize</emphasis>, some text goes here.</p> + </li> + <li> + <p>Tags should be nested and step indented for block text like: (except in-line tags)</p> + <p class="LITERALLAYOUT"> <para><br> + <itemizedlist><br> + <para><br> + <listitem><br> + Some text goes here in our list example.<br> - <SPAN -CLASS="QUOTE" ->"<A -HREF="https://web.archive.org/web/20160315230758/http://opensource.bureau-cornavin.com/crash-course/index.html" -TARGET="_top" -> Writing Documentation Using DocBook - A Crash Course</A ->"</SPAN -> useful.</P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="DOCSTYLE" ->3.2. <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> Documentation Style</A -></H2 -><P -> It will be easier if everyone follows a similar writing style. This - just makes it easier to read what someone else has written if it - is all done in a similar fashion. - </P -><P -> Here it is: - </P -><P -></P -><UL -><LI -><P -> All tags should be lower case. - </P -></LI -><LI -><P -> Tags delimiting a <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->block</I -></SPAN -> of text (even small - blocks) should be on their own line. Like: - </P -><P -CLASS="LITERALLAYOUT" -> <para><br> - Some text goes here.<br> - </para></P -><P -> Tags marking individual words, or few words, should be in-line: - </P -><P -CLASS="LITERALLAYOUT" -> Just to <emphasis>emphasize</emphasis>, some text goes here.</P -></LI -><LI -><P -> Tags should be nested and step indented for block text like: (except - in-line tags) - </P -><P -CLASS="LITERALLAYOUT" -> <para><br> - <itemizedlist><br> - <para><br> - <listitem><br> - Some text goes here in our list example.<br> - </listitem><br> - </para><br> - </itemizedlist><br> - </para></P -><P -> This makes it easier to find the text amongst the tags ;-) - </P -></LI -><LI -><P -> Use white space to separate logical divisions within a document, - like between sections. Running everything together consistently - makes it harder to read and work on. - </P -></LI -><LI -><P -> Do not hesitate to make comments. Comments can either use the - <comment> element, or the <!-- --> style comment - familiar from HTML. (Note in Docbook v4.x <comment> is - replaced by <remark>.) - </P -></LI -><LI -><P -> We have an international audience. Refrain from slang, or English - idiosyncrasies (too many to list :). Humor also does not translate - well sometimes. - </P -></LI -><LI -><P -> Try to keep overall line lengths in source files to 80 characters or less - for obvious reasons. This is not always possible, with lengthy URLs for - instance. - </P -></LI -><LI -><P -> Our documents are available in differing formats. Right now, they - are just plain text and/or HTML, but others are always a - future possibility. Be careful with URLs (<ulink>), and avoid - this mistake: - </P -><P -> My favorite site is <ulink url="http://example.com">here</ulink>. - </P -><P -> This will render as <SPAN -CLASS="QUOTE" ->"My favorite site is here"</SPAN ->, which is - not real helpful in a text doc. Better like this: - </P -><P -> My favorite site is <ulink url="http://example.com">example.com</ulink>. - </P -></LI -><LI -><P -> All documents should be spell checked occasionally. - <SPAN -CLASS="APPLICATION" ->aspell</SPAN -> can check SGML with the - <TT -CLASS="LITERAL" ->-H</TT -> option. (<SPAN -CLASS="APPLICATION" ->ispell</SPAN -> I think - too.) - </P -></LI -></UL -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="CUSTOM-ENTITIES" ->3.3. Privoxy Custom Entities</A -></H2 -><P -> <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> documentation is using - a number of customized <SPAN -CLASS="QUOTE" ->"entities"</SPAN -> to facilitate - documentation maintenance. - </P -><P -> We are using a set of <SPAN -CLASS="QUOTE" ->"boilerplate"</SPAN -> files with generic text, - that is used by multiple docs. This way we can write something once, and use - it repeatedly without having to re-write the same content over and over again. - If editing such a file, keep in mind that it should be - <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->generic</I -></SPAN ->. That is the purpose; so it can be used in varying - contexts without additional modifications. - </P -><P -> We are also using what <SPAN -CLASS="APPLICATION" ->Docbook</SPAN -> calls - <SPAN -CLASS="QUOTE" ->"internal entities"</SPAN ->. These are like variables in - programming. Well, sort of. For instance, we have the - <TT -CLASS="LITERAL" ->p-version</TT -> entity that contains the current - <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> version string. You are strongly - encouraged to use these where possible. Some of these obviously - require re-setting with each release (done by the Makefile). A sampling of - custom entities are listed below. See any of the main docs for examples. - </P -><P -></P -><UL -><LI -><P -> Re- <SPAN -CLASS="QUOTE" ->"boilerplate"</SPAN -> text entities are defined like: - </P -><P -> <TT -CLASS="LITERAL" -><!entity supported SYSTEM "supported.sgml"></TT -> - </P -><P -> In this example, the contents of the file, - <TT -CLASS="FILENAME" ->supported.sgml</TT -> is available for inclusion anywhere - in the doc. To make this happen, just reference the now defined - entity: <TT -CLASS="LITERAL" ->&supported;</TT -> (starts with an ampersand - and ends with a semi-colon), and the contents will be dumped into - the finished doc at that point. - </P -></LI -><LI -><P -> Commonly used <SPAN -CLASS="QUOTE" ->"internal entities"</SPAN ->: - </P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->p-version</I -></SPAN ->: the <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> - version string, e.g. <SPAN -CLASS="QUOTE" ->"3.0.34"</SPAN ->. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->p-status</I -></SPAN ->: the project status, either - <SPAN -CLASS="QUOTE" ->"alpha"</SPAN ->, <SPAN -CLASS="QUOTE" ->"beta"</SPAN ->, or <SPAN -CLASS="QUOTE" ->"stable"</SPAN ->. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->p-not-stable</I -></SPAN ->: use to conditionally include - text in <SPAN -CLASS="QUOTE" ->"not stable"</SPAN -> releases (e.g. <SPAN -CLASS="QUOTE" ->"beta"</SPAN ->). - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->p-stable</I -></SPAN ->: just the opposite. - </TD -></TR -><TR -><TD -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->p-text</I -></SPAN ->: this doc is only generated as text. - </TD -></TR -></TBODY -></TABLE -><P -></P -></LI -></UL -><P -> There are others in various places that are defined for a specific - purpose. Read the source! - </P -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="git.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="coding.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->The Git Repository</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Coding Guidelines</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file + </listitem><br> + </para><br> + </itemizedlist><br> + </para></p> + <p>This makes it easier to find the text amongst the tags ;-)</p> + </li> + <li> + <p>Use white space to separate logical divisions within a document, like between sections. Running everything + together consistently makes it harder to read and work on.</p> + </li> + <li> + <p>Do not hesitate to make comments. Comments can either use the <comment> element, or the <!-- + --> style comment familiar from HTML. (Note in Docbook v4.x <comment> is replaced by + <remark>.)</p> + </li> + <li> + <p>We have an international audience. Refrain from slang, or English idiosyncrasies (too many to list :). + Humor also does not translate well sometimes.</p> + </li> + <li> + <p>Try to keep overall line lengths in source files to 80 characters or less for obvious reasons. This is not + always possible, with lengthy URLs for instance.</p> + </li> + <li> + <p>Our documents are available in differing formats. Right now, they are just plain text and/or HTML, but + others are always a future possibility. Be careful with URLs (<ulink>), and avoid this mistake:</p> + <p>My favorite site is <ulink url="http://example.com">here</ulink>.</p> + <p>This will render as <span class="QUOTE">"My favorite site is here"</span>, which is not real helpful in a + text doc. Better like this:</p> + <p>My favorite site is <ulink url="http://example.com">example.com</ulink>.</p> + </li> + <li> + <p>All documents should be spell checked occasionally. <span class="APPLICATION">aspell</span> can check SGML + with the <tt class="LITERAL">-H</tt> option. (<span class="APPLICATION">ispell</span> I think too.)</p> + </li> + </ul> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="CUSTOM-ENTITIES" id="CUSTOM-ENTITIES">3.3. Privoxy Custom Entities</a></h2> + <p><span class="APPLICATION">Privoxy</span> documentation is using a number of customized <span class= + "QUOTE">"entities"</span> to facilitate documentation maintenance.</p> + <p>We are using a set of <span class="QUOTE">"boilerplate"</span> files with generic text, that is used by + multiple docs. This way we can write something once, and use it repeatedly without having to re-write the same + content over and over again. If editing such a file, keep in mind that it should be <span class= + "emphasis"><i class="EMPHASIS">generic</i></span>. That is the purpose; so it can be used in varying contexts + without additional modifications.</p> + <p>We are also using what <span class="APPLICATION">Docbook</span> calls <span class="QUOTE">"internal + entities"</span>. These are like variables in programming. Well, sort of. For instance, we have the <tt class= + "LITERAL">p-version</tt> entity that contains the current <span class="APPLICATION">Privoxy</span> version + string. You are strongly encouraged to use these where possible. Some of these obviously require re-setting with + each release (done by the Makefile). A sampling of custom entities are listed below. See any of the main docs for + examples.</p> + <ul> + <li> + <p>Re- <span class="QUOTE">"boilerplate"</span> text entities are defined like:</p> + <p><tt class="LITERAL"><!entity supported SYSTEM "supported.sgml"></tt></p> + <p>In this example, the contents of the file, <tt class="FILENAME">supported.sgml</tt> is available for + inclusion anywhere in the doc. To make this happen, just reference the now defined entity: <tt class= + "LITERAL">&supported;</tt> (starts with an ampersand and ends with a semi-colon), and the contents will + be dumped into the finished doc at that point.</p> + </li> + <li> + <p>Commonly used <span class="QUOTE">"internal entities"</span>:</p> + <table border="0"> + <tbody> + <tr> + <td><span class="emphasis"><i class="EMPHASIS">p-version</i></span>: the <span class= + "APPLICATION">Privoxy</span> version string, e.g. <span class="QUOTE">"3.0.34"</span>.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS">p-status</i></span>: the project status, either + <span class="QUOTE">"alpha"</span>, <span class="QUOTE">"beta"</span>, or <span class= + "QUOTE">"stable"</span>.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS">p-not-stable</i></span>: use to conditionally include + text in <span class="QUOTE">"not stable"</span> releases (e.g. <span class="QUOTE">"beta"</span>).</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS">p-stable</i></span>: just the opposite.</td> + </tr> + <tr> + <td><span class="emphasis"><i class="EMPHASIS">p-text</i></span>: this doc is only generated as + text.</td> + </tr> + </tbody> + </table> + </li> + </ul> + <p>There are others in various places that are defined for a specific purpose. Read the source!</p> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="git.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"><a href="coding.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top">The Git Repository</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">Coding Guidelines</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/git.html b/doc/webserver/developer-manual/git.html index e835f4a3..e9c8d755 100644 --- a/doc/webserver/developer-manual/git.html +++ b/doc/webserver/developer-manual/git.html @@ -1,170 +1,60 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->The Git Repository</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Introduction" -HREF="introduction.html"><LINK -REL="NEXT" -TITLE="Documentation Guidelines" -HREF="documentation.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="introduction.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="documentation.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="GIT" ->2. The Git Repository</A -></H1 -><P -> If you become part of the active development team, you will eventually - need write access to our holy grail, the Git repository. One of the - team members will need to set this up for you. Please read - this chapter completely before accessing via Git. - </P -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="GITACCESS" ->2.1. Access to Git</A -></H2 -><P -> The project's Git repository is hosted on the - <A -HREF="https://www.privoxy.org/" -TARGET="_top" ->Privoxy webserver</A ->. - For Privoxy team members with push privileges the Git repository URL is - <TT -CLASS="LITERAL" ->ssh://git@git.privoxy.org:23/git/privoxy.git</TT ->. - </P -><P -> Contributors without push privileges can - <SPAN -CLASS="QUOTE" ->"git clone https://www.privoxy.org/git/privoxy.git"</SPAN ->. - </P -><P -> The central repository is called <TT -CLASS="LITERAL" ->privoxy</TT ->, and the - source branch is called <TT -CLASS="LITERAL" ->master</TT ->. Subfolders exist - within the project for target-dependent build and packaging tools, each - including the name of the target operating system in their name (e.g. - Windows, OSXPackageBuilder, debian). There is a webview of the Git - hierarchy at - <A -HREF="https://www.privoxy.org/gitweb/?p=privoxy.git;a=tree" -TARGET="_top" -> https://www.privoxy.org/gitweb/?p=privoxy.git;a=tree</A ->, - which might help with visualizing how these pieces fit together. - </P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="GITBRANCHES" ->2.2. Branches</A -></H2 -><P -> Whilst the central repository contains only the master branch, developers - are of course free to create branches in their local repositories as they - develop features, fixes, or update the target-dependent tools. Only once - such changes are fully tested ought they be pushed back to the central - repository master branch. - </P -><P -> Before pushing stuff, please rebase it on a current master so we get - an uncomplicated commit history. Avoid merges where possible. - </P -><P -> Here's an example git sesssion that should result in a merge-free history: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> fk@t520 ~/git/privoxy $git checkout master +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>The Git Repository</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="Introduction" href="introduction.html"> + <link rel="NEXT" title="Documentation Guidelines" href="documentation.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="introduction.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"><a href="documentation.html" accesskey="N">Next</a></td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="GIT" id="GIT">2. The Git Repository</a></h1> + <p>If you become part of the active development team, you will eventually need write access to our holy grail, the + Git repository. One of the team members will need to set this up for you. Please read this chapter completely + before accessing via Git.</p> + <div class="SECT2"> + <h2 class="SECT2"><a name="GITACCESS" id="GITACCESS">2.1. Access to Git</a></h2> + <p>The project's Git repository is hosted on the <a href="https://www.privoxy.org/" target="_top">Privoxy + webserver</a>. For Privoxy team members with push privileges the Git repository URL is <tt class= + "LITERAL">ssh://git@git.privoxy.org:23/git/privoxy.git</tt>.</p> + <p>Contributors without push privileges can <span class="QUOTE">"git clone + https://www.privoxy.org/git/privoxy.git"</span>.</p> + <p>The central repository is called <tt class="LITERAL">privoxy</tt>, and the source branch is called <tt class= + "LITERAL">master</tt>. Subfolders exist within the project for target-dependent build and packaging tools, each + including the name of the target operating system in their name (e.g. Windows, OSXPackageBuilder, debian). There + is a webview of the Git hierarchy at <a href="https://www.privoxy.org/gitweb/?p=privoxy.git;a=tree" target= + "_top">https://www.privoxy.org/gitweb/?p=privoxy.git;a=tree</a>, which might help with visualizing how these + pieces fit together.</p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="GITBRANCHES" id="GITBRANCHES">2.2. Branches</a></h2> + <p>Whilst the central repository contains only the master branch, developers are of course free to create + branches in their local repositories as they develop features, fixes, or update the target-dependent tools. Only + once such changes are fully tested ought they be pushed back to the central repository master branch.</p> + <p>Before pushing stuff, please rebase it on a current master so we get an uncomplicated commit history. Avoid + merges where possible.</p> + <p>Here's an example git sesssion that should result in a merge-free history:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> fk@t520 ~/git/privoxy $git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. # Make sure you have the latest changes @@ -208,161 +98,64 @@ CLASS="PROGRAMLISTING" fk@t520 ~/git/privoxy $git checkout local-branch # Rebase on top of master and continue hacking fk@t520 ~/git/privoxy $git rebase master - Successfully rebased and updated refs/heads/local-branch.</PRE -></TD -></TR -></TABLE -><P -> At one time there were two distinct branches: stable and unstable. The - more drastic changes were to be in the unstable branch. These branches - have now been merged to minimize time and effort of maintaining two - branches. - </P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="GITCOMMIT" ->2.3. Git Commit Guidelines</A -></H2 -><P -> The source tree is the heart of every software project. Every effort must - be made to ensure that it is readable, compilable and consistent at all - times. We expect anyone with Git access to strictly - adhere to the following guidelines: - </P -><P -> Basic Guidelines, for all branches: - </P -><P -></P -><UL -><LI -><P -> Please don't commit even - a small change without testing it thoroughly first. When we're - close to a public release, ask a fellow developer to review your - changes. - </P -></LI -><LI -><P -> Your commit message should give a concise overview of <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->what you - changed</I -></SPAN -> (no big details) and <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->why you changed it</I -></SPAN -> - Just check previous messages for good examples. - </P -></LI -><LI -><P -> Don't use the same message on multiple files, unless it equally applies to - all those files. - </P -></LI -><LI -><P -> If your changes span multiple files, and the code won't recompile unless - all changes are committed (e.g. when changing the signature of a function), - then commit all files one after another, without long delays in between. - If necessary, prepare the commit messages in advance. - </P -></LI -><LI -><P -> Before changing things on Git, make sure that your changes are in line - with the team's general consensus on what should be done. - </P -></LI -><LI -><P -> Note that near a major public release, we get more cautious. - There is always the possibility to submit a patch to the <A -HREF="https://sourceforge.net/p/ijbswa/patches/" -TARGET="_top" ->patch - tracker</A -> or the <A -HREF="https://lists.privoxy.org/mailman/listinfo/privoxy-devel" -TARGET="_top" ->privoxy-devel mailing list</A -> - instead. - </P -></LI -></UL -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="introduction.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="documentation.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Introduction</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Documentation Guidelines</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file + Successfully rebased and updated refs/heads/local-branch.</pre> + </td> + </tr> + </table> + <p>At one time there were two distinct branches: stable and unstable. The more drastic changes were to be in the + unstable branch. These branches have now been merged to minimize time and effort of maintaining two branches.</p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="GITCOMMIT" id="GITCOMMIT">2.3. Git Commit Guidelines</a></h2> + <p>The source tree is the heart of every software project. Every effort must be made to ensure that it is + readable, compilable and consistent at all times. We expect anyone with Git access to strictly adhere to the + following guidelines:</p> + <p>Basic Guidelines, for all branches:</p> + <ul> + <li> + <p>Please don't commit even a small change without testing it thoroughly first. When we're close to a public + release, ask a fellow developer to review your changes.</p> + </li> + <li> + <p>Your commit message should give a concise overview of <span class="emphasis"><i class="EMPHASIS">what you + changed</i></span> (no big details) and <span class="emphasis"><i class="EMPHASIS">why you changed + it</i></span> Just check previous messages for good examples.</p> + </li> + <li> + <p>Don't use the same message on multiple files, unless it equally applies to all those files.</p> + </li> + <li> + <p>If your changes span multiple files, and the code won't recompile unless all changes are committed (e.g. + when changing the signature of a function), then commit all files one after another, without long delays in + between. If necessary, prepare the commit messages in advance.</p> + </li> + <li> + <p>Before changing things on Git, make sure that your changes are in line with the team's general consensus + on what should be done.</p> + </li> + <li> + <p>Note that near a major public release, we get more cautious. There is always the possibility to submit a + patch to the <a href="https://sourceforge.net/p/ijbswa/patches/" target="_top">patch tracker</a> or the + <a href="https://lists.privoxy.org/mailman/listinfo/privoxy-devel" target="_top">privoxy-devel mailing + list</a> instead.</p> + </li> + </ul> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="introduction.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"><a href="documentation.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top">Introduction</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">Documentation Guidelines</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/index.html b/doc/webserver/developer-manual/index.html index f30c89c1..1ddbf5b3 100644 --- a/doc/webserver/developer-manual/index.html +++ b/doc/webserver/developer-manual/index.html @@ -1,594 +1,186 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Privoxy Developer Manual</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="NEXT" -TITLE="Introduction" -HREF="introduction.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="ARTICLE" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="ARTICLE" -><DIV -CLASS="TITLEPAGE" -><H1 -CLASS="TITLE" -><A -NAME="AEN2" ->Privoxy Developer Manual</A -></H1 -><P -CLASS="PUBDATE" -> <SUB -> - - <A -HREF="https://www.privoxy.org/user-manual/copyright.html" -TARGET="_top" ->Copyright</A -> - © 2001-2021 by - <A -HREF="https://www.privoxy.org/" -TARGET="_top" ->Privoxy Developers</A -> - </SUB -> - <BR></P -><DIV -><DIV -CLASS="ABSTRACT" -><P -></P -><A -NAME="AEN8" -></A -><P -> The developer manual provides guidance on coding, testing, packaging, documentation - and other issues of importance to those involved with - <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> development. It is mandatory (and helpful!) reading - for anyone who wants to join the team. Note that it's currently out of date - and may not be entirely correct. As always, patches are welcome.</P -><P -> Please note that this document is constantly evolving. This copy represents - the state at the release of version 3.0.34. - You can find the latest version of the this manual at <A -HREF="https://www.privoxy.org/developer-manual/" -TARGET="_top" ->https://www.privoxy.org/developer-manual/</A ->. - Please have a look at the - <A -HREF="https://www.privoxy.org/user-manual/contact.html" -TARGET="_top" ->contact section in the user manual</A -> - if you are interested in contacting the developers.</P -><P -></P -></DIV -></DIV -><HR></DIV -><DIV -CLASS="TOC" -><DL -><DT -><B ->Table of Contents</B -></DT -><DT ->1. <A -HREF="introduction.html" ->Introduction</A -></DT -><DD -><DL -><DT ->1.1. <A -HREF="introduction.html#QUICKSTART" ->Quickstart to Privoxy Development</A -></DT -></DL -></DD -><DT ->2. <A -HREF="git.html" ->The Git Repository</A -></DT -><DD -><DL -><DT ->2.1. <A -HREF="git.html#GITACCESS" ->Access to Git</A -></DT -><DT ->2.2. <A -HREF="git.html#GITBRANCHES" ->Branches</A -></DT -><DT ->2.3. <A -HREF="git.html#GITCOMMIT" ->Git Commit Guidelines</A -></DT -></DL -></DD -><DT ->3. <A -HREF="documentation.html" ->Documentation Guidelines</A -></DT -><DD -><DL -><DT ->3.1. <A -HREF="documentation.html#SGML" ->Quickstart to Docbook and SGML</A -></DT -><DT ->3.2. <A -HREF="documentation.html#DOCSTYLE" -><SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> Documentation Style</A -></DT -><DT ->3.3. <A -HREF="documentation.html#CUSTOM-ENTITIES" ->Privoxy Custom Entities</A -></DT -></DL -></DD -><DT ->4. <A -HREF="coding.html" ->Coding Guidelines</A -></DT -><DD -><DL -><DT ->4.1. <A -HREF="coding.html#S1" ->Introduction</A -></DT -><DT ->4.2. <A -HREF="coding.html#S2" ->Using Comments</A -></DT -><DD -><DL -><DT ->4.2.1. <A -HREF="coding.html#S3" ->Comment, Comment, Comment</A -></DT -><DT ->4.2.2. <A -HREF="coding.html#S4" ->Use blocks for comments</A -></DT -><DT ->4.2.3. <A -HREF="coding.html#S5" ->Keep Comments on their own line</A -></DT -><DT ->4.2.4. <A -HREF="coding.html#S6" ->Comment each logical step</A -></DT -><DT ->4.2.5. <A -HREF="coding.html#S7" ->Comment All Functions Thoroughly</A -></DT -><DT ->4.2.6. <A -HREF="coding.html#S8" ->Comment at the end of braces if the - content is more than one screen length</A -></DT -></DL -></DD -><DT ->4.3. <A -HREF="coding.html#S9" ->Naming Conventions</A -></DT -><DD -><DL -><DT ->4.3.1. <A -HREF="coding.html#S10" ->Variable Names</A -></DT -><DT ->4.3.2. <A -HREF="coding.html#S11" ->Function Names</A -></DT -><DT ->4.3.3. <A -HREF="coding.html#S12" ->Header file prototypes</A -></DT -><DT ->4.3.4. <A -HREF="coding.html#S13" ->Enumerations, and #defines</A -></DT -><DT ->4.3.5. <A -HREF="coding.html#S14" ->Constants</A -></DT -></DL -></DD -><DT ->4.4. <A -HREF="coding.html#S15" ->Using Space</A -></DT -><DD -><DL -><DT ->4.4.1. <A -HREF="coding.html#S16" ->Put braces on a line by themselves.</A -></DT -><DT ->4.4.2. <A -HREF="coding.html#S17" ->ALL control statements should have a - block</A -></DT -><DT ->4.4.3. <A -HREF="coding.html#S18" ->Do not belabor/blow-up boolean - expressions</A -></DT -><DT ->4.4.4. <A -HREF="coding.html#S19" ->Use white space freely because it is - free</A -></DT -><DT ->4.4.5. <A -HREF="coding.html#S20" ->Don't use white space around structure - operators</A -></DT -><DT ->4.4.6. <A -HREF="coding.html#S21" ->Make the last brace of a function stand - out</A -></DT -><DT ->4.4.7. <A -HREF="coding.html#S22" ->Use 3 character indentions</A -></DT -></DL -></DD -><DT ->4.5. <A -HREF="coding.html#S23" ->Initializing</A -></DT -><DD -><DL -><DT ->4.5.1. <A -HREF="coding.html#S24" ->Initialize all variables</A -></DT -></DL -></DD -><DT ->4.6. <A -HREF="coding.html#S25" ->Functions</A -></DT -><DD -><DL -><DT ->4.6.1. <A -HREF="coding.html#S26" ->Name functions that return a boolean as a - question.</A -></DT -><DT ->4.6.2. <A -HREF="coding.html#S27" ->Always specify a return type for a - function.</A -></DT -><DT ->4.6.3. <A -HREF="coding.html#S28" ->Minimize function calls when iterating by - using variables</A -></DT -><DT ->4.6.4. <A -HREF="coding.html#S29" ->Pass and Return by Const Reference</A -></DT -><DT ->4.6.5. <A -HREF="coding.html#S30" ->Pass and Return by Value</A -></DT -><DT ->4.6.6. <A -HREF="coding.html#S31" ->Names of include files</A -></DT -><DT ->4.6.7. <A -HREF="coding.html#S32" ->Provide multiple inclusion - protection</A -></DT -><DT ->4.6.8. <A -HREF="coding.html#S33" ->Use `extern "C"` when appropriate</A -></DT -><DT ->4.6.9. <A -HREF="coding.html#S34" ->Where Possible, Use Forward Struct - Declaration Instead of Includes</A -></DT -></DL -></DD -><DT ->4.7. <A -HREF="coding.html#S35" ->General Coding Practices</A -></DT -><DD -><DL -><DT ->4.7.1. <A -HREF="coding.html#S36" ->Turn on warnings</A -></DT -><DT ->4.7.2. <A -HREF="coding.html#S37" ->Provide a default case for all switch - statements</A -></DT -><DT ->4.7.3. <A -HREF="coding.html#S38" ->Try to avoid falling through cases in a - switch statement.</A -></DT -><DT ->4.7.4. <A -HREF="coding.html#S40" ->Don't mix size_t and other types</A -></DT -><DT ->4.7.5. <A -HREF="coding.html#S41" ->Declare each variable and struct on its - own line.</A -></DT -><DT ->4.7.6. <A -HREF="coding.html#S42" ->Use malloc/zalloc sparingly</A -></DT -><DT ->4.7.7. <A -HREF="coding.html#S43" ->The Programmer Who Uses 'malloc' is - Responsible for Ensuring 'free'</A -></DT -><DT ->4.7.8. <A -HREF="coding.html#S44" ->Add loaders to the `file_list' structure - and in order</A -></DT -><DT ->4.7.9. <A -HREF="coding.html#S45" ->"Uncertain" new code and/or changes to - existing code, use XXX</A -></DT -></DL -></DD -><DT ->4.8. <A -HREF="coding.html#S46" ->Addendum: Template for files and function - comment blocks:</A -></DT -></DL -></DD -><DT ->5. <A -HREF="testing.html" ->Testing Guidelines</A -></DT -><DD -><DL -><DT ->5.1. <A -HREF="testing.html#TESTING-PLAN" ->Testplan for releases</A -></DT -><DT ->5.2. <A -HREF="testing.html#PRIVOXY-REGRESSION-TEST" ->Testing with <SPAN -CLASS="APPLICATION" ->Privoxy-Regression-Test</SPAN -></A -></DT -><DT ->5.3. <A -HREF="testing.html#FUZZING" ->Fuzzing Privoxy</A -></DT -></DL -></DD -><DT ->6. <A -HREF="newrelease.html" ->Releasing a New Version</A -></DT -><DD -><DL -><DT ->6.1. <A -HREF="newrelease.html#VERSIONNUMBERS" ->Version numbers</A -></DT -><DT ->6.2. <A -HREF="newrelease.html#BEFORERELEASE" ->Before the Release</A -></DT -><DT ->6.3. <A -HREF="newrelease.html#THERELEASE" ->Building and Releasing the Packages</A -></DT -><DD -><DL -><DT ->6.3.1. <A -HREF="newrelease.html#PACK-GUIDELINES" ->Note on Privoxy Packaging</A -></DT -><DT ->6.3.2. <A -HREF="newrelease.html#NEWRELEASE-TARBALL" ->Source Tarball</A -></DT -><DT ->6.3.3. <A -HREF="newrelease.html#NEWRELEASE-WINDOWS" ->Windows</A -></DT -><DT ->6.3.4. <A -HREF="newrelease.html#NEWRELEASE-DEBIAN" ->Debian</A -></DT -><DT ->6.3.5. <A -HREF="newrelease.html#NEWRELEASE-MACOSX" ->macOS / OS X</A -></DT -><DT ->6.3.6. <A -HREF="newrelease.html#NEWRELEASE-FREEBSD" ->FreeBSD</A -></DT -></DL -></DD -><DT ->6.4. <A -HREF="newrelease.html#RELEASING" ->Uploading and Releasing Your Package</A -></DT -><DT ->6.5. <A -HREF="newrelease.html#AFTERRELEASE" ->After the Release</A -></DT -></DL -></DD -><DT ->7. <A -HREF="webserver-update.html" ->Update the Webserver</A -></DT -></DL -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -> </TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="introduction.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -> </TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Introduction</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Privoxy Developer Manual</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="NEXT" title="Introduction" href="introduction.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="ARTICLE" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="ARTICLE"> + <div class="TITLEPAGE"> + <h1 class="TITLE"><a name="AEN2" id="AEN2">Privoxy Developer Manual</a></h1> + <p class="PUBDATE"><sub><a href="https://www.privoxy.org/user-manual/copyright.html" target="_top">Copyright</a> + © 2001-2021 by <a href="https://www.privoxy.org/" target="_top">Privoxy Developers</a></sub><br></p> + <div> + <div class="ABSTRACT"> + <a name="AEN8" id="AEN8"></a> + <p>The developer manual provides guidance on coding, testing, packaging, documentation and other issues of + importance to those involved with <span class="APPLICATION">Privoxy</span> development. It is mandatory (and + helpful!) reading for anyone who wants to join the team. Note that it's currently out of date and may not be + entirely correct. As always, patches are welcome.</p> + <p>Please note that this document is constantly evolving. This copy represents the state at the release of + version 3.0.34. You can find the latest version of the this manual at <a href= + "https://www.privoxy.org/developer-manual/" target="_top">https://www.privoxy.org/developer-manual/</a>. + Please have a look at the <a href="https://www.privoxy.org/user-manual/contact.html" target="_top">contact + section in the user manual</a> if you are interested in contacting the developers.</p> + </div> + </div> + <hr> + </div> + <div class="TOC"> + <dl> + <dt><b>Table of Contents</b></dt> + <dt>1. <a href="introduction.html">Introduction</a></dt> + <dd> + <dl> + <dt>1.1. <a href="introduction.html#QUICKSTART">Quickstart to Privoxy Development</a></dt> + </dl> + </dd> + <dt>2. <a href="git.html">The Git Repository</a></dt> + <dd> + <dl> + <dt>2.1. <a href="git.html#GITACCESS">Access to Git</a></dt> + <dt>2.2. <a href="git.html#GITBRANCHES">Branches</a></dt> + <dt>2.3. <a href="git.html#GITCOMMIT">Git Commit Guidelines</a></dt> + </dl> + </dd> + <dt>3. <a href="documentation.html">Documentation Guidelines</a></dt> + <dd> + <dl> + <dt>3.1. <a href="documentation.html#SGML">Quickstart to Docbook and SGML</a></dt> + <dt>3.2. <a href="documentation.html#DOCSTYLE"><span class="APPLICATION">Privoxy</span> Documentation + Style</a></dt> + <dt>3.3. <a href="documentation.html#CUSTOM-ENTITIES">Privoxy Custom Entities</a></dt> + </dl> + </dd> + <dt>4. <a href="coding.html">Coding Guidelines</a></dt> + <dd> + <dl> + <dt>4.1. <a href="coding.html#S1">Introduction</a></dt> + <dt>4.2. <a href="coding.html#S2">Using Comments</a></dt> + <dd> + <dl> + <dt>4.2.1. <a href="coding.html#S3">Comment, Comment, Comment</a></dt> + <dt>4.2.2. <a href="coding.html#S4">Use blocks for comments</a></dt> + <dt>4.2.3. <a href="coding.html#S5">Keep Comments on their own line</a></dt> + <dt>4.2.4. <a href="coding.html#S6">Comment each logical step</a></dt> + <dt>4.2.5. <a href="coding.html#S7">Comment All Functions Thoroughly</a></dt> + <dt>4.2.6. <a href="coding.html#S8">Comment at the end of braces if the content is more than one screen + length</a></dt> + </dl> + </dd> + <dt>4.3. <a href="coding.html#S9">Naming Conventions</a></dt> + <dd> + <dl> + <dt>4.3.1. <a href="coding.html#S10">Variable Names</a></dt> + <dt>4.3.2. <a href="coding.html#S11">Function Names</a></dt> + <dt>4.3.3. <a href="coding.html#S12">Header file prototypes</a></dt> + <dt>4.3.4. <a href="coding.html#S13">Enumerations, and #defines</a></dt> + <dt>4.3.5. <a href="coding.html#S14">Constants</a></dt> + </dl> + </dd> + <dt>4.4. <a href="coding.html#S15">Using Space</a></dt> + <dd> + <dl> + <dt>4.4.1. <a href="coding.html#S16">Put braces on a line by themselves.</a></dt> + <dt>4.4.2. <a href="coding.html#S17">ALL control statements should have a block</a></dt> + <dt>4.4.3. <a href="coding.html#S18">Do not belabor/blow-up boolean expressions</a></dt> + <dt>4.4.4. <a href="coding.html#S19">Use white space freely because it is free</a></dt> + <dt>4.4.5. <a href="coding.html#S20">Don't use white space around structure operators</a></dt> + <dt>4.4.6. <a href="coding.html#S21">Make the last brace of a function stand out</a></dt> + <dt>4.4.7. <a href="coding.html#S22">Use 3 character indentions</a></dt> + </dl> + </dd> + <dt>4.5. <a href="coding.html#S23">Initializing</a></dt> + <dd> + <dl> + <dt>4.5.1. <a href="coding.html#S24">Initialize all variables</a></dt> + </dl> + </dd> + <dt>4.6. <a href="coding.html#S25">Functions</a></dt> + <dd> + <dl> + <dt>4.6.1. <a href="coding.html#S26">Name functions that return a boolean as a question.</a></dt> + <dt>4.6.2. <a href="coding.html#S27">Always specify a return type for a function.</a></dt> + <dt>4.6.3. <a href="coding.html#S28">Minimize function calls when iterating by using variables</a></dt> + <dt>4.6.4. <a href="coding.html#S29">Pass and Return by Const Reference</a></dt> + <dt>4.6.5. <a href="coding.html#S30">Pass and Return by Value</a></dt> + <dt>4.6.6. <a href="coding.html#S31">Names of include files</a></dt> + <dt>4.6.7. <a href="coding.html#S32">Provide multiple inclusion protection</a></dt> + <dt>4.6.8. <a href="coding.html#S33">Use `extern "C"` when appropriate</a></dt> + <dt>4.6.9. <a href="coding.html#S34">Where Possible, Use Forward Struct Declaration Instead of + Includes</a></dt> + </dl> + </dd> + <dt>4.7. <a href="coding.html#S35">General Coding Practices</a></dt> + <dd> + <dl> + <dt>4.7.1. <a href="coding.html#S36">Turn on warnings</a></dt> + <dt>4.7.2. <a href="coding.html#S37">Provide a default case for all switch statements</a></dt> + <dt>4.7.3. <a href="coding.html#S38">Try to avoid falling through cases in a switch statement.</a></dt> + <dt>4.7.4. <a href="coding.html#S40">Don't mix size_t and other types</a></dt> + <dt>4.7.5. <a href="coding.html#S41">Declare each variable and struct on its own line.</a></dt> + <dt>4.7.6. <a href="coding.html#S42">Use malloc/zalloc sparingly</a></dt> + <dt>4.7.7. <a href="coding.html#S43">The Programmer Who Uses 'malloc' is Responsible for Ensuring + 'free'</a></dt> + <dt>4.7.8. <a href="coding.html#S44">Add loaders to the `file_list' structure and in order</a></dt> + <dt>4.7.9. <a href="coding.html#S45">"Uncertain" new code and/or changes to existing code, use + XXX</a></dt> + </dl> + </dd> + <dt>4.8. <a href="coding.html#S46">Addendum: Template for files and function comment blocks:</a></dt> + </dl> + </dd> + <dt>5. <a href="testing.html">Testing Guidelines</a></dt> + <dd> + <dl> + <dt>5.1. <a href="testing.html#TESTING-PLAN">Testplan for releases</a></dt> + <dt>5.2. <a href="testing.html#PRIVOXY-REGRESSION-TEST">Testing with <span class= + "APPLICATION">Privoxy-Regression-Test</span></a></dt> + <dt>5.3. <a href="testing.html#FUZZING">Fuzzing Privoxy</a></dt> + </dl> + </dd> + <dt>6. <a href="newrelease.html">Releasing a New Version</a></dt> + <dd> + <dl> + <dt>6.1. <a href="newrelease.html#VERSIONNUMBERS">Version numbers</a></dt> + <dt>6.2. <a href="newrelease.html#BEFORERELEASE">Before the Release</a></dt> + <dt>6.3. <a href="newrelease.html#THERELEASE">Building and Releasing the Packages</a></dt> + <dd> + <dl> + <dt>6.3.1. <a href="newrelease.html#PACK-GUIDELINES">Note on Privoxy Packaging</a></dt> + <dt>6.3.2. <a href="newrelease.html#NEWRELEASE-TARBALL">Source Tarball</a></dt> + <dt>6.3.3. <a href="newrelease.html#NEWRELEASE-WINDOWS">Windows</a></dt> + <dt>6.3.4. <a href="newrelease.html#NEWRELEASE-DEBIAN">Debian</a></dt> + <dt>6.3.5. <a href="newrelease.html#NEWRELEASE-MACOSX">macOS / OS X</a></dt> + <dt>6.3.6. <a href="newrelease.html#NEWRELEASE-FREEBSD">FreeBSD</a></dt> + </dl> + </dd> + <dt>6.4. <a href="newrelease.html#RELEASING">Uploading and Releasing Your Package</a></dt> + <dt>6.5. <a href="newrelease.html#AFTERRELEASE">After the Release</a></dt> + </dl> + </dd> + <dt>7. <a href="webserver-update.html">Update the Webserver</a></dt> + </dl> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"> </td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top"><a href="introduction.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top"> </td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">Introduction</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/introduction.html b/doc/webserver/developer-manual/introduction.html index 8900cfa4..c6f41714 100644 --- a/doc/webserver/developer-manual/introduction.html +++ b/doc/webserver/developer-manual/introduction.html @@ -1,206 +1,64 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Introduction</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="NEXT" -TITLE="The Git Repository" -HREF="git.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="index.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="git.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="INTRODUCTION" ->1. Introduction</A -></H1 -><P -> <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN ->, as an heir to - <SPAN -CLASS="APPLICATION" ->Junkbuster</SPAN ->, is a <A -HREF="https://www.privoxy.org/user-manual/copyright.html" -TARGET="_top" ->Free Software</A -> project. - As such, <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> development is potentially open - to anyone who has the time, knowledge, and desire to contribute - in any capacity. Our goals are simply to continue the mission, - to improve <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN ->, and - to make it available to as wide an audience as possible. - </P -><P -> One does not have to be a programmer to contribute. Packaging, testing, - documenting and porting, are all important jobs as well. - </P -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="QUICKSTART" ->1.1. Quickstart to Privoxy Development</A -></H2 -><P -> The first step is to join the <A -HREF="https://lists.privoxy.org/mailman/listinfo/privoxy-devel" -TARGET="_top" ->privoxy-devel mailing list</A ->. - You can submit your ideas or, even better, patches. - Patches can also be submitted to the - <A -HREF="https://sourceforge.net/p/ijbswa/patches/" -TARGET="_top" ->Sourceforge patch tracker</A ->. - </P -><P -> You will also need to have a git package installed, - in order to access the git repository. - Having the GNU build tools is also going to be important (particularly, - autoconf and gmake). - </P -><P -> For the time being (read, this section is under construction), you can - also refer to the extensive comments in the source code. In fact, - reading the code is recommended in any case. - </P -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="git.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Privoxy Developer Manual</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->The Git Repository</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Introduction</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="Privoxy Developer Manual" href="index.html"> + <link rel="NEXT" title="The Git Repository" href="git.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="index.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"><a href="git.html" accesskey="N">Next</a></td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="INTRODUCTION" id="INTRODUCTION">1. Introduction</a></h1> + <p><span class="APPLICATION">Privoxy</span>, as an heir to <span class="APPLICATION">Junkbuster</span>, is a + <a href="https://www.privoxy.org/user-manual/copyright.html" target="_top">Free Software</a> project. As such, + <span class="APPLICATION">Privoxy</span> development is potentially open to anyone who has the time, knowledge, and + desire to contribute in any capacity. Our goals are simply to continue the mission, to improve <span class= + "APPLICATION">Privoxy</span>, and to make it available to as wide an audience as possible.</p> + <p>One does not have to be a programmer to contribute. Packaging, testing, documenting and porting, are all + important jobs as well.</p> + <div class="SECT2"> + <h2 class="SECT2"><a name="QUICKSTART" id="QUICKSTART">1.1. Quickstart to Privoxy Development</a></h2> + <p>The first step is to join the <a href="https://lists.privoxy.org/mailman/listinfo/privoxy-devel" target= + "_top">privoxy-devel mailing list</a>. You can submit your ideas or, even better, patches. Patches can also be + submitted to the <a href="https://sourceforge.net/p/ijbswa/patches/" target="_top">Sourceforge patch + tracker</a>.</p> + <p>You will also need to have a git package installed, in order to access the git repository. Having the GNU + build tools is also going to be important (particularly, autoconf and gmake).</p> + <p>For the time being (read, this section is under construction), you can also refer to the extensive comments in + the source code. In fact, reading the code is recommended in any case.</p> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="index.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"><a href="git.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top">Privoxy Developer Manual</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">The Git Repository</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/newrelease.html b/doc/webserver/developer-manual/newrelease.html index 77b2fe44..f4c69425 100644 --- a/doc/webserver/developer-manual/newrelease.html +++ b/doc/webserver/developer-manual/newrelease.html @@ -1,368 +1,150 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Releasing a New Version</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Testing Guidelines" -HREF="testing.html"><LINK -REL="NEXT" -TITLE="Update the Webserver" -HREF="webserver-update.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="testing.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="webserver-update.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="NEWRELEASE" ->6. Releasing a New Version</A -></H1 -><P -> When we release versions of <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN ->, - our work leaves our cozy secret lab and has to work in the cold - RealWorld[tm]. Once it is released, there is no way to call it - back, so it is very important that great care is taken to ensure - that everything runs fine, and not to introduce problems in the - very last minute. - </P -><P -> So when releasing a new version, please adhere exactly to the - procedure outlined in this chapter. - </P -><P -> The following programs are required to follow this process: - <TT -CLASS="FILENAME" ->ssh</TT ->, - <TT -CLASS="FILENAME" ->gmake</TT -> (GNU's version of make), autoconf, git, - a web browser. - </P -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="VERSIONNUMBERS" ->6.1. Version numbers</A -></H2 -><P -> First you need to determine which version number the release will have. - <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> version numbers consist of three numbers, - separated by dots, like in X.Y.Z (e.g. 3.0.0), where: - </P -><P -></P -><UL -><LI -><P -> X, the version major, is rarely ever changed. It is increased by one if - turning a development branch into stable substantially changes the functionality, - user interface or configuration syntax. Majors 1 and 2 were - <SPAN -CLASS="APPLICATION" ->Junkbuster</SPAN ->, and 3 is the first stable - <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> release. - </P -></LI -><LI -><P -> - Y, the version minor, represents the branch within the major version. - At any point in time, there are two branches being maintained: - The stable branch, with an even minor, say, 2N, in which no functionality is - being added and only bug-fixes are made, and 2N+1, the development branch, in - which the further development of <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> takes - place. - This enables us to turn the code upside down and inside out, while at the same time - providing and maintaining a stable version. - The minor is reset to zero (and one) when the major is incremented. When a development - branch has matured to the point where it can be turned into stable, the old stable branch - 2N is given up (i.e. no longer maintained), the former development branch 2N+1 becomes the - new stable branch 2N+2, and a new development branch 2N+3 is opened. - </P -></LI -><LI -><P -> Z, the point or sub version, represents a release of the software within a branch. - It is therefore incremented immediately after each software release. - - The point version is reset to zero when the minor changes. - </P -><P -> Stable branches work a little differently, since there should be - little to no development happening in such branches. Remember, - only bugfixes, which presumably should have had some testing - before being committed. Stable branches will then have their - version reported as <TT -CLASS="LITERAL" ->0.0.0</TT ->, during that period - between releases when changes are being added. This is to denote - that this code is <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->not for release</I -></SPAN ->. Then - as the release nears, the version is bumped according: e.g. - <TT -CLASS="LITERAL" ->3.0.1 -> 0.0.0 -> 3.0.2</TT ->. - </P -></LI -></UL -><P -> In summary, the main Git trunk is the development branch where new - features are being worked on for the next stable series. This should - almost always be where the most activity takes place. There is always at - least one stable branch from the trunk, e.g now it is - <TT -CLASS="LITERAL" ->3.0</TT ->, which is only used to release stable versions. - Once the initial *.0 release of the stable branch has been done, then as a - rule, only bugfixes that have had prior testing should be committed to - the stable branch. Once there are enough bugfixes to justify a new - release, the version of this branch is again incremented Example: 3.0.0 - -> 3.0.1 -> 3.0.2, etc are all stable releases from within the stable - branch. 3.1.x is currently the main trunk, and where work on 3.2.x is - taking place. If any questions, please post to the devel list - <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->before</I -></SPAN -> committing to a stable branch! - </P -><P -> Developers should remember too that if they commit a bugfix to the stable - branch, this will more than likely require a separate submission to the - main trunk, since these are separate development trees within Git. If you - are working on both, then this would require at least two separate check - outs (i.e main trunk, <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->and</I -></SPAN -> the stable release branch, - which is <TT -CLASS="LITERAL" ->v_3_0_branch</TT -> at the moment). - </P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="BEFORERELEASE" ->6.2. Before the Release</A -></H2 -><P -> The following <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->must be done by one of the - developers</I -></SPAN -> prior to each new release. - </P -><P -></P -><UL -><LI -><P -> Make sure that everybody who has worked on the code in the last - couple of days has had a chance to yell <SPAN -CLASS="QUOTE" ->"no!"</SPAN -> in case - they have pending changes/fixes in their pipelines. Announce the - freeze so that nobody will interfere with last minute changes. - </P -></LI -><LI -><P -> Update the code status (CODE_STATUS="xxx") in <TT -CLASS="FILENAME" ->configure.in</TT -> to one of - "alpha", "beta" or "stable". - </P -></LI -><LI -><P -> Rebuild configure and GNUMakefile to make sure the updated values are being used. - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="90%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> $ autoheader && autoconf # rebuild configure - $ ./configure # rebuild GNUmakefile</PRE -></TD -></TR -></TABLE -></LI -><LI -><P -> <B -CLASS="COMMAND" ->make dok-release</B -> to update the sgml documentation source files. - </P -></LI -><LI -><P -> If action file processing has changed and is not backward-compatible, - make sure the "for-privoxy-version=x.y.z" minimum version number in - <TT -CLASS="FILENAME" ->default.action.master</TT -> has been updated: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="90%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> {{settings}} +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Releasing a New Version</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="Testing Guidelines" href="testing.html"> + <link rel="NEXT" title="Update the Webserver" href="webserver-update.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="testing.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"><a href="webserver-update.html" accesskey="N">Next</a></td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="NEWRELEASE" id="NEWRELEASE">6. Releasing a New Version</a></h1> + <p>When we release versions of <span class="APPLICATION">Privoxy</span>, our work leaves our cozy secret lab and + has to work in the cold RealWorld[tm]. Once it is released, there is no way to call it back, so it is very + important that great care is taken to ensure that everything runs fine, and not to introduce problems in the very + last minute.</p> + <p>So when releasing a new version, please adhere exactly to the procedure outlined in this chapter.</p> + <p>The following programs are required to follow this process: <tt class="FILENAME">ssh</tt>, <tt class= + "FILENAME">gmake</tt> (GNU's version of make), autoconf, git, a web browser.</p> + <div class="SECT2"> + <h2 class="SECT2"><a name="VERSIONNUMBERS" id="VERSIONNUMBERS">6.1. Version numbers</a></h2> + <p>First you need to determine which version number the release will have. <span class= + "APPLICATION">Privoxy</span> version numbers consist of three numbers, separated by dots, like in X.Y.Z (e.g. + 3.0.0), where:</p> + <ul> + <li> + <p>X, the version major, is rarely ever changed. It is increased by one if turning a development branch into + stable substantially changes the functionality, user interface or configuration syntax. Majors 1 and 2 were + <span class="APPLICATION">Junkbuster</span>, and 3 is the first stable <span class= + "APPLICATION">Privoxy</span> release.</p> + </li> + <li> + <p>Y, the version minor, represents the branch within the major version. At any point in time, there are two + branches being maintained: The stable branch, with an even minor, say, 2N, in which no functionality is being + added and only bug-fixes are made, and 2N+1, the development branch, in which the further development of + <span class="APPLICATION">Privoxy</span> takes place. This enables us to turn the code upside down and inside + out, while at the same time providing and maintaining a stable version. The minor is reset to zero (and one) + when the major is incremented. When a development branch has matured to the point where it can be turned into + stable, the old stable branch 2N is given up (i.e. no longer maintained), the former development branch 2N+1 + becomes the new stable branch 2N+2, and a new development branch 2N+3 is opened.</p> + </li> + <li> + <p>Z, the point or sub version, represents a release of the software within a branch. It is therefore + incremented immediately after each software release. The point version is reset to zero when the minor + changes.</p> + <p>Stable branches work a little differently, since there should be little to no development happening in + such branches. Remember, only bugfixes, which presumably should have had some testing before being committed. + Stable branches will then have their version reported as <tt class="LITERAL">0.0.0</tt>, during that period + between releases when changes are being added. This is to denote that this code is <span class= + "emphasis"><i class="EMPHASIS">not for release</i></span>. Then as the release nears, the version is bumped + according: e.g. <tt class="LITERAL">3.0.1 -> 0.0.0 -> 3.0.2</tt>.</p> + </li> + </ul> + <p>In summary, the main Git trunk is the development branch where new features are being worked on for the next + stable series. This should almost always be where the most activity takes place. There is always at least one + stable branch from the trunk, e.g now it is <tt class="LITERAL">3.0</tt>, which is only used to release stable + versions. Once the initial *.0 release of the stable branch has been done, then as a rule, only bugfixes that + have had prior testing should be committed to the stable branch. Once there are enough bugfixes to justify a new + release, the version of this branch is again incremented Example: 3.0.0 -> 3.0.1 -> 3.0.2, etc are all + stable releases from within the stable branch. 3.1.x is currently the main trunk, and where work on 3.2.x is + taking place. If any questions, please post to the devel list <span class="emphasis"><i class= + "EMPHASIS">before</i></span> committing to a stable branch!</p> + <p>Developers should remember too that if they commit a bugfix to the stable branch, this will more than likely + require a separate submission to the main trunk, since these are separate development trees within Git. If you + are working on both, then this would require at least two separate check outs (i.e main trunk, <span class= + "emphasis"><i class="EMPHASIS">and</i></span> the stable release branch, which is <tt class= + "LITERAL">v_3_0_branch</tt> at the moment).</p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="BEFORERELEASE" id="BEFORERELEASE">6.2. Before the Release</a></h2> + <p>The following <span class="emphasis"><i class="EMPHASIS">must be done by one of the developers</i></span> + prior to each new release.</p> + <ul> + <li> + <p>Make sure that everybody who has worked on the code in the last couple of days has had a chance to yell + <span class="QUOTE">"no!"</span> in case they have pending changes/fixes in their pipelines. Announce the + freeze so that nobody will interfere with last minute changes.</p> + </li> + <li> + <p>Update the code status (CODE_STATUS="xxx") in <tt class="FILENAME">configure.in</tt> to one of "alpha", + "beta" or "stable".</p> + </li> + <li> + <p>Rebuild configure and GNUMakefile to make sure the updated values are being used.</p> + <table border="0" bgcolor="#E0E0E0" width="90%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> $ autoheader && autoconf # rebuild configure + $ ./configure # rebuild GNUmakefile</pre> + </td> + </tr> + </table> + </li> + <li> + <p><b class="COMMAND">make dok-release</b> to update the sgml documentation source files.</p> + </li> + <li> + <p>If action file processing has changed and is not backward-compatible, make sure the + "for-privoxy-version=x.y.z" minimum version number in <tt class="FILENAME">default.action.master</tt> has + been updated:</p> + <table border="0" bgcolor="#E0E0E0" width="90%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> {{settings}} ############################################################################# #MASTER# COMMENT: The minimum Privoxy version: - for-privoxy-version=3.0.11</PRE -></TD -></TR -></TABLE -></LI -><LI -><P -> Create the change log: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="90%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> $ git tag + for-privoxy-version=3.0.11</pre> + </td> + </tr> + </table> + </li> + <li> + <p>Create the change log:</p> + <table border="0" bgcolor="#E0E0E0" width="90%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> $ git tag # to see the tags $ git log [last release tag]..master > /tmp/log # get the commit log since the last release $ utils/makeChangeLog /tmp/log > /tmp/change.log - # reformat the commit log</PRE -></TD -></TR -></TABLE -><P -> Edit <TT -CLASS="FILENAME" ->/tmp/change.log</TT -> to remove trivial - changes and group the changes under general headings like: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="90%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> - Bug fixes: + # reformat the commit log</pre> + </td> + </tr> + </table> + <p>Edit <tt class="FILENAME">/tmp/change.log</tt> to remove trivial changes and group the changes under + general headings like:</p> + <table border="0" bgcolor="#E0E0E0" width="90%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> - Bug fixes: - Action file improvements: - Filter file improvements: - General improvements: @@ -370,1358 +152,546 @@ CLASS="PROGRAMLISTING" - Build system improvements: - Code cleanups: - Privoxy-Log-Parser: - - Privoxy-Regression-Test:</PRE -></TD -></TR -></TABLE -><P -> Add the contents of <TT -CLASS="FILENAME" ->/tmp/change.log</TT -> to the - start of <TT -CLASS="FILENAME" ->ChangeLog</TT -> and re-create - <TT -CLASS="FILENAME" ->doc/source/changelog.sgml</TT ->: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="90%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> $ utils/changelog2doc.pl /tmp/change.log >| doc/source/changelog.sgml</PRE -></TD -></TR -></TABLE -></LI -><LI -><P -> All developers should look at the <TT -CLASS="FILENAME" ->ChangeLog</TT -> and - make sure noteworthy changes are referenced. - </P -></LI -><LI -><P -> Update the announcement at <TT -CLASS="FILENAME" ->doc/webserver/announce.txt</TT ->. - </P -></LI -><LI -><P -> All documentation should be rebuilt: - <TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="90%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> $ make man + - Privoxy-Regression-Test:</pre> + </td> + </tr> + </table> + <p>Add the contents of <tt class="FILENAME">/tmp/change.log</tt> to the start of <tt class= + "FILENAME">ChangeLog</tt> and re-create <tt class="FILENAME">doc/source/changelog.sgml</tt>:</p> + <table border="0" bgcolor="#E0E0E0" width="90%"> + <tr> + <td> + <pre class= + "PROGRAMLISTING"> $ utils/changelog2doc.pl /tmp/change.log >| doc/source/changelog.sgml</pre> + </td> + </tr> + </table> + </li> + <li> + <p>All developers should look at the <tt class="FILENAME">ChangeLog</tt> and make sure noteworthy changes are + referenced.</p> + </li> + <li> + <p>Update the announcement at <tt class="FILENAME">doc/webserver/announce.txt</tt>.</p> + </li> + <li> + <p>All documentation should be rebuilt:</p> + <table border="0" bgcolor="#E0E0E0" width="90%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> $ make man $ make dok $ make dok-man $ make dok-tidy - $ make config-file</PRE -></TD -></TR -></TABLE -> - Finished docs should be then be committed to Git (for those - without the ability to build these). Some docs may require - rather obscure processing tools. <TT -CLASS="FILENAME" ->config</TT ->, - the man page (and the html version of the man page) - fall in this category. README, the man page, AUTHORS, and config - should all also be committed to Git for other packagers. The - formal docs should be uploaded to the webserver. See the section - <A -HREF="webserver-update.html" -TARGET="_top" ->"Updating the webserver"</A -> - in this manual for details. - </P -></LI -><LI -><P -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Commit all files that were changed in the above steps!</I -></SPAN -> - </P -></LI -><LI -><P -> The <I -CLASS="CITETITLE" ->User Manual</I -> is also used for context - sensitive help for the CGI editor. This is version sensitive, so that - the user will get appropriate help for his/her release. So with - each release a fresh version should be uploaded to the webserver - (this is in addition to the main <I -CLASS="CITETITLE" ->User Manual</I -> - link from the main page since we need to keep manuals for various - versions available). The CGI pages will link to something like - <TT -CLASS="LITERAL" ->https://www.privoxy.org/$(VERSION)/user-manual/</TT ->. This - needs to be updated for each new release and is done with the - <SPAN -CLASS="QUOTE" ->"webserver"</SPAN -> target. - </P -></LI -><LI -><P -> Tag all files in Git with the version number with - <SPAN -CLASS="QUOTE" ->"<B -CLASS="COMMAND" ->git tag -s v_X_Y_Z</B ->"</SPAN ->. - Don't use vX_Y_Z, ver_X_Y_Z, v_X.Y.Z (won't work) etc. - </P -></LI -><LI -><P -> Push the tag to the remote with - <SPAN -CLASS="QUOTE" ->"<B -CLASS="COMMAND" ->git push origin v_X_Y_Z</B ->"</SPAN ->. - </P -></LI -><LI -><P -> On the webserver, copy the user manual to a new top-level directory - called <TT -CLASS="FILENAME" ->X.Y.Z</TT ->. This ensures that help links from the CGI - pages, which have the version as a prefix, will go into the right version of the manual. - If this is a development branch release, also symlink <TT -CLASS="FILENAME" ->X.Y.(Z-1)</TT -> - to <TT -CLASS="FILENAME" ->X.Y.Z</TT -> and <TT -CLASS="FILENAME" ->X.Y.(Z+1)</TT -> to - <TT -CLASS="FILENAME" ->.</TT -> (i.e. dot). - </P -></LI -></UL -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="THERELEASE" ->6.3. Building and Releasing the Packages</A -></H2 -><P -> Now the individual packages can be built and released. Note that for - GPL reasons the first package to be released is always the source tarball. - </P -><P -> For <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->all</I -></SPAN -> types of packages, including the source tarball, - <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->you must make sure that you build from clean sources by exporting - the right version from Git into an empty directory</I -></SPAN -> (just press return when - asked for a password): - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> mkdir dist # delete or choose different name if it already exists + $ make config-file</pre> + </td> + </tr> + </table>Finished docs should be then be committed to Git (for those without the ability to build these). Some + docs may require rather obscure processing tools. <tt class="FILENAME">config</tt>, the man page (and the + html version of the man page) fall in this category. README, the man page, AUTHORS, and config should all + also be committed to Git for other packagers. The formal docs should be uploaded to the webserver. See the + section <a href="webserver-update.html" target="_top">"Updating the webserver"</a> in this manual for + details. + </li> + <li> + <p><span class="emphasis"><i class="EMPHASIS">Commit all files that were changed in the above + steps!</i></span></p> + </li> + <li> + <p>The <i class="CITETITLE">User Manual</i> is also used for context sensitive help for the CGI editor. This + is version sensitive, so that the user will get appropriate help for his/her release. So with each release a + fresh version should be uploaded to the webserver (this is in addition to the main <i class="CITETITLE">User + Manual</i> link from the main page since we need to keep manuals for various versions available). The CGI + pages will link to something like <tt class="LITERAL">https://www.privoxy.org/$(VERSION)/user-manual/</tt>. + This needs to be updated for each new release and is done with the <span class="QUOTE">"webserver"</span> + target.</p> + </li> + <li> + <p>Tag all files in Git with the version number with <span class="QUOTE">"<b class="COMMAND">git tag -s + v_X_Y_Z</b>"</span>. Don't use vX_Y_Z, ver_X_Y_Z, v_X.Y.Z (won't work) etc.</p> + </li> + <li> + <p>Push the tag to the remote with <span class="QUOTE">"<b class="COMMAND">git push origin + v_X_Y_Z</b>"</span>.</p> + </li> + <li> + <p>On the webserver, copy the user manual to a new top-level directory called <tt class= + "FILENAME">X.Y.Z</tt>. This ensures that help links from the CGI pages, which have the version as a prefix, + will go into the right version of the manual. If this is a development branch release, also symlink + <tt class="FILENAME">X.Y.(Z-1)</tt> to <tt class="FILENAME">X.Y.Z</tt> and <tt class= + "FILENAME">X.Y.(Z+1)</tt> to <tt class="FILENAME">.</tt> (i.e. dot).</p> + </li> + </ul> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="THERELEASE" id="THERELEASE">6.3. Building and Releasing the Packages</a></h2> + <p>Now the individual packages can be built and released. Note that for GPL reasons the first package to be + released is always the source tarball.</p> + <p>For <span class="emphasis"><i class="EMPHASIS">all</i></span> types of packages, including the source tarball, + <span class="emphasis"><i class="EMPHASIS">you must make sure that you build from clean sources by exporting the + right version from Git into an empty directory</i></span> (just press return when asked for a password):</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> mkdir dist # delete or choose different name if it already exists cd dist git clone https://www.privoxy.org/git/privoxy.git cd privoxy - git checkout v_X_Y_Z</PRE -></TD -></TR -></TABLE -><P -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Do NOT change</I -></SPAN -> a single bit, including, but not limited to - version information after export from Git. This is to make sure that - all release packages, and with them, all future bug reports, are based - on exactly the same code. - </P -><DIV -CLASS="WARNING" -><P -></P -><TABLE -CLASS="WARNING" -BORDER="1" -WIDTH="100%" -><TR -><TD -ALIGN="CENTER" -><B ->Warning</B -></TD -></TR -><TR -><TD -ALIGN="LEFT" -><P -> Every significant release of Privoxy has included at least one - package that either had incorrect versions of files, missing files, - or incidental leftovers from a previous build process that gave - unknown numbers of users headaches to try to figure out what was - wrong. PLEASE, make sure you are using pristene sources, and are - following the prescribed process! - </P -></TD -></TR -></TABLE -></DIV -><P -> Please find additional instructions for the source tarball and the - individual platform dependent binary packages below. And details - on the Sourceforge release process below that. - </P -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="PACK-GUIDELINES" ->6.3.1. Note on Privoxy Packaging</A -></H3 -><P -> Please keep these general guidelines in mind when putting together - your package. These apply to <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->all</I -></SPAN -> platforms! - </P -><P -></P -><UL -><LI -><P -> <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->requires</I -></SPAN -> - write access to: all <TT -CLASS="FILENAME" ->*.action</TT -> files, all - logfiles, and the <TT -CLASS="FILENAME" ->trust</TT -> file. You will - need to determine the best way to do this for your platform. - </P -></LI -><LI -><P -> Please include up to date documentation. At a bare minimum: - </P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <TT -CLASS="FILENAME" ->LICENSE</TT -> (top-level directory) - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <TT -CLASS="FILENAME" ->README</TT -> (top-level directory) - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <TT -CLASS="FILENAME" ->AUTHORS</TT -> (top-level directory) - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <TT -CLASS="FILENAME" ->man page</TT -> (top-level directory, Unix-like - platforms only) - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <TT -CLASS="FILENAME" ->The User Manual</TT -> (doc/webserver/user-manual/) - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -></P -><TABLE -BORDER="0" -><TBODY -><TR -><TD -> <TT -CLASS="FILENAME" ->FAQ</TT -> (doc/webserver/faq/) - </TD -></TR -></TBODY -></TABLE -><P -></P -><P -> Also suggested: <TT -CLASS="FILENAME" ->Developer Manual</TT -> - (doc/webserver/developer-manual) and <TT -CLASS="FILENAME" ->ChangeLog</TT -> - (top-level directory). <TT -CLASS="FILENAME" ->FAQ</TT -> and the manuals are - HTML docs. - </P -><P -> The documentation has been designed such that the manuals are linked - to each other from parallel directories, and should be packaged - that way. <TT -CLASS="FILENAME" ->privoxy-index.html</TT -> can also be - included and can serve as a focal point for docs and other links of - interest (and possibly renamed to <TT -CLASS="FILENAME" ->index.html</TT ->). - This should be one level up from the manuals. There is a link also - on this page to an HTMLized version of the man page. To avoid 404 for - this, it is in Git as - <TT -CLASS="FILENAME" ->doc/webserver/man-page/privoxy-man-page.html</TT ->, - and should be included along with the manuals. There is also a - css stylesheets that can be included for better presentation: - <TT -CLASS="FILENAME" ->p_doc.css</TT ->. This should be in the same directory - with <TT -CLASS="FILENAME" ->privoxy-index.html</TT ->, (i.e. one level up from - the manual directories). - </P -></LI -><LI -><P -> <TT -CLASS="FILENAME" ->user.action</TT -> and <TT -CLASS="FILENAME" ->user.filter</TT -> - are designed for local preferences. Make sure these do not get overwritten! - <TT -CLASS="FILENAME" ->config</TT -> should not be overwritten either. This - has especially important configuration data in it. - <TT -CLASS="FILENAME" ->trust</TT -> should be left in tact as well. - </P -></LI -><LI -><P -> Other configuration files (<TT -CLASS="FILENAME" ->default.action</TT ->, - <TT -CLASS="FILENAME" ->regression-tests.action</TT -> and - <TT -CLASS="FILENAME" ->default.filter</TT ->) should be installed as the new - defaults, but all previously installed configuration files should be - preserved as backups. This is just good manners :-) These files are - likely to change between releases and contain important new features - and bug fixes. - </P -></LI -><LI -><P -> Please check platform specific notes in this doc, if you haven't - done <SPAN -CLASS="QUOTE" ->"Privoxy"</SPAN -> packaging before for other platform - specific issues. Conversely, please add any notes that you know - are important for your platform (or contact one of the doc - maintainers to do this if you can't). - </P -></LI -><LI -><P -> Packagers should do a <SPAN -CLASS="QUOTE" ->"clean"</SPAN -> install of their - package after building it. So any previous installs should be - removed first to ensure the integrity of the newly built package. - Then run the package for a while to make sure there are no - obvious problems, before uploading. - </P -></LI -></UL -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="NEWRELEASE-TARBALL" ->6.3.2. Source Tarball</A -></H3 -><P -> First, <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->make sure that you have freshly exported the right - version into an empty directory</I -></SPAN ->. (See "Building and releasing - packages" above). Then run from that directory: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> autoheader && autoconf && ./configure</PRE -></TD -></TR -></TABLE -><P -> Then do: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> make tarball-dist</PRE -></TD -></TR -></TABLE -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="NEWRELEASE-WINDOWS" ->6.3.3. Windows</A -></H3 -><P -> Note that the docbook generated files might need some hand editing, - so the Windows build makefile does not rebuild the docs. - </P -><P -> First, <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->make sure that you have freshly exported the right - version into an empty directory</I -></SPAN ->. (See "Building and releasing - packages" above). - </P -><P -> Check that you have the current versions of the - <A -HREF="https://sourceforge.net/projects/nsis/files/NSIS%203/" -TARGET="_top" -> NSIS installer</A ->, - <A -HREF="https://ftp.pcre.org/pub/pcre/" -TARGET="_top" ->PCRE library</A ->, - <A -HREF="https://tls.mbed.org/download" -TARGET="_top" ->MBED TLS library</A ->, - <A -HREF="https://github.com/google/brotli/releases" -TARGET="_top" -> Brotli library</A ->, - and that the <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->MAKENSIS</I -></SPAN -> evar in - <TT -CLASS="FILENAME" ->windows/GNUMakefile</TT -> - points to the NSIS installer program. (See the - <A -HREF="../user-manual/installation.html#WINBUILD-CYGWIN" -TARGET="_top" -> <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->Building from Source / Windows</I -></SPAN -></A -> - section of the User Manual for details.) - </P -><P -> Then you can build the package. This is fully automated, and is - controlled by <TT -CLASS="FILENAME" ->windows/GNUmakefile</TT ->. - All you need to do is: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> cd windows - make</PRE -></TD -></TR -></TABLE -><P -> Now you can manually rename <TT -CLASS="FILENAME" ->privoxy_setup.exe</TT -> to - <TT -CLASS="FILENAME" ->privoxy_setup_X.Y.Z.exe</TT ->, and the <TT -CLASS="FILENAME" ->build</TT -> - directory to <TT -CLASS="FILENAME" ->privoxy_X.Y.Z</TT ->. - Create a .zip file of the newly renamed <TT -CLASS="FILENAME" ->privoxy_X.Y.Z</TT -> directory, - GPG sign the installer and zip file, - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> gpg --armor --detach --sign <TT -CLASS="FILENAME" ->privoxy_setup_X.Y.Z.exe</TT -> - gpg --armor --detach --sign <TT -CLASS="FILENAME" ->privoxy_X.Y.Z.zip</TT -></PRE -></TD -></TR -></TABLE -><P -> and upload the files to SourceForge. - </P -><P -> When releasing the package on SourceForge, use the release notes - and Change Log from the source tarball package. - </P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="NEWRELEASE-DEBIAN" ->6.3.4. Debian</A -></H3 -><P -> Using git-buildpackage we start with a clone of the last Debian version: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> gbp clone https://salsa.debian.org/debian/privoxy.git - cd privoxy</PRE -></TD -></TR -></TABLE -><P -> or if the repository is already there - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> cd privoxy - gbp pull</PRE -></TD -></TR -></TABLE -><P -> Now import the newly released upstream tarball via debian/watch file: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> gbp import-orig --uscan</PRE -></TD -></TR -></TABLE -><P -> Next update all Debian quilt patches to the new version: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> while quilt push; do quilt refresh; done</PRE -></TD -></TR -></TABLE -><P -> If some patch is no longer required (because it is already merged - upstream), it can be removed using - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> quilt delete XX_patchname.patch - git rm debian/patches/XX_patchname.patch</PRE -></TD -></TR -></TABLE -><P -> If the patch needs modification, you can apply, edit and update it with - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> quilt push -f + git checkout v_X_Y_Z</pre> + </td> + </tr> + </table> + <p><span class="emphasis"><i class="EMPHASIS">Do NOT change</i></span> a single bit, including, but not limited + to version information after export from Git. This is to make sure that all release packages, and with them, all + future bug reports, are based on exactly the same code.</p> + <div class="WARNING"> + <table class="WARNING" border="1" width="100%"> + <tr> + <td align="center"><b>Warning</b></td> + </tr> + <tr> + <td align="left"> + <p>Every significant release of Privoxy has included at least one package that either had incorrect + versions of files, missing files, or incidental leftovers from a previous build process that gave unknown + numbers of users headaches to try to figure out what was wrong. PLEASE, make sure you are using pristene + sources, and are following the prescribed process!</p> + </td> + </tr> + </table> + </div> + <p>Please find additional instructions for the source tarball and the individual platform dependent binary + packages below. And details on the Sourceforge release process below that.</p> + <div class="SECT3"> + <h3 class="SECT3"><a name="PACK-GUIDELINES" id="PACK-GUIDELINES">6.3.1. Note on Privoxy Packaging</a></h3> + <p>Please keep these general guidelines in mind when putting together your package. These apply to <span class= + "emphasis"><i class="EMPHASIS">all</i></span> platforms!</p> + <ul> + <li> + <p><span class="APPLICATION">Privoxy</span> <span class="emphasis"><i class="EMPHASIS">requires</i></span> + write access to: all <tt class="FILENAME">*.action</tt> files, all logfiles, and the <tt class= + "FILENAME">trust</tt> file. You will need to determine the best way to do this for your platform.</p> + </li> + <li> + <p>Please include up to date documentation. At a bare minimum:</p> + <table border="0"> + <tbody> + <tr> + <td><tt class="FILENAME">LICENSE</tt> (top-level directory)</td> + </tr> + </tbody> + </table> + <table border="0"> + <tbody> + <tr> + <td><tt class="FILENAME">README</tt> (top-level directory)</td> + </tr> + </tbody> + </table> + <table border="0"> + <tbody> + <tr> + <td><tt class="FILENAME">AUTHORS</tt> (top-level directory)</td> + </tr> + </tbody> + </table> + <table border="0"> + <tbody> + <tr> + <td><tt class="FILENAME">man page</tt> (top-level directory, Unix-like platforms only)</td> + </tr> + </tbody> + </table> + <table border="0"> + <tbody> + <tr> + <td><tt class="FILENAME">The User Manual</tt> (doc/webserver/user-manual/)</td> + </tr> + </tbody> + </table> + <table border="0"> + <tbody> + <tr> + <td><tt class="FILENAME">FAQ</tt> (doc/webserver/faq/)</td> + </tr> + </tbody> + </table> + <p>Also suggested: <tt class="FILENAME">Developer Manual</tt> (doc/webserver/developer-manual) and + <tt class="FILENAME">ChangeLog</tt> (top-level directory). <tt class="FILENAME">FAQ</tt> and the manuals + are HTML docs.</p> + <p>The documentation has been designed such that the manuals are linked to each other from parallel + directories, and should be packaged that way. <tt class="FILENAME">privoxy-index.html</tt> can also be + included and can serve as a focal point for docs and other links of interest (and possibly renamed to + <tt class="FILENAME">index.html</tt>). This should be one level up from the manuals. There is a link also + on this page to an HTMLized version of the man page. To avoid 404 for this, it is in Git as <tt class= + "FILENAME">doc/webserver/man-page/privoxy-man-page.html</tt>, and should be included along with the + manuals. There is also a css stylesheets that can be included for better presentation: <tt class= + "FILENAME">p_doc.css</tt>. This should be in the same directory with <tt class= + "FILENAME">privoxy-index.html</tt>, (i.e. one level up from the manual directories).</p> + </li> + <li> + <p><tt class="FILENAME">user.action</tt> and <tt class="FILENAME">user.filter</tt> are designed for local + preferences. Make sure these do not get overwritten! <tt class="FILENAME">config</tt> should not be + overwritten either. This has especially important configuration data in it. <tt class="FILENAME">trust</tt> + should be left in tact as well.</p> + </li> + <li> + <p>Other configuration files (<tt class="FILENAME">default.action</tt>, <tt class= + "FILENAME">regression-tests.action</tt> and <tt class="FILENAME">default.filter</tt>) should be installed + as the new defaults, but all previously installed configuration files should be preserved as backups. This + is just good manners :-) These files are likely to change between releases and contain important new + features and bug fixes.</p> + </li> + <li> + <p>Please check platform specific notes in this doc, if you haven't done <span class= + "QUOTE">"Privoxy"</span> packaging before for other platform specific issues. Conversely, please add any + notes that you know are important for your platform (or contact one of the doc maintainers to do this if + you can't).</p> + </li> + <li> + <p>Packagers should do a <span class="QUOTE">"clean"</span> install of their package after building it. So + any previous installs should be removed first to ensure the integrity of the newly built package. Then run + the package for a while to make sure there are no obvious problems, before uploading.</p> + </li> + </ul> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="NEWRELEASE-TARBALL" id="NEWRELEASE-TARBALL">6.3.2. Source Tarball</a></h3> + <p>First, <span class="emphasis"><i class="EMPHASIS">make sure that you have freshly exported the right version + into an empty directory</i></span>. (See "Building and releasing packages" above). Then run from that + directory:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> autoheader && autoconf && ./configure</pre> + </td> + </tr> + </table> + <p>Then do:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> make tarball-dist</pre> + </td> + </tr> + </table> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="NEWRELEASE-WINDOWS" id="NEWRELEASE-WINDOWS">6.3.3. Windows</a></h3> + <p>Note that the docbook generated files might need some hand editing, so the Windows build makefile does not + rebuild the docs.</p> + <p>First, <span class="emphasis"><i class="EMPHASIS">make sure that you have freshly exported the right version + into an empty directory</i></span>. (See "Building and releasing packages" above).</p> + <p>Check that you have the current versions of the <a href= + "https://sourceforge.net/projects/nsis/files/NSIS%203/" target="_top">NSIS installer</a>, <a href= + "https://ftp.pcre.org/pub/pcre/" target="_top">PCRE library</a>, <a href="https://tls.mbed.org/download" + target="_top">MBED TLS library</a>, <a href="https://github.com/google/brotli/releases" target="_top">Brotli + library</a>, and that the <span class="emphasis"><i class="EMPHASIS">MAKENSIS</i></span> evar in <tt class= + "FILENAME">windows/GNUMakefile</tt> points to the NSIS installer program. (See the <a href= + "../user-manual/installation.html#WINBUILD-CYGWIN" target="_top"><span class="emphasis"><i class= + "EMPHASIS">Building from Source / Windows</i></span></a> section of the User Manual for details.)</p> + <p>Then you can build the package. This is fully automated, and is controlled by <tt class= + "FILENAME">windows/GNUmakefile</tt>. All you need to do is:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> cd windows + make</pre> + </td> + </tr> + </table> + <p>Now you can manually rename <tt class="FILENAME">privoxy_setup.exe</tt> to <tt class= + "FILENAME">privoxy_setup_X.Y.Z.exe</tt>, and the <tt class="FILENAME">build</tt> directory to <tt class= + "FILENAME">privoxy_X.Y.Z</tt>. Create a .zip file of the newly renamed <tt class="FILENAME">privoxy_X.Y.Z</tt> + directory, GPG sign the installer and zip file,</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> gpg --armor --detach --sign <tt class= + "FILENAME">privoxy_setup_X.Y.Z.exe</tt> + gpg --armor --detach --sign <tt class="FILENAME">privoxy_X.Y.Z.zip</tt></pre> + </td> + </tr> + </table> + <p>and upload the files to SourceForge.</p> + <p>When releasing the package on SourceForge, use the release notes and Change Log from the source tarball + package.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="NEWRELEASE-DEBIAN" id="NEWRELEASE-DEBIAN">6.3.4. Debian</a></h3> + <p>Using git-buildpackage we start with a clone of the last Debian version:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> gbp clone https://salsa.debian.org/debian/privoxy.git + cd privoxy</pre> + </td> + </tr> + </table> + <p>or if the repository is already there</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> cd privoxy + gbp pull</pre> + </td> + </tr> + </table> + <p>Now import the newly released upstream tarball via debian/watch file:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> gbp import-orig --uscan</pre> + </td> + </tr> + </table> + <p>Next update all Debian quilt patches to the new version:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> while quilt push; do quilt refresh; done</pre> + </td> + </tr> + </table> + <p>If some patch is no longer required (because it is already merged upstream), it can be removed using</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> quilt delete XX_patchname.patch + git rm debian/patches/XX_patchname.patch</pre> + </td> + </tr> + </table> + <p>If the patch needs modification, you can apply, edit and update it with</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> quilt push -f quilt edit some_file - quilt refresh</PRE -></TD -></TR -></TABLE -><P -> until - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> while quilt push; do quilt refresh; done</PRE -></TD -></TR -></TABLE -><P -> succeeds. Then you can - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> quilt pop -a</PRE -></TD -></TR -></TABLE -><P -> Now add a new entry to the debian/changelog representing the new - version: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> dch -v 3.0.34-1</PRE -></TD -></TR -></TABLE -><P -> and describe what you did before and don't forget to git commit all - changes. - </P -><P -> Now you can build the package on the local machine using - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> gbp buildpackage -us -uc</PRE -></TD -></TR -></TABLE -><P -> You should check for warnings using - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> lintian -iI ../build-area/privoxy_3.0.34-1_amd64.changes</PRE -></TD -></TR -></TABLE -><P -> Maybe rebuild the package in different defined cowbuilder environments - like - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> sudo cowbuilder --build --basepath /var/cache/pbuilder/base.cow ../build-area/privoxy_3.0.34-1.dsc</PRE -></TD -></TR -></TABLE -><P -> And try to run autopackage testing suite on the result: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> autopkgtest /var/cache/pbuilder/result/privoxy_3.0.34-1_amd64.changes -s -- schroot sid</PRE -></TD -></TR -></TABLE -><P -> Or just push the changes to salsa.debian.org, where a CI pipeline is - defined for the package, that builds and tests it. - </P -><P -> If everything is okay, run cowbuilder with i386 and amd64 environments - for current Debian stable release and build - privoxy_3.0.34-1_i386.deb and privoxy_3.0.34-1_amd64.deb. - Then sign both files: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> gpg --detach-sign --armor privoxy_3.0.34-1_i386.deb - gpg --detach-sign --armor privoxy_3.0.34-1_amd64.deb</PRE -></TD -></TR -></TABLE -><P -> Create a README file containing the recent block from debian/changelog - and upload the two packages, the two signatures and the README to a - freshly created folder below - https://sourceforge.net/projects/ijbswa/files/Debian/ - </P -><DIV -CLASS="SECT4" -><H4 -CLASS="SECT4" -><A -NAME="SNAPSHOT-DEBIAN" ->6.3.4.1. Debian GIT Snapshot</A -></H4 -><P -> For building just a git snapshot build the following workflow may be - useful. First create a build environment, for this you may have to - run the following commands: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> sudo apt install build-essential devscripts - sudo apt-get build-dep privoxy</PRE -></TD -></TR -></TABLE -><P -> After this enter the checked out privoxy git tree and check that all - (new) build dependencies are met: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> dpkg-checkbuilddeps</PRE -></TD -></TR -></TABLE -><P -> If something is missing, just add it using - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> sudo apt install foobar</PRE -></TD -></TR -></TABLE -><P -> Now you may update debian/changelog, especially the version number - using - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> dch</PRE -></TD -></TR -></TABLE -><P -> and finally build the package: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> debuild -us -uc -b</PRE -></TD -></TR -></TABLE -><P -> If everything went okay, you may find the resulting Debian package in - the parent directory. - </P -><P -> You may want to clean up the build tree using - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> debian/rules clean</PRE -></TD -></TR -></TABLE -><P -> And maybe repair some artefacts using one or both of the following - commands: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> git reset --hard - git clean -fd</PRE -></TD -></TR -></TABLE -></DIV -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="NEWRELEASE-MACOSX" ->6.3.5. macOS / OS X</A -></H3 -><P -> First, <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->make sure that you have freshly exported the right - version into an empty directory</I -></SPAN ->. (See "Building and releasing - packages" above). - </P -><P -> The OSXPackageBuilder module generates OS X installer packages - supporting all Macs running OS X 10.4 and above. Obtain it from Git as - follows into a folder parallel to the exported privoxy source: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> git clone ssh://git@git.privoxy.org:23/git/OSXPackageBuilder.git</PRE -></TD -></TR -></TABLE -><P -> The module contains complete instructions on its usage in the file - <TT -CLASS="FILENAME" ->OS X Package Builder HOWTO.txt</TT ->. - </P -><P -> Once the package(s) have been generated, you can then upload them - directly to the Files section of the Sourceforge project in the - Macintosh (OS X) folder. Each new version release of Privoxy should - have a new subfolder created in which to store its files. Please - ensure that the folder contains a readme file that makes it clear - which package is for which version of OS X. - </P -></DIV -><DIV -CLASS="SECT3" -><H3 -CLASS="SECT3" -><A -NAME="NEWRELEASE-FREEBSD" ->6.3.6. FreeBSD</A -></H3 -><P -> Update the www/privoxy port and submit a diff upstream. - For details see the <A -HREF="https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/" -TARGET="_top" ->FreeBSD Porter's Handbook</A ->. - </P -></DIV -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="RELEASING" ->6.4. Uploading and Releasing Your Package</A -></H2 -><P -> After the package is ready, it is time to upload it - and go through the release steps. The upload - is done at - <A -HREF="https://sourceforge.net/projects/ijbswa/upload/" -TARGET="_top" ->SourceForge</A -> - after logging in. - </P -><P -> Now just follow the prompts. Be sure to add any appropriate Release - notes. You should see your freshly uploaded packages in - <SPAN -CLASS="QUOTE" ->"Step 2. Add Files To This Release"</SPAN ->. Check the - appropriate box(es). Remember at each step to hit the - <SPAN -CLASS="QUOTE" ->"Refresh/Submit"</SPAN -> buttons! You should now see your - file(s) listed in Step 3. Fill out the forms with the appropriate - information for your platform, being sure to hit <SPAN -CLASS="QUOTE" ->"Update"</SPAN -> - for each file. If anyone is monitoring your platform, check the - <SPAN -CLASS="QUOTE" ->"email"</SPAN -> box at the very bottom to notify them of - the new package. This should do it! - </P -><P -> If you have made errors, or need to make changes, you can go through - essentially the same steps, but select <TT -CLASS="LITERAL" ->Edit Release</TT ->, - instead of <TT -CLASS="LITERAL" ->Add Release</TT ->. - </P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="AFTERRELEASE" ->6.5. After the Release</A -></H2 -><P -> When all (or: most of the) packages have been uploaded and made available, - send an email to the - <A -HREF="mailto:privoxy-announce@lists.privoxy.org" -TARGET="_top" ->announce mailing - list</A ->, Subject: "Announcing Privoxy X.Y.Z $CODE_STATUS". Be sure to - include the - <A -HREF="https://sourceforge.net/projects/ijbswa/files/" -TARGET="_top" -> download location</A ->, the release notes and the Changelog. Also, post an - updated News item on the project page Sourceforge, and update the Home - page and docs linked from the Home page (see below). Other news sites - and release oriented sites, such as Freshmeat, should also be notified. - </P -><P -> Then update the source code for the next version to be released: - </P -><P -></P -><UL -><LI -><P -> Increment the version number and change the code status to "UNRELEASED" - in <TT -CLASS="FILENAME" ->configure.in</TT -> - </P -></LI -><LI -><P -> Rebuild configure (<SPAN -CLASS="QUOTE" ->"<B -CLASS="COMMAND" ->autoheader && autoconf</B ->"</SPAN ->) - and GNUMakefile (<SPAN -CLASS="QUOTE" ->"<B -CLASS="COMMAND" ->./configure</B ->"</SPAN ->) - </P -></LI -><LI -><P -> <SPAN -CLASS="QUOTE" ->"<B -CLASS="COMMAND" ->make dok-release</B ->"</SPAN -> to update the sgml documentation source files. - </P -></LI -><LI -><P -> Commit all your changes. - </P -></LI -></UL -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="testing.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="webserver-update.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Testing Guidelines</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Update the Webserver</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file + quilt refresh</pre> + </td> + </tr> + </table> + <p>until</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> while quilt push; do quilt refresh; done</pre> + </td> + </tr> + </table> + <p>succeeds. Then you can</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> quilt pop -a</pre> + </td> + </tr> + </table> + <p>Now add a new entry to the debian/changelog representing the new version:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> dch -v 3.0.34-1</pre> + </td> + </tr> + </table> + <p>and describe what you did before and don't forget to git commit all changes.</p> + <p>Now you can build the package on the local machine using</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> gbp buildpackage -us -uc</pre> + </td> + </tr> + </table> + <p>You should check for warnings using</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> lintian -iI ../build-area/privoxy_3.0.34-1_amd64.changes</pre> + </td> + </tr> + </table> + <p>Maybe rebuild the package in different defined cowbuilder environments like</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class= + "PROGRAMLISTING"> sudo cowbuilder --build --basepath /var/cache/pbuilder/base.cow ../build-area/privoxy_3.0.34-1.dsc</pre> + </td> + </tr> + </table> + <p>And try to run autopackage testing suite on the result:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class= + "PROGRAMLISTING"> autopkgtest /var/cache/pbuilder/result/privoxy_3.0.34-1_amd64.changes -s -- schroot sid</pre> + </td> + </tr> + </table> + <p>Or just push the changes to salsa.debian.org, where a CI pipeline is defined for the package, that builds + and tests it.</p> + <p>If everything is okay, run cowbuilder with i386 and amd64 environments for current Debian stable release and + build privoxy_3.0.34-1_i386.deb and privoxy_3.0.34-1_amd64.deb. Then sign both files:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> gpg --detach-sign --armor privoxy_3.0.34-1_i386.deb + gpg --detach-sign --armor privoxy_3.0.34-1_amd64.deb</pre> + </td> + </tr> + </table> + <p>Create a README file containing the recent block from debian/changelog and upload the two packages, the two + signatures and the README to a freshly created folder below + https://sourceforge.net/projects/ijbswa/files/Debian/</p> + <div class="SECT4"> + <h4 class="SECT4"><a name="SNAPSHOT-DEBIAN" id="SNAPSHOT-DEBIAN">6.3.4.1. Debian GIT Snapshot</a></h4> + <p>For building just a git snapshot build the following workflow may be useful. First create a build + environment, for this you may have to run the following commands:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> sudo apt install build-essential devscripts + sudo apt-get build-dep privoxy</pre> + </td> + </tr> + </table> + <p>After this enter the checked out privoxy git tree and check that all (new) build dependencies are met:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> dpkg-checkbuilddeps</pre> + </td> + </tr> + </table> + <p>If something is missing, just add it using</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> sudo apt install foobar</pre> + </td> + </tr> + </table> + <p>Now you may update debian/changelog, especially the version number using</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> dch</pre> + </td> + </tr> + </table> + <p>and finally build the package:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> debuild -us -uc -b</pre> + </td> + </tr> + </table> + <p>If everything went okay, you may find the resulting Debian package in the parent directory.</p> + <p>You may want to clean up the build tree using</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> debian/rules clean</pre> + </td> + </tr> + </table> + <p>And maybe repair some artefacts using one or both of the following commands:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> git reset --hard + git clean -fd</pre> + </td> + </tr> + </table> + </div> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="NEWRELEASE-MACOSX" id="NEWRELEASE-MACOSX">6.3.5. macOS / OS X</a></h3> + <p>First, <span class="emphasis"><i class="EMPHASIS">make sure that you have freshly exported the right version + into an empty directory</i></span>. (See "Building and releasing packages" above).</p> + <p>The OSXPackageBuilder module generates OS X installer packages supporting all Macs running OS X 10.4 and + above. Obtain it from Git as follows into a folder parallel to the exported privoxy source:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> git clone ssh://git@git.privoxy.org:23/git/OSXPackageBuilder.git</pre> + </td> + </tr> + </table> + <p>The module contains complete instructions on its usage in the file <tt class="FILENAME">OS X Package Builder + HOWTO.txt</tt>.</p> + <p>Once the package(s) have been generated, you can then upload them directly to the Files section of the + Sourceforge project in the Macintosh (OS X) folder. Each new version release of Privoxy should have a new + subfolder created in which to store its files. Please ensure that the folder contains a readme file that makes + it clear which package is for which version of OS X.</p> + </div> + <div class="SECT3"> + <h3 class="SECT3"><a name="NEWRELEASE-FREEBSD" id="NEWRELEASE-FREEBSD">6.3.6. FreeBSD</a></h3> + <p>Update the www/privoxy port and submit a diff upstream. For details see the <a href= + "https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/" target="_top">FreeBSD Porter's + Handbook</a>.</p> + </div> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="RELEASING" id="RELEASING">6.4. Uploading and Releasing Your Package</a></h2> + <p>After the package is ready, it is time to upload it and go through the release steps. The upload is done at + <a href="https://sourceforge.net/projects/ijbswa/upload/" target="_top">SourceForge</a> after logging in.</p> + <p>Now just follow the prompts. Be sure to add any appropriate Release notes. You should see your freshly + uploaded packages in <span class="QUOTE">"Step 2. Add Files To This Release"</span>. Check the appropriate + box(es). Remember at each step to hit the <span class="QUOTE">"Refresh/Submit"</span> buttons! You should now see + your file(s) listed in Step 3. Fill out the forms with the appropriate information for your platform, being sure + to hit <span class="QUOTE">"Update"</span> for each file. If anyone is monitoring your platform, check the + <span class="QUOTE">"email"</span> box at the very bottom to notify them of the new package. This should do + it!</p> + <p>If you have made errors, or need to make changes, you can go through essentially the same steps, but select + <tt class="LITERAL">Edit Release</tt>, instead of <tt class="LITERAL">Add Release</tt>.</p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="AFTERRELEASE" id="AFTERRELEASE">6.5. After the Release</a></h2> + <p>When all (or: most of the) packages have been uploaded and made available, send an email to the <a href= + "mailto:privoxy-announce@lists.privoxy.org" target="_top">announce mailing list</a>, Subject: "Announcing Privoxy + X.Y.Z $CODE_STATUS". Be sure to include the <a href="https://sourceforge.net/projects/ijbswa/files/" target= + "_top">download location</a>, the release notes and the Changelog. Also, post an updated News item on the project + page Sourceforge, and update the Home page and docs linked from the Home page (see below). Other news sites and + release oriented sites, such as Freshmeat, should also be notified.</p> + <p>Then update the source code for the next version to be released:</p> + <ul> + <li> + <p>Increment the version number and change the code status to "UNRELEASED" in <tt class= + "FILENAME">configure.in</tt></p> + </li> + <li> + <p>Rebuild configure (<span class="QUOTE">"<b class="COMMAND">autoheader && autoconf</b>"</span>) and + GNUMakefile (<span class="QUOTE">"<b class="COMMAND">./configure</b>"</span>)</p> + </li> + <li> + <p><span class="QUOTE">"<b class="COMMAND">make dok-release</b>"</span> to update the sgml documentation + source files.</p> + </li> + <li> + <p>Commit all your changes.</p> + </li> + </ul> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="testing.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"><a href="webserver-update.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top">Testing Guidelines</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">Update the Webserver</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/testing.html b/doc/webserver/developer-manual/testing.html index b49839d9..8d5ce3dc 100644 --- a/doc/webserver/developer-manual/testing.html +++ b/doc/webserver/developer-manual/testing.html @@ -1,204 +1,87 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Testing Guidelines</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Coding Guidelines" -HREF="coding.html"><LINK -REL="NEXT" -TITLE="Releasing a New Version" -HREF="newrelease.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="coding.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -><A -HREF="newrelease.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="TESTING" ->5. Testing Guidelines</A -></H1 -><P ->To be filled.</P -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="TESTING-PLAN" ->5.1. Testplan for releases</A -></H2 -><P -> Explain release numbers. major, minor. developer releases. etc. - </P -><P -></P -><OL -TYPE="1" -><LI -><P ->Remove any existing rpm with rpm -e</P -></LI -><LI -><P ->Remove any file that was left over. This includes (but is not limited to) - </P -><P -></P -><UL -><LI -><P ->/var/log/privoxy</P -></LI -><LI -><P ->/etc/privoxy</P -></LI -><LI -><P ->/usr/sbin/privoxy</P -></LI -><LI -><P ->/etc/init.d/privoxy</P -></LI -><LI -><P ->/usr/doc/privoxy*</P -></LI -></UL -></LI -><LI -><P ->Install the rpm. Any error messages?</P -></LI -><LI -><P ->start,stop,status <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> with the specific script - (e.g. /etc/rc.d/init/privoxy stop). Reboot your machine. Does - autostart work?</P -></LI -><LI -><P ->Start browsing. Does <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> work? Logfile written?</P -></LI -><LI -><P ->Remove the rpm. Any error messages? All files removed?</P -></LI -></OL -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="PRIVOXY-REGRESSION-TEST" ->5.2. Testing with <SPAN -CLASS="APPLICATION" ->Privoxy-Regression-Test</SPAN -></A -></H2 -><P -> If you compiled, packaged or merely installed Privoxy, it is recommended to run - <SPAN -CLASS="APPLICATION" ->Privoxy-Regression-Test</SPAN -> to verify that at least - the tested parts of <SPAN -CLASS="APPLICATION" ->Privoxy</SPAN -> are working as expected. - </P -><P -> This is actually pretty easy. For details, please see - <B -CLASS="COMMAND" ->perldoc privoxy-regression-test.pl</B ->. - </P -><P -> Here is an example of what <SPAN -CLASS="APPLICATION" ->Privoxy-Regression-Test</SPAN -> can do for you: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> # Run all the tests +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Testing Guidelines</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="Coding Guidelines" href="coding.html"> + <link rel="NEXT" title="Releasing a New Version" href="newrelease.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="coding.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"><a href="newrelease.html" accesskey="N">Next</a></td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="TESTING" id="TESTING">5. Testing Guidelines</a></h1> + <p>To be filled.</p> + <div class="SECT2"> + <h2 class="SECT2"><a name="TESTING-PLAN" id="TESTING-PLAN">5.1. Testplan for releases</a></h2> + <p>Explain release numbers. major, minor. developer releases. etc.</p> + <ol type="1"> + <li> + <p>Remove any existing rpm with rpm -e</p> + </li> + <li> + <p>Remove any file that was left over. This includes (but is not limited to)</p> + <ul> + <li> + <p>/var/log/privoxy</p> + </li> + <li> + <p>/etc/privoxy</p> + </li> + <li> + <p>/usr/sbin/privoxy</p> + </li> + <li> + <p>/etc/init.d/privoxy</p> + </li> + <li> + <p>/usr/doc/privoxy*</p> + </li> + </ul> + </li> + <li> + <p>Install the rpm. Any error messages?</p> + </li> + <li> + <p>start,stop,status <span class="APPLICATION">Privoxy</span> with the specific script (e.g. + /etc/rc.d/init/privoxy stop). Reboot your machine. Does autostart work?</p> + </li> + <li> + <p>Start browsing. Does <span class="APPLICATION">Privoxy</span> work? Logfile written?</p> + </li> + <li> + <p>Remove the rpm. Any error messages? All files removed?</p> + </li> + </ol> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="PRIVOXY-REGRESSION-TEST" id="PRIVOXY-REGRESSION-TEST">5.2. Testing with <span class= + "APPLICATION">Privoxy-Regression-Test</span></a></h2> + <p>If you compiled, packaged or merely installed Privoxy, it is recommended to run <span class= + "APPLICATION">Privoxy-Regression-Test</span> to verify that at least the tested parts of <span class= + "APPLICATION">Privoxy</span> are working as expected.</p> + <p>This is actually pretty easy. For details, please see <b class="COMMAND">perldoc + privoxy-regression-test.pl</b>.</p> + <p>Here is an example of what <span class="APPLICATION">Privoxy-Regression-Test</span> can do for you:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> # Run all the tests fk@t520 ~ $privoxy-regression-test.pl 2020-12-14 12:16:32: Asking Privoxy for the number of action files available ... 2020-12-14 12:16:32: Gathering regression tests from 9 action file(s) delivered by Privoxy 3.0.30. @@ -217,44 +100,22 @@ CLASS="PROGRAMLISTING" 2020-12-14 12:17:56: Executing: curl --include -H 'Proxy-Connection:' -H 'Connection: close' -s -S --user-agent 'Privoxy-Regression-Test 0.7.2' --max-time '5' --globoff -H 'X-Privoxy-Control: hide-referrer{conditional-block}' -H 'Referer: https://p.p/' http://p.p/show-request 2>&1 2020-12-14 12:17:56: Ooops. Expected removal but: 'Referer: https://p.p/' is still there. 2020-12-14 12:17:56: Failure for test 785 (0/13/5). Header 'Referer: https://p.p/' and tag 'hide-referrer{conditional-block}' - 2020-12-14 12:17:56: Executed 1 regression tests. Skipped 1201. 0 successes, 1 failures.</PRE -></TD -></TR -></TABLE -><P -> Use the if the <B -CLASS="COMMAND" ->--privoxy-address</B -> option if the - http_proxy environment variable isn't configured and you don't want - to use the default (http://127.0.0.1:8118/). - </P -></DIV -><DIV -CLASS="SECT2" -><H2 -CLASS="SECT2" -><A -NAME="FUZZING" ->5.3. Fuzzing Privoxy</A -></H2 -><P -> To make fuzzing more convenient, Privoxy can be configured - with --enable-fuzz which will result in the --fuzz option - becoming available. - </P -><P -> Example (tested on ElectroBSD): - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> # Compile Privoxy with instrumentation for afl + 2020-12-14 12:17:56: Executed 1 regression tests. Skipped 1201. 0 successes, 1 failures.</pre> + </td> + </tr> + </table> + <p>Use the if the <b class="COMMAND">--privoxy-address</b> option if the http_proxy environment variable isn't + configured and you don't want to use the default (http://127.0.0.1:8118/).</p> + </div> + <div class="SECT2"> + <h2 class="SECT2"><a name="FUZZING" id="FUZZING">5.3. Fuzzing Privoxy</a></h2> + <p>To make fuzzing more convenient, Privoxy can be configured with --enable-fuzz which will result in the --fuzz + option becoming available.</p> + <p>Example (tested on ElectroBSD):</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> # Compile Privoxy with instrumentation for afl $ export CC=afl-clang $ export CFLAGS="-fsanitize=address -ggdb" $ export CPPFLAGS=-I/usr/local/include/ @@ -303,70 +164,26 @@ CLASS="PROGRAMLISTING" FILTER: bla fasel s@(.{1})[432](\d+)@$1$2$hostname@UgisT - $ afl-fuzz -i input/ -o output/ -f bla.filter -m none privoxy --fuzz filter bla.filter --stfu</PRE -></TD -></TR -></TABLE -></DIV -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="coding.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -><A -HREF="newrelease.html" -ACCESSKEY="N" ->Next</A -></TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Coding Guidelines</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" ->Releasing a New Version</TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file + $ afl-fuzz -i input/ -o output/ -f bla.filter -m none privoxy --fuzz filter bla.filter --stfu</pre> + </td> + </tr> + </table> + </div> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="coding.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"><a href="newrelease.html" accesskey="N">Next</a></td> + </tr> + <tr> + <td width="33%" align="left" valign="top">Coding Guidelines</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top">Releasing a New Version</td> + </tr> + </table> + </div> +</body> +</html> diff --git a/doc/webserver/developer-manual/webserver-update.html b/doc/webserver/developer-manual/webserver-update.html index 0777b74c..6e1f21c4 100644 --- a/doc/webserver/developer-manual/webserver-update.html +++ b/doc/webserver/developer-manual/webserver-update.html @@ -1,239 +1,81 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<HTML -><HEAD -><TITLE ->Update the Webserver</TITLE -><META -NAME="GENERATOR" -CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK -REL="HOME" -TITLE="Privoxy Developer Manual" -HREF="index.html"><LINK -REL="PREVIOUS" -TITLE="Releasing a New Version" -HREF="newrelease.html"><LINK -REL="STYLESHEET" -TYPE="text/css" -HREF="../p_doc.css"><META -HTTP-EQUIV="Content-Type" -CONTENT="text/html; -charset=ISO-8859-1"></HEAD -><BODY -CLASS="SECT1" -BGCOLOR="#EEEEEE" -TEXT="#000000" -LINK="#0000FF" -VLINK="#840084" -ALINK="#0000FF" -><DIV -CLASS="NAVHEADER" -><TABLE -SUMMARY="Header navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TH -COLSPAN="3" -ALIGN="center" ->Privoxy Developer Manual</TH -></TR -><TR -><TD -WIDTH="10%" -ALIGN="left" -VALIGN="bottom" -><A -HREF="newrelease.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="80%" -ALIGN="center" -VALIGN="bottom" -></TD -><TD -WIDTH="10%" -ALIGN="right" -VALIGN="bottom" -> </TD -></TR -></TABLE -><HR -ALIGN="LEFT" -WIDTH="100%"></DIV -><DIV -CLASS="SECT1" -><H1 -CLASS="SECT1" -><A -NAME="WEBSERVER-UPDATE" ->7. Update the Webserver</A -></H1 -><P -> The webserver should be updated at least with each stable release. When - updating, please follow these steps to make sure that no broken links, - inconsistent contents or permission problems will occur (as it has many - times in the past!): - </P -><P -> If you have changed anything in the stable-branch documentation source - SGML files, do: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> make dok && make dok-tidy</PRE -></TD -></TR -></TABLE -><P -> That will generate <TT -CLASS="FILENAME" ->doc/webserver/user-manual</TT ->, - <TT -CLASS="FILENAME" ->doc/webserver/developer-manual</TT ->, - <TT -CLASS="FILENAME" ->doc/webserver/faq</TT ->, - <TT -CLASS="FILENAME" ->doc/webserver/index.html</TT -> automatically. - </P -><P -> If you changed the manual page sources, generate - <TT -CLASS="FILENAME" ->doc/webserver/man-page/privoxy-man-page.html</TT -> - by running <SPAN -CLASS="QUOTE" ->"<B -CLASS="COMMAND" ->make man</B ->"</SPAN ->. (This is - a separate target due to dependencies on some obscure perl scripts - [now in Git, but not well tested]. See comments in <TT -CLASS="FILENAME" ->GNUmakefile</TT ->.) - </P -><P -> If you want to add new files to the webserver, create them locally in - the <TT -CLASS="FILENAME" ->doc/webserver/*</TT -> directory (or - create new directories under <TT -CLASS="FILENAME" ->doc/webserver</TT ->). - </P -><P -> Next, commit any changes from the above steps to Git. All set? - If these are docs in the stable branch, then do: - </P -><TABLE -BORDER="0" -BGCOLOR="#E0E0E0" -WIDTH="100%" -><TR -><TD -><PRE -CLASS="PROGRAMLISTING" -> make webserver</PRE -></TD -></TR -></TABLE -><P -> This will do the upload to the SourceForge webserver (which is manually - syncronized with <A -HREF="https://www.privoxy.org/" -TARGET="_top" ->www.privoxy.org</A ->) - and ensure all files and directories there are group writable. - </P -><P -> Please do <SPAN -CLASS="emphasis" -><I -CLASS="EMPHASIS" ->NOT</I -></SPAN -> use any other means of transferring - files to the webserver to avoid permission problems. Also, please do not - upload docs from development branches or versions. The publicly posted - docs should be in sync with the last official release. - </P -></DIV -><DIV -CLASS="NAVFOOTER" -><HR -ALIGN="LEFT" -WIDTH="100%"><TABLE -SUMMARY="Footer navigation table" -WIDTH="100%" -BORDER="0" -CELLPADDING="0" -CELLSPACING="0" -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" -><A -HREF="newrelease.html" -ACCESSKEY="P" ->Prev</A -></TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -><A -HREF="index.html" -ACCESSKEY="H" ->Home</A -></TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -> </TD -></TR -><TR -><TD -WIDTH="33%" -ALIGN="left" -VALIGN="top" ->Releasing a New Version</TD -><TD -WIDTH="34%" -ALIGN="center" -VALIGN="top" -> </TD -><TD -WIDTH="33%" -ALIGN="right" -VALIGN="top" -> </TD -></TR -></TABLE -></DIV -></BODY -></HTML -> \ No newline at end of file +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>Update the Webserver</title> + <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79"> + <link rel="HOME" title="Privoxy Developer Manual" href="index.html"> + <link rel="PREVIOUS" title="Releasing a New Version" href="newrelease.html"> + <link rel="STYLESHEET" type="text/css" href="../p_doc.css"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</head> +<body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF"> + <div class="NAVHEADER"> + <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <th colspan="3" align="center">Privoxy Developer Manual</th> + </tr> + <tr> + <td width="10%" align="left" valign="bottom"><a href="newrelease.html" accesskey="P">Prev</a></td> + <td width="80%" align="center" valign="bottom"></td> + <td width="10%" align="right" valign="bottom"> </td> + </tr> + </table> + <hr align="left" width="100%"> + </div> + <div class="SECT1"> + <h1 class="SECT1"><a name="WEBSERVER-UPDATE" id="WEBSERVER-UPDATE">7. Update the Webserver</a></h1> + <p>The webserver should be updated at least with each stable release. When updating, please follow these steps to + make sure that no broken links, inconsistent contents or permission problems will occur (as it has many times in + the past!):</p> + <p>If you have changed anything in the stable-branch documentation source SGML files, do:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> make dok && make dok-tidy</pre> + </td> + </tr> + </table> + <p>That will generate <tt class="FILENAME">doc/webserver/user-manual</tt>, <tt class= + "FILENAME">doc/webserver/developer-manual</tt>, <tt class="FILENAME">doc/webserver/faq</tt>, <tt class= + "FILENAME">doc/webserver/index.html</tt> automatically.</p> + <p>If you changed the manual page sources, generate <tt class= + "FILENAME">doc/webserver/man-page/privoxy-man-page.html</tt> by running <span class="QUOTE">"<b class= + "COMMAND">make man</b>"</span>. (This is a separate target due to dependencies on some obscure perl scripts [now in + Git, but not well tested]. See comments in <tt class="FILENAME">GNUmakefile</tt>.)</p> + <p>If you want to add new files to the webserver, create them locally in the <tt class= + "FILENAME">doc/webserver/*</tt> directory (or create new directories under <tt class= + "FILENAME">doc/webserver</tt>).</p> + <p>Next, commit any changes from the above steps to Git. All set? If these are docs in the stable branch, then + do:</p> + <table border="0" bgcolor="#E0E0E0" width="100%"> + <tr> + <td> + <pre class="PROGRAMLISTING"> make webserver</pre> + </td> + </tr> + </table> + <p>This will do the upload to the SourceForge webserver (which is manually syncronized with <a href= + "https://www.privoxy.org/" target="_top">www.privoxy.org</a>) and ensure all files and directories there are group + writable.</p> + <p>Please do <span class="emphasis"><i class="EMPHASIS">NOT</i></span> use any other means of transferring files to + the webserver to avoid permission problems. Also, please do not upload docs from development branches or versions. + The publicly posted docs should be in sync with the last official release.</p> + </div> + <div class="NAVFOOTER"> + <hr align="left" width="100%"> + <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="33%" align="left" valign="top"><a href="newrelease.html" accesskey="P">Prev</a></td> + <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td> + <td width="33%" align="right" valign="top"> </td> + </tr> + <tr> + <td width="33%" align="left" valign="top">Releasing a New Version</td> + <td width="34%" align="center" valign="top"> </td> + <td width="33%" align="right" valign="top"> </td> + </tr> + </table> + </div> +</body> +</html>