#include #include #include #include #include /* #Sp‚cification: verfind / analyse un r‚vision A partir du path du premier makefile.dat (ancetre), retrace le path de tous les autres sous makefile.dat composant cette revision. Retrouve ceux uniquement associ‚ a cette r‚vision */ int main (int argc, char *argv[]) { int ret = -1; char *kitombre = getenv("KITOMBRE"); if (argc != 2){ fprintf (stderr, "cd /kit/ombre\n" "verfind _6_1_6_1.s\n"); }else if (kitombre == NULL){ fprintf (stderr,"kitombre n'est pas d‚fini\n"); }else{ char *tbpath[2000]; int nbpath = 1; char start[MAXSIZ_PATH]; path_make (argv[1],"makefile.dat",start); tbpath[0] = strdup_err (start,1); while (nbpath > 0){ char *fmake = tbpath[--nbpath]; { // C'est tout ce qui nous interesse char dpath[MAXSIZ_PATH]; path_splitlex (fmake,dpath,NULL); printf ("%s\n",dpath); } FILE *fin = fopen_err (fmake,"r",1); char nom[MAXSIZ_NAME*2+1+1]; char date[20]; char time[20]; char path[MAXSIZ_PATH]; char buf[500]; while (fgets(buf,sizeof(buf)-1,fin)!=NULL){ if (sscanf (buf,"%s %s %s %s",nom,date,time,path)==4 && strchr(nom,'/')!=NULL && strncmp(path,"$(KITOMBRE)",11)==0){ // Verifie si c'est la mˆme r‚vision char decomp[MAXSIZ_PATH]; path_splitlex (path,decomp,NULL); path_splitlex (decomp,NULL,decomp); //printf ("Trouve %s -> %s\n",path,decomp); if (strcmp(decomp,argv[1])==0){ // Accumule le path dans tbpath path_make (kitombre,path+11,path); tbpath[nbpath++] = strdup_err (path,1); } } } fclose (fin); free (fmake); } ret = 0; } return ret; }