From 433db43374e2ad685f6e29c7e0433200e9c536cd Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Thu, 16 Feb 2017 20:47:47 +0100 Subject: [PATCH] Drop ARG_NOLIST, let them be WYSHLIST, but without args.. so this is a bit more expensive, but allows line sequencing and in addition it is just what a user expects from an input line. Also the commands are not time critical, anyway. --- cmd_tab.h | 20 +++++++++----------- lex_input.c | 22 ++++++++++++---------- nail.h | 7 +++---- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/cmd_tab.h b/cmd_tab.h index 90151dcc..6afe79d1 100644 --- a/cmd_tab.h +++ b/cmd_tab.h @@ -37,7 +37,6 @@ #define MSGLIST ARG_MSGLIST #define STRLIST ARG_STRLIST #define RAWLIST ARG_RAWLIST -#define NOLIST ARG_NOLIST #define NDMLIST ARG_NDMLIST #define WYSHLIST ARG_WYSHLIST # define WYRALIST ARG_WYRALIST @@ -134,7 +133,7 @@ DS(N_("If can be opened successfully, read commands from it")) }, { "set", &c_set, (G | M | X | WYRALIST), 0, 1000 DS(N_("Print all variables, or set (a) (s)")) }, - { "shell", &c_dosh, (I | S | NOLIST), 0, 0 + { "shell", &c_dosh, (I | S | WYSHLIST), 0, 0 DS(N_("Invoke an interactive shell")) }, { "unalias", &c_unalias, (M | WYRALIST), 1, 1000 DS(N_("Un`alias' (* for all)")) }, @@ -166,7 +165,7 @@ DS(N_("Show help [[Option] for the given command]]")) }, { "?", &a_lex_c_help, (M | X | WYRALIST), 0, 1 DS(N_("Show help [[Option] for the given command]]")) }, - { "=", &c_pdot, (A | NOLIST), 0, 0 + { "=", &c_pdot, (A | WYSHLIST), 0, 0 DS(N_("Show current message number")) }, { "Reply", &c_Reply, (A | I | R | S | MSGLIST), 0, MMNDEL DS(N_("Reply to originator, exclusively")) }, @@ -212,13 +211,13 @@ DS(N_("Echo arguments, without a trailing newline, to standard output")) }, { "echoerrn", &c_echoerrn, (G | M | X | WYSHLIST), 0, 1000 DS(N_("Echo arguments, without a trailing newline, to standard error")) }, - { "quit", &a_lex_c_quit, NOLIST, 0, 0 + { "quit", &a_lex_c_quit, WYSHLIST, 0, 0 DS(N_("Terminate session, saving messages as necessary")) }, { "list", &a_lex_c_list, (M | STRLIST), 0, 0 DS(N_("List all commands (with argument: in prefix search order)")) }, - { "xit", &a_lex_c_exit, (M | X | NOLIST), 0, 0 + { "xit", &a_lex_c_exit, (M | X | WYSHLIST), 0, 0 DS(N_("Immediately return to the shell without saving")) }, - { "exit", &a_lex_c_exit, (M | X | NOLIST), 0, 0 + { "exit", &a_lex_c_exit, (M | X | WYSHLIST), 0, 0 DS(N_("Immediately return to the shell without saving")) }, { "pipe", &c_pipe, (A | STRLIST), 0, MMNDEL DS(N_("Pipe to , honouring `ignore' / `retain'")) }, @@ -262,7 +261,7 @@ DS(N_("Un`saveignore' ")) }, { "unsaveretain", &c_unsaveretain, (O | M | RAWLIST), 0, 1000 DS(N_("Un`saveretain' ")) }, - { "newmail", &c_newmail, (A | T | NOLIST), 0, 0 + { "newmail", &c_newmail, (A | T | WYSHLIST), 0, 0 DS(N_("Check for new mail in current folder")) }, { "shortcut", &c_shortcut, (M | WYRALIST), 0, 1000 DS(N_("Define s and their , or list shortcuts")) }, @@ -403,7 +402,7 @@ DS(N_("Inside `define' / `account': isolate modifications? "))}, { "read", &a_lex_c_read, (G | M | X | EM | WYSHLIST), 1, 1000 DS(N_("Read a line from standard input into (s)")) }, - { "version", &a_lex_c_version, (H | M | X | NOLIST), 0, 0 + { "version", &a_lex_c_version, (H | M | X | WYSHLIST), 0, 0 DS(N_("Show the version and feature set of the program")) }, { "history", &c_history, (H | I | M | WYSHLIST), 0, 1 @@ -434,11 +433,11 @@ DS(N_("Decode the URL-encoded into strings")) }, #ifdef HAVE_MEMORY_DEBUG - { "memtrace", &c_memtrace, (I | M | NOLIST), 0, 0 + { "memtrace", &c_memtrace, (I | M | WYSHLIST), 0, 0 DS(N_("Trace current memory usage afap")) }, #endif #ifdef HAVE_DEVEL - { "sigstate", &c_sigstate, (I | M | NOLIST), 0, 0 + { "sigstate", &c_sigstate, (I | M | WYSHLIST), 0, 0 DS(N_("Show signal handler states")) }, #endif @@ -447,7 +446,6 @@ #undef MSGLIST #undef STRLIST #undef RAWLIST -#undef NOLIST #undef NDMLIST #undef ARG_ARGMASK diff --git a/lex_input.c b/lex_input.c index b142ee04..00005d7a 100644 --- a/lex_input.c +++ b/lex_input.c @@ -229,7 +229,7 @@ static struct a_lex_cmd const a_lex_cmd_tab[] = { a_lex_special_cmd_tab[] = { { "#", NULL, ARG_STRLIST, 0, 0 DS(N_("Comment command: ignore remaining (continuable) line")) }, - { "-", NULL, ARG_NOLIST, 0, 0 + { "-", NULL, ARG_WYSHLIST, 0, 0 DS(N_("Print out the preceding message")) } }; #undef DS @@ -430,10 +430,14 @@ a_lex_cmdinfo(struct a_lex_cmd const *lcp){ case ARG_MSGLIST: cp = N_("message-list"); break; case ARG_STRLIST: cp = N_("string data"); break; case ARG_RAWLIST: cp = N_("old-style quoting"); break; - case ARG_NOLIST: cp = N_("no arguments"); break; case ARG_NDMLIST: cp = N_("message-list (no default)"); break; - case ARG_WYSHLIST: cp = N_("sh(1)ell-style quoting"); break; - default: cp = N_("`wysh' for sh(1)ell-style quoting"); break; + case ARG_WYRALIST: cp = N_("`wysh' for sh(1)ell-style quoting"); break; + default: + case ARG_WYSHLIST: + cp = (lcp->lc_minargs == 0 && lcp->lc_maxargs == 0) + ? N_("sh(1)ell-style quoting (takes no arguments)") + : N_("sh(1)ell-style quoting"); + break; } rv = n_string_push_cp(rv, V_(cp)); @@ -455,6 +459,9 @@ a_lex_cmdinfo(struct a_lex_cmd const *lcp){ if(lcp->lc_argtype & ARG_X) rv = n_string_push_cp(rv, _(" | ok: in subprocess")); + if(lcp->lc_argtype & ARG_G) + rv = n_string_push_cp(rv, _(" | gabby history")); + cp = n_string_cp(rv); NYD2_LEAVE; return cp; @@ -984,7 +991,7 @@ je96: case ARG_STRLIST: /* Just the straight string, with leading blanks removed */ - while(whitechar(*cp)) + while(blankspacechar(*cp)) ++cp; rv = (*cmd->lc_func)(cp); break; @@ -1040,11 +1047,6 @@ je96: rv = (*cmd->lc_func)(arglist); break; - case ARG_NOLIST: - /* Just the constant zero, for exiting, eg. */ - rv = (*cmd->lc_func)(0); - break; - default: DBG( n_panic(_("Implementation error: unknown argument type: %d"), cmd->lc_argtype & ARG_ARGMASK); ) diff --git a/nail.h b/nail.h index 7e397ca1..1519ec25 100644 --- a/nail.h +++ b/nail.h @@ -2277,10 +2277,9 @@ enum argtype { ARG_MSGLIST = 0, /* Message list type */ ARG_STRLIST = 1, /* A pure string */ ARG_RAWLIST = 2, /* getrawlist(), old style */ - ARG_NOLIST = 3, /* Just plain 0 */ - ARG_NDMLIST = 4, /* Message list, no defaults */ - ARG_WYSHLIST = 5, /* getrawlist(), sh(1) compatible */ - ARG_WYRALIST = 6, /* _RAWLIST or _WYSHLIST (with `wysh') */ + ARG_NDMLIST = 3, /* Message list, no defaults */ + ARG_WYSHLIST = 4, /* getrawlist(), sh(1) compatible */ + ARG_WYRALIST = 5, /* _RAWLIST or _WYSHLIST (with `wysh') */ ARG_ARGMASK = 7, /* Mask of the above */ ARG_A = 1u<< 4, /* Needs an active mailbox */ -- 2.11.4.GIT