[Code study] lp_motd_file defination? Help

Daniel.Li daniel_li at usish.com
Wed Apr 22 08:29:49 GMT 2009


On Wed, 2009-04-22 at 15:54 +0800, Daniel.Li wrote:
> Dear List,
> 
> Currently, I read this in clientserver.c, line 148.
> 
> motd = lp_motd_file();
> 
> I have googled, but didn't the definition of char *lp_motd_file(void).
> Can anyone help to explain the following code segment. Many thanks.

I got this, just take a closer look at those macros

FN_GLOBAL_STRING(lp_motd_file, &Globals.motd_file)
#define FN_LOCAL_STRING(fn_name,val) \
char *fn_name(int i)
{return((LP_SNUM_OK(i)&&pSERVICE(i)->val)?pSERVICE(i)->val :
(sDefault.val?sDefault.val:""));}

So, char *lp_motd_file(void) is as below. Well, I still didn't have a
clear picture about below function. Any help is mostly appreciated.:)

char *lp_motd_file(int i) {
	return((LP_SNUM_OK(i)&&pSERVICE(i)->&Globals.motd_file)?
				pSERVICE(i)->&Globals.motd_file : 
				(sDefault.&Globals.motd_file?sDefault.&Globals.motd_file:""));
}
-- 
Daniel



More information about the rsync mailing list