Example #1
0
static void exec_woman_emacs(const char* path, const char *page)
{
	if (!check_emacsclient_version()) {
		/* This works only with emacsclient version >= 22. */
		struct strbuf man_page = STRBUF_INIT;

		if (!path)
			path = "emacsclient";
		strbuf_addf(&man_page, "(woman \"%s\")", page);
		execlp(path, "emacsclient", "-e", man_page.buf, NULL);
		warning("failed to exec '%s': %s", path, strerror(errno));
	}
}
Example #2
0
static void exec_woman_emacs(const char *path, const char *page)
{
	char sbuf[STRERR_BUFSIZE];

	if (!check_emacsclient_version()) {
		/* This works only with emacsclient version >= 22. */
		char *man_page;

		if (!path)
			path = "emacsclient";
		if (asprintf(&man_page, "(woman \"%s\")", page) > 0) {
			execlp(path, "emacsclient", "-e", man_page, NULL);
			free(man_page);
		}
		warning("failed to exec '%s': %s", path,
			strerror_r(errno, sbuf, sizeof(sbuf)));
	}
}