473,549 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: expected ')' before '*' token -- What is this ?

I am trying to write a simple libspf2 plugin code for my postfix
( milter)
I am getting this unhelpful error message when I try to compile

gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c
In file included from mfunc.c:1:
mfunc.c:42: error: expected ')' before '*' token
make: *** [mfunc.o] Error 1

my mfunc.c has on the line 42
-----------------------
.. . . . .
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {
SPF_response_t *spf_response = NULL;
SPF_result_t t;
SPF_request_set _ipv4_str( ecm_spf_request , ip );
SPF_request_set _helo_dom( ecm_spf_request , helo );
SPF_request_set _env_from( ecm_spf_request , sender );
SPF_request_que ry_mailfrom(ecm _spf_request, &spf_respons e);
t = SPF_response_re sult(spf_respon se);
SPF_response_fr ee(spf_response );
return t;
}

.. . . . .


So what could be the error ?
Thanks
Ram

PS:
Note to Spammers: Go ahead , send me spam
ra*@netcore.co. in
http://ecm.netcore.co.in/spamtrap.html

Jul 31 '07 #1
21 35494
Ram Prasad <ra**********@g mail.comwrites:
I am trying to write a simple libspf2 plugin code for my postfix
( milter)
I am getting this unhelpful error message when I try to compile

gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c
In file included from mfunc.c:1:
mfunc.c:42: error: expected ')' before '*' token
make: *** [mfunc.o] Error 1

my mfunc.c has on the line 42
-----------------------
. . . . .
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {
SPF_response_t *spf_response = NULL;
SPF_result_t t;
SPF_request_set _ipv4_str( ecm_spf_request , ip );
SPF_request_set _helo_dom( ecm_spf_request , helo );
SPF_request_set _env_from( ecm_spf_request , sender );
SPF_request_que ry_mailfrom(ecm _spf_request, &spf_respons e);
t = SPF_response_re sult(spf_respon se);
SPF_response_fr ee(spf_response );
return t;
}

. . . . .


So what could be the error ?
Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?
Jul 31 '07 #2
>
Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?

The file is here
----
#include "mdef.h"
FILE* LOGFILE;


/*
* Opens file ( /var/log/milter.log ) for debug log
* any milter code can print to log file using addlog function
*/
void opendbglog(void ){
LOGFILE=NULL;
LOGFILE=fopen(L OGFILENAME,"a") ;
if(LOGFILE==NUL L){
fprintf(stderr, "Couldnot open logfile\n");
exit(1);
}
fprintf(LOGFILE ,"opened logfile\n");
setvbuf(LOGFILE , (char *)NULL, _IONBF, 0);
}

/*
* Debug function
* using va_args for number of args
*
* usage addlog(number_o f_arguments,arg 1,arg2,arg3,arg 4...)
*/

void addlog(int num_args, ... ) {
va_list ap;
if(LOGFILE == NULL ) return;
va_start(ap,num _args);
while(num_args--) fprintf(LOGFILE ," %s ", va_arg(ap,char* ));
va_end(ap);
fprintf(LOGFILE ,"\n");
return;
}
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {
SPF_response_t *spf_response = NULL;
SPF_result_t t;
SPF_request_set _ipv4_str( ecm_spf_request , ip );
SPF_request_set _helo_dom( ecm_spf_request , helo );
SPF_request_set _env_from( ecm_spf_request , sender );
SPF_request_que ry_mailfrom(ecm _spf_request, &spf_respons e);
t = SPF_response_re sult(spf_respon se);
SPF_response_fr ee(spf_response );
return t;
}

Jul 31 '07 #3
Ram Prasad <ra**********@g mail.comwrites:
>>
Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?


The file is here
----
*snip*

I loaded into a syntax hilited editor and saw no obvious syntax errors -
I cant see anything manually despite a quick scan, I guess there might
be troubles in mdef.h where I assume you are including <stdio.hamong st
other things. Without it one cant really tell.

Try commenting blocks out and then reinstating them to pinpoint the
error.
Jul 31 '07 #4
Ram Prasad wrote:

Please don't remove attribution lines.
[Richard wrote]
>Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?


The file is here
----
#include "mdef.h"
FILE* LOGFILE;
It idiomatic in C to reserve all uppercase names for macros.
/*
* Opens file ( /var/log/milter.log ) for debug log
* any milter code can print to log file using addlog function
*/
void opendbglog(void ){
LOGFILE=NULL;
LOGFILE=fopen(L OGFILENAME,"a") ;
if(LOGFILE==NUL L){
fprintf(stderr, "Couldnot open logfile\n");
exit(1);
}
fprintf(LOGFILE ,"opened logfile\n");
setvbuf(LOGFILE , (char *)NULL, _IONBF, 0);
The cast is not needed.
}

