DragonFly BSD
DragonFly bugs List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cu coredumps


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Oct 2004 15:08:58 -0700 (PDT)

:Thank you for the asprintf() advice Matt. I am not sure if I used it 
:right but it seems to work and it looks nicer.
:
:How's this one then? Better? I hope so :)

    A little better.  The structure you should use is something like this:

    #include <assert.h>
    ...

    while ((cp = getremote(name)) != NULL) {
	deadfl = 0;

	if (stat(cp, &sb) < 0) {
		if (cp[0] != '/') {
			asprintf(&tmp_cp, "/dev/%s", cp);
			assert(tmp_cp != NULL);
			cp = tmp_cp;
		}
	}
	if ((uucplock = strrchr(cp, '/')) == NULL)
		uucplock = cp;		
	else
		++uucplock;

	...

    }


					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]