(Courriels de diversion: <garde-cotes@crochetent-disputeront.com> <blasonner@hissais-obstines.com> <commemorerez@abrutissions-discuterent.com> <tantieme@remilitariser-decapitez.com> <abat@degrisaient-epanouissiez.com> <vilipenderont@releguerent-parades.com> <efforciez@deflation-banniraient.com> <agressais@tricoterai-lenifiantes.com> <frigidite@immortel-marmonneront.com> <radiographiee@reflechissiez-annoterons.com> )
Selon Franz-Albert VAN DEN BUSSCHE <fa.vdb@free.fr>: > Le jeudi 18 Novembre 2004 21:44, jeanmichel.123@free.fr a écrit :> > oui; et puis après avoir détruit ~/.libralux > > [jmg@localhost src]$ ls -dl ~/.libralux> > drw---xr-- 2 jmg jmg 4096 nov 18 21:19 /home/jmg/.libralux/ > > [jmg@localhost src]$> > > > voir fichier init.c; ligne 101: > > mkdir (prefix) > > Cependant, je ne sais pas trop ce que fait cete fonction, vu que ma manpage > > documente la fonction prenant deux paramètres: > > int mkdir(const char *pathname, mode_t mode); > > Pour résumer, dans init.c et s'il n'existe pas de libralux.cfg on en crée un > dans ~/.libralux > Donc après un premier : libralux --help tu dervais trouver un > ~/.libralux/libralux.cfg > > Mais je vais revoir çà. En attendant voici mon libralux.cfg à toi de > l'adapter. Je reste sur ma position, il semble préférable d'utiliser un mkdir a deux arguments. (Voir les fichiers joints). Les fichiers joints sont: - init.c le fichier uinit.c avec mes modifications. - init.c.diff un cvs diff classique - init.c.diff.u un cvs diff -u Ceci me permet de passer de drw---xr-- 2 jmg jmg 4096 nov 18 23:54 /home/jmg/.libralux// à drwx------ 2 jmg jmg 4096 nov 18 23:48 /home/jmg/.libralux// Jean-Michel
/***************************************************************************
* LibraLux *
* Copyright (C) 2004 by FaVdB *
* *
* Contact : biglux@culte.org * * *
* Licence : GNU Public License (GPL) *
* *
* Projet BigLux (http://www.culte.org/projets/biglux) de synthèse *
* pour non ou mal-voyant *
* *
* BigLux project (http://www.culte.org/projets/biglux) to synthetisis *
* for disabilties peoples *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <termios.h>
#include <unistd.h>
#include "structures.h"
#define INIT_C
#include "lexique.h"
#include "util.h"
#include "nett.h"
#include "tagger.h"
#include "phonet.h"
#include "init.h"
#include "options.h"
#include "sys/stat.h"
/*************************************************************************
* Description : Charge les lexiques et autres fichiers de règles
*************************************************************************/
#define NOM_FICHIER(a,b) a = b;if (a[0] != '/') a = add_chaines(prefix, b, "/");
struct termios tio,
saved;
int llp_init(int *pargc, char **ppargs)
{
FILE *file;
// Variables d'initialisation du formattage
char *nomspec,
*nomloc;
// char *nomlex, *nomlong;
char prefix[PATHLEN];
// Variables d'initialisation de l'étiquetage
char *nomcatal,
*nommorpho,
*taglex;
char *nompmc,
*nomml,
*nomnp;
// Variables d'initialisation de la phonetisation
char *nomreg_l,
*nomhlex;
char *ficregP,
*ficExep;
char *ficregD,
*ficregE,
*ficregL;
char *fmtprop;
char *ficprop[NBTNP];
char *nomrule;
int siafreg;
int affich;
int ilang;
int rc = 0;
if (llp_initialized)
return (0);
frequence = 100;
tempo = 60;
num_voix = 3;
// Affichage des options par défaut
affiche_options(p_llpopt);
// Lecture du fichier de configuration
if ((file = ouvrir_cfg(prefix)) == NULL) {
sprintf(prefix, "%s/.libralux", getenv("HOME"));
fprintf(stderr, "Création de %s/libralux.cfg\n", prefix);
mkdir(prefix,S_IRWXU);
//mkdir(prefix);
fic_ecrire_options(prefix);
} else {
fic_lire_options(file);
fclose(file);
verbose=OPT_GET_INT(verbose);
// Affichage des options après prise en compte du fichier de
// configuration
LogERR(3, "llp_init : après lecture cfg\n");
affiche_options(p_llpopt);
}
LogERR(2, "llp_init : config=%s/libralux.cfg\n", prefix);
// Prise en compte des options de la ligne de commande
traite_options(pargc, ppargs, p_llpopt);
verbose=OPT_GET_INT(verbose);
affiche_options(p_llpopt);
if (option_modified)
fic_ecrire_options(prefix);
// Initialisation du formattage
strcpy(prefix, OPT_GET_PTR(generalpath));
NOM_FICHIER(nomspec, "speciaux");
NOM_FICHIER(nomloc, "locutions");
if ((arbre_spec = charger_arbre()) == NULL) {
LogERR(1, "llp_init : nomspec %s/speciaux impossible à trouver\n", prefix);
exit(-3);
}
// Initialisation de l'étiquetage
NOM_FICHIER(nomcatal, "lm3classe.arpa.sirlex");
NOM_FICHIER(nommorpho, "model_morpho");
NOM_FICHIER(taglex, "lex10k.sirlex");
NOM_FICHIER(nompmc, "lex10k");
NOM_FICHIER(nomml, "lm3classe.arpa");
NOM_FICHIER(nomnp, "model_np");
if (OPT_GET_INT(acc)) {
NOM_FICHIER(taglex, "lex10k.acc.sirlex");
NOM_FICHIER(nompmc, "lex10k.acc");
}
S_ET_tagger = charge_tagger(nomcatal, nompmc, nomml, nommorpho);
if ((S_ET_lex = charge_lexique(taglex)) == NULL)
return (-2);
S_ET_morpho_np = charge_model_morpho(nomnp);
// Initialisation de la phonetisation
NOM_FICHIER(nomreg_l, "regles_l.pro3");
NOM_FICHIER(nomhlex, "h_aspi.sirlex");
NOM_FICHIER(ficregP, "french01.pron");
NOM_FICHIER(ficExep, "list_exep");
NOM_FICHIER(ficregD, "desigle.pron");
NOM_FICHIER(ficregE, "epeler_sig.pron");
NOM_FICHIER(ficregL, "lire_sig.pron");
NOM_FICHIER(fmtprop, "propername_%d.pron");
for (ilang = 0; ilang < NBTNP; ilang++) {
ficprop[ilang] = strdup(fmtprop);
if (ficprop[ilang] == NULL) {
LogERR(1, "llp_init : ficprop[%d] %s impossible à trouver\n", ilang, ficprop[ilang]);
return (-1);
}
sprintf(ficprop[ilang], fmtprop, ilang + 1);
}
NOM_FICHIER(nomrule, "rule_phon.pro");
// Initialisation phonetisation_phase2
if ((S_PH2_regles_liai = charge_regles_liaison(nomreg_l)) == NULL)
return (-4);
S_PH2_hlex = charge_lexique(nomhlex);
// Initialisation phonetisation_phase3
SeeReg = AfFrontiere = False;
siafreg = False;
AfLiaison = True;
set_poids_regle(0);
if ((S_PH3_regsP = lecture_regles_ph(ficregP, &S_PH3_nbrP)) == NULL)
return (-6);
if (siafreg) {
affiche_regles_ph(S_PH3_regsP, S_PH3_nbrP);
exit(-1);
}
if ((S_PH3_regsD = lecture_regles_ph(ficregD, &S_PH3_nbrD)) == NULL)
return (-7);
if ((S_PH3_regsL = lecture_regles_ph(ficregL, &S_PH3_nbrL)) == NULL)
return (-8);
if ((S_PH3_regsE = lecture_regles_ph(ficregE, &S_PH3_nbrE)) == NULL)
return (-9);
for (ilang = 0; ilang < NBTNP; ilang++)
if ((S_PH3_regs[ilang] = lecture_regles_ph(ficprop[ilang], S_PH3_nbr + ilang)) == NULL) {
LogERR(1, "llp_init: lecture_regles_ph %s == NULL\n", ficprop[ilang]);
exit(-10);
}
if (charge_exception(ficExep) == -1) {
LogERR(1, "llp_init : ficExep %s non trouvé\n", ficExep);
exit(-1);
}
// Initialisation phonetisation_phase4
affich = False;
set_poids_regle(1);
if ((S_PH4_regles = lecture_regles_ph(nomrule, &S_PH4_nbr)) == NULL)
exit (-12);
LogERR(3, "llp_init : Terminé\n");
tcgetattr(0, &tio);
tcgetattr(0, &saved);
tio.c_lflag &= ~ICANON;
tio.c_lflag &= ~ECHO;
tcsetattr(0, TCSANOW, &tio);
tcsetattr(0, TCSANOW, &saved);
llp_initialized = 1;
return (0);
}
static void llp_fin(liste * phrases)
{
int ilang;
// Nettoyage étiquetage
liberer_tagger(S_ET_tagger);
liberer_lexique(S_ET_lex);
liberer_model_morpho(S_ET_morpho_np);
// Nettoyage phonetisation_phase2
liberer_lexique(S_PH2_hlex);
// Nettoyage phonetisation_phase3
liberer_exceptions();
liberer_regles_ph(S_PH3_regsP, S_PH3_nbrP);
liberer_regles_ph(S_PH3_regsD, S_PH3_nbrD);
liberer_regles_ph(S_PH3_regsL, S_PH3_nbrL);
liberer_regles_ph(S_PH3_regsE, S_PH3_nbrE);
for (ilang = 0; ilang < NBTNP; ilang++)
liberer_regles_ph(S_PH3_regs[ilang], S_PH3_nbr[ilang]);
// Nettoyage phonetisation_phase4
liberer_regles_ph(S_PH4_regles, S_PH4_nbr);
return;
}
Index: init.c =================================================================== RCS file: /cvsroot/biglux/LibraLux/src/init.c,v retrieving revision 1.2 diff -r1.2 init.c 51a52,53 > #include "sys/stat.h" > 101c103,104 < mkdir(prefix); --- > mkdir(prefix,S_IRWXU); > //mkdir(prefix);
Attachment:
init.c.diff.u
Description: Binary data