lesskey.1: Don't mention email address

2015-11-22 Thread Michael Reed
This was already done for less.1, as OpenBSD's less(1) differs
substantially from upstream.



Index: lesskey.1
===
RCS file: /cvs/src/usr.bin/less/lesskey.1,v
retrieving revision 1.13
diff -u -p -r1.13 lesskey.1
--- lesskey.1   5 Nov 2015 22:08:44 -   1.13
+++ lesskey.1   23 Nov 2015 06:21:07 -
@@ -448,9 +448,6 @@ file.
 .Xr less 1
 .Sh AUTHORS
 .An Mark Nudelman
-.Pp
-Send bug reports or comments to
-.Aq Mt bug\-l...@gnu.org .
 .\" .Sh CAVEATS
 .\" On MS-DOS and OS/2 systems, certain keys send a sequence of characters
 .\" which start with a NUL character (0).



less.1: Update for LESSCHARSET removal

2015-11-22 Thread Michael Reed
Index: less.1
===
RCS file: /cvs/src/usr.bin/less/less.1,v
retrieving revision 1.50
diff -u -p -r1.50 less.1
--- less.1  15 Nov 2015 21:05:56 -  1.50
+++ less.1  23 Nov 2015 06:15:22 -
@@ -1424,67 +1424,9 @@ in text files.
 .Pp
 A "character set" is simply a description of which characters are to
 be considered normal, control, and binary.
-The
-.Ev LESSCHARSET
-environment variable may be used to select a character set.
-Possible values for
-.Ev LESSCHARSET
-are:
-.Bl -tag -width "IBM-1047"
-.It ascii
-BS, TAB, NL, CR, and formfeed are control characters,
-all chars with values between 32 and 126 are normal,
-and all others are binary.
-.It iso8859
-Selects an ISO 8859 character set.
-This is the same as ASCII, except characters between 160 and 255 are
-treated as normal characters.
-.It latin1
-Same as iso8859.
-.It latin9
-Same as iso8859.
-.It dos
-Selects a character set appropriate for MS-DOS.
-.It ebcdic
-Selects an EBCDIC character set.
-.It IBM-1047
-Selects an EBCDIC character set used by OS/390
-.Ux
-Services.
-This is the EBCDIC analogue of latin1.
-You get similar results by setting either LESSCHARSET=IBM-1047 or
-LC_CTYPE=en_US in your environment.
-.It koi8-r
-Selects a Russian character set.
-.It next
-Selects a character set appropriate for NeXT computers.
-.It utf-8
-Selects the UTF-8 encoding of the ISO 10646 character set.
-UTF-8 is special in that it supports multi-byte characters in the input file.
-It is the only character set that supports multi-byte characters.
-.It windows
-Selects a character set appropriate for Microsoft Windows (cp 1251).
-.El
-.Pp
-If neither LESSCHARSET is not set,
-but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" is found in the
-.Ev LC_ALL , LC_CTYPE
-or
-.Ev LANG
-environment variables, then the default character set is utf-8.
-.Pp
-If that string is not found, but your system supports the
-setlocale interface,
 .Nm
-will use setlocale to determine the character set.
-setlocale is controlled by setting the
-.Ev LANG
-or
-.Ev LC_CTYPE
-environment variables.
-.Pp
-Finally, if the
-setlocale interface is also not available, the default character set is latin1.
+will determine the character set to use from the environment (see
+.Xr locale 1 ) .
 .Pp
 Control and binary characters are displayed in standout (reverse video).
 Each such character is displayed in caret notation if possible
