From: Pasi Kallinen Date: Mon, 4 Mar 2013 15:26:06 +0000 (+0200) Subject: Add a -c option (login shell command) with an error message. (from Edoardo Spadolini) X-Git-Tag: v1.6.1-roc-dev~66 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=d54512a31f1cf51b2b80f371270e35b1974ee8a8;p=dgamelaunch Add a -c option (login shell command) with an error message. (from Edoardo Spadolini) --- diff --git a/README b/README index 2c1a60d..2ecc7ef 100644 --- a/README +++ b/README @@ -152,6 +152,7 @@ COMMANDLINE PARAMETERS ====================== -a Ignored. + -c Shows error message and exits. (login shell command) -e Ignored. -h Ignored. -i user Autologin and run the register -command hook for "user" @@ -191,6 +192,7 @@ ERROR CODES 11 Cannot run as root: Config file has shed_uid = 0 12 Config file has an unrecognized token 13 Config file: Negative value not accepted + 15 dgamelaunch called with -c (login shell command); exited 20 No menu defined, or no banner found for menu 60 Cannot create a new terminal, or no termcap files. 61 Cannot openpty() diff --git a/dgamelaunch.c b/dgamelaunch.c index cdacfb5..fbf6ef5 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -2719,10 +2719,15 @@ main (int argc, char** argv) __progname = basename(strdup(argv[0])); - while ((c = getopt(argc, argv, "sqh:pi:aeW:SD")) != -1) + while ((c = getopt(argc, argv, "c:sqh:pi:aeW:SD")) != -1) { switch (c) { + case 'c': + fprintf(stderr, "This is not a shell account, you can't execute " + "arbitrary commands.\n"); + graceful_exit(15); + break; case 's': showplayers = 1; break;