🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Actualizar el XF86Config desde un script

#10982
From: Ignacio Arenaza
Date: Fri, 04 Jan 2002 23:22
108 lines
3960 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

    tas> El churro :) tal y como lo has escrito falla en casi todos
    tas> los casos (y porque nos vamos conociendo, no descarto que los
    tas> errores los hayas puesto intencionadamente :) , pero he
    tas> cogido la idea.

No, ya digo que fue algo rapido y sucio. Probe con mi XF86Config, que
no tiene tabuladores, sino solo espacios. De ahi la mayoria de los
problemas y el que no me plantease siquiera el tema de los
"separadores blancos".

#!/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;

$continue = 0;

# La siguiente l�nea no pinta nada, as� que la quito...
#print "$ARGV[1]\n";

   ####<--- Glubs, restos del debugging ;-)

while (<STDIN>) {
    chomp;
# Para que no haya l�os entre espacios y tabuladores...
#    next unless (/^ *FontPath/i or $continue); 
##    next unless (/^[ \t]*FontPath/i or $continue);
#
# mejor:
    next unless (/^\s*FontPath/i or $continue);

    if (! $continue) {
#        /^ *FontPath (.*)$/io;
##        /^[ \t]*FontPath[ \t](.*)$/io;
#
# idem que arriba
        /^\s*FontPath\s(.*)$/io;
        $_ = $1;
    }
#    /^ *(.*)$/o;
##    /^[ \t]*(.*)$/o;
    /^\s*(.*)$/o;
    $_ = $1;
    $last = substr ($_, -1);
    if ($last eq "\\") {
        $continue = 1;
# No me vuelvas loco. Hay una funci�n que hace esto :)
#        $_ = substr ($_, 0, length ($_)-1);
        chop;
## Ya ves, y yo volviendome loco para quitar el ultimo
## caracter de la cadena de marras. Memoria la mia...
	}
    else {
        $continue = 0;
    }
    @paths = split /,/;
    foreach $i (@paths) {
# Esta l�nea es la que provoca la mayor�a de los fallos...
#        $i =~ /^[^\"]*\"([^\"]*)\"/o;
##
## Hummm, no se como rayos tendras los paths en tu XF86Config, pero si
## estan entre comillas te hara falta lo que yo te he dado. Si tienes
## a veces con y a veces sin, entonces es otro cantar. Lo siento, me
## he basado en mi XF86Config...

        $i =~ /^\"?([^\"]*)\"?/o;
	$_ = $1;
        $fontpaths{$_} = 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

iD8DBQE8NjkgZXLnGT1HLgcRAlUMAJ0co6zvt5P4ab2DgNWlqNQcm+AAjACeLH7P
kpiifE+GL6DM4owD8AKxt14=
=anWX
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <87k7uxk8gu.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!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!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>

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-04 17:20:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!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: 05 Jan 2002 00:22:09 +0100
Organization: Servidor NNTP de eb2ebu.ampr.org
Lines: 108
Message-ID: <87k7uxk8gu.fsf@eb2ebu.ampr.org>
References: <rvhi0a.9aj.ln@127.0.0.1> <871yhdzkvi.fsf@eb2ebu.ampr.org> <mao21a.6eg.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 1010193611 25435659 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