diff --git a/cmd/wmii.rc.rc b/cmd/wmii.rc.rc index 1c879633..a5a0c37a 100755 --- a/cmd/wmii.rc.rc +++ b/cmd/wmii.rc.rc @@ -47,7 +47,7 @@ fn wi_fnmenu { group=$1^Menu-$2 last=$group^_last fns=`{wi_getfuns $group} { shift 2 if(! ~ $#fns 0) { - res = `{wmii9menu -initial $"($last) $fns} \ + res = `{wmii9menu -i $"($last) $fns} \ if(! ~ $res '') { ($last) = $res $group-$res $*}}} diff --git a/cmd/wmii.sh.sh b/cmd/wmii.sh.sh index 75147bde..062617bd 100755 --- a/cmd/wmii.sh.sh +++ b/cmd/wmii.sh.sh @@ -110,7 +110,7 @@ wi_fnmenu() { eval "last=\"\$$_last\"" res=$(set -- $(echo "$Menus" | awk -v "s=$group" 'BEGIN{n=length(s)} substr($1,1,n) == s{print substr($1,n+2)}') - [ $# != 0 ] && wmii9menu -initial "$last" "$@") + [ $# != 0 ] && wmii9menu -i "$last" "$@") if [ -n "$res" ]; then eval "$_last="'"$res"' Menu $group-$res "$@" diff --git a/cmd/wmii9menu.c b/cmd/wmii9menu.c index 8be4db65..092098f5 100644 --- a/cmd/wmii9menu.c +++ b/cmd/wmii9menu.c @@ -37,6 +37,7 @@ #define IXP_NO_P9_ #define IXP_P9_STRUCTS +#include #include #include #include @@ -58,7 +59,6 @@ static IxpClient* client; static IxpCFid* ctlfid; static char ctl[1024]; static char* ectl; -static char* address; static int wborder; @@ -106,57 +106,31 @@ void warpmouse(int, int); void memory(void); int args(void); -/* args --- go through the argument list, set options */ - -struct { - char *name, **var; -} argtab[] = { - {"initial", &initial}, - {"a", &address}, - {0, }, -}, *ap; - /* main --- crack arguments, set up X stuff, run the main menu loop */ int main(int argc, char **argv) { - int i, n; + static char *address; char *cp; + int i; g_argc = argc; g_argv = argv; - /* set default label name */ - if((cp = strrchr(argv[0], '/')) != nil) - argv0 = ++cp; - else - argv0 = argv[0]; - - for(i = 1; i < argc && argv[i][0] == '-'; i++) { - if(strcmp(argv[i], "-version") == 0) { - printf("%s\n", version); - exit(0); - } - - SET(n); - for(ap = argtab; ap->name; ap++) { - n = strlen(ap->name); - if(strncmp(ap->name, argv[i]+1, n) == 0) - break; - } - if(ap->name == 0) - usage(); - - if(argv[i][n+1] != '\0') - *ap->var = &argv[i][n+1]; - else { - if(argc <= i+1) - usage(); - *ap->var = argv[++i]; - } - } - argc -= i, argv += i; + ARGBEGIN{ + case 'v': + print("%s\n", version); + return 0; + case 'a': + address = EARGF(usage()); + break; + case 'i': + initial = EARGF(usage()); + break; + default: + usage(); + }ARGEND; if(argc == 0) usage(); @@ -209,8 +183,8 @@ main(int argc, char **argv) void usage(void) { - fprintf(stderr, "usage: %s -version\n", argv0); - fprintf(stderr, " %s [-a
] [-initial ] menitem[:command] ...\n", argv0); + fprintf(stderr, "usage: %s -v\n", argv0); + fprintf(stderr, " %s [-a
] [-i ] menitem[:command] ...\n", argv0); exit(0); } diff --git a/rc/wmiirc.sh b/rc/wmiirc.sh index ab5099ff..885bccb0 100644 --- a/rc/wmiirc.sh +++ b/rc/wmiirc.sh @@ -66,19 +66,6 @@ events() { Event LeftBarClick LeftBarDND shift wmiir xwrite /ctl view "$@" - Event ClientMouseDown - client=$1; button=$2 - case "$button" in - 3) - do=$(wimii9menu -initial "$menulast" Nop Delete Fullscreen) - case "$do" in - Delete) - wmiir xwrite /client/$client/ctl kill;; - Fullscreen) - wmiir xwrite /client/$client/ctl Fullscreen on;; - esac - menulast=${do:-"$menulast"} - esac Event Unresponsive { client=$1; shift