Make sudo asking more obvious if prompt is given. - thinglaunch - A simple command and password promtper for X11. HTML git clone git://bitreich.org/thinglaunch DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit d67511b5bd71cac812727218bc42cc3d23760bc5 DIR parent ea4447f1720d7ef60229bc29b3a0fc12c0d39ccb HTML Author: Christoph Lohmann <20h@r-36.net> Date: Thu, 26 Apr 2018 07:16:12 +0200 Make sudo asking more obvious if prompt is given. Diffstat: M thinglaunch.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- DIR diff --git a/thinglaunch.c b/thinglaunch.c @@ -68,6 +68,8 @@ usage(void) int main(int argc, char *argv[]) { + char promptb[256]; + if (strstr(argv[0], "thingaskpass")) { issecret = 1; tostdout = 1; @@ -76,10 +78,13 @@ main(int argc, char *argv[]) if (strstr(argv[0], "thingsudoaskpass")) { issecret = 1; tostdout = 1; - if (argc > 1) - prompt = argv[1]; - else - prompt = "secret sudo> "; + if (argc > 1) { + snprintf(promptb, sizeof(promptb), + "sudo('%s')> ", argv[1]); + prompt = promptb; + } else { + prompt = "sudo> "; + } argc = 0; }