🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Preguntillas C y Linux.

#16267
From: batsman
Date: Tue, 02 May 2000 00:00
90 lines
3756 bytes
-----BEGIN PGP SIGNED MESSAGE-----


    >>>> El Mon, 1 May 2000 17:38:04 +0200, Santiago Romero
    >>>> aporre� su teclado, y logr� este curioso efecto:

>El Mon, 01 May 2000 06:32:58 GMT, batsman escribi�:
>>man regcomp
>>
>>regcomp(3)                     GNU                     regcomp(3)
>
> a ver si esto esta bien.
> tengo esto:
>
>struct Filters
>{
>   int     num_rules;
>   struct regex_t **rules;
    ^^^^^^^^^^^^^^^^^^^^^^^
Es sin struct, ya est� hecho el typedef:

:r !cat /usr/include/regex.h|grep regex_t|grep typedef

typedef struct re_pattern_buffer regex_t;

	
>};
>
> y luego esto:
>
>  if(GetFirstWord( where+strlen("from"), 255, word ))
>  {
>      // add the filter
>      filters->num_rules++;
>      realloc( filters->rules,
>               filters->num_rules*sizeof(struct regex_t **) );
Tienes que tomar el valor del realloc.                   ^^ 
					una pijada, pero es un solo *

tendr�as que poner algo como
      void *old=filters->rules;
      filters->rules = realloc ( filters->rules, 
		filters->num_rules*sizeof(regex_t *) );
      if (filters->rules = NULL ) {
	 /* no se ha podido obtener memoria */
	 /* dos posibidades, o bien seguimos como si nada, poniendo 
	 	filters->rules = (regex_t **)old; filters->num_rules--;
	    o bien 
	    	free(old); return(-1); // o exit o lo que quieras
	 */
      }

>      regcomp( filters->rules[filters->num_rules-1], word, 0 );
>      regfree( filters->rules[filters->num_rules-1]);
>      printf("%s\n", word );
>   }
>
> Pero la compilaci�n me dice esto:
>
>gcc -o checkmail popsockets.c serverwork.c cfgfile.c checkmail.c
>cfgfile.c: In function `ParseFilterFile':
>cfgfile.c:371: warning: passing arg 1 of `regcomp' 
>                        from incompatible pointer type
>cfgfile.c:372: warning: passing arg 1 of `regfree' 
>                        from incompatible pointer type

A ver si se va con lo del struct...

- -- 
              _           _                             
             | |__   __ _| |_ ___ _ __ ___   __ _ _ __  
             | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
             | |_) | (_| | |_\__ \ | | | | | (_| | | | |
             |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|

             Real email: batsman dot geo at yahoo dot com

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: Public key via email: send mail with Subject: [PGPKEY]

iQEVAwUBOQ62K70Y27yr0iefAQHCtQgAoTSZBUI3s08eRwV3YODRrIDTknSRmCcp
4/7ytABmKvz16sGKoKHxxrDuhJrQWQIx5CMP17LojgdUPQcgvtmkVbFozMbM87St
etnecSZUPfxdmDgiKD5mQqjZpO2qMWaEQZLF9fDGXIkPL90hAiz25AwGrniJ2TKK
nwGewvkbSnAUrsYsHFibF+crob3vR4XaQmVudBIOprwomYAP8jT2OhnzIVxmrn6U
1N2XsxOm0US2yMGyuc6YeuzUCsU/Rd6tP3YYZ6aRRW6mBstMFWFA3x2nZ2o9mWwv
MeeaZMjfLjwtnbA+UJ7LM8ol3mcY6yuxDeZw4Sj6Vm5BXVeJnNia0w==
=hgPw
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <gncme8.0e.ln@simpsons4ever>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <slrn8goisq.33m.nop@compiler.linux.es> <t8fje8.ie.ln@simpsons4ever> <slrn8gr96s.367.nop@compiler.linux.es>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,21477be2e2f46d7
X-Google-Attributes: gidf86c8,public
From: batsman@simpsons.for.ever (batsman)
Subject: Re: Preguntillas C y Linux.
Date: 2000/05/02
Message-ID: <gncme8.0e.ln@simpsons4ever>
X-Deja-AN: 618187827
Content-Transfer-Encoding: 8bit
References: <slrn8goisq.33m.nop@compiler.linux.es> <t8fje8.ie.ln@simpsons4ever> <slrn8gr96s.367.nop@compiler.linux.es>
Content-Type: text/plain; charset=iso-8859-1
X-Complaints-To: abuse@news.wanadoo.es
X-Trace: m2newsread.uni2.es 957258805 62.37.26.8 (Tue, 02 May 2000 11:13:25 MET DST)
Organization: Wanadoo Usenet News - Visita http://www.wanadoo.es/
Mime-Version: 1.0
User-Agent: slrn/0.9.5.3 (UNIX)
Reply-To: see_signature-mira_firma
NNTP-Posting-Date: Tue, 02 May 2000 11:13:25 MET DST
Newsgroups: es.comp.os.linux.programacion