cu coredumps

Matthew Dillon dillon at apollo.backplane.com
Wed Oct 27 15:09:46 PDT 2004


: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 at xxxxxxxxxxxxx>





More information about the Bugs mailing list