@@ -1893,8 +1835,6 @@ end character in an ANSI color escape se
 (default "0123456789;[?!"'#%()*+\ ").
 .It Ev LESSBINFMT
 Format for displaying non-printable, non-control characters.
-.It Ev LESSCHARSET
-Selects a predefined character set.
 .It Ev LESSCLOSE
 Command line to invoke the (optional) input-postprocessor.
 .It Ev LESSEDIT
Index: lesskey.1
===
RCS file: /cvs/src/usr.bin/less/lesskey.1,v
retrieving revision 1.13
diff -u -p -r1.13 lesskey.1
--- lesskey.1   5 Nov 2015 22:08:44 -   1.13
+++ lesskey.1   23 Nov 2015 06:15:22 -
@@ -410,13 +410,10 @@ Although the lesskey file can be used to
 environment, the main purpose of assigning variables in the lesskey file
 is simply to have all less configuration information stored in one file.
 .Pp
-The following input file sets the -i option whenever less is run,
-and specifies the character set to be
-.Qq latin1 :
+The following input file sets the -i option whenever less is run:
 .Bd -literal -offset indent
 #env
 LESS = -i
-LESSCHARSET = latin1
 .Ed
 .Sh ENVIRONMENT
 .Bl -tag -width LESSKEY_SYSTEM -compact



Re: [patch] Add Broadcom BCM15700A2 and BCM4360 to pcidevs

2015-11-22 Thread Bryan Vyhmeister
On Sun, Nov 22, 2015 at 01:27:49PM -0800, Bryan Vyhmeister wrote:
> I noticed a patch come through a few minutes ago to add some pcidevs for
> other Apple systems so I added identifications for the BCM15700A2 chip
> which appears at least in the 2013/2014/2015 MacBook Air system. It
> appears to be the 720p FaceTime camera. I also added identifications for
> the BCM4360 802.11ac wireless chipset. This is my first patch of this
> type so I tried to put the added information in the right spots.

I just realized that pcidevs.h and pcidevs_data.h are auto generated so
my patch did not need to include them. I also added the pcidevs info for
the Intel DSL3510 Thunderbolt as well which appears in pcidump output on
the 2013 MacBook Air (MacBookAir6,1) under pcidump but, curiously, does
not show up in pcidump output on the 2015 MacBook Air (MacBookAir7,2).

Bryan


Index: pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1777
diff -u -p -r1.1777 pcidevs
--- pcidevs 22 Nov 2015 21:13:05 -  1.1777
+++ pcidevs 23 Nov 2015 01:42:48 -
@@ -1937,6 +1937,7 @@ product BOCHS VGA 0x  VGA
 
 /* Broadcom */
 product BROADCOM BCM43224_10x0576  BCM43224 
+product BROADCOM BCM15700A20x1570  BCM15700A2
 product BROADCOM BCM5752   0x1600  BCM5752
 product BROADCOM BCM5752M  0x1601  BCM5752M
 product BROADCOM BCM5709   0x1639  BCM5709
@@ -2075,6 +2076,7 @@ product BROADCOM SERIAL_GC0x4344  Serial
 product BROADCOM BCM43224  0x4353  BCM43224
 product BROADCOM BCM43225  0x4357  BCM43225
 product BROADCOM BCM43227  0x4358  BCM43227
+product BROADCOM BCM4360   0x43a0  BCM4360
 product BROADCOM BCM4401   0x4401  BCM4401
 product BROADCOM BCM4401B0 0x4402  BCM4401B0
 product BROADCOM BCM4313   0x4727  BCM4313
@@ -3335,6 +3337,7 @@ product INTEL I210_SGMII  0x1538  I210 SGM
 product INTEL I211_COPPER  0x1539  I211
 product INTEL I217_LM  0x153a  I217-LM
 product INTEL I217_V   0x153b  I217-V
+product INTEL DSL3510  0x1547  DSL3510 Thunderbolt
 product INTEL 82599_SFP_SF20x154d  82599
 product INTEL 82599EN_SFP  0x1557  82599EN
 product INTEL I218_LM  0x155a  I218-LM



Typo, and consistency, in www/build/mirrors/ftp.html.head

2015-11-22 Thread Larry Hynes

I *think* www/build/mirrors/ftp.html.head is the correct source to make
corrections for /ftp.html - apologies if I'm mistaken.

This corrects 'sytem' to 'system', and applies consistency to the use of
'CD-ROM'.


Index: ftp.html.head
===
RCS file: /cvs/www/build/mirrors/ftp.html.head,v
retrieving revision 1.23
diff -u -p -r1.23 ftp.html.head
--- ftp.html.head   18 Oct 2015 19:25:30 -  1.23
+++ ftp.html.head   22 Nov 2015 23:50:14 -
@@ -28,14 +28,14 @@ More information is available on our 


If you choose not to buy an OpenBSD CD-ROM, you can also install
-OpenBSD with a CDROM or flash disk you create yourself.
+OpenBSD with a CD-ROM or flash disk you create yourself.
To achieve this, you have to download one of the following ISO or file
-sytem image files from our mirrors:
+system image files from our mirrors:


-  cd58.iso to burn a minimal 5.8 CDROM
+  cd58.iso to burn a minimal 5.8 CD-ROM
   (roughly 8MB in size, boot only)
-  install58.iso to burn a full 5.8 CDROM
+  install58.iso to burn a full 5.8 CD-ROM
   (roughly 230MB in size, boot + sets)
  miniroot58.fs to create a minimal 5.8 boot media
   (for flash or HD image installs -- roughly 5M in size, boot only)



Re: Interesting if_get() case

2015-11-22 Thread Alexandr Nedvedicky
Hello,

> > 
> > > + else {
> > > + struct ifnet *destifp;
> > > +
> > > + destifp = if_get(rt->rt_ifidx);
> > > + if (destifp != NULL)
> > > + destmtu = destifp->if_mtu;
> > > + if_put(destifp);
> > > + }
> > 
> > your code potentially leaves destmtu set to 0 in case we deal with invalid
> > ipforward_rt. I wonder how icmp_error() we are going to call further below
> > (at line 1544 in the old code) is going to deal with it.  May be we
> > should just give up on sending ICMP_UNREACH message in this case.
> > find my small improvement to your patch further below.
> 
> Note that my change should only matter for IPSEC.  This whole MTU mess is
> scary. I can't even tell if it makes sense to send an ICMP if the ifp
> disappeared.  The use of if_get(9) makes it clear that the MTU handling
> is insane.
> 
> So I'm not opposed to your change but I think you should either commit
> it separately or keep it inside the "if (ipforward_rt.ro_rt) {" block,
> because it's a behavior change.
> 

IMO we should not let IPSEC send ICMP with 0 MTU proposal. We are probably
better to send nothing in this case and let sender to retransmit.

Also if I understand the code well enough the proposed MTU could not be zero
before your change. However given the likelihood someone triggers the case
of invalidated route is very low (more academical than practical problem...),
I agree with follow up commit.

We should probably check with mikeb here.

regards
sasha



Re: rt_ifp and pf(4)

2015-11-22 Thread Alexandr Nedvedicky
On Sat, Nov 21, 2015 at 12:37:58PM +0100, Martin Pieuchot wrote:
> On 20/11/15(Fri) 18:05, Alexandr Nedvedicky wrote:
> > Hello,
> > 
> > I have just nit comments, feel free to ignore them.
> > 
> > 1) would it be possible to use closing #endif guards as follows:
> > #endif  /* NCARP */
> 
> Done.
> 

