Hacker News new | ask | show | jobs
by kazinator 660 days ago
The author doesn't seem to understand that argv[0] can be different due to, for instance, one executable implementing many programs, such as BusyBox and similar projects.

While argv[0] is old, if you had to design it from scratch to day, it would still be a good idea to have the program invocation name as an argument.

The idea that anything old must is historic quirk that we can today eliminate is flawed.

Now argv[0] should not be relied upon for obtaining the executable name, except as a last resort if the program is built for platforms that don't have anything else. But if one executable has multiple program names via symlinks, only argv[0] will distinguish them.