[BACK]Return to test-progname.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / test-progname.c (download)

Revision 1.2, Fri Nov 6 16:30:33 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, VERSION_1_14_5, VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2, VERSION_1_14_1, VERSION_1_13_4, VERSION_1_13, HEAD
Changes since 1.1: +5 -4 lines

Use getprogname(3) rather than __progname.
Suggested by Joerg@ Sonnenberger (NetBSD).
Last year, deraadt@ confirmed on tech@ that this "has the potential
to be more portable", and micro-optimizing for speed is not relevant
here.  Also gets rid of one global variable.

#include <stdlib.h>

int
main(void)
{
	const char * progname;

	progname = getprogname();
	return progname == NULL;
}