-----------------------------------------------------------------------
Pre Make Kit coding style file

Document revision:
# $Id: style.txt,v 1.5 2004/08/26 20:03:08 xsa Exp $
-----------------------------------------------------------------------

                        RECOMMENDED CODING STYLE FOR PMK
                        --------------------------------

1) Comments

/*
	This is a function heading comment.

	Here the input arguments.

	return : and here the output.
*/

/* simple in-code comment */

/*
	Recommended multiline comment.
	Other formats are allowed.
*/

Comments in the code are GREATLY appreciated.


2) Includes

#include <system_first.h>

#include "local_after.h"

Each group of include can be sorted in alphabetical order.


3) Prototypes

Use of tab indenting is recommended.
Extra space to line up functions could be nice.

void	 first_proc(void *);
char	*second_proc(char, int);
int	 third_proc(char *);


4) Structures

It uses the same specs as above, see the following example:

struct mystruct {
	char	*first_field;
	int	 second_field;
	double	 third_field;
};


5) Variables

Always the same format:

FILE	*first_var;
int	 second_var;
char	 third_var[NB_CHAR],
	*fourth_var;

Variables could be sorted by type in alphabetical order.
You can also group them by letter case with uppercase first.


6) Keywords

Keywords should be followed by a space instead of functions.


7) Functions

Function must be declared on one line with type, function name,
arguments and open brace as the following :

int first_proc(char *arg_one, int arg_two) {

Variables declared in functions respect the same rules defined in
the fifth section.

8) Error messages

When using the errorf() function, the format should look like the following:

  errorf("error message starting with a lowercase.");

    or

  errorf("error message %s : %s.", var, strerror(errno));

You should always use strerror(errno) when possible.
Note that error messages always end with a dot (.) and start with a lowercase.

9) Exit statements

- exit(EXIT_FAILURE) and exit(EXIT_SUCCESS) should be used respectively
  instead of exit(1) and exit(0).
