
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <math.h>

int *S, check=0, verbose=0, vmax=0, nmax=100, nblignes = 1, randopt=0, pas = 1;

int * randtable( int n )  {
  int i,* res, max;
     res=(int *) malloc(n*sizeof(int));
     if ( ! vmax ) max = n;
     for(i = 0; i < n ; i++)
          res[i]=random() % max;
     return res;
     }
 
int * sorttable( int n )  {
  int i,* res;
     res=(int *) malloc(n*sizeof(int));
     for(i = 0; i < n; i++ )
          res[i] = i;
     return res;
     }
     
int verification(int * t, int n) {
     int i;
     for(i=0;i<n-1;i++)
          if(t[i]>t[i+1]) return (0);
     return (1);
     }

void printable(int * T, int n) {
  int i, max;
  max = n;
  if ( n > 10 ) max = 10;
  printf("\n");
  for(i = 0; i <= max;i++)
          printf(" %d", T[i]);
  if ( n > 10 ) printf(" etc ...");
  }

void  options(int argc ,char*argv[]) {
  int opt; char * optliste = "n:v:l:rch";
  while (( opt = getopt( argc, argv, optliste )) >= 0 ) {
      switch ( opt ) { 
       case 'n' : nmax     = atoi(optarg);    break; 
       case 'v' : vmax     = atoi(optarg);    break;  
       case 'l' : nblignes = atoi(optarg);    break; 
       case 'c' : check    = 1;               break;   
       case 'r' : randopt  = 1;               break;
       case 'h' : printf("\nusage : -n nmax -v vmax -check");
                  printf("\n      : -l nbignes -random"); 
		  printf("\n      : -help");
       default  : exit(1); 
      }
  }  
  pas = nmax / nblignes;
}