/*
* Debug function
* using va_args for number of args
* usage addlog(number_o f_arguments,arg 1,arg2,arg3,arg 4...)
*/
void addlog(int num_args, ... ) {
va_list ap;
if(LOGFILE == NULL ) return;
va_start(ap,num _args);
while(num_args--) fprintf(LOGFILE ," %s ", va_arg(ap,char* ));
va_end(ap);
fprintf(LOGFILE ,"\n");
return;
}

SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {
SPF_response_t *spf_response = NULL;
SPF_result_t t;
SPF_request_set _ipv4_str( ecm_spf_request , ip );
SPF_request_set _helo_dom( ecm_spf_request , helo );
SPF_request_set _env_from( ecm_spf_request , sender );
SPF_request_que ry_mailfrom(ecm _spf_request, &spf_respons e);
t = SPF_response_re sult(spf_respon se);
SPF_response_fr ee(spf_response );
return t;
}
We'll need to see the definitions for SPF_*_t types. I can't spot anything
amiss, just looking at the above code.

Jul 31 '07 #5
Ram Prasad wrote:
>Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?


The file is here
[...]
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {
Just a guess: Does the header file (which you didn't show)
declare a type named `SPF_request_t' , or does it declare something
slightly different like `SPF_Request_t' or `SPF_request'? (Or
does it declare `struct SPF_request_t' but not `SPF_request_t' ?)

--
Eric Sosman
es*****@ieee-dot-org.invalid
Jul 31 '07 #6
On Jul 31, 5:25 pm, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
Ram Prasad wrote:
Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?
The file is here
[...]
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {

Just a guess: Does the header file (which you didn't show)
declare a type named `SPF_request_t' , or does it declare something
slightly different like `SPF_Request_t' or `SPF_request'? (Or
does it declare `struct SPF_request_t' but not `SPF_request_t' ?)

--
Eric Sosman
esos...@ieee-dot-org.invalid
I am not much of a cprogrammer myself , ( been doing perl all this
while)
But I am willing to improve

Here you go, this is my mdef.h sorry for not posting all src code in
first place.
The spf header files come from standard libspf2-devel rpm

-------
#ifndef MDEF_H
#include "milterconfig.h "
#define MDEF_H 1
#include "milterconfig.h "

#include <time.h>
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <sysexits.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <syslog.h>
#include <regex.h/* Provides regular expression matching */
#include <strings.h/* String utillity functions */
#include <libmilter/mfapi.h>
#include <netinet/in.h>
# include <inttypes.h>
# include <string.h> /* strstr / strdup */
# include <sys/socket.h /* inet_ functions / structs */
# include <netinet/in.h /* inet_ functions / structs */
# include <arpa/inet.h> /* in_addr struct */
# include <unistd.h>
# include <spf.h>

#ifndef true
# define false 0
# define true 1
#endif /* ! true */

struct blist {
char *key;
};
typedef struct blist bl;
struct ecm_list_stru {
int count;
bl *list;
};

typedef struct ecm_list_stru ecml;

#define BLACKLIST_FILE "blacklist. txt"
/* Global functions */
void opendbglog(void );
void addlog(int num_args, ... ) ;
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t,char* ip, char*
helo, char* sender);
int compbl(const void *m1, const void *m2);
int init_ecml(ecml* el,char *filename);
int searchlist(ecml el,char *needle);
/* All definitions here */
#define LOGFILENAME "/var/log/milter.log"
#define MLOGLEVEL 5 /* level of error logs generation
0-5 */
#define MAXFROMSIZE 200
#define SAMPLE 1
/* some std structures */
struct mlfiPriv
{
#ifdef SAMPLE
char *mlfi_fname;
FILE *mlfi_fp;
#endif
#ifdef SPFCHECK
char mfrom[MAXFROMSIZE];
#endif
};

#define MLFIPRIV ((struct mlfiPriv *) smfi_getpriv(ct x))
#endif




Jul 31 '07 #7
On Jul 31, 6:31 am, Ram Prasad <ramprasad...@g mail.comwrote:
I am trying to write a simple libspf2 plugin code for my postfix
( milter)
I am getting this unhelpful error message when I try to compile

gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c
In file included from mfunc.c:1:
mfunc.c:42: error: expected ')' before '*' token
make: *** [mfunc.o] Error 1

my mfunc.c has on the line 42
-----------------------
. . . . .
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {
SPF_response_t *spf_response = NULL;
SPF_result_t t;
SPF_request_set _ipv4_str( ecm_spf_request , ip );
SPF_request_set _helo_dom( ecm_spf_request , helo );
SPF_request_set _env_from( ecm_spf_request , sender );
SPF_request_que ry_mailfrom(ecm _spf_request, &spf_respons e);
t = SPF_response_re sult(spf_respon se);
SPF_response_fr ee(spf_response );
return t;

}

. . . . .

So what could be the error ?
Well, the message says that the syntax error occurred
In file included from mfunc.c:1
which (in a later post) appears to be your
#include "mdef.h"

Otherwise, your code does not appear to contain any syntax errors that
would be detected and reported as
mfunc.c:42: error: expected ')' before '*' token
so I'm guessing that your mdef.h header has the syntax error.

HTH
--
Lew

Jul 31 '07 #8
Ram Prasad wrote:
On Jul 31, 5:25 pm, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
>Ram Prasad wrote:
>Post all the code in that file and then "line 42" will be in context.
It isn't even apparent from above what IS on line 42. "----"? ". . .
"? or SPF_ ?
The file is here
[...]
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {

Just a guess: Does the header file (which you didn't show)
declare a type named `SPF_request_t' , or does it declare something
slightly different like `SPF_Request_t' or `SPF_request'? (Or
does it declare `struct SPF_request_t' but not `SPF_request_t' ?)
>
I am not much of a cprogrammer myself , ( been doing perl all this
while) But I am willing to improve

Here you go, this is my mdef.h sorry for not posting all src code in
first place. The spf header files come from standard libspf2-devel rpm
<snip header>

We still need the definitions for all the SPF_*_t types, particularly,
SPF_result_t and SPF_request_t.

Jul 31 '07 #9
Ram Prasad <ra**********@g mail.comwrites:
On Jul 31, 5:25 pm, Eric Sosman <esos...@ieee-dot-org.invalidwrot e:
>Ram Prasad wrote:
>Post all the code in that file and then "line 42" will be in context. It
isn't even apparent from above what IS on line 42. "----"? ". . . "? or
SPF_ ?
The file is here
[...]
SPF_result_t spfcheck_s(SPF_ request_t *ecm_spf_reques t, char* ip,
char* helo, char* sender) {

Just a guess: Does the header file (which you didn't show)
declare a type named `SPF_request_t' , or does it declare something
slightly different like `SPF_Request_t' or `SPF_request'? (Or
does it declare `struct SPF_request_t' but not `SPF_request_t' ?)

--
Eric Sosman
esos...@ieee-dot-org.invalid

I am not much of a cprogrammer myself , ( been doing perl all this
while)
But I am willing to improve

Here you go, this is my mdef.h sorry for not posting all src code in
first place.
And you still haven't. There are other includes that people here
probably wont have. milterconfig.h for a start.

I suspect it would be quicker for you to comment/uncomment bit by bit to
find your error yourself.

btw, you include milterconfig.h twice for some reason.
Jul 31 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5667
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
4
2104
by: Gary Wessle | last post by:
Hi I have been trying to find out the reason for this error for an 1hr, please look at it for me. thanks **************** error **************** $ make; ./proj g++ -gdwarf-2 -c -o gen_data.o gen_data.cpp
9
9545
by: Trent | last post by:
Here is the error while using Visual Studio 2005 Error 1 error LNK2019: unresolved external symbol "void __cdecl print(int,int,int,int,int,int,int,int)" (?print@@YAXHHHHHHHH@Z) referenced in function _main assign2.obj Thanks a lot ! Here is the code:
4
10154
by: nickyeng | last post by:
i calling this piece of java code in jsp : List<Customer> list = Customer.listby_page(currentRs); ... ... then it gives me the following error:
2
3086
by: brasewel | last post by:
Hi guys, I'm getting an error i cannot figure. Here is my code Header file ------------------------------------------------------------------------------------------- #ifndef Clock_H #define Clock_H #include <vector> #include <list>
5
7962
by: amitmool | last post by:
hi, i have used the queue library file and try to use the template as template <class QueueItem> queue <QueueItem>::~queue() // line 25 { } template <class QueueItem> void queue<QueueItem>::push(const QueueItem& entry) // line 42
1
2798
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I incorporate the same logic within my simulation, the class that implements the functor logic has problems compiling. I get the following errors: --...
2
1862
by: Latina | last post by:
Hi, I am doing a program using overloded operators but I am getting some error, Can some one help please. Here is my code: #include<iostream> #include<string.h> #include<cctype> using namespace std;
2
8090
by: kya2 | last post by:
I am not able to create following store procedure. CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT ) RESULT SETS 1 LANGUAGE SQL BEGIN part1 DECLARE TOTAL_LEFT INT DEFAULT 0; SELECT COUNT(*)INTO TOTAL_LEFT FROM DBSAMBA.REPORTEDTRANSACTION_S; WHILE (TOTAL_LEFT > 0) DO
6
14710
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing declerations.... #include <queue> #include <vector> #include <string> class database { queue<delayTP> delayThrouput;
0
7462
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7730
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7975
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7492
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5101
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1957
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
777
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.