🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: necesito ayuda con una cadena de caracteres

#712
From: Pascal Bourguignon
Date: Wed, 20 Sep 2006 19:41
29 lines
2530 bytes
"teoria" <teoriaderedes@gmail.com> writes:

> Hola se�ores. Estoy haciendo una especie de bash y me encontr� con un
> problema.
> Tengo una cadena de caracteres ingresada por el usuario y quiero
> separar las palabras que hay en ella.
> Por ejemplo:
> tengo una cadena que contiene:
> 'sleep 10'
>
> Yo lo que necesito es formar un argv[] que sea de la siguiente forma
> argv[0] == 'sleep'
> argv[1] ==  '10'
>
> Esto se puede hacer artesanalmente, pero mi pregunta, no hay alguna
> funcion implementada qye ya me resuelva este problema???

Para hacer una especie de bash, hay un monton de funciones ya
implementadas que te resuelvan este problema y muchos otros, en las
fuentes de bash.  ftp://ftp.gnu.org/gnu/bash/bash-3.1.tar.gz

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

PUBLIC NOTICE AS REQUIRED BY LAW: Any use of this product, in any
manner whatsoever, will increase the amount of disorder in the
universe. Although no liability is implied herein, the consumer is
warned that this process will ultimately lead to the heat death of
the universe.
Technical Details
Message-ID: <87ac4u9vgi.fsf@thalassa.informatimago.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <1158776731.925375.57910@d34g2000cwd.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,d14f133debb57936
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Pascal Bourguignon <pjb@informatimago.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: necesito ayuda con una cadena de caracteres
Date: Wed, 20 Sep 2006 21:41:49 +0200
Organization: Informatimago
Lines: 29
Message-ID: <87ac4u9vgi.fsf@thalassa.informatimago.com>
References: <1158776731.925375.57910@d34g2000cwd.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: individual.net iZWanBHz8Qajmh+ojWKzzwuvpSD0TgJwE459fKxu6aYaURjLo5
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA
      oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9
      033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac
      l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR
      mV+hO/VvFAAAAABJRU5ErkJggg==
X-Accept-Language:         fr, es, en
X-Disabled: X-No-Archive: no
Importance: high
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)
Cancel-Lock: sha1:ErooPPefqOXXjPoND16vu0e5Nqs=