[hackers] [lsw] flagless || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Sat, 18 Jun 2011 05:30:27 +0200 (CEST)

changeset: 13:3c024cc9cbbf
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Sat Jun 18 04:30:21 2011 +0100
files: config.mk lsw.1 lsw.c
description:
flagless

diff -r cddbc36a1e1c -r 3c024cc9cbbf config.mk
--- a/config.mk Sat Jun 18 03:48:12 2011 +0100
+++ b/config.mk Sat Jun 18 04:30:21 2011 +0100
@@ -1,5 +1,5 @@
 # lsw version
-VERSION = 0.2
+VERSION = 0.3
 
 # paths
 PREFIX = /usr/local
diff -r cddbc36a1e1c -r 3c024cc9cbbf lsw.1
--- a/lsw.1 Sat Jun 18 03:48:12 2011 +0100
+++ b/lsw.1 Sat Jun 18 04:30:21 2011 +0100
@@ -3,17 +3,9 @@
 lsw \- list window titles
 .SH SYNOPSIS
 .B lsw
-.RB [ \-l ]
-.RB [ \-v ]
 .RI [ windows ...]
 .SH DESCRIPTION
 .B lsw
-prints the titles of the given X windows' children to stdout. If no windows are
-given the root window is used.
-.SH OPTIONS
-.TP
-.B \-l
-lsw lists each window's XID as well as its title.
-.TP
-.B \-v
-prints version information to stdout, then exits.
+prints the title and XID of each child of each
+.IR window .
+If none are given the root window is used.
diff -r cddbc36a1e1c -r 3c024cc9cbbf lsw.c
--- a/lsw.c Sat Jun 18 03:48:12 2011 +0100
+++ b/lsw.c Sat Jun 18 04:30:21 2011 +0100
@@ -10,7 +10,6 @@
 static void lsw(Window win);
 
 static Atom netwmname;
-static Bool lflag = False;
 static Display *dpy;
 
 int
@@ -23,20 +22,10 @@
         }
         netwmname = XInternAtom(dpy, "_NET_WM_NAME", False);
 
- for(i = 1; i < argc; i++)
- if(!strcmp(argv[i], "-v")) {
- puts("lsw-"VERSION", © 2006-2011 lsw engineers, see LICENSE for details");
- exit(EXIT_SUCCESS);
- }
- else if(!strcmp(argv[i], "-l"))
- lflag = True;
- else
- break;
-
- if(i == argc)
+ if(argc < 2)
                 lsw(DefaultRootWindow(dpy));
- else while(i < argc)
- lsw(strtol(argv[i++], NULL, 0));
+ else for(i = 1; i < argc; i++)
+ lsw(strtol(argv[i], NULL, 0));
 
         XCloseDisplay(dpy);
         return EXIT_SUCCESS;
@@ -55,17 +44,14 @@
                 if(XGetWindowAttributes(dpy, wins[i], &wa)
                 && !wa.override_redirect && wa.map_state == IsViewable) {
                         getname(wins[i], buf, sizeof buf);
- if(lflag)
- printf("0x%07lx %s\n", wins[i], buf);
- else if(*buf)
- puts(buf);
+ printf("0x%07lx %s\n", wins[i], buf);
                 }
         XFree(wins);
 }
 
 void
 getname(Window win, char *buf, size_t size) {
- char **list = NULL;
+ char **list;
         int n;
         XTextProperty prop;
 
Received on Sat Jun 18 2011 - 05:30:27 CEST

This archive was generated by hypermail 2.2.0 : Sat Jun 18 2011 - 05:36:04 CEST