[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] .editor: Fallback to sensible-editor if EDITOR is unset
From: |
John Darrington |
Subject: |
[PATCH] .editor: Fallback to sensible-editor if EDITOR is unset |
Date: |
Sun, 2 Feb 2020 12:46:06 +0100 |
---
bootstrap.conf | 1 +
src/pk-editor.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 3948f97a..84a824be 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -20,6 +20,7 @@
gnulib_modules="
array-list
byteswap
+ findprog
gcd
gendocs
getline
diff --git a/src/pk-editor.c b/src/pk-editor.c
index afc6f629..c7da400e 100644
--- a/src/pk-editor.c
+++ b/src/pk-editor.c
@@ -24,10 +24,13 @@
#include "pk-cmd.h"
+#include "findprog.h"
+
static int
pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t uflags)
{
- char *editor, *cmdline;
+ const char *editor;
+ char *cmdline;
char tmpfile[1024];
int des, ret;
FILE *f;
@@ -37,6 +40,10 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
/* Get the value of EDITOR. */
editor = getenv ("EDITOR");
+ /* Debian based systems should always have "sensible-editor"
+ in the path. */
+ if (!editor)
+ editor = find_in_path ("sensible-editor");
if (!editor)
{
pk_term_class ("error");
--
2.20.1
- [PATCH] .editor: Fallback to sensible-editor if EDITOR is unset,
John Darrington <=