/* Ce programme permet de d‚marrer le systŠme RCS Il prend tous les fichier "sources" d'un r‚pertoire et tente de les archiver dans le r‚pertoire courant en leur donnant la version 1. Il cr‚e du mˆme coup le fichier makefile.dat et l'archive. Tout en faisant l'archivage, il d‚sarchive dans le r‚pertoire ombre. */ #include #include #include #include #include "projet.h" unsigned int _stklen=20000; void error_showdef (int noerr, ...) { fprintf (stderr,"Error #%d\n",noerr); gets(""); } static void usage(void) { fprintf (stderr,"bootrcs [-t] projet\n"); fprintf (stderr,"bootrcs [-t] -\n"); exit (-1); } class SCREEN_LOG: public PROJET_LOG{ public: SCREEN_LOG(const char *fname, int append); void sendstr(const char *str); }; SCREEN_LOG::SCREEN_LOG(const char *fname, int append) : PROJET_LOG(fname,append) { } void SCREEN_LOG::sendstr (const char *str) { PROJET_LOG::sendstr(str); ::printf ("%s",str); } /* Retourne conditionnellement une valeur de variable dans l'environnement */ static const char *chkenv ( const char *var, // Nom de la variable const char *def) // Valeur par d‚faut { const char *ret = getenv(var); if (ret == NULL) ret = def; return ret; } static void bootrcs_showinfo(const USERINFO *user, const char *projet) { char path[MAXSIZ_PATH]; user->makusrpath (projet,path); printf ("R‚pertoire groupe : %s\n",path); user->makombpath (projet,path); printf ("R‚pertoire ombre : %s\n",path); user->makbldpath (projet,path); printf ("R‚pertoire build : %s\n",path); } int main (int argc, char *argv[]) { int ret = -1; if (argc != 2 && argc != 3){ usage(); }else if (file_exist ("makefile.dav")){ fprintf (stderr,"Ce r‚pertoire a d‚j… ‚t‚ archiv‚\n"); }else{ char *projet = argv[1]; if (strcmp(projet,"-")!=0 && file_exist("makefile.dat")){ fprintf (stderr,"Le fichier makefile.dat existe ???\n"); }else{ if (strcmp(argv[1],"-t")==0){ if (argc != 3){ usage (); } rcs_setmode (1); projet = argv[2]; }else{ rcs_setmode (0); } if (strcmp(projet,"-")==0) projet = ""; USERINFO user(prog_getid(true),"v42" ,chkenv("KITGROUPE",EVOL "/kit/groupe2") ,chkenv("KITGROUPE",EVOL "/kit/groupe2") ,chkenv("KITOMBRE" ,EVOL "/kit/ombre")); PRJCTRL ctrl(&user); SCREEN_LOG log("bootrcs.log",1); rcs_setlog (&log); bootrcs_showinfo(&user,projet); SSTRINGS tberr; int nberr = livre_test (&user,&ctrl,projet,false,tberr); if (nberr > 0){ ret = -1; fprintf (stderr ,"Les fichiers suivants ne sont pas archivables\n"); for (int i=0; i