
libbadpenguin 0.2.0
===================
libbadpenguin is a static library used in many utilities that are part
of the AGX's GNU/Linux distribution "Bad Penguin". It provides functions
to manage the filesystem, chains of data and the colors of the terminal.



badpenguin-ansi.h
-----------------
Include macros and constant to be used on console terminals
to handle colors. You can use the FG_* and BG_* constants into
a printf statement to change the foreground and background color
of your terminal or one of the other defined macros to manage
the colour terminal.



badpenguin-chain.h
------------------
This system provide you the ability to manage double-linked
lists. First allocate a root node with:
    TChain *mychain = NULL;
    mychain = chain_create();

then you can add new items:
    TChainItem *myitem = NULL;
    myitem = chain_append(mychain);

you can add a new items in ascending order using the 'name'
properties of the TChainItem structure:
    TChainItem *myitem = NULL;
    myitem = chain_insert(mychain, "green", 0);
the thirth parameter is the order (0=ascending; 1=descending)

you can delete the whole chain with:
    chain_cleanall(mychain);
and if you want also to dispose the main pointer:
    chain_delete(mychain);
    
The main chain have a member 'count' with the number of items
currently into the chain.

Each chain's item have a member to hold a nema (char*) and
the item's data, this member called 'data' is of type (void*)
so require type castingt to be used.



badpenguin-errors.h
-------------------
It is a simple list of common errors used into badpenguin tools.



badpenguin-fs.h
-------------------
It is a list of function to access the filesystem:

- int deltree(char *s);
  recursively delete the specified directory, I/O errors are signaled
  as warnings and are non blocking;

- char *dirbase(char *s1) {
  allocate space for a new string containing the basename of *s1
  
- char *dirpath(char *s1);
  allocate space for a new string containing the dirname of *s1

- long diskfree(char *s);
  return the number of bytes available under a specified directory of
  a give mounted filestytems. Return -1 in case of errors.
  
- int file_exists( char* s );
  return 0 if the file, dir or link exists otherwise it's an I/O error;
  
- int file_time( char *filename, time_t newtime, time_t nowtime );
  set the new access and modification datatime upon a file;

- int is_directory( char *p, char *d );
  check if a file specified as path (p) + basename (d) is a directory
  or not
  
- int is_regularfile( char *p, char *d );
  check if a file specified as path (p) + basename (d) is a regular
  file or not
  
- int makedir( char* s, mode_t m );
  create a directory, if the father directory also does not exists
  try to create it;

- int move_dir( char* source, char* target);
  move a full directory tree
  
- int move_file( char* source, char* target);
  move a file on the same filesystem, if the files are on two different
  filesystems then it try to copy it first and then to unlink the old one;
  
- int read_line( FILE* fd, char* buffer );
  read a line from a text file ignoring '\r' and returning when '\n'
  or the EOF is encountered;

- int runshell (char *command);
  execute the specified command using the shell 'sh'
  
- int runcommand (char *options[], int fdin, int fdout, int fderr );
  run the command directly without the shell but you have to give an
  array of program options where options[0] is the binary file to run
  and also you can redirect the input, output or error from/to a 
  different file

- char *strtoken( char **s, char *d);
  instead of strtok this return NULL when 2 delimiters are not
  separated by any chars like in /etc/group for example
 
 
  
badpenguin-untar.h
------------------
This provide the untar() function that is used to exctract a .tar.gz or
just a .tar file into a temporary directory and according to determinet
options.

This contains also libbadpenguin_version() that can be used to print
the version of the library builded into the program and the version
of the Z lib used.