thanks a lot. I'm fine with your patch.

OK

regards
sasha

> > it's detail, given at some point in future we will probably have to use
> > if_put()/if_get() for ifp's bound to kif's (right?).
> 
> Well not necessarily.  kif have the same lifetime as an ifp and are easy
> to garbage collect so there's no need for the moment to use index for
> them.  Indexes are useful when two objects having a different lifetime
> need to be linked at some point.  By using indexes/id/cookie we do not 
> increase the lifetime of an object like with references but this has the
> cost of a layer of indirection.

and thanks for clarification here.



[nc] rename sun to s_un (for building on Solaris)

2015-11-22 Thread Brent Cook

Finally getting around to trying out nc on some more platforms for
LibreSSL-portable, and ran into Sun/Oracle's silly definition of 'sun'
in the system headers. OK to rename the local sockaddr_un variables?

Portable contains a patch full of #ifdef's around other systems-specific
nc features (e.g. rdomain support). I'm not sure if any of those
should also move into cvs or stay in the portable patch.

Index: netcat.c
===
RCS file: /cvs/src/usr.bin/nc/netcat.c,v
retrieving revision 1.143
diff -u -p -u -p -r1.143 netcat.c
--- netcat.c13 Nov 2015 18:13:13 -  1.143
+++ netcat.c22 Nov 2015 22:26:08 -
@@ -643,7 +643,7 @@ main(int argc, char *argv[])
 int
 unix_bind(char *path, int flags)
 {
-   struct sockaddr_un sun;
+   struct sockaddr_un s_un;
int s;

/* Create unix domain socket. */
@@ -651,17 +651,17 @@ unix_bind(char *path, int flags)
0)) < 0)
return (-1);

