Makefile pour developpement multi-OS, multi-variants

crabs_makefile-5.2 ©2003-2008 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)

~~ / Pinfo.c
Makefile include.LINUX include.SOLARIS include.CGI include.CGI_BIN include.XPI xpi_rdf.xsl Pdepend.c Pinfo.c PrelativeHome.c PrelativePath.c Pprojetgpl.c Prelative.c PinfoGPL.sh PgenInfo_c.sh PenvProjet.sh Pinfo2html.sh Pinstall.sh PgenInfo_include.sh projet.env crabs_mk.sh crabs_mk.csh fr/crabs_makefile.po Makefile.SOLARIS
    1 /*
    2 **=============================================================================
    3 ** crabs_makefile-5.2 : Makefile pour developpement multi-OS, multi-variants
    4 ** Copyright (C) 2003-2008 : Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)
    5 **
    6 ** Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    7 ** et/ou le modifier en respectant les termes de la GNU General Public License
    8 ** version 2 ou (suite a votre propre choix) une version ulterieure.
    9 **
   10 ** Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   11 ** sans aucune garantie, meme si il est associe a un produit qui vous en
   12 ** propose une. Conformez-vous a la GNU General Public License pour avoir
   13 ** plus de precisions.
   14 **
   15 ** L'auteur ne peut etre tenu responsable de l'utilisation faite des
   16 ** composantes associees a ce projet (en partie ou dans leur totalite).
   17 **
   18 ** Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   19 ** de ce projet sous le nom gnu_gpl.txt
   20 **
   21 **=============================================================================
   22 */
   23 #include <sys/types.h>
   24 #include <fcntl.h>
   25 #include <stdio.h>
   26 #include <stdlib.h>
   27 #include <unistd.h>
   28 #include <string.h>
   29 #include <locale.h>
   30 #include <libintl.h>
   31 
   32 
   33 const char* START   = "@[PI] "  ;
   34 const char* STOP    = "@[PI]"   ;
   35 
   36 int main( int argc, char **argv )
   37     {
   38     int         in          ;
   39     char        b1  [1024]  ;
   40     char        b2  [1024]  ;
   41     size_t      len         ;
   42     size_t      i           ;
   43     size_t      j           ;
   44     size_t      k           ;
   45     size_t      lSTART      ;
   46     size_t      lSTOP       ;
   47     int         copie       ;
   48 
   49     setlocale( LC_ALL, "" ) ; textdomain( "libc" ) ;
   50     if ( ! argv[1] )
   51         {
   52         sprintf( b1, "%s file_name\n", argv[0] ) ;
   53         write( 2, b1, strlen( b1) ) ;
   54         exit( 1 ) ;
   55         }
   56 
   57     in = open( argv[1], O_RDONLY ) ;
   58     if ( in == -1 )
   59         {
   60         sprintf( b1, "open(%s):", argv[1] ) ;
   61         perror( b1 ) ;
   62         exit( 1 ) ;
   63         }
   64     lSTART = strlen( START ) ; lSTOP = strlen( STOP ) ;
   65     copie = 0 ; k = j = 0 ;
   66     while( ( len=read( in, b1, sizeof( b1 ) ) ) > 0 )
   67         for( i=0; i<len; i++ )
   68             {
   69             /*printf( "i=%6d copie=%d k=%6d j=%6d\n",i,copie,k,j) ;*/
   70             if ( !copie )
   71                 {
   72                 if ( b1[i] == START[j] ) j++ ;
   73                 if ( j == lSTART )
   74                     {
   75                     copie = 1 ;
   76                     k = j = 0 ;
   77                     continue ;
   78                     }
   79                 }
   80             if ( !copie ) continue ;
   81             if ( b1[i] < 32 )
   82                 {
   83                 copie = 0; j=0; k=0; continue ;
   84                 }
   85             if ( b1[i] == STOP[j] ) j++ ;
   86             if ( j >= lSTOP )
   87                 {
   88                 write( 1, b2, k-lSTOP ) ;
   89                 write( 1, "\n", 1 ) ;
   90                 copie = 0 ;
   91                 j = 0 ; k = 0 ;
   92                 }
   93             if ( k<sizeof(b2) )
   94                 b2[k++] = b1[i] ;
   95             }
   96     close( in ) ;
   97     return 0 ;
   98     }
   99 
Makefile include.LINUX include.SOLARIS include.CGI include.CGI_BIN include.XPI xpi_rdf.xsl Pdepend.c Pinfo.c PrelativeHome.c PrelativePath.c Pprojetgpl.c Prelative.c PinfoGPL.sh PgenInfo_c.sh PenvProjet.sh Pinfo2html.sh Pinstall.sh PgenInfo_include.sh projet.env crabs_mk.sh crabs_mk.csh fr/crabs_makefile.po Makefile.SOLARIS
~~ / Pinfo.c

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:47