void help(char **); void main(int argc, char ** argv) { int i,debug,fichier; char fich[30]; debug=0; fichier=0; if ( .... ) printf ("Aucune option\n"); else { printf(" Analyse de cmd1\n"); for ( i=1; .... ; i++) { if ( .... != '-') { printf("Pas de '-'\n"); help( .... ); exit(); } switch ( .... ) { case 'h': { printf("Option -h\n"); help( .... ); exit(); } case 'd': { printf("Mode Debug\n"); debug=1; break; } case 'f': { printf("Option -f\n"); if (i == .... ) { printf("Pas de fichier\n"); help( .... ); exit(); } i=i+1; fichier=1; sprintf(fich,"%s", .... ); break; } default : { help(argv); exit(); } } } } printf("Execution de cmd1\n"); if ( debug == 1) printf("\tOption debug\n"); if ( fichier == 1) printf("\tOption fichier: %s\n",fich);} void help(char **argv) { printf("Utilisation de cmd1:\n"); printf("%s [-h -d] [-f nom de fichier]\n",argv[0]); printf("\t-h help\n\ \t-d mode debug\n\ \t-f nom_de_fichier\n\ \tsi l'option -f est omise on traitera stdin par defaut\n"); }