So There I am, rooting around in the source to the tftpd server
(never you mind why) when I see this:

-----------------------------------------
#define MAXARG  4
static char     *dirs[MAXARG+1];
 
int
main(int ac, char **av)
{
        register struct tftphdr *tp;
        register int n = 0;
        int on = 1;
 
        ac--; av++;
        if (ac==0) dirs[0] = "/tftpboot";  /* default directory */
        while (ac-- > 0 && n < MAXARG)
                dirs[n++] = *av++;             
-----------------------------------------

There are several things about this code that puzzle me.

1.  It looks to me like 'dirs' is set to be a 5 character
        string by the MAXARG define, then they turn around
        and set a default of 9 characters? Didn't they just
        run right off the end of the array?

2. Or am I misreading this and it's creating a list of up to
        5 acceptable directories? If that's so, where does it set
        the maximum size for each argument? If that's in some
        previous part of the declarations, that's fine, just
        give me an example construction to look for.

3. Stylistically, is that 'while' statement normal? It looks to
        me like a syntax mistake waiting to happen, but I'll code
        to that style if it's normal for C programmers. Coming
        from a mostly perl background that line would either be
        one line or enclosed in curly braces.



-- 
-------------------------------------
Sam Bayne - System Administrator
North Seattle Community College
[EMAIL PROTECTED]     (206)527-3762
=====================================


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to