Re: remove twm(1) from xenocara ?
This is just the perspective of a user (even less: my _personal_ perspective). Removing twm would be a mistake in my opinion. It is still pretty functional and, when correctly configured, useful for server maintenance. And having it available in stock X11 is a definitely a plus. Cheers On July 17, 2022 10:38:53 AM GMT+02:00, Matthieu Herrb wrote: >Hi, > >twm(1) is the original X11R5 window manager. It has not been update to >support any of the extended window manager hints and still only knows >how to handle the legacy bitmapped fonts rendered by the X server. > >In ports we have x11/ctwm which, for people looking at legacy stuff, is >superior ihmo. > >I'm suggesting here to drop twm from xenocara (ie xbase). > >Anyone willing to keep it around is welcome to submit a port for it. > >ok ? >-- >Matthieu Herrb > -- Alessandro De Laurenzis
Re: Non-statically compiled utilities in /sbin
Sorry Theo, but this is not really inherent to what I wrote... I'm not arguing why those utilities are now dynamically linked (I'm sure they are for a reason), but just reporting a misalignment between hier(7) man page and the actual directory contents. Cheers On 14/11/2021 08:30, Theo de Raadt wrote: Hey you have the source code, and could have figured this out in a few minutes. iked/Makefile: revision 1.14 date: 2015/10/22 15:14:27; author: reyk; state: Exp; lines: +4 -1; commitid: H3YSN6oyq ntUT6Jo; Stop linking iked -static: It was inherited from isakmpd that is -static for NFS-over-IPsec that might mount the libraries after /usr. The benefit of linking iked dynamic outweighs the historic reason, eg. to get full address space randomization and to benefit from libcrypto updates, so we turn it into a dynamic binary. OK deraadt@ naddy@ Alessandro De Laurenzis wrote: Greeting, From hier(7): /sbin/ System programs and administration utilities fundamental to both single and multi-user environments. These programs are statically compiled and therefore do not depend on any system libraries to run. I see 2 exceptions here: $ ldd /sbin/iked /sbin/iked: StartEnd Type Open Ref GrpRef Name 0d960eed3000 0d960ef5a000 exe 10 0 /sbin/iked 0d98291ee000 0d9829203000 rlib 01 0 /usr/lib/libutil.so.16.0 0d98bc5a4000 0d98bc5b5000 rlib 01 0 /usr/lib/libevent.so.4.1 0d983e55f000 0d983e7a1000 rlib 01 0 /usr/lib/libcrypto.so.48.0 0d987a11c000 0d987a20e000 rlib 01 0 /usr/lib/libc.so.96.1 0d9827c28000 0d9827c28000 ld.so 01 0 /usr/libexec/ld.so and $ ldd /sbin/isakmpd /sbin/isakmpd: StartEnd Type Open Ref GrpRef Name 0bccefef1000 0bcceff67000 exe 10 0 /sbin/isakmpd 0bcf436b5000 0bcf438f7000 rlib 01 0 /usr/lib/libcrypto.so.48.0 0bcfa4819000 0bcfa4849000 rlib 01 0 /usr/lib/libm.so.10.1 0bcfb729f000 0bcfb7391000 rlib 01 0 /usr/lib/libc.so.96.1 0bcf00856000 0bcf00856000 ld.so 01 0 /usr/libexec/ld.so Should they be moved in /usr/sbin? Or should the man page be amended? Maybe something like this? --- hier.7.orig Thu Feb 6 06:40:02 2020 +++ hier.7 Sun Nov 14 06:43:38 2021 @@ -165,8 +165,8 @@ .It /sbin/ System programs and administration utilities fundamental to both single and multi-user environments. -These programs are statically compiled and therefore do not depend on any -system libraries to run. +Most of these programs are statically compiled and therefore do not depend +on any system libraries to run. .It /tmp/ Temporary files that are .Em not -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis
Non-statically compiled utilities in /sbin
Greeting, From hier(7): /sbin/ System programs and administration utilities fundamental to both single and multi-user environments. These programs are statically compiled and therefore do not depend on any system libraries to run. I see 2 exceptions here: $ ldd /sbin/iked /sbin/iked: StartEnd Type Open Ref GrpRef Name 0d960eed3000 0d960ef5a000 exe 10 0 /sbin/iked 0d98291ee000 0d9829203000 rlib 01 0 /usr/lib/libutil.so.16.0 0d98bc5a4000 0d98bc5b5000 rlib 01 0 /usr/lib/libevent.so.4.1 0d983e55f000 0d983e7a1000 rlib 01 0 /usr/lib/libcrypto.so.48.0 0d987a11c000 0d987a20e000 rlib 01 0 /usr/lib/libc.so.96.1 0d9827c28000 0d9827c28000 ld.so 01 0 /usr/libexec/ld.so and $ ldd /sbin/isakmpd /sbin/isakmpd: StartEnd Type Open Ref GrpRef Name 0bccefef1000 0bcceff67000 exe 10 0 /sbin/isakmpd 0bcf436b5000 0bcf438f7000 rlib 01 0 /usr/lib/libcrypto.so.48.0 0bcfa4819000 0bcfa4849000 rlib 01 0 /usr/lib/libm.so.10.1 0bcfb729f000 0bcfb7391000 rlib 01 0 /usr/lib/libc.so.96.1 0bcf00856000 0bcf00856000 ld.so 01 0 /usr/libexec/ld.so Should they be moved in /usr/sbin? Or should the man page be amended? Maybe something like this? --- hier.7.orig Thu Feb 6 06:40:02 2020 +++ hier.7 Sun Nov 14 06:43:38 2021 @@ -165,8 +165,8 @@ .It /sbin/ System programs and administration utilities fundamental to both single and multi-user environments. -These programs are statically compiled and therefore do not depend on any -system libraries to run. +Most of these programs are statically compiled and therefore do not depend +on any system libraries to run. .It /tmp/ Temporary files that are .Em not -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis
fortune(6): Veni, vidi, vici
Greetings, I was reluctant to submit this patch, since I'm not a native English speaker and this could be a wordplay joke, but if not, and it is really citing the Latin phrase popularly attributed to Julius Caesar (see e.g. [1], but there are plenty on the net, of course), the wrong order warps the meaning. Please consider the attached diff. All the best [1] https://en.wikipedia.org/wiki/Veni,_vidi,_vici -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis --- /usr/src/games/fortune/datfiles/fortunes2-o.orig Thu Jul 13 04:45:56 2017 +++ /usr/src/games/fortune/datfiles/fortunes2-o Mon Aug 23 20:07:23 2021 @@ -14251,8 +14251,8 @@ to a rival. Husbands, good or bad, always have rivals. Lovers, never. -- Helen Lawrenson, "Esquire" % -Vidi, vici, veni. -(I saw, I conquered, I came.) +Veni, vidi, vici. +(I came, I saw, I conquered.) % Viennese Oyster: Lady who can cross her feet behind her head, lying on her back, of course. When she has done so, you hold her tightly round each instep
Re: ucc(4): consumer control keyboard device driver
sc->sc_rawsiz = isize * sizeof(*sc->sc_raw); + sc->sc_raw = mallocarray(isize, sizeof(*sc->sc_raw), M_USBDEV, + M_WAITOK | M_ZERO); + + hd = hid_start_parse(desc, descsiz, hid_input); + while (hid_get_item(hd, &hi)) { + const struct ucc_keysym *us; + int bit; + + if (HID_GET_USAGE_PAGE(hi.usage) != HUP_CONSUMER || + HID_GET_USAGE(hi.usage) == HUC_CONTROL) + continue; + + bit = sc->sc_nkeys++; + if (ucc_usage_to_sym(HID_GET_USAGE(hi.usage), &us)) + continue; + + if (sc->sc_maplen + 2 >= sc->sc_mapsiz) + return ENOMEM; + sc->sc_map[sc->sc_maplen++] = KS_KEYCODE(bit); + sc->sc_map[sc->sc_maplen++] = us->us_key; + + if (sc->sc_rawlen + 1 >= sc->sc_rawsiz) + return ENOMEM; + sc->sc_raw[sc->sc_rawlen].ur_bit = bit; + sc->sc_raw[sc->sc_rawlen].ur_raw = us->us_raw; + sc->sc_rawlen++; + + DPRINTF("%s: bit %d, usage %0x, key %0x\n", __func__, + bit, HID_GET_USAGE(hi.usage), us->us_key); + } + hid_end_parse(hd); + + return 0; +} + +int +ucc_bit_to_raw(struct ucc_softc *sc, u_int bit, u_char *raw) +{ + u_int i; + + for (i = 0; i < sc->sc_rawlen; i++) { + const struct ucc_keyraw *ur = &sc->sc_raw[i]; + + if (ur->ur_bit == bit) { + *raw = ur->ur_raw; + return 0; + } + } + return 1; +} + +int +ucc_usage_to_sym(int32_t usage, const struct ucc_keysym **us) +{ + int len = nitems(ucc_keysyms); + int i; + + for (i = 0; i < len; i++) { + if (ucc_keysyms[i].us_usage == usage) { + *us = &ucc_keysyms[i]; + return 0; + } + } + return 1; +} + +void +ucc_input(struct ucc_softc *sc, u_int bit, int release) +{ + int s; + + s = spltty(); + wskbd_input(sc->sc_wskbddev, + release ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN, bit); + splx(s); +} + +void +ucc_rawinput(struct ucc_softc *sc, u_char c, int release) +{ + u_char buf[2]; + int len = 0; + int s; + + if (c & 0x80) + buf[len++] = 0xe0; + buf[len++] = c & 0x7f; + if (release) + buf[len - 1] |= 0x80; + + s = spltty(); + wskbd_rawinput(sc->sc_wskbddev, buf, len); + splx(s); +} + +int +ucc_setbits(u_char *data, int len, u_int *bit) +{ + int i, j; + + for (i = 0; i < len; i++) { + if (data[i] == 0) + continue; + + for (j = 0; j < 8; j++) { + if (data[i] & (1 << j)) { + *bit = (i * 8) + j; + return 0; + } + } + } + + return 1; +} + +#ifdef UCC_DEBUG + +void +ucc_dump(const char *prefix, u_char *data, u_int len) +{ + u_int i; + + if (ucc_debug == 0) + return; + + printf("%s:", prefix); + for (i = 0; i < len; i++) + printf(" %02x", data[i]); + printf("\n"); +} + +#endif -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis OpenBSD 6.9-current (GENERIC.MP) #171: Sat Aug 7 19:31:34 MDT 2021 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 8239386624 (7857MB) avail mem = 7973724160 (7604MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdae9c000 (68 entries) bios0: vendor LENOVO version "G1ETB8WW (2.78 )" date 09/19/2018 bios0: LENOVO 2349KT5 acpi0 at bios0: ACPI 5.0 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP SLIC TCPA SSDT SSDT SSDT HPET APIC MCFG ECDT FPDT ASF! UEFI UEFI POAT SSDT SSDT DMAR UEFI DBG2 acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP3(S4) XHCI(S3) EHC1(S3) EHC2(S3) HDEF(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpihpet0 at acpi0: 14318179 Hz acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2594.48 MHz, 06-3a-09 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSA
Re: ksh(1): '[' and ']' chars disturbing substitution?
Hello Andreas, Got the point, thanks a lot for your feedback. Cheers On 26/12/2020 16:04, Andreas Kusalananda Kähäri wrote: On Sat, Dec 26, 2020 at 01:29:58PM +0100, Alessandro De Laurenzis wrote: Greetings, While extracting the first two characters from a string I noticed the following: $ str="-- foo bar blahblahblah" $ echo "First 2 chars: ${str%${str#??}}" First 2 chars: -- $ str="-- foo bar blahblahblah [foo]" $ echo "First 2 chars: ${str%${str#??}}" First 2 chars: -- foo bar blahblahblah [foo] $ It seems that the presence of '[' and ']' is somehow disturbing the substitution... Quite similar behavior in bash (the only difference is that the substitution works there when no chars are present in between the square brackets). Is this expected? The main issue with your code is that you need to quote the pattern to have it be interpeted as a string an not as a shell globbing pattern: ${str%"${str#??}"} You may also want to use printf to output variable data (it doesn't matter in this particular case though, but would matter with bash with the xpg_echo shell option set, if the two characters happens to be something like \n or \t). printf 'First 2 chars: %s\n' "${str%"${str#??}"}" -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis
ksh(1): '[' and ']' chars disturbing substitution?
Greetings, While extracting the first two characters from a string I noticed the following: $ str="-- foo bar blahblahblah" $ echo "First 2 chars: ${str%${str#??}}" First 2 chars: -- $ str="-- foo bar blahblahblah [foo]" $ echo "First 2 chars: ${str%${str#??}}" First 2 chars: -- foo bar blahblahblah [foo] $ It seems that the presence of '[' and ']' is somehow disturbing the substitution... Quite similar behavior in bash (the only difference is that the substitution works there when no chars are present in between the square brackets). Is this expected? -- Alessandro De Laurenzis [mailto:jus...@atlantide.mooo.com] Web: http://www.atlantide.mooo.com LinkedIn: http://it.linkedin.com/in/delaurenzis
cwm - vtile and htile functions not compatible with group paradigm?
Dear tech@ readers, I recently started to use cwm (which I'm appreciating for its simplicity) and, coming from a long dwm experience, I use the vtile/htile functions a lot. I noticed that, imho, they break the group paradigm (maybe to the advanted of ewmh desktop usage in this case, which is partially broken in other situations, see e.g. [1]), since they only act on windows belonging to the same group of the active one: 1) open a window in group 1; only "window 1" will be visible; 2) switch to group 2 only and open a new window; only "window 2 will be visible; 3) toggle group 1 visibility; both "window 1" and "window 2" are now visible; 4) try "vtile" or "htile" functions: nothing happens, since there is only one client for each group. In a situation like that, I'm expecting tile-shaping adjustment instead... Would the following patch be suitable? --- client.c.orig Sun Aug 11 10:47:28 2019 +++ client.cSun Aug 11 10:50:20 2019 @@ -974,7 +974,7 @@ return; i = n = 0; - TAILQ_FOREACH(ci, &gc->clientq, group_entry) { + TAILQ_FOREACH(ci, &gc->clientq, entry) { if (ci->flags & CLIENT_HIDDEN || ci->flags & CLIENT_IGNORE || (ci == cc)) continue; @@ -1003,7 +1003,7 @@ x = area.x; w = area.w / n; h = area.h - mh; - TAILQ_FOREACH(ci, &gc->clientq, group_entry) { + TAILQ_FOREACH(ci, &gc->clientq, entry) { if (ci->flags & CLIENT_HIDDEN || ci->flags & CLIENT_IGNORE || (ci == cc)) continue; @@ -1034,7 +1034,7 @@ return; i = n = 0; - TAILQ_FOREACH(ci, &gc->clientq, group_entry) { + TAILQ_FOREACH(ci, &gc->clientq, entry) { if (ci->flags & CLIENT_HIDDEN || ci->flags & CLIENT_IGNORE || (ci == cc)) continue; @@ -1063,7 +1063,7 @@ y = area.y; h = area.h / n; w = area.w - mw; - TAILQ_FOREACH(ci, &gc->clientq, group_entry) { + TAILQ_FOREACH(ci, &gc->clientq, entry) { if (ci->flags & CLIENT_HIDDEN || ci->flags & CLIENT_IGNORE || (ci == cc)) continue; [1] https://marc.info/?l=openbsd-misc&m=148094411610762&w=2 -- Alessandro DE LAURENZIS [mailto:jus...@atlantide.t28.net] Web: http://www.atlantide.t28.net LinkedIn: https://www.linkedin.com/in/delaurenzis/
games/fortune translation fix
Dear developers, Currently the latin motto "Ad astra per aspera" is translated as "to the stars by aspiration", which sounds weird. The literal translation from Wikipedia [1] would be "through hardships to the stars", but here I'm proposing a rewording by A. J. Finn, in "The Woman in the Window: A Novel" (cited in Wikipedia too), which I like more: "Through adversity to the stars": [...] Index: games/fortune/datfiles/fortunes2 === RCS file: /cvs/src/games/fortune/datfiles/fortunes2,v retrieving revision 1.49 diff -u -p -u -p -r1.49 fortunes2 --- games/fortune/datfiles/fortunes225 Nov 2017 05:55:40 - 1.49 +++ games/fortune/datfiles/fortunes22 Feb 2019 16:50:16 - @@ -7694,7 +7694,7 @@ Assume true for N, prove for N+1: it is true for all N+1 floors. QED. % -Ad astra per aspera. (To the stars by aspiration.) +Ad astra per aspera. (Through adversity to the stars.) % Adde parvum parvo manus acervus erit. [Add little to little and there will be a big pile.] [...] Just my 2 cents. [1] https://en.wikipedia.org/wiki/Per_aspera_ad_astra -- Alessandro DE LAURENZIS [mailto:jus...@atlantide.t28.net] Web: http://www.atlantide.t28.net LinkedIn: https://www.linkedin.com/in/delaurenzis/
Re: ksh: add support for HISTCONTROL ignorespace & ignoredups
= >RCS file: /d/cvs/src/bin/ksh/table.h,v >retrieving revision 1.11 >diff -u -p -r1.11 table.h >--- table.h10 Oct 2015 07:35:16 - 1.11 >+++ table.h30 Aug 2017 10:38:43 - >@@ -160,15 +160,16 @@ extern const struct builtin shbuiltins [ > #define V_MAILPATH 6 > #define V_MAILCHECK 7 > #define V_RANDOM8 >-#define V_HISTSIZE9 >-#define V_HISTFILE10 >-#define V_VISUAL 11 >-#define V_EDITOR 12 >-#define V_COLUMNS 13 >-#define V_POSIXLY_CORRECT 14 >-#define V_TMOUT 15 >-#define V_TMPDIR 16 >-#define V_LINENO 17 >+#define V_HISTCONTROL 9 >+#define V_HISTSIZE 10 >+#define V_HISTFILE 11 >+#define V_VISUAL12 >+#define V_EDITOR13 >+#define V_COLUMNS 14 >+#define V_POSIXLY_CORRECT 15 >+#define V_TMOUT 16 >+#define V_TMPDIR17 >+#define V_LINENO18 > > /* values for set_prompt() */ > #define PS1 0 /* command */ >Index: var.c >=== >RCS file: /d/cvs/src/bin/ksh/var.c,v >retrieving revision 1.57 >diff -u -p -r1.57 var.c >--- var.c 8 Sep 2016 15:50:50 - 1.57 >+++ var.c 30 Aug 2017 10:38:43 - >@@ -98,6 +98,7 @@ initvar(void) > { "POSIXLY_CORRECT",V_POSIXLY_CORRECT }, > { "TMPDIR", V_TMPDIR }, > #ifdef HISTORY >+ { "HISTCONTROL",V_HISTCONTROL }, > { "HISTFILE", V_HISTFILE }, > { "HISTSIZE", V_HISTSIZE }, > #endif /* HISTORY */ >@@ -993,6 +994,9 @@ setspec(struct tbl *vp) > } > break; > #ifdef HISTORY >+ case V_HISTCONTROL: >+ sethistcontrol(str_val(vp)); >+ break; > case V_HISTSIZE: > vp->flag &= ~SPECIAL; > sethistsize((int) intval(vp)); >@@ -1086,6 +1090,11 @@ unsetspec(struct tbl *vp) > case V_MAILPATH: > mpset(NULL); > break; >+#ifdef HISTORY >+ case V_HISTCONTROL: >+ sethistcontrol(NULL); >+ break; >+#endif > case V_LINENO: > case V_MAILCHECK: /* at&t ksh leaves previous value in place */ > case V_RANDOM: > >-- >jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 >E7EE -- Alessandro DE LAURENZIS [jus...@atlantide.t28.net]
Re: [patch] Fix tput(1) capability's needed argument count
Dear tech@ readers, On Thu 24/12/2015 15:58, Alessandro DE LAURENZIS wrote: [...] > my second attempt... I understand that the previous patch was wrong. > > After digging into terminfo(5) man page, I think the problem could be > related to the if...then...else structures (%?...%t...%e...%t...%;) > Probably we should reset the parameter counter each time we change the > branch, proceeding "row by row" as per "infocmp -f" output. I didn't receive any feedback so far, meaning either xterm 256-color usage is barely used in our community or my approach in fixing tput is completely wrong. Nevertheless, I'm still trying to improve the patch; this time, I realized that popcount is not actually involved into the parameter counting process, so no need to reset it: --- /usr/src/usr.bin/tput/tput.c.orig Fri Jan 16 07:40:13 2015 +++ /usr/src/usr.bin/tput/tput.cFri Dec 25 14:39:32 2015 @@ -190,10 +190,10 @@ process(char *cap, char *str, char **argv) { char *cp, *s, *nargv[9]; - int arg_need, popcount, i; + int arg_need, arg_need_p, popcount, i; /* Count how many values we need for this capability. */ - for (cp = str, arg_need = popcount = 0; *cp != '\0'; cp++) { + for (cp = str, arg_need = arg_need_p = popcount = 0; *cp != '\0'; cp++) { if (*cp == '%') { switch (*++cp) { case '%': @@ -224,6 +224,14 @@ case '.': case '+': arg_need++; + break; + case '?': + case 'e': + arg_need_p = MAXIMUM(arg_need_p, arg_need); + arg_need=0; + break; + case ';': + arg_need = MAXIMUM(arg_need_p, arg_need); break; default: break; -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis
Re: [patch] Fix tput(1) capability's needed argument count
Dear tech@ readers, On 11/21/15 13:20, Alessandro DE LAURENZIS wrote: > Dear tech@, > > This is an attempt to solve a problem I previously reported [1] to > misc@ (without receiving any feedback, so far). [...] > [1] http://marc.info/?l=openbsd-misc&m=144800414402238&w=2 > my second attempt... I understand that the previous patch was wrong. After digging into terminfo(5) man page, I think the problem could be related to the if...then...else structures (%?...%t...%e...%t...%;) Probably we should reset the parameter counter each time we change the branch, proceeding "row by row" as per "infocmp -f" output. The following patch could be a step forward in this direction, although some corner cases might be uncovered: --- /usr/src/usr.bin/tput/tput.c.orig Fri Jan 16 07:40:13 2015 +++ /usr/src/usr.bin/tput/tput.cThu Dec 24 15:12:28 2015 @@ -190,10 +190,12 @@ process(char *cap, char *str, char **argv) { char *cp, *s, *nargv[9]; - int arg_need, popcount, i; + int arg_need, arg_need_p, popcount, popcount_p, i; /* Count how many values we need for this capability. */ - for (cp = str, arg_need = popcount = 0; *cp != '\0'; cp++) { + for (cp = str, + arg_need = arg_need_p = popcount = popcount_p = 0; + *cp != '\0'; cp++) { if (*cp == '%') { switch (*++cp) { case '%': @@ -224,6 +226,17 @@ case '.': case '+': arg_need++; + break; + case '?': + case 'e': + arg_need_p = MAXIMUM(arg_need_p, arg_need); + arg_need=0; + popcount_p = MAXIMUM(popcount_p, popcount); + popcount=0; + break; + case ';': + arg_need = MAXIMUM(arg_need_p, arg_need); + popcount = MAXIMUM(popcount_p, popcount); break; default: break; I played a bit with it and I didn't observe any regression with TERM set to "xterm", "xterm-color", "xterm-256color", "screen", "screen-256color" and "wsvt25"; of course, both "tput setaf" and "tput setab" now work as expected. Just let me know your view. All the best -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis
[patch] Fix tput(1) capability's needed argument count
Dear tech@, This is an attempt to solve a problem I previously reported [1] to misc@ (without receiving any feedback, so far). >From terminfo(5), I understand that the stack mechanism is the only way to parametrize a string in terminfo db; this should mean that parameter count should't take into account "%d", "%s" and "%[1-9]" codes. On top of that, cp[1] usage in the original code sounds like a mistake. Please consider that I'm not a C programmer and this is only a "work for me" proposal (even if I tested it with typical tput usage and the resulting code seems closer to NetBSD's implementation). Just let me know your thoughts. [snip] --- /usr/src/usr.bin/tput/tput.c.orig Fri Jan 16 07:40:13 2015 +++ /usr/src/usr.bin/tput/tput.cSat Nov 21 12:26:13 2015 @@ -190,47 +190,30 @@ process(char *cap, char *str, char **argv) { char *cp, *s, *nargv[9]; - int arg_need, popcount, i; + int arg_need, i; /* Count how many values we need for this capability. */ - for (cp = str, arg_need = popcount = 0; *cp != '\0'; cp++) { + for (cp = str, arg_need = 0; *cp != '\0'; cp++) { if (*cp == '%') { switch (*++cp) { case '%': cp++; break; case 'i': - if (popcount < 2) - popcount = 2; + if (arg_need < 2) + arg_need = 2; break; case 'p': cp++; - if (isdigit((unsigned char)cp[1]) && - popcount < cp[1] - '0') - popcount = cp[1] - '0'; + if (isdigit((unsigned char)cp[0]) && + arg_need < cp[0] - '0') + arg_need = cp[0] - '0'; break; - case 'd': - case 's': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '.': - case '+': - arg_need++; - break; default: break; } } } - arg_need = MAXIMUM(arg_need, popcount); if (arg_need > 9) errx(2, "too many arguments (%d) for capability `%s'", arg_need, cap); [snip] [1] http://marc.info/?l=openbsd-misc&m=144800414402238&w=2 -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis
Re: does anoybody use ul?
Hi Ted, On Fri 23/10/2015 03:47, Ted Unangst wrote: > ul appears somewhat useless for its intended purpose. > > echo _xxx_ | ul does not result in underlined text in an xterm, so I doubt > many people are using this. [...] I don't use it anymore, but some time ago I needed to quickly highlight some text in a couple of scripts and found out (see [0]) that ul(1) requires a rather obscure sequence of backspaces and underscores to work properly; just try: echo $'x\b_x\b_x\b_' | ul which correctly underlines the "xxx" string in xterm. I'm not against the removal, this is only to say that the command actually works. Cheers [0]: http://unix.stackexchange.com/questions/3044/how-to-use-the-ul-command-line-utility -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis
Re: ksh: allow leading space stripping with <<- redirection
Hello Philip, On Sun 13/09/2015 09:32, Philip Guenther wrote: [...] > Nope. The just-strip-tabs behavior is straight from the standard. To > quote SUSv4 XCU section 2.7.4 paragraph 5: [...] Got it, thanks for your feedback. Cheers -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis
ksh: allow leading space stripping with <<- redirection
Hello, The following patch would strip leading blank characters (instead of tabs only) from the lines in the document when <<- redirection is used (and should be useful when indentation is done with spaces): --- tree.h.orig Mon Mar 28 23:28:22 2005 +++ tree.h Sun Sep 13 08:23:01 2015 @@ -92,7 +92,7 @@ #defineIOCAT 0x5 /* >> */ #defineIODUP 0x6 /* <&/>& */ #defineIOEVAL BIT(4) /* expand in << */ -#defineIOSKIP BIT(5) /* <<-, skip ^\t* */ +#defineIOSKIP BIT(5) /* <<-, skip ^[ \t]* */ #defineIOCLOB BIT(6) /* >|, override -o noclobber */ #define IORDUP BIT(7) /* x<&y (as opposed to x>&y) */ #define IONAMEXP BIT(8)/* name has been expanded */ --- lex.c.orig Sun Sep 13 07:50:06 2015 +++ lex.c Sun Sep 13 08:08:29 2015 @@ -843,7 +843,7 @@ int c; char *volatile eof; char *eofp; - int skiptabs; + int skipblanks; XString xs; char *xp; int xpos; @@ -857,13 +857,13 @@ for (;;) { eofp = eof; - skiptabs = iop->flag & IOSKIP; + skipblanks = iop->flag & IOSKIP; xpos = Xsavepos(xs, xp); while ((c = getsc()) != 0) { - if (skiptabs) { - if (c == '\t') + if (skipblanks) { + if (isblank(c)) continue; - skiptabs = 0; + skipblanks = 0; } if (c != *eofp) break; --- ksh.1.orig Fri Jul 17 08:39:57 2015 +++ ksh.1 Sun Sep 13 08:11:05 2015 @@ -2085,7 +2085,8 @@ .It \*(Lt\*(Lt- Ar marker Same as .Ic \*(Lt\*(Lt , -except leading tabs are stripped from lines in the here document. +except leading blank characters (tabs and spaces) are stripped from lines in +the here document. .It \*(Lt& Ar fd Standard input is duplicated from file descriptor .Ar fd . --- sh.1.orig Wed Jun 17 07:47:43 2015 +++ sh.1Sun Sep 13 08:13:20 2015 @@ -1554,7 +1554,7 @@ .It Oo Ar n Oc Ns <<- Same as .Ic << , -except leading tabs are stripped from lines in +except leading blank characters (spaces or tabs) are stripped from lines in .Ar block . .It Oo Ar n Oc Ns <& Ns Ar file Make file descriptor I don't know if isblank(3) is acceptable here (since I do not understand from the man page if it could return true for characters different from spaces and tabs when locales other than C are used); if not, a simple or operator between '\t' and ' ' could be used instead. All the best -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis
WOL support for bge driver
0x0020 +#define BGE_WOL0x0400 +#define BGE_WOL_NEEDS_VAUX 0x0800 +#define BGE_NO_GPIO2 0x1000 #defineBGE_MSI 0x0040 #defineBGE_RDMA_BUG0x0080 #defineBGE_JUMBO_RING 0x0100 --- ./bge.4.origSun May 17 19:20:38 2015 +++ ./bge.4 Sun May 17 19:23:23 2015 @@ -114,6 +114,15 @@ .Pp The .Nm +driver additionally supports Wake on LAN (WoL). +See +.Xr arp 8 +and +.Xr ifconfig 8 +for more details. +.Pp +The +.Nm driver supports the following media types: .Bl -tag -width 1000baseSX .It Cm autoselect -- Alessandro DE LAURENZIS [mailto:just22@gmail.com] LinkedIn: http://it.linkedin.com/in/delaurenzis