🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #10993

Re: Actualizar el XF86Config desde un script

#10993
From: Ignacio Arenaza
Date: Sun, 06 Jan 2002 02:31
95 lines
3667 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "tas" == tas  <tas@subdimension.com> writes:

    IA> veces sin, entonces es otro cantar. Lo siento, me ## he basado
    IA> en mi XF86Config...

    IA> $i =~ /^\"?([^\"]*)\"?/o;

    tas> F�jate en que ya hemos hecho un split de todo el
    tas> path. Algunos '$i' tendr�n comillas (delante y/o detr�s), y
    tas> otros no.

Acabo de leer la pagina del manual de XF86Config y he visto que la
sintaxis de las lineas FontPath es diferente de lo que yo pensaba. Yo
creia que en caso de haber multiples paths, cada uno de ellos iba
entre comillas y separados por comas. Parece ser que el conjunto de
todos los paths es lo que va entre comillas. De ahi la expresion
regular que te daba. Corregido el error de concepto, quedaria en algo
como:

    #!/usr/bin/perl -w
    #
    # fichero busca_fontpath.pl
    #
    # Copyright (C) 2001 Ignacio Arenaza. Distribuible bajo licencia GPL.
    #
    use strict;
    
    my $IN;
    my $OUT;
    my $continue;
    my $last;
    my @paths;
    my %fontpaths;
    my $i;
    
    if (scalar(@ARGV) < 1) {
        print "\n\tDame un path al menos, �tio racano!\n\n";
        exit 2;
    }

    $continue = 0;
    %fontpaths = ();
    
    while (<STDIN>) {
        chomp;
        next unless (/^\s*FontPath/i or $continue);
    
        if (! $continue) {
            /^\s*FontPath\s(.*)$/io;
            $_ = $1;
        }
        /^\s*(.*)$/o;
        $_ = $1;
        $last = substr ($_, -1);
        if ($last eq "\\") {
            $continue = 1;
            chop;
        }
        else {
            $continue = 0;
        }
        @paths = split /,/;
        foreach (@paths) {
            # Nos cepillamos las comillas que tanta guerra dan.
            s/\"//g;
            # Nos quedamos con todo lo que pueda estar entre blancos.
            /^\s*(\S+)\s*$/o;
            $fontpaths{$1} = 1;
        }
    }
    
    if (defined ($fontpaths {$ARGV[0]})) {
        exit 0;
    }
    else {
        exit 1;
    }

Saludos. I�aki.

- -- 
  Get PGP/GPG Keys at  http://www.escomposlinux.org/iarenaza/pgpkey.html
  I use free software / Yo uso software libre

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt and GPG

iD8DBQE8N7cXZXLnGT1HLgcRAuvYAJ9UH8mP5OBmnNwjEGH3GLc1iDBBLgCfffoB
eZ4pxNPRlRIbYQKgcKunu3I=
=6KUz
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <87heq0ryzl.fsf@eb2ebu.ampr.org>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!213-98-91-117.uc.nombres.ttd.ES!not-for-mail
References: <rvhi0a.9aj.ln@127.0.0.1> <871yhdzkvi.fsf@eb2ebu.ampr.org> <mao21a.6eg.ln@127.0.0.1> <87k7uxk8gu.fsf@eb2ebu.ampr.org> <2gm51a.94k.ln@127.0.0.1>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,3ab78fa791df1f1e
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-01-05 19:20:21 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!213-98-91-117.uc.nombres.ttd.ES!not-for-mail
From: Ignacio Arenaza <iarenaza@eb2ebu.ampr.org>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Actualizar el XF86Config desde un script
Date: 06 Jan 2002 03:31:58 +0100
Organization: Servidor NNTP de eb2ebu.ampr.org
Lines: 95
Message-ID: <87heq0ryzl.fsf@eb2ebu.ampr.org>
References: <rvhi0a.9aj.ln@127.0.0.1> <871yhdzkvi.fsf@eb2ebu.ampr.org> <mao21a.6eg.ln@127.0.0.1> <87k7uxk8gu.fsf@eb2ebu.ampr.org> <2gm51a.94k.ln@127.0.0.1>
NNTP-Posting-Host: 213-98-91-117.uc.nombres.ttd.es (213.98.91.117)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1010287218 26337338 213.98.91.117 (16 [63420])
X-Orig-Path: julieta.escomposlinux.org!eriador.escomposlinux.net!eb2ebu.ampr.org!not-for-mail
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7