Since __progname is not exposed in stdlib.h, use getprogname(3) instead. While here remove the useless cast.
If this is ok, I'd like to also replace the uses of __progname throughout the tree with getprogname(). Rationale for this is setprogname takes a const char *, which means __progname should also be const. Instead of fixing all the declarations throughout the tree, use getprogname(3) which is the documented API anyway. - Matthew Martin diff --git style.9 style.9 index 6e662f3a4f6..c849dd172ed 100644 --- style.9 +++ style.9 @@ -589,10 +589,10 @@ Uppercase letters take precedence over lowercase. .Ed .Pp The -.Li __progname -string may be used instead of hard-coding the program name. +.Xr getprogname 3 +function may be used instead of hard-coding the program name. .Bd -literal -offset indent -(void)fprintf(stderr, "usage: %s [-ab]\en", __progname); +fprintf(stderr, "usage: %s [-ab]\en", getprogname()); exit(1); .Ed .Pp