-   memset(&sun, 0, sizeof(struct sockaddr_un));
-   sun.sun_family = AF_UNIX;
+   memset(&s_un, 0, sizeof(struct sockaddr_un));
+   s_un.sun_family = AF_UNIX;

-   if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
-   sizeof(sun.sun_path)) {
+   if (strlcpy(s_un.sun_path, path, sizeof(s_un.sun_path)) >=
+   sizeof(s_un.sun_path)) {
close(s);
errno = ENAMETOOLONG;
return (-1);
}

-   if (bind(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
+   if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
close(s);
return (-1);
}
@@ -737,7 +737,7 @@ tls_setup_server(struct tls *tls_ctx, in
 int
 unix_connect(char *path)
 {
-   struct sockaddr_un sun;
+   struct sockaddr_un s_un;
int s;

if (uflag) {
@@ -748,16 +748,16 @@ unix_connect(char *path)
return (-1);
}

-   memset(&sun, 0, sizeof(struct sockaddr_un));
-   sun.sun_family = AF_UNIX;
+   memset(&s_un, 0, sizeof(struct sockaddr_un));
+   s_un.sun_family = AF_UNIX;

-   if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
-   sizeof(sun.sun_path)) {
+   if (strlcpy(s_un.sun_path, path, sizeof(s_un.sun_path)) >=
+   sizeof(s_un.sun_path)) {
close(s);
errno = ENAMETOOLONG;
return (-1);
}
-   if (connect(s, (struct sockaddr *)&sun, sizeof(sun)) < 0) {
+   if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) {
close(s);
return (-1);
}



vmm update

2015-11-22 Thread Mike Larkin
An early rough cut of the vmm subsystem is now in the tree. This includes both
the kernel parts and userland parts.

There are still lots of things that need to be fixed and improved. For this
reason, it is still disabled by default.

But there is enough there for people to start playing with running OpenBSD VMs.

To get this in the tree faster, I temporarily removed some code that had rotted
in my tree (SVM, i386, shadow paging, etc). I still have the last versions of
those pieces, and they will get merged back in due time once I have the time
to merge the changes back in and re-test.

As we don't presently emulate a BIOS, the bootloader and kernel loading is
built into vmd(8). Presently, vmd(8) knows about OpenBSD kernels, nothing more.
It should be a fairly simple effort to add support for other ELF kernel types
(I did NetBSD one night in an hour as a one-off experiment).

I'm not going to explain all the how-tos at this point. This is because vmmctl
is going to have a pretty significant change coming in shortly, and anything
I would write here on "how to use it" is just going to end up changing anyway.
If you want to get started now, you can read the man page.

As this is a very early version of the subsystem, you can and should expect
breakage. There are many things left on my list that need to get cleaned up
before I'd consider enabling things by default.

-ml



[patch] Add Broadcom BCM4331 to pcidevs

2015-11-22 Thread Ossi Herrala
Hi tech@,

The following patch adds Broadcom BCM4331 wifi chip to pcidevs, so
it's shown correctly with pcidump. Tested with MacBookPro9,2.


Index: sys/dev/pci/pcidevs
===
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1775
diff -u -p -r1.1775 pcidevs
--- sys/dev/pci/pcidevs 9 Nov 2015 00:37:44 -   1.1775
+++ sys/dev/pci/pcidevs 22 Nov 2015 18:54:45 -
@@ -2069,6 +2069,7 @@ product BROADCOM BCM43XG  0x4325  BCM43XG
 product BROADCOM BCM4321   0x4328  BCM4321
 product BROADCOM BCM4321_2 0x4329  BCM4321
 product BROADCOM BCM4322   0x432b  BCM4322
+product BROADCOM BCM4331   0x4331  BCM4331
 product BROADCOM SERIAL0x4333  Serial
 product BROADCOM SERIAL_GC 0x4344  Serial
 product BROADCOM BCM43224  0x4353  BCM43224
Index: sys/dev/pci/pcidevs.h
===
RCS file: /cvs/src/sys/dev/pci/pcidevs.h,v
retrieving revision 1.1768
diff -u -p -r1.1768 pcidevs.h
--- sys/dev/pci/pcidevs.h   9 Nov 2015 00:38:23 -   1.1768
+++ sys/dev/pci/pcidevs.h   22 Nov 2015 18:54:45 -
@@ -2074,6 +2074,7 @@
 #definePCI_PRODUCT_BROADCOM_BCM43210x4328  /* BCM4321 */
 #definePCI_PRODUCT_BROADCOM_BCM4321_2  0x4329  /* BCM4321 */
 #definePCI_PRODUCT_BROADCOM_BCM43220x432b  /* BCM4322 */
+#definePCI_PRODUCT_BROADCOM_BCM43310x4331  /* BCM4331 */
 #definePCI_PRODUCT_BROADCOM_SERIAL 0x4333  /* Serial */
 #definePCI_PRODUCT_BROADCOM_SERIAL_GC  0x4344  /* Serial */
 #definePCI_PRODUCT_BROADCOM_BCM43224   0x4353  /* BCM43224 */
Index: sys/dev/pci/pcidevs_data.h
===
RCS file: /cvs/src/sys/dev/pci/pcidevs_data.h,v
retrieving revision 1.1763
diff -u -p -r1.1763 pcidevs_data.h
--- sys/dev/pci/pcidevs_data.h  9 Nov 2015 00:38:22 -   1.1763
+++ sys/dev/pci/pcidevs_data.h  22 Nov 2015 18:54:45 -
@@ -6432,6 +6432,10 @@ static const struct pci_known_product pc
"BCM4322",
},
{
+   PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4331,
+   "BCM4331",
+   },
+   {
PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_SERIAL,
"Serial",
},


-- 
Ossi Herrala



Re: Change PC's to PCs in www/i386.html

2015-11-22 Thread Michael McConville
Larry Hynes wrote:
> PC's is a possessive form, PCs a plural one: The plural of peecee is
> peecees, not peecee's.

Committed. Thanks.

> Index: i386.html
> ===
> RCS file: /cvs/www/i386.html,v
> retrieving revision 1.735
> diff -r1.735 i386.html
> 19c19
> < OpenBSD/i386 runs on the standard PC's and clones, with a wide variety
> ---
> >OpenBSD/i386 runs on the standard PCs and clones, with a wide variety
> 48c48
> < Machines using custom BIOS (such as older proprietary PC's, laptops, and 
> some
> ---
> >Machines using custom BIOS (such as older proprietary PCs, laptops, and some
> 



Re: [patch] cwm: Preserve stacking order during cycling

2015-11-22 Thread Vadim Vygonets
День добрый,

Quoth Артур Истомин on Sun, Nov 22, 2015:
> It is always reproducable for me when 3 or more windows opened. This
> is not immediately, but eventualy I can't access to the window located
> below one or two other through Alt+Tab.

Sorry to be so explicit, but just to make sure I understand you
correctly: while holding Alt, you press Tab several times, and
you get to the original window (the one you started with) without
seeing one or more non-hidden windows in the process?

> It is very annoying, that Alt+Tab in cwm does not work in "classic"
> way, cycling ALL windows in order.

It should (unless you remapped M-Tab or have "ignore" directives
in your .cwmrc).  What you describe sounds like cwm losing
windows, or marking them as hidden or ignored for some reason.

Do you notice any common conditions in which it happens?  E.g.,
after hiding/showing groups, or after not doing it for a while?
Do particular clients (programs) drop off the list more often, or
does it happen when particular clients are shown?  What's your
favourite client (i.e., what terminal emulator do you use)?  Do
you have any surprises in your .cwmrc?

> But I've never seen someone complain
> and thought it was my local problem.

Either it is, or everyone else thought the same :)  I don't think
I've noticed this happening.  We can add debug printfs liberally
and let you log your activity for a while, if you wish.

Hey world, has anybody else seen this happening?

> You became the first ray of hope :)

My patch seems to be unrelated.

> I'll try your patch in 10-12 hours after some sleep. 

Awesome.  Please note there's version 2 now.

Vadik.

-- 
Since everything in life is but an experience perfect in being what it is,
having nothing to do with good or bad, acceptance or rejection, one may well
burst out in laughter.
-- Long Chen Pa



Change PC's to PCs in www/i386.html

2015-11-22 Thread Larry Hynes

PC's is a possessive form, PCs a plural one: The plural of peecee is
peecees, not peecee's.


Index: i386.html
===
RCS file: /cvs/www/i386.html,v
retrieving revision 1.735
diff -r1.735 i386.html
19c19
< OpenBSD/i386 runs on the standard PC's and clones, with a wide variety
---

OpenBSD/i386 runs on the standard PCs and clones, with a wide variety

48c48
< Machines using custom BIOS (such as older proprietary PC's, laptops, and some
---

Machines using custom BIOS (such as older proprietary PCs, laptops, and some




Re: [patch v2] cwm: Preserve stacking order during cycling

2015-11-22 Thread Vadim Vygonets
I accidentally killed restacking on group_show().  Sorry about
that.  Here's version 2 of the patch.

Vadik.

Quoth Vadim Vygonets on Sat, Nov 21, 2015:
> After cycling through many windows, the original window may be
> obscured by many others, and if you still want to see its
> contents you end up doing the Alt-Tab-Tab-Tab-Tab-Tab, Alt-Tab,
> Alt-Tab dance.
> 
> This patch adds restacking of windows during cycling.  Hold Alt,
> press Tab and a window will be raised.  Press Tab again while
> still holding Alt and that window will be lowered back before
> another is raised.  Once you release Alt, the original window
> will be hidden behind no more than one other (the target),
> assuming it was raised before.

-- 
Parents often talk about the younger generation as if they
didn't have much of anything to do with it.
Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.311
diff -u -r1.311 calmwm.h
--- calmwm.h	12 Nov 2015 21:28:03 -	1.311
+++ calmwm.h	22 Nov 2015 15:33:22 -
@@ -62,6 +62,9 @@
 #define CWM_CLIENT_RCYCLE	0x0002
 #define CWM_CLIENT_CYCLE_INGRP	0x0004
 
+#define CWM_CLIENT_RESTACK_GROUP	0x0001
+#define CWM_CLIENT_RESTACK_HIDDEN	0x0002
+
 #define CWM_CLIENT_TILE_HORIZ	0x0001
 #define CWM_CLIENT_TILE_VERT	0x0002
 
@@ -385,6 +388,7 @@
 void			 client_applysizehints(struct client_ctx *);
 void			 client_config(struct client_ctx *);
 struct client_ctx	*client_current(void);
+void			 client_restack(struct client_ctx_q *, int);
 void			 client_cycle(struct screen_ctx *, int);
 void			 client_cycle_leave(struct screen_ctx *);
 void			 client_delete(struct client_ctx *);
Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.214
diff -u -r1.214 client.c
--- client.c	12 Nov 2015 18:33:30 -	1.214
+++ client.c	22 Nov 2015 15:33:22 -
@@ -664,6 +664,54 @@
 }
 
 void
+client_restack(struct client_ctx_q *clientq, int flags)
+{
+#define CLIENTQ_FOREACH(var, head, ingrp)\
+	for((var) = TAILQ_FIRST(head);	\
+	(var) != TAILQ_END(head);	\
+	(var) = (ingrp) ?		\
+		TAILQ_NEXT(var, group_entry) : TAILQ_NEXT(var, entry))
+	struct client_ctx	*cc;
+	Window			*winlist;
+	int			 i, lastempty = -1;
+	int			 nwins = 0, highstack = 0;
+
+	CLIENTQ_FOREACH(cc, clientq, flags & CWM_CLIENT_RESTACK_GROUP) {
+		if (!(flags & CWM_CLIENT_RESTACK_HIDDEN) &&
+		(cc->flags & CLIENT_HIDDEN)) {
+			continue;
+		}
+		if (cc->stackingorder > highstack)
+			highstack = cc->stackingorder;
+	}
+	winlist = xreallocarray(NULL, (highstack + 1), sizeof(*winlist));
+
+	/* Invert the stacking order for XRestackWindows(). */
+	CLIENTQ_FOREACH(cc, clientq, flags & CWM_CLIENT_RESTACK_GROUP) {
+		if (!(flags & CWM_CLIENT_RESTACK_HIDDEN) &&
+		(cc->flags & CLIENT_HIDDEN)) {
+			continue;
+		}
+		winlist[highstack - cc->stackingorder] = cc->win;
+		nwins++;
+	}
+
+	/* Un-sparseify */
+	for (i = 0; i <= highstack; i++) {
+		if (!winlist[i] && lastempty == -1)
+			lastempty = i;
+		else if (winlist[i] && lastempty != -1) {
+			winlist[lastempty] = winlist[i];
+			if (++lastempty == i)
+lastempty = -1;
+		}
+	}
+
+	XRestackWindows(X_Dpy, winlist, nwins);
+	free(winlist);
+}
+
+void
 client_cycle(struct screen_ctx *sc, int flags)
 {
 	struct client_ctx	*newcc, *oldcc;
@@ -704,9 +752,15 @@
 		}
 	}
 
-	/* reset when cycling mod is released. XXX I hate this hack */
-	sc->cycling = 1;
 	client_ptrsave(oldcc);
+	if (!sc->cycling) {
+		/* reset when cycling mod is released. XXX I hate this hack */
+		sc->cycling = 1;
+		screen_updatestackingorder(sc);
+	} else {
+		client_restack(&sc->clientq, (flags & CWM_CLIENT_CYCLE_INGRP) ?
+		CWM_CLIENT_RESTACK_GROUP : 0);
+	}
 	client_ptrwarp(newcc);
 }
 
Index: group.c
===
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.121
diff -u -r1.121 group.c
--- group.c	10 Nov 2015 20:05:33 -	1.121
+++ group.c	22 Nov 2015 15:33:22 -
@@ -34,7 +34,6 @@
 
 static struct group_ctx	*group_next(struct group_ctx *);
 static struct group_ctx	*group_prev(struct group_ctx *);
-static void		 group_restack(struct group_ctx *);
 static void		 group_setactive(struct group_ctx *);
 
 const char *num_to_name[] = {
@@ -82,43 +81,9 @@
 			client_unhide(cc);
 	}
 
-	group_restack(gc);
+	client_restack(&gc->clientq,
+	CWM_CLIENT_RESTACK_GROUP | CWM_CLIENT_RESTACK_HIDDEN);
 	group_setactive(gc);
-}
-
-static void
-group_restack(struct group_ctx *gc)
-{
-	struct client_ctx	*cc;
-	Window			*winlist;
-	int			 i, lastempty = -1;
-	int			 nwins = 0, highstack = 0;
-
-	TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
-		if (cc->stackingorder > highstack)
-			highstack = cc->stackingorder;
-	}
-	winlist = xreallocarray(NULL, (highstack + 1), sizeof(*winlist));
-
-	/* Invert the stacking order for XRestackWindows(). */
-	TAILQ_FOREACH(c

Re: int -> size_t in ksh

2015-11-22 Thread Nicholas Marriott
Just look at the trouble changing one int->size_t is causing in lex ;-).


On Sun, Nov 22, 2015 at 08:18:55AM +, Nicholas Marriott wrote:
> On Sun, Nov 22, 2015 at 01:59:07AM +, B?hler  Theo wrote:
> > > It seems apparent that they never go negative. All instances are used to
> > > manipulate strlen() values.
> > >
> > > ok?
> > 
> > the first hunk is fine with me. I don't understand the second one:
> > why only convert w? Aren't all three ints guaranteed to be unsigned there?
> 
> Don't change i to size_t, it is not a size. Personally I wouldn't change
> this, int instead of size_t is everywhere in code this old, it would be
> a lot of churn, I don't think it necessarily improves anything and the
> risk of a mistake is high.



Re: int -> size_t in ksh

2015-11-22 Thread Nicholas Marriott
On Sun, Nov 22, 2015 at 01:59:07AM +, B?hler  Theo wrote:
> > It seems apparent that they never go negative. All instances are used to
> > manipulate strlen() values.
> >
> > ok?
> 
> the first hunk is fine with me. I don't understand the second one:
> why only convert w? Aren't all three ints guaranteed to be unsigned there?

Don't change i to size_t, it is not a size. Personally I wouldn't change
this, int instead of size_t is everywhere in code this old, it would be
a lot of churn, I don't think it necessarily improves anything and the
risk of a mistake is high.