[hackers] [wmii] Remove -long arguments from wmii9menu || Kris Maglione

From: <hg_AT_suckless.org>
Date: Thu, 16 Oct 2008 23:05:19 +0000 (UTC)

changeset: 2382:45430b2f40dd
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Thu Oct 16 19:05:17 2008 -0400
files: cmd/wmii.rc.rc cmd/wmii.sh.sh cmd/wmii9menu.c rc/wmiirc.sh
description:
Remove -long arguments from wmii9menu

diff -r edd8053e231d -r 45430b2f40dd cmd/wmii.rc.rc
--- a/cmd/wmii.rc.rc Thu Oct 16 18:54:03 2008 -0400
+++ b/cmd/wmii.rc.rc Thu Oct 16 19:05:17 2008 -0400
@@ -47,7 +47,7 @@
         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 -r edd8053e231d -r 45430b2f40dd cmd/wmii.sh.sh
--- a/cmd/wmii.sh.sh Thu Oct 16 18:54:03 2008 -0400
+++ b/cmd/wmii.sh.sh Thu Oct 16 19:05:17 2008 -0400
@@ -110,7 +110,7 @@
         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 -r edd8053e231d -r 45430b2f40dd cmd/wmii9menu.c
--- a/cmd/wmii9menu.c Thu Oct 16 18:54:03 2008 -0400
+++ b/cmd/wmii9menu.c Thu Oct 16 19:05:17 2008 -0400
@@ -37,6 +37,7 @@
 
 #define IXP_NO_P9_
 #define IXP_P9_STRUCTS
+#include <fmt.h>
 #include <ixp.h>
 #include <stdarg.h>
 #include <stdbool.h>
@@ -58,7 +59,6 @@
 static IxpCFid* ctlfid;
 static char ctl[1024];
 static char* ectl;
-static char* address;
 
 static int wborder;
 
@@ -106,57 +106,31 @@
 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 @@
 void
 usage(void)
 {
- fprintf(stderr, "usage: %s -version\n", argv0);
- fprintf(stderr, " %s [-a <address>] [-initial <arg>] menitem[:command] ...\n", argv0);
+ fprintf(stderr, "usage: %s -v\n", argv0);
+ fprintf(stderr, " %s [-a <address>] [-i <arg>] menitem[:command] ...\n", argv0);
         exit(0);
 }
 
diff -r edd8053e231d -r 45430b2f40dd rc/wmiirc.sh
--- a/rc/wmiirc.sh Thu Oct 16 18:54:03 2008 -0400
+++ b/rc/wmiirc.sh Thu Oct 16 19:05:17 2008 -0400
@@ -66,19 +66,6 @@
         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
Received on Thu Oct 16 2008 - 23:05:19 UTC

This archive was generated by hypermail 2.2.0 : Thu Oct 16 2008 - 23:12:05 UTC