LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2005, 11:41 AM   #1
smurff
Member
 
Registered: Sep 2004
Location: England
Distribution: Mandriva 2005LE / Whitebox
Posts: 48

Rep: Reputation: 15
Expain How this work please?


Hi,

Looking for some good log / debug witing tips and found this. Can someone explain what how this works to a kind of newbie please.
Thanks


int fw__debug_level;

int
fw__debug (char *f, ...)
{
va_list ap;
va_start (ap, f);

if (fw__debug_level >= 2)
{
/* print info commented to stdout */
fprintf (stdout, "\n<!-- \n");
vfprintf (stdout, f, ap);
fprintf (stdout, "\n -->\n");
fflush (stdout);
}

if (fw__debug_level >= 3)
{
/* also print info to stderr */
vfprintf (stderr, f, ap);
fflush (stderr);
}

if (fw__debug_level >= 4)
{
/* also print direct to stdout */
vfprintf (stdout, f, ap);
fflush (stdout);
}

va_end (ap);

return 0;
}
 
Old 12-05-2005, 12:39 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
I presume you're curious about the va_list/va_start/va_end "variable arguments" stuff. Here's a good article that might help:

http://www.codeproject.com/cpp/C___V..._Arguments.asp
 
Old 12-05-2005, 02:48 PM   #3
smurff
Member
 
Registered: Sep 2004
Location: England
Distribution: Mandriva 2005LE / Whitebox
Posts: 48

Original Poster
Rep: Reputation: 15
Thanks Paul
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does the mounting of a *BSD partition on linux work work well when rw ? kloss *BSD 3 10-08-2005 02:21 PM
Will Ubuntu Work work With my Wireless Card? PulsarSL Ubuntu 3 10-07-2005 10:33 PM
got ALSA to work in root, need help getting it to work in my user profile ic3 Slackware 2 11-28-2003 10:32 PM
FALCONS EYE (nethack) FAILS ON STARTUP, use to work, wont work even after reinstall roorings Linux - Software 0 10-08-2003 10:39 PM
UPS cable didn't work. A cool work-around jlangelier LinuxQuestions.org Member Success Stories 1 07-18-2003 05:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration