Thanks to Dave Reisner for pointing this out.
"\t current kernel symbols.\n"
"\t-E, --symvers=FILE Use Module.symvers file to check\n"
"\t symbol versions.\n",
- binname);
+ program_invocation_short_name);
}
static inline void _show(const char *fmt, ...)
"Options:\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
- binname);
+ program_invocation_short_name);
}
static const char *mod_strerror(int err)
#include <libkmod.h>
#include "kmod.h"
-/* visible to all tools, compat or otherwise */
-const char *binname;
-
static const char options_s[] = "+hV";
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{
int err;
- binname = basename(argv[0]);
-
- if (strcmp(binname, "kmod") == 0)
+ if (strcmp(program_invocation_short_name, "kmod") == 0)
err = handle_kmod_commands(argc, argv);
else
err = handle_kmod_compat_commands(argc, argv);
extern const struct kmod_cmd kmod_cmd_list;
-/* kmod.c */
-extern const char *binname;
-
#include "log.h"
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#endif
} else {
#ifdef ENABLE_DEBUG
- fprintf(stderr, "%s: %s: %s:%d %s() %s", binname, prioname,
- file, line, fn, str);
+ fprintf(stderr, "%s: %s: %s:%d %s() %s",
+ program_invocation_short_name, prioname, file, line,
+ fn, str);
#else
- fprintf(stderr, "%s: %s: %s", binname, prioname, str);
+ fprintf(stderr, "%s: %s: %s", program_invocation_short_name,
+ prioname, str);
#endif
}
log_use_syslog = use_syslog;
if (log_use_syslog)
- openlog(binname, LOG_CONS, LOG_DAEMON);
+ openlog(program_invocation_short_name, LOG_CONS, LOG_DAEMON);
}
void log_close(void)
if (log_use_syslog)
syslog(prio, "%s: %s", prioname, msg);
else
- fprintf(stderr, "%s: %s: %s", binname, prioname, msg);
+ fprintf(stderr, "%s: %s: %s", program_invocation_short_name,
+ prioname, msg);
free(msg);
if (prio <= LOG_CRIT)
"\t-b, --basedir=DIR Use DIR as filesystem root for /lib/modules\n"
"\t-V, --version Show version\n"
"\t-h, --help Show this help\n",
- binname);
+ program_invocation_short_name);
}
static bool is_module_filename(const char *name)
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
- binname, binname, binname, binname, binname, binname);
+ program_invocation_short_name, program_invocation_short_name,
+ program_invocation_short_name, program_invocation_short_name,
+ program_invocation_short_name, program_invocation_short_name);
}
static inline void _show(const char *fmt, ...)
"\t-v, --verbose enables more messages\n"
"\t-V, --version show version\n"
"\t-h, --help show this help\n",
- binname);
+ program_invocation_short_name);
}
static int check_module_inuse(struct kmod_module *mod) {