<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="Riccardo Facchetti"> <meta name="GENERATOR" content="Mozilla/4.74 [en] (X11; U; Linux 2.4.3 i586) [Netscape]"> </head> <body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FF0000"> <h2> Coding Style</h2> These are simple rules to follow while writing code for APCUPSD. These rules are not absolute as anyone can use their preferred style. What is asked here is to follow as much as possible the general APCUPSD code layout. <p>The function indenting can be: <p>type function(type arg1, type arg2,...) { <p>} <p>This is the preferred indentation because it is more readable. <p>Local and global variable are all lowercase and with a meaningful name. Functions and globans not exported to other modules are `static'. Function names are meaningful. Defines are all uppercase and with meaningful name. Do not use TABs. Always expand them to spaces. The preferred expansion is 4 chars. <p>Data structures are all in apc_struct.h. Defines are all in apc_defines.h. Externs are all in apc_externs.h. Lately, as the code is growing, it is preferred to write header files dedicated to the single source module. <p>Flow control is indented like the function example above. Comments are not only welcome: piece of code that may resemble like black magic _must_ be well commented. <p>Diffs are to be submitted as `diff -u -r --new-file <old-tree> <new-tree>' <p>Configure is your friend: learn how to add modules to Makefile.in and tests to configure.in <p>Try to keep logical position of files: docs in doc/, config files in etc/, include files in include/ sources in lib/ daemons/ or clients/, distribution specific files in distributions/<whatever>. <br> </body> </html>