code implementation of a break point doesn't work in bigger file?

I tried to write a breakpoint function to debug a strange issue in another program. I test it out first in its own small test program. It works fine. I put it in the other file, (usage shown below) I get the following: Using gcc version 4.2.1 for Apple

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
format4.c: In function ‘breakpoint’:
format4.c:192: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:247: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:279: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:299: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:316: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:338: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:445: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:450: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:461: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:494: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:524: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:554: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:614: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:619: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:623: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:627: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:697: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:721: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:759: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:810: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:925: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
format4.c:938: error: old-style parameter declarations in prototyped function definition
format4.c:938: error: expected ‘{’ at end of input


lines 925 and 938 correspond to the beginning and end of the function, respectively.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void breakpoint(const char *str, ...)
{
	va_list list;
	va_start(list,str);
	char Buffer[1024];
	vsprintf(Buffer,str,list);
	printf("%s\n",Buffer);
        va_end(list);
	printf("Press \"e\" to exit or any other key to continue...\n");
	scanf("%s",Buffer);
	if(Buffer[0]=='e')
	{
		exit(490);
	}
}


1
2
breakpoint("replace called: original: %s, delimiter: %s, replacement: %s\n",(*original),delimiter,replacement);
breakpoint("buffer: %s, new_string: %s\n",buffer,new_string);
Is there a
#define breakpoint ... ...
somewhere (perhaps in some header)?

What happens if you rename the function? Say, to:
void my_break_point( const char *str, ... ) ;
I got the exact same error output. even `format4.c: In function ‘breakpoint’:` is the same. I even tried to make a copy in a different directory, close and reopen terminal, thinking maybe gcc caches the files to some extent. i grepped looking for "breakpoint" in /usr/include, nothing. I'm confused.
line 160: `void breakpoint(const char *str, ...)`

I was missing a semi-colon. *facepalm*

See I knew this question belonged here
I'd rather not post another thread, looking at that function, would there be any reason why the scanf() function wouldn't pause the program waiting for user input? It works in a smaller program, but not in a larger program. I have no idea what I should be looking for.

should I use vprintf instead?
Topic archived. No new replies allowed.