missing .Pa in spamdb.8

2014-06-22 Thread Jan Stary
Index: usr.sbin/spamdb/spamdb.8
===
RCS file: /cvs/src/usr.sbin/spamdb/spamdb.8,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 spamdb.8
--- usr.sbin/spamdb/spamdb.829 Jun 2013 09:08:41 -  1.17
+++ usr.sbin/spamdb/spamdb.822 Jun 2014 12:06:06 -
@@ -168,7 +168,7 @@ Times may be converted to human readable
 .Pp
 .Dl $ date -r value
 .Sh FILES
-/var/db/spamd
+.Pa /var/db/spamd
 .Sh SEE ALSO
 .Xr spamd.conf 5 ,
 .Xr spamd 8 ,



Re: infnan.3

2014-06-22 Thread Jan Stary
On Jun 22 14:27:26, h...@stare.cz wrote:
 lib/libm/man/infnan.3 says
 
At some time in the future, some of the useful properties
of the Infinities and NaNs in the IEEE standard 754 for Binary
Floating-Point Arithmetic will be simulated in UNIX on the DEC VAX
 
 Not sure about the future of DEC VAX
 - do we want to keep the slightly amusing text or what?

Anyway:


Index: lib/libm/man/infnan.3
===
RCS file: /cvs/src/lib/libm/man/infnan.3,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 infnan.3
--- lib/libm/man/infnan.3   3 Nov 2013 18:28:27 -   1.16
+++ lib/libm/man/infnan.3   22 Jun 2014 12:29:00 -
@@ -47,7 +47,7 @@ the Infinities and \*(Nas in the
 .Tn IEEE
 standard 754 for Binary
 Floating\-Point Arithmetic will be simulated in
-.Tn UNIX
+.Ux
 on the
 .Tn DEC VAX
 by using its Reserved Operands.
@@ -62,7 +62,7 @@ in appropriate places in
 .Em libm .
 When
 better exception\-handling is implemented in
-.Tn UNIX ,
+.Ux ,
 only
 .Fn infnan
 among the codes in



Re: Advanced btcoex in iwn(4)

2013-08-18 Thread Jan Stary
On Aug 10 18:12:26, ccna@gmail.com wrote:
 Here is a patch for advanced btcoex support in iwn(4). I know
 that there is no particular reason to do it due to the lack of
 bluetooth enabled by default. But as we already do btcoex for
 the cards without IWN_FLAG_ADV_BT_COEX flag I was thinking
 that we could also do it on other cards.
 
 I take all these things in freebsd without the memset that
 overflow:
 memset(btprot, 0, sizeof btprio);
 
 I've also replaced some hardcoded values by defines and added
 few comments.
 
 It works on Intel Wifi Link 130 and jca@ have tried it
 on his Wifi Link 5300. It would be awesome if someone could 
 try it on other chips.

It doesn't break my Intel Wireless WiFi Link 4965.


OpenBSD 5.4-current (GENERIC) #3: Sun Aug 18 13:14:59 CEST 2013
r...@lenovo.stare.cz:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Core(TM)2 Duo CPU T7250 @ 2.00GHz (GenuineIntel 686-class) 
2.20 GHz
cpu0: 
FPU,V86,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,NXE,LONG,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,LAHF,PERF
real mem  = 1071894528 (1022MB)
avail mem = 1042558976 (994MB)
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 08/27/07, BIOS32 rev. 0 @ 0xfdc70, SMBIOS 
rev. 2.4 @ 0xe0010 (71 entries)
bios0: vendor LENOVO version 7KET72WW (1.22 ) date 08/27/2007
bios0: LENOVO 8918B8G
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG HPET SLIC BOOT SSDT SSDT SSDT 
SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) LURT(S3) DURT(S3) IGBE(S4) EXP0(S4) 
EXP1(S4) EXP2(S4) EXP3(S4) EXP4(S4) PCI1(S4) USB0(S3) USB1(S3) USB2(S3) 
USB3(S3) USB4(S3) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: apic clock running at 199MHz
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 2, remapped to apid 1
acpimcfg0 at acpi0 addr 0xf000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (EXP0)
acpiprt3 at acpi0: bus 3 (EXP1)
acpiprt4 at acpi0: bus 4 (EXP2)
acpiprt5 at acpi0: bus 5 (EXP3)
acpiprt6 at acpi0: bus 13 (EXP4)
acpiprt7 at acpi0: bus 21 (PCI1)
acpicpu0 at acpi0: C3, C2, C1, PSS
acpipwrres0 at acpi0: PUBS
acpitz0 at acpi0: critical temperature is 127 degC
acpitz1 at acpi0: critical temperature is 100 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model COMPATIBLE serial 13920 type LION oem SANYO
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: GDCK not docked (0)
bios0: ROM list: 0xc/0xf000 0xcf000/0x1000 0xd/0x1000 0xe/0x1!
cpu0: Enhanced SpeedStep 1996 MHz: speeds: 2001, 2000, 1600, 1200, 800 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 Intel GM965 Host rev 0x0c
ppb0 at pci0 dev 1 function 0 Intel GM965 PCIE rev 0x0c: apic 1 int 16
pci1 at ppb0 bus 1
vga1 at pci1 dev 0 function 0 vendor NVIDIA, unknown product 0x0429 rev 0xa1
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
em0 at pci0 dev 25 function 0 Intel ICH8 IGP M rev 0x03: msi, address 
00:1a:6b:d4:5f:22
uhci0 at pci0 dev 26 function 0 Intel 82801H USB rev 0x03: apic 1 int 20
uhci1 at pci0 dev 26 function 1 Intel 82801H USB rev 0x03: apic 1 int 21
ehci0 at pci0 dev 26 function 7 Intel 82801H USB rev 0x03: apic 1 int 22
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 Intel 82801H HD Audio rev 0x03: msi
azalia0: codecs: Analog Devices AD1984, Conexant/0x2bfa, using Analog Devices 
AD1984
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 Intel 82801H PCIE rev 0x03: apic 1 int 20
pci2 at ppb1 bus 2
ppb2 at pci0 dev 28 function 1 Intel 82801H PCIE rev 0x03: apic 1 int 21
pci3 at ppb2 bus 3
iwn0 at pci3 dev 0 function 0 Intel Wireless WiFi Link 4965 rev 0x61: msi, 
MIMO 2T3R, MoW2, address 00:13:e8:d2:4e:9b
ppb3 at pci0 dev 28 function 2 Intel 82801H PCIE rev 0x03: apic 1 int 22
pci4 at ppb3 bus 4
ppb4 at pci0 dev 28 function 3 Intel 82801H PCIE rev 0x03: apic 1 int 23
pci5 at ppb4 bus 5
ppb5 at pci0 dev 28 function 4 Intel 82801H PCIE rev 0x03: apic 1 int 20
pci6 at ppb5 bus 13
uhci2 at pci0 dev 29 function 0 Intel 82801H USB rev 0x03: apic 1 int 16
uhci3 at pci0 dev 29 function 1 Intel 82801H USB rev 0x03: apic 1 int 17
uhci4 at pci0 dev 29 function 2 Intel 82801H USB rev 0x03: apic 1 int 18
ehci1 at pci0 dev 29 function 7 Intel 82801H USB rev 0x03: apic 1 int 19
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb6 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0xf3
pci7 at ppb6 bus 21
cbb0 at pci7 dev 0 function 

appleagp(4) disabled

2013-08-18 Thread Jan Stary
On Aug 18 11:33:01, kette...@cvs.openbsd.org wrote:
 Modified files:
   sys/arch/macppc/conf: GENERIC 
 
 Log message:
 Disable appleagp(4).  It doesn't really work yet, and hurts certain iBook G3
 models (PowerMac4,3).

As I have an appleagp(4) on a MacMini,
I tried to see what it does (now that it is being disabled)
but it seems we don't have a appleagp(4) manpage.
Is this described elsewhere? Or is appleagp(4) just
a lower apple-specific layer of agp(4)?



a nice diff

2014-02-13 Thread Jan Stary
--- /usr/src/usr.bin/nice/nice.cTue Dec 24 17:13:20 2013
+++ ./nice.cThu Feb 13 21:20:05 2014
@@ -30,7 +30,6 @@
  * SUCH DAMAGE.
  */
 
-#include sys/time.h
 #include sys/resource.h
 #include stdio.h
 #include stdlib.h
@@ -72,7 +71,8 @@ main(int argc, char *argv[])
break;
}
}
-   argc -= optind; argv += optind;
+   argc -= optind;
+   argv += optind;
 
if (argc == 0)
usage();



Re: Remove userland agp interfaces

2014-03-16 Thread Jan Stary
On Mar 12 16:44:10, mark.kette...@xs4all.nl wrote:
 Now that we have KMS, giving userland access to AGP through /dev/agp0
 is no longer necessary.  As far as I can tell none of the drivers we
 ship in xenocara still use this.

Back when we had appleagp, my PowerBook6,1 and MacMini were happier.
So I tried to just reenable

  appleagp*   at pchb?
  agp*at appleagp?# AGP bridges

in my kernel config, but this diff below seems to break it:

cc  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes  -Wno-main
-Wno-uninitialized -Wno-format  -Wstack-larger-than-2047 -msoft-float
-Wa,-many -fno-builtin-printf -fno-builtin-snprintf
-fno-builtin-vsnprintf -fno-builtin-log  -fno-builtin-log2
-fno-builtin-malloc  -O2 -pipe -nostdinc -I../../../.. -I.
-I../../../../arch -DDDB -DDIAGNOSTIC -DKTRACE -DACCOUNTING -DKMEMSTATS
-DPTRACE -DPOOL_DEBUG -DCRYPTO -DSYSVMSG -DSYSVSEM -DSYSVSHM
-DUVM_SWAP_ENCRYPT -DCOMPAT_43 -DLKM -DFFS -DFFS2 -DFFS_SOFTUPDATES
-DUFS_DIRHASH -DQUOTA -DEXT2FS -DMFS -DNFSCLIENT -DNFSSERVER -DCD9660
-DUDF -DMSDOSFS -DFIFO -DTMPFS -DFUSE -DSOCKET_SPLICE -DTCP_SACK
-DTCP_ECN -DTCP_SIGNATURE -DINET -DALTQ -DINET6 -DIPSEC -DPPP_BSDCOMP
-DPPP_DEFLATE -DPIPEX -DMROUTING -DMPLS -DBOOT_CONFIG -DPCIVERBOSE
-DUSBVERBOSE -DADBVERBOSE -DALTIVEC -DAPERTURE -DWSDISPLAY_COMPAT_USL
-DWSDISPLAY_COMPAT_RAWKBD -DWSDISPLAY_DEFAULTSCREENS=6
-DWSDISPLAY_COMPAT_PCVT -DUSER_PCICONF -DONEWIREVERBOSE -DMAXUSERS=80
-D_KERNEL -D__macppc__ -MD -MP  -c ../../../../arch/macppc/macppc/conf.c
../../../../arch/macppc/macppc/conf.c:235: error: 'cdev_notdef'
undeclared here (not in a function)


Does that mean that there is no way back now to appleagp?
I hear it wasn't really right, but e.g. my PowerBook did X
just fine in 5.4, but needs to use Driver wsfb now ...

Thank you for your time

Jan



 A possible exception is Intel's
 first generation of integrated graphics (the i810 and i815 chipsets),
 but I believe support for those has been broken for at least a year
 now.  And with the gutting of XAA from the X server the vesa driver
 probably works as well as a dedicated driver for this hardware.
 
 ok?
 
 Index: arch/amd64/amd64/conf.c
 ===
 RCS file: /home/cvs/src/sys/arch/amd64/amd64/conf.c,v
 retrieving revision 1.44
 diff -u -p -r1.44 conf.c
 --- arch/amd64/amd64/conf.c   4 Nov 2013 17:14:26 -   1.44
 +++ arch/amd64/amd64/conf.c   12 Mar 2014 15:06:54 -
 @@ -156,8 +156,6 @@ cdev_decl(cztty);
  #include radio.h
  #include nvram.h
  cdev_decl(nvram);
 -#include agp.h
 -cdev_decl(agp);
  #include drm.h
  cdev_decl(drm);
  
 @@ -278,7 +276,7 @@ struct cdevsw cdevsw[] =
   cdev_acpi_init(NACPI,acpi), /* 83: ACPI */
   cdev_notdef(),
   cdev_nvram_init(NNVRAM,nvram),  /* 85: NVRAM interface */
 - cdev_agp_init(NAGP,agp),/* 86: agp */
 + cdev_notdef(),  /* 86 */
   cdev_drm_init(NDRM,drm),/* 87: drm */
   cdev_gpio_init(NGPIO,gpio), /* 88: gpio */
   cdev_vscsi_init(NVSCSI,vscsi),  /* 89: vscsi */
 Index: arch/i386/i386/conf.c
 ===
 RCS file: /home/cvs/src/sys/arch/i386/i386/conf.c,v
 retrieving revision 1.145
 diff -u -p -r1.145 conf.c
 --- arch/i386/i386/conf.c 4 Nov 2013 14:11:29 -   1.145
 +++ arch/i386/i386/conf.c 12 Mar 2014 15:06:03 -
 @@ -159,8 +159,6 @@ cdev_decl(cztty);
  #include gpr.h
  #include nvram.h
  cdev_decl(nvram);
 -#include agp.h
 -cdev_decl(agp);
  #include drm.h
  cdev_decl(drm);
  
 @@ -283,7 +281,7 @@ struct cdevsw cdevsw[] =
   cdev_nvram_init(NNVRAM,nvram),  /* 84: NVRAM interface */
   cdev_notdef(),  /* 85: ACPI (deprecated) */
   cdev_notdef(),
 - cdev_agp_init(NAGP,agp),/* 87: agp */
 + cdev_notdef(),  /* 87 */
   cdev_drm_init(NDRM,drm),/* 88: drm */
   cdev_amdmsr_init(NAMDMSR,amdmsr),   /* 89: amdmsr */
   cdev_vscsi_init(NVSCSI,vscsi),  /* 90: vscsi */
 Index: arch/macppc/macppc/conf.c
 ===
 RCS file: /home/cvs/src/sys/arch/macppc/macppc/conf.c,v
 retrieving revision 1.56
 diff -u -p -r1.56 conf.c
 --- arch/macppc/macppc/conf.c 4 Nov 2013 17:14:26 -   1.56
 +++ arch/macppc/macppc/conf.c 12 Mar 2014 15:32:26 -
 @@ -110,8 +110,6 @@ cdev_decl(com);
  #include inet.h
  
  #include apm.h
 -#include agp.h
 -cdev_decl(agp);
  #include drm.h
  cdev_decl(drm);
  
 @@ -234,7 +232,7 @@ struct cdevsw cdevsw[] = {
   cdev_vscsi_init(NVSCSI,vscsi),  /* 83: vscsi */
   cdev_disk_init(1,diskmap),  /* 84: disk mapper */
   cdev_pppx_init(NPPPX,pppx), /* 85: pppx */
 - cdev_agp_init(NAGP,agp),/* 86: agp */
 + cdev_notdef,/* 86 */
   cdev_drm_init(NDRM,drm),/* 87: drm */
   cdev_fuse_init(NFUSE,fuse), /* 

Re: installation to (W)hole disk - saner default

2012-03-07 Thread Jan Stary
On Mar 07 18:32:00, David Vasek wrote:
 On Wed, 7 Mar 2012, Dmitrij D. Czarkoff wrote:
 
 On Wed, 2012-03-07 at 17:32 +0100, David Vasek wrote:
 So if the installer finds a valid MBR which contains some partition(s),
 then don't make whole disk (overwriting everything) the default choice and
 let it up to the user. For those who still want to use whole disk in this
 not so frequent case, it requires exactly one key press more.
  
 I'm not sure about this part, actually. I won't make statements about
 the OpenBSD community as whole, but in my experience using the whole
 disk is the most typical action.
 
 Yes, but not nuking everything already there. Not the most typical action.

Nukin everything that's there with one big OpenBSD partition
has so far been the most frequent case for me.



getline missing in stdio(3)

2012-04-10 Thread Jan Stary
Recently, getdelim() and getline() were commited to stdio.
Shouldn't they also be mentioned in stdio(3)?

(While at it, fixed a grammar glitch.)

Jan


Index: stdio.3
===
RCS file: /cvs/src/lib/libc/stdio/stdio.3,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 stdio.3
--- stdio.3 3 Sep 2011 23:24:51 -   1.22
+++ stdio.3 10 Apr 2012 13:30:11 -
@@ -95,7 +95,7 @@ files.
 Neither does an exit due to a signal.
 Buffers are flushed by
 .Xr abort 3
-as required by POSIX, although previous implementations did not.
+as required by POSIX, although in previous implementations they were not.
 .Pp
 This implementation needs and makes
 no distinction between
@@ -237,6 +237,8 @@ definitions are explicitly removed.
 .It fwrite Ta binary stream input/output
 .It getc Ta get next character or word from input stream
 .It getchar Ta get next character or word from input stream
+.It getdelim Ta read a delimited record from a stream
+.It getline Ta read a delimited record from a stream
 .It gets Ta get a line from a stream
 .It getw Ta get next character or word from input stream
 .It mkstemp Ta create unique temporary file



Re: fun with libtool for masochistic guys

2012-07-11 Thread Jan Stary
On Jul 11 10:57:21, Marc Espie wrote:
 Lots of fun last night and this morning.

 1/ Turns out GNU libtool simply *removes* stuff it doesn't understand while
 linking.

 Case in point: libdns/ldns. It does link with
 libtool link  cc -o somelib  --export-symbols lib.def someobj.o

 notice the --export-symbols, that's not a valid gnu libtool option (the
 option is spelled -export-symbols).
 So it gets ignored !

 this did work by accident for us, since we used Getopt::Long which
 doesn't care if it's --export-symbols or -export-symbols...

 when I fixed that, suddenly, we got some different behavior, so
 our link stopped working.

 But I'll contend that's a fucking BUG in gnu libtool, since you can
 just mispell something, and hey, watch it ! magic trick! it's gone !!!

 (that also explains why some ports require gnu libtool...

Marc, could you please confirm that
this is why audio/opencore-amr builds
with USE_LIBTOOL=gnu but not otherwise?

With USE_LIBTOOL=yes, the linking fails with

libtool: link: cc -shared -fPIC -DPIC -o .libs/libopencore-amrnb.so.0.0
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/oscl
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/dec/src
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/common/include
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/dec/include
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/common/dec/include
-I/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.3/opencore/codecs_v2/au
dio/gsm_amr/amr_nb/enc/src -x c -std=c99 -O2 -pipe .libs/wrapper.o .libs/agc.o
.libs/amrdecode.o .libs/a_refl.o .libs/b_cn_cod.o .libs/bgnscd.o
.libs/c_g_aver.o .libs/d1035pf.o .libs/d2_11pf.o .libs/d2_9pf.o
.libs/d3_14pf.o .libs/d4_17pf.o .libs/d8_31pf.o .libs/dec_amr.o
.libs/dec_gain.o .libs/dec_input_format_tab.o .libs/dec_lag3.o
.libs/dec_lag6.o .libs/d_gain_c.o .libs/d_gain_p.o .libs/d_plsf_3.o
.libs/d_plsf_5.o .libs/d_plsf.o .libs/dtx_dec.o .libs/ec_gains.o
.libs/ex_ctrl.o .libs/if2_to_ets.o .libs/int_lsf.o .libs/lsp_avg.o
.libs/ph_disp.o .libs/post_pro.o .libs/preemph.o .libs/pstfilt.o
.libs/qgain475_tab.o .libs/sp_dec.o .libs/wmf_to_ets.o .libs/amrencode.o
.libs/autocorr.o .libs/c1035pf.o .libs/c2_11pf.o .libs/c2_9pf.o
.libs/c3_14pf.o .libs/c4_17pf.o .libs/c8_31pf.o .libs/calc_cor.o
.libs/calc_en.o .libs/cbsearch.o .libs/cl_ltp.o .libs/cod_amr.o
.libs/convolve.o .libs/cor_h.o .libs/cor_h_x2.o .libs/cor_h_x.o
.libs/corrwght_tab.o .libs/div_32.o .libs/dtx_enc.o .libs/enc_lag3.o
.libs/enc_lag6.o .libs/enc_output_format_tab.o .libs/ets_to_if2.o
.libs/ets_to_wmf.o .libs/g_adapt.o .libs/gain_q.o .libs/g_code.o
.libs/g_pitch.o .libs/hp_max.o .libs/inter_36.o .libs/inter_36_tab.o
.libs/l_abs.o .libs/lag_wind.o .libs/lag_wind_tab.o .libs/l_comp.o
.libs/levinson.o .libs/l_extract.o .libs/lflg_upd.o .libs/l_negate.o
.libs/lpc.o .libs/ol_ltp.o .libs/pitch_fr.o .libs/pitch_ol.o .libs/p_ol_wgh.o
.libs/pre_big.o .libs/pre_proc.o .libs/prm2bits.o .libs/qgain475.o
.libs/qgain795.o .libs/q_gain_c.o .libs/q_gain_p.o .libs/qua_gain.o
.libs/s10_8pf.o .libs/set_sign.o .libs/sid_sync.o .libs/sp_enc.o
.libs/spreproc.o .libs/spstproc.o .libs/ton_stab.o .libs/vad1.o .libs/add.o
.libs/az_lsp.o .libs/bitno_tab.o .libs/bitreorder_tab.o .libs/c2_9pf_tab.o
.libs/div_s.o .libs/extract_h.o .libs/extract_l.o .libs/gains_tbl.o
.libs/gc_pred.o .libs/get_const_tbls.o .libs/gmed_n.o .libs/gray_tbl.o
.libs/grid_tbl.o .libs/int_lpc.o .libs/inv_sqrt.o .libs/inv_sqrt_tbl.o
.libs/l_deposit_h.o .libs/l_deposit_l.o .libs/log2.o .libs/log2_norm.o
.libs/log2_tbl.o .libs/lsfwt.o .libs/l_shr_r.o .libs/lsp_az.o .libs/lsp.o
.libs/lsp_lsf.o .libs/lsp_lsf_tbl.o .libs/lsp_tab.o .libs/mult_r.o
.libs/negate.o .libs/norm_l.o .libs/norm_s.o .libs/overflow_tbl.o
.libs/ph_disp_tab.o .libs/pow2.o .libs/pow2_tbl.o .libs/pred_lt.o
.libs/q_plsf_3.o .libs/q_plsf_3_tbl.o .libs/q_plsf_5.o .libs/q_plsf_5_tbl.o
.libs/q_plsf.o .libs/qua_gain_tbl.o .libs/reorder.o .libs/residu.o
.libs/round.o .libs/set_zero.o .libs/shr.o .libs/shr_r.o .libs/sqrt_l.o
.libs/sqrt_l_tbl.o .libs/sub.o .libs/syn_filt.o .libs/weight_a.o
.libs/window_tab.o -L.libs -lm
-Wl,-retain-symbols-file,/usr/ports/pobj/opencore-amr-0.1.3/opencore-amr-0.1.
3/amrnb/opencore-amrnb.sym
.libs/wrapper.o:1: error: stray '\177' in program
.libs/wrapper.o:1: error: stray '\1' in program
.libs/wrapper.o:1: error: stray '\2' in program
.libs/wrapper.o:1: error: stray '\1' in program
[...]

Note the -x c ... file.o;
it treats the *.o files as C source and fails.
(Which itself is probably a bug in the non-gnu libtool, right?)


With USE_LIBTOOL=gnu, the linking line becomes

libtool: link: cc -shared  -fPIC -DPIC -o .libs/libopencore-amrnb.so.0.0
.libs/wrapper.o .libs/agc.o .libs/amrdecode.o .libs/a_refl.o .libs/b_cn_cod.o
.libs/bgnscd.o .libs/c_g_aver.o .libs/d1035pf.o .libs/d2_11pf.o .libs/d2_9pf.o

Re: ncheck_ffs DUID support

2012-07-11 Thread Jan Stary
On Jul 11 19:18:21, Alexander Hall wrote:
 This adds DUID support to ncheck_ffs.
 Testers? ok?

This indeed enables ncheck_ffs for DUIDs,
but breaks ncheck_ffs for /dev/wd0x

My fstab says

5d2ade1fc5a8d569.n /tmp ffs rw,softdep,nodev,nosuid 1 2

With your diff I can do 'ncheck_ffs /tmp',
which previously said

5d2ade1fc5a8d569.n: no such file or directory

But I can no longer do 'ncheck_ffs /dev/wd0n'
which worked before this diff, but now says

ncheck_ffs: cannot open /dev/wd0n: Device busy

'ncheck_ffs /dev/rwd0n' works though.


Jan



Re: ncheck_ffs DUID support

2012-07-13 Thread Jan Stary
On Jul 13 11:54:11, Alexander Hall wrote:
 On 07/12/12 22:55, Alexander Hall wrote:
  On 07/11/12 23:43, Jan Stary wrote:
  On Jul 11 19:18:21, Alexander Hall wrote:
  This adds DUID support to ncheck_ffs.
  Testers? ok?
 
  This indeed enables ncheck_ffs for DUIDs,
  but breaks ncheck_ffs for /dev/wd0x
 
  My fstab says
 
  5d2ade1fc5a8d569.n /tmpffs rw,softdep,nodev,nosuid 1 2
 
  With your diff I can do 'ncheck_ffs /tmp',
  which previously said
 
 5d2ade1fc5a8d569.n: no such file or directory
 
  But I can no longer do 'ncheck_ffs /dev/wd0n'
  which worked before this diff, but now says
 
 ncheck_ffs: cannot open /dev/wd0n: Device busy
 
  'ncheck_ffs /dev/rwd0n' works though.
  
  Indeed, thanks.
  
  Another try follows, with less entangled diff. Does it work better?
 Bah, fix indendation from spaces to tabs.
 Comments? OK?

Now all of the following work:

ncheck_ffs /dev/wd0n
ncheck_ffs /dev/rwd0n
ncheck_ffs 5d2ade1fc5a8d569.n
ncheck_ffs /tmp


Jan


 Index: Makefile
 ===
 RCS file: /data/openbsd/cvs/src/sbin/ncheck_ffs/Makefile,v
 retrieving revision 1.3
 diff -u -p -r1.3 Makefile
 --- Makefile  29 Jun 1996 19:25:09 -  1.3
 +++ Makefile  11 Jul 2012 13:54:01 -
 @@ -1,6 +1,8 @@
  #$OpenBSD: Makefile,v 1.3 1996/06/29 19:25:09 mickey Exp $
  
  PROG=ncheck_ffs
 +LDADD=  -lutil
 +DPADD=  ${LIBUTIL}
  MAN= ncheck_ffs.8
  
  LINKS=   ${BINDIR}/ncheck_ffs ${BINDIR}/ncheck
 Index: ncheck_ffs.c
 ===
 RCS file: /data/openbsd/cvs/src/sbin/ncheck_ffs/ncheck_ffs.c,v
 retrieving revision 1.35
 diff -u -p -r1.35 ncheck_ffs.c
 --- ncheck_ffs.c  27 Oct 2009 23:59:33 -  1.35
 +++ ncheck_ffs.c  13 Jul 2012 09:34:40 -
 @@ -542,24 +542,34 @@ main(int argc, char *argv[])
   if (optind != argc - 1 || (mflag  format))
   usage();
  
 - odisk = argv[optind];
 - if (realpath(odisk, rdisk) == NULL)
 + disk = argv[optind];
 + if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) = 0) {
 + if (fstat(diskfd, stblock))
 + err(1, cannot stat %s, disk);
 + if (S_ISCHR(stblock.st_mode))
 + goto gotdev;
 + close(diskfd);
 + }
 +
 + if (realpath(disk, rdisk) == NULL)
   err(1, cannot find real path for %s, odisk);
   disk = rdisk;
  
   if (stat(disk, stblock)  0)
   err(1, cannot stat %s, disk);
  
 -if (S_ISBLK(stblock.st_mode)) {
 + if (S_ISBLK(stblock.st_mode)) {
   disk = rawname(disk);
   } else if (!S_ISCHR(stblock.st_mode)) {
   if ((fsp = getfsfile(disk)) == NULL)
   err(1, could not find file system %s, disk);
 -disk = rawname(fsp-fs_spec);
 -}
 + disk = rawname(fsp-fs_spec);
 + }
  
 - if ((diskfd = open(disk, O_RDONLY))  0)
 + if ((diskfd = opendev(disk, O_RDONLY, 0, NULL))  0)
   err(1, cannot open %s, disk);
 +
 +gotdev:
   sblock = (struct fs *)sblock_buf;
   for (i = 0; sblock_try[i] != -1; i++) {
   n = pread(diskfd, sblock, SBLOCKSIZE, (off_t)sblock_try[i]);



Argument list too long while copying

2012-08-23 Thread Jan Stary
On current/amd64 I created a MSDOS filesystem on a CF card
inserted into a USB card reader

# newfs_msdos -F 32 -L SHERLOCK sd3i 

and tried to copy some files to it

# mount /dev/sd3i /mnt
# cp * /mnt
cp: /mnt/202.the-hounds-of-baskerville.avi: Argument list too long
cp: /mnt/201.a-scandal-in-belgravia.avi: Argument list too long
cp: /mnt/102.the-blind-banker.avi: Argument list too long

These three files are not copied fully.
The other files are copied alright.

On another run, this happens with _other_ files.
Indeed, it is a problem with the card:

sd3(umass1:1:0): Check Condition (error 0x70) on opcode 0x2a
SENSE KEY: Media Error
ASC/ASCQ: Peripheral Device Write Fault

However, it is not the case that the argument list is too long:

# ls -1
101.study-in-pink.avi
101.study-in-pink.srt
102.the-blind-banker.avi
102.the-blind-banker.srt
103.the-great-game.avi
103.the-great-game.srt
104.extras.mkv
201.a-scandal-in-belgravia.avi
201.a-scandal-in-belgravia.srt
202.the-hounds-of-baskerville.avi
202.the-hounds-of-baskerville.srt
203.the-reichenbach-fall.avi
203.the-reichenbach-fall.srt

Somehow, the wrong error condition is reported:
E2BIG instead of a failed write(2).

The code that gives the warning messages is
the following block in /usr/src/bin/cp/utils.c:


int skipholes = 0;
struct stat tosb;
if (!fstat(to_fd, tosb)  S_ISREG(tosb.st_mode))
skipholes = 1;
while ((rcount = read(from_fd, buf, MAXBSIZE))  0) {
if (skipholes  memcmp(buf, zeroes, rcount) == 0)
wcount = lseek(to_fd, rcount, SEEK_CUR) == -1 ? -1 : rcount;
else
wcount = write(to_fd, buf, rcount);
if (rcount != wcount || wcount == -1) {
warn(%s, to.p_path);
rval = 1;
break;
}
}


If I am reading this right, getting the warn() message means
that either the lseek() or the write() must have failed;
but both of them set errno, and not to E2BIG.
So why does the warn() report E2BIG?


Jan



Re: Support power saving with athn(4) in host AP mode

2012-09-10 Thread Jan Stary
On Aug 18 10:40:23, Mark Kettenis wrote:
 Finally got annoyed enough that my MacBook running OS X (don't ask)
 didn't work too well on my OpenBSD AP at home.  The reason is the
 following caveat listed in the athn(4) man page:
 
  Host AP mode doesn't support power saving.  Clients attempting to use
  power saving mode may experience significant packet loss (disabling power
  saving on the client will fix this).

Same here.

 Unfortunately Steve doesn't allow you to disable power saving.  So
 here is a diff to make athn(4) in host AP mode handle clients that use
 power saving.  The Mac is much happier now.
 
 Further testing would be welcome.  Even if you don't use clients with
 power saving enabled.  So if you're running an athn(4) based AP,
 please give this a spin.

This diff seems to be in the tree already, and in the snapshots,
so I upgraded my i386 AP to current, and indeed, the connections
from my macbook via wifi no longer die out.

Thank you!

Jan



512 hardcoded into scan_ffs(8)

2012-11-02 Thread Jan Stary
Looking at the source of scan_ffs, 512 is hardcoded all over the place.
Would it be an improvement to have that configurable, for the newer disks
with bigger size?



cwm - cosmetic renaming diff

2013-01-04 Thread Jan Stary
Below is a cosmetic diff to current cwm
which merely renames two functions.

Everywhere in the code and configuration and bindings and the manpage,
the function that does horizontal maximization is named hmaximize,
except the actual function that ultimately gets called and does
the resizing, which is named client_horizmaximize. This diff
changes it to client_hmaximize too.

Similarly for vmaximize everywhere vs vertmaximize.

I thought I would try to get this renaming in
before sending another diff with [lrud]maximize
(maximize to the left/right/up/down).

Jan


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.182
diff -u -p -r1.182 calmwm.h
--- calmwm.h2 Jan 2013 16:26:34 -   1.182
+++ calmwm.h4 Jan 2013 11:13:48 -
@@ -325,7 +325,7 @@ struct client_ctx   *client_find(Window);
 voidclient_freeze(struct client_ctx *);
 voidclient_getsizehints(struct client_ctx *);
 voidclient_hide(struct client_ctx *);
-voidclient_horizmaximize(struct client_ctx *);
+voidclient_hmaximize(struct client_ctx *);
 voidclient_leave(struct client_ctx *);
 voidclient_lower(struct client_ctx *);
 voidclient_map(struct client_ctx *);
@@ -342,7 +342,7 @@ void client_setname(struct 
client_ctx
 int client_snapcalc(int, int, int, int, int);
 voidclient_transient(struct client_ctx *);
 voidclient_unhide(struct client_ctx *);
-voidclient_vertmaximize(struct client_ctx *);
+voidclient_vmaximize(struct client_ctx *);
 voidclient_warp(struct client_ctx *);
 
 voidgroup_alltoggle(struct screen_ctx *);
Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.113
diff -u -p -r1.113 client.c
--- client.c2 Jan 2013 21:37:21 -   1.113
+++ client.c4 Jan 2013 11:13:48 -
@@ -298,7 +298,7 @@ resize:
 }
 
 void
-client_vertmaximize(struct client_ctx *cc)
+client_vmaximize(struct client_ctx *cc)
 {
struct screen_ctx   *sc = cc-sc;
struct geom  xine;
@@ -339,7 +339,7 @@ resize:
 }
 
 void
-client_horizmaximize(struct client_ctx *cc)
+client_hmaximize(struct client_ctx *cc)
 {
struct screen_ctx   *sc = cc-sc;
struct geom  xine;
Index: kbfunc.c
===
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.74
diff -u -p -r1.74 kbfunc.c
--- kbfunc.c2 Jan 2013 21:41:14 -   1.74
+++ kbfunc.c4 Jan 2013 11:13:48 -
@@ -452,13 +452,13 @@ kbfunc_client_maximize(struct client_ctx
 void
 kbfunc_client_vmaximize(struct client_ctx *cc, union arg *arg)
 {
-   client_vertmaximize(cc);
+   client_vmaximize(cc);
 }
 
 void
 kbfunc_client_hmaximize(struct client_ctx *cc, union arg *arg)
 {
-   client_horizmaximize(cc);
+   client_hmaximize(cc);
 }
 
 void



cwm - Conf.bwidth vs cc-bwidth

2013-01-04 Thread Jan Stary
Here's some more cleanage for cwm:
the hmaximize and vmaximize functions are, obviously, completely dual,
except that hmaximize uses Conf.bwidth when adjusting for a boundary,
while vmaximize uses cc-bwidth (correctly IMHO).

Jan


Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.115
diff -u -p -r1.115 client.c
--- client.c4 Jan 2013 16:30:03 -   1.115
+++ client.c4 Jan 2013 22:21:29 -
@@ -321,7 +321,7 @@ client_vmaximize(struct client_ctx *cc)
 
/* if this will make us fully maximized then remove boundary */
if ((cc-flags  CLIENT_MAXFLAGS) == CLIENT_HMAXIMIZED) {
-   cc-geom.w += Conf.bwidth * 2;
+   cc-geom.w += cc-bwidth * 2;
cc-bwidth = 0;
}



Re: cwm - Conf.bwidth vs cc-bwidth

2013-01-05 Thread Jan Stary
On Jan 04 23:27:48, h...@stare.cz wrote:
 Here's some more cleanage for cwm:
 the hmaximize and vmaximize functions are, obviously, completely dual,
 except that hmaximize uses Conf.bwidth when adjusting for a boundary,
 while vmaximize uses cc-bwidth (correctly IMHO).

Also, it seems that unmaximizing always sets cc-bwidth = Conf.bwidth
- there is cc-savegeom to restore from, but no cc-savewidth.

Is that intentional? Do we want every window that returns from
a MAXIMIZED state to obtain the defalut bwidth, even if its width
has been changed in the meantime? Or has the savebwidth code
simply not been written yet?

Would it make sense to have cc-savewidth for that purpose,
or should that be another member of cc-savegeom ?

(I always use 1px borders anyway, but it feels a bit
inconsitent to restore all of the geometry/position
but not the border width.)


   Jan
 
 
 Index: client.c
 ===
 RCS file: /cvs/xenocara/app/cwm/client.c,v
 retrieving revision 1.115
 diff -u -p -r1.115 client.c
 --- client.c  4 Jan 2013 16:30:03 -   1.115
 +++ client.c  4 Jan 2013 22:21:29 -
 @@ -321,7 +321,7 @@ client_vmaximize(struct client_ctx *cc)
  
   /* if this will make us fully maximized then remove boundary */
   if ((cc-flags  CLIENT_MAXFLAGS) == CLIENT_HMAXIMIZED) {
 - cc-geom.w += Conf.bwidth * 2;
 + cc-geom.w += cc-bwidth * 2;
   cc-bwidth = 0;
   }



Re: cwm - Conf.bwidth vs cc-bwidth

2013-01-05 Thread Jan Stary
On Jan 05 14:50:21, h...@stare.cz wrote:
 On Jan 04 23:27:48, h...@stare.cz wrote:
  Here's some more cleanage for cwm:
  the hmaximize and vmaximize functions are, obviously, completely dual,
  except that hmaximize uses Conf.bwidth when adjusting for a boundary,
  while vmaximize uses cc-bwidth (correctly IMHO).
 
 Also, it seems that unmaximizing always sets cc-bwidth = Conf.bwidth
 - there is cc-savegeom to restore from, but no cc-savewidth.

Please ignore - there is no way to change the borderwidth
to something else then what we have started with in the config,
right?



[PATCH] cwm - maximizing in each direction

2013-01-05 Thread Jan Stary
Below is a diff that enables cwm to maximize a window
in a given direction (left / right / up / down) only.

Only left/right is implemented actually; I want to make sure
this isn't completely wrong before writing up the other half
(which will be dual of course).

The motivating situation for me is that my usual X setup
is a vertically maximized xterm in the upper left corner
(to write what I am writing) and whatever accompanies it
(xdvi, firefox, mupdf, ...) in the rest of the screen.
Setting that up is not complicated, but maximizing the
other window to the rest of the screen means:
align its left border to the right border of the xterm,
then hold CMS-l until the window enlarges fully to the right.

Obviously, the obligate h/j/k/l keys are taken already,
so I chose (CM-) the arrows for the default keybindings.

In the current implementation of e.g. hmaximize,
it is checked whether this actually means full maximization.
As there are currently only two parts of full maximization
(CLIENT_HMAXIMIZED, CLIENT_VMAXIMIZED) it is done by checking
the other one. With four parts of maximization now, I have
used a macro (LASTMAX) instead that checks whether this is
the last bit that's missing in full maximization. I believe
the current [vh]maximizing function should be so altered too.

Xinerama considerations: first of all, I only have one monitor,
so could please someone with more screens test this?

My logic of placing the maximized window is obvious:
when left-maximizing, the new left border is the left border of
the screen where the current left border is; that is, the leftmost
screen which is 'hit' by the current window is where the left-maximization
happens. I believe this is the sensible thing. Similarly for right.

This differs from the logic currently implemented in the maximizing
functions: the screen holding the center of the window is found,
and the window is maximized within that screen. I object to this,
with the following counterexample in mind: with 3 screens,
and a window spanning a little more than the central screen,
maximizing it actually means shrinking it!

This difference in placement logic is what stops me from
replacing hmaximize with a call to lmaximize and rmaximize.

Comments?

Jan


Index: calmwm.h
===
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.185
diff -u -p -r1.185 calmwm.h
--- calmwm.h4 Jan 2013 16:30:03 -   1.185
+++ calmwm.h5 Jan 2013 18:52:35 -
@@ -148,15 +148,22 @@ struct client_ctx {
int  xproto;
 #define CLIENT_HIDDEN  0x0001
 #define CLIENT_IGNORE  0x0002
-#define CLIENT_VMAXIMIZED  0x0004
-#define CLIENT_HMAXIMIZED  0x0008
 #define CLIENT_FREEZE  0x0010
 #define CLIENT_GROUP   0x0020
 #define CLIENT_UNGROUP 0x0040
+#define CLIENT_LMAXIMIZED  0x0100
+#define CLIENT_RMAXIMIZED  0x0200
+#define CLIENT_UMAXIMIZED  0x0400
+#define CLIENT_DMAXIMIZED  0x0800
 
 #define CLIENT_HIGHLIGHT   (CLIENT_GROUP | CLIENT_UNGROUP)
-#define CLIENT_MAXFLAGS(CLIENT_VMAXIMIZED | 
CLIENT_HMAXIMIZED)
+#define CLIENT_HMAXIMIZED  (CLIENT_LMAXIMIZED | CLIENT_RMAXIMIZED)
+#define CLIENT_VMAXIMIZED  (CLIENT_UMAXIMIZED | CLIENT_DMAXIMIZED)
 #define CLIENT_MAXIMIZED   (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)
+#define CLIENT_MAXFLAGS(CLIENT_MAXIMIZED)
+#define LASTMAX(f, b)  (((f | b)  CLIENT_MAXFLAGS) \
+   == CLIENT_MAXIMIZED)
+
int  flags;
int  state;
int  active;
@@ -315,6 +322,7 @@ void client_cycle(struct screen_ctx 
*
 voidclient_cycle_leave(struct screen_ctx *,
 struct client_ctx *);
 voidclient_delete(struct client_ctx *);
+voidclient_dmaximize(struct client_ctx *);
 voidclient_draw_border(struct client_ctx *);
 struct client_ctx  *client_find(Window);
 voidclient_freeze(struct client_ctx *);
@@ -322,6 +330,7 @@ void client_getsizehints(struct 
clien
 voidclient_hide(struct client_ctx *);
 voidclient_hmaximize(struct client_ctx *);
 voidclient_leave(struct client_ctx *);
+voidclient_lmaximize(struct client_ctx *);
 voidclient_lower(struct client_ctx *);
 voidclient_map(struct client_ctx *);
 voidclient_maximize(struct client_ctx *);
@@ -331,11 +340,13 @@ void   client_ptrsave(struct 
client_ctx
 voidclient_ptrwarp(struct 

userdel vs /nonexistent

2013-01-07 Thread Jan Stary
useradd treats /nonexistent specially whene creating the home dir.
Should userdel also treat /nonexistent specially when deleting it?
In particular, should nonexisting /nonexistent be an error?

Jan


Index: user.c
===
RCS file: /cvs/src/usr.sbin/user/user.c,v
retrieving revision 1.92
diff -u -p -r1.92 user.c
--- user.c  20 Sep 2012 11:32:06 -  1.92
+++ user.c  7 Jan 2013 20:37:49 -
@@ -231,6 +231,10 @@ removehomedir(const char *user, uid_t ui
}
 
/* directory exists (and is a directory!) */
+   if (strcmp(dir, _PATH_NONEXISTENT) == 0) {
+   warnx(Not trying to delete `%s', dir);
+   return 1;
+   }
if (stat(dir, st)  0) {
warnx(Home directory `%s' doesn't exist, dir);
return 0;



dhclient.conf(5) mandoc lint

2013-01-22 Thread Jan Stary
In dhclient.conf.5 at two places,
text is (unnecessarily IMHO) indented
in a way mandoc -Tlint complains about.

Jan

/usr/src/sbin/dhclient/dhclient.conf.5:299:6: WARNING: tab in non-literal 
context
/usr/src/sbin/dhclient/dhclient.conf.5:398:6: WARNING: tab in non-literal 
context


Index: dhclient.conf.5
===
RCS file: /cvs/src/sbin/dhclient/dhclient.conf.5,v
retrieving revision 1.26
diff -u -p -r1.26 dhclient.conf.5
--- dhclient.conf.5 27 Nov 2012 15:51:48 -  1.26
+++ dhclient.conf.5 22 Jan 2013 14:34:09 -
@@ -296,7 +296,7 @@ the behaviour will be unpredictable.
 The lease declaration:
 .Pp
 .Xo
-.Ic \  \ lease No { Ar lease-declaration
+.Ic lease No { Ar lease-declaration
 .Oo Ar ... lease-declaration Oc }
 .Xc
 .Pp
@@ -395,7 +395,7 @@ DHCP client.
 .Pp
 Dates are specified as follows:
 .Pp
-.Ar \  \weekday
+.Ar weekday
 .Sm off
 .Ar year No / Ar month No / Ar day
 .Ar hour : minute : second



Remove more .Tn markup from manpages

2015-01-15 Thread Jan Stary
Ingo, recently you removed .Tn from stdio:

On Jan 13 07:02:30, schwa...@cvs.openbsd.org wrote:
 Modified files:
   lib/libc/stdio : fgetln.3 fgetwln.3 fopen.3 fputs.3 funopen.3 
printf.3 tmpnam.3 
 Log message:
 remove .Tn from stdio manuals; Kaspars Bankovskis found one of these

The following diff removes .Tn from bin, games, libm, libexec,
and a few assorted places; replaces some .Tn with .Dv if they are.

Please see also previous diff to tech@ removing .Tn from sys.

Jan


Index: bin/cat/cat.1
===
RCS file: /cvs/src/bin/cat/cat.1,v
retrieving revision 1.33
diff -u -p -r1.33 cat.1
--- bin/cat/cat.1   16 Jul 2013 06:52:05 -  1.33
+++ bin/cat/cat.1   14 Jan 2015 20:08:01 -
@@ -92,12 +92,9 @@ which are displayed normally.
 The tab character, control-I, can be made visible via the
 .Fl t
 option.
-The
-.Tn DEL
-character (octal 0177) prints as
+The DEL character (octal 0177) prints as
 .Ql ^? .
-.Pf Non- Ns Tn ASCII
-characters (with the high bit set) are printed as
+Non-ASCII characters (with the high bit set) are printed as
 .Ql M-
 (for meta) followed by the character for the low 7 bits.
 .El
Index: bin/chio/chio.1
===
RCS file: /cvs/src/bin/chio/chio.1,v
retrieving revision 1.32
diff -u -p -r1.32 chio.1
--- bin/chio/chio.1 15 Jul 2013 23:43:58 -  1.32
+++ bin/chio/chio.1 14 Jan 2015 20:08:01 -
@@ -243,9 +243,7 @@ Configure the changer to use picker 2 (t
 .Sh AUTHORS
 The
 .Nm
-program and
-.Tn SCSI
-changer driver were written by
+program and SCSI changer driver were written by
 .An Jason R. Thorpe Aq Mt thor...@and.com
 for And Communications
 .Pq Lk http://www.and.com/ .
Index: bin/csh/csh.1
===
RCS file: /cvs/src/bin/csh/csh.1,v
retrieving revision 1.73
diff -u -p -r1.73 csh.1
--- bin/csh/csh.1   9 Dec 2014 15:37:13 -   1.73
+++ bin/csh/csh.1   14 Jan 2015 20:08:01 -
@@ -179,9 +179,7 @@ in the home directory of the invoker,
 and, if this is a login shell, the file
 .Pa .login
 in the same location.
-It is typical for users on
-.Tn CRT Ns s
-to put the command
+It is typical for users on CRTs to put the command
 .Ic stty crt
 in their
 .Pa .login
@@ -1677,9 +1675,7 @@ Like
 but no
 .Ql \e
 escapes are recognized and words are delimited
-by
-.Tn NUL
-characters in the output.
+by NUL characters in the output.
 Useful for programs that wish to use the shell to filename expand a list
 of words.
 .Pp
@@ -1936,9 +1932,7 @@ to the given
 The final two forms run command at priority 4 and
 .Ar number
 respectively.
-The greater the number, the less
-.Tn CPU
-the process will get.
+The greater the number, the less CPU the process will get.
 The superuser may specify negative priority by using
 .Dq nice \-number ... .
 .Ar command
@@ -2570,9 +2564,7 @@ Built-in commands that fail return exit 
 all other built-in commands set status to 0.
 .It Ic time
 Controls automatic timing of commands.
-If set, then any command that takes more than this many
-.Tn CPU
-seconds
+If set, then any command that takes more than this many CPU seconds
 will cause a line giving user, system, and real times, and a utilization
 percentage which is the ratio of user plus system times to real time
 to be printed when it terminates.
Index: bin/date/date.1
===
RCS file: /cvs/src/bin/date/date.1,v
retrieving revision 1.64
diff -u -p -r1.64 date.1
--- bin/date/date.1 14 Feb 2014 19:12:27 -  1.64
+++ bin/date/date.1 14 Jan 2015 20:08:01 -
@@ -93,8 +93,7 @@ Print out (in specified format) the date
 .Ar seconds
 from the Epoch.
 .It Fl t Ar minutes_west
-Set the system's value for minutes west of
-.Tn GMT .
+Set the system's value for minutes west of GMT.
 .Ar minutes_west
 specifies the number of minutes returned in
 .Fa tz_minuteswest
Index: bin/dd/dd.1
===
RCS file: /cvs/src/bin/dd/dd.1,v
retrieving revision 1.31
diff -u -p -r1.31 dd.1
--- bin/dd/dd.1 27 Mar 2014 15:32:13 -  1.31
+++ bin/dd/dd.1 14 Jan 2015 20:08:01 -
@@ -123,9 +123,7 @@ using the tape
 .Xr ioctl 2
 function calls.
 If the seek operation is past the end of file, space from the current
-end of file to the specified offset is filled with blocks of
-.Tn NUL
-bytes.
+end of file to the specified offset is filled with blocks of NUL bytes.
 .It Cm skip= Ns Ar n
 Skip
 .Ar n
@@ -165,12 +163,8 @@ is one of the symbols from the following
 .It Cm ascii
 The same as the
 .Cm unblock
-value except that characters are translated from
-.Tn EBCDIC
-to
-.Tn ASCII
-before the
-records are converted.
+value except that characters are translated from EBCDIC to ASCII
+before the records are converted.
 (These values imply
 .Cm unblock
 if the operand

newsyslog hardcoded paths

2015-02-18 Thread Jan Stary
Some of the paths #define'd in newsyslog.c
seem to be outfated.

Jan

Index: newsyslog.c
===
RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v
retrieving revision 1.93
diff -u -p -r1.93 newsyslog.c
--- newsyslog.c 16 Jan 2015 06:40:10 -  1.93
+++ newsyslog.c 18 Feb 2015 08:58:13 -
@@ -75,7 +75,7 @@
 #define CONF /etc/newsyslog.conf /* Configuration file */
 #endif
 #ifndef PIDFILE
-#define PIDFILE /etc/syslog.pid
+#define PIDFILE /var/run/syslog.pid
 #endif
 #ifndef COMPRESS
 #define COMPRESS /usr/bin/compress /* File compression program */
@@ -87,7 +87,7 @@
 #define STATS_DIR /etc
 #endif
 #ifndef SENDMAIL
-#define SENDMAIL /usr/lib/sendmail
+#define SENDMAIL /usr/sbin/sendmail
 #endif
 
 #include sys/param.h /* DEV_BSIZE */



Re: re(4) reads the pci-e max packet size wrongly

2015-02-19 Thread Jan Stary
On Feb 19 10:01:22, j...@insec.sh wrote:
 On Wed, Feb 18, 2015 at 11:23:15AM +1000, David Gwynne wrote:
  it looks like it reads the DCSR register and then keeps everything
  except the MPS field.
  
  this might cause it to erronously consider the mps to be much bigger
  than 2048, which in turn could prevent it from setting it correctly.
  
  i dont actually have one of these chips. can someone give it a spin?
 
 nothing broke on my 8168D and 8168E running -current with this, for
 what it's worth.

Nothing broke on my 8168G.

re0 at pci2 dev 0 function 0 Realtek 8168 rev 0x0c: RTL8168G/8111G (0x4c00), 
msi, address e0:3f:49:6f:f3:1c
rgephy0 at re0 phy 7: RTL8251 PHY, rev. 0

Jan



Re: Jan's crontab.5 diff

2015-01-08 Thread Jan Stary
On Jan 08 22:45:59, j...@kerhand.co.uk wrote:
 On Thu, Jan 08, 2015 at 10:21:03PM +, Craig Skinner wrote:
  http://marc.info/?l=openbsd-miscm=142031621606691w=2
  
 
 i don;t see the discrepancy. crontab(5) explains how MAILTO works

Not precisely:

If MAILTO is defined and non-empty, mail is sent to the user
 ^^^
so named. If MAILTO is defined but empty (MAILTO = ), no
mail will be sent.  Otherwise mail is sent to the owner of
   ^^^
the crontab. 


Mail is NOT necessarily sent.
That's the nitpicking here.

 and cron(8) (jan meant cron.8 not cron.1, right?)

right; sorry.

 explains the conditions under which mail is generated.
 there is enough there already, no?

Arguably.

crontab.5 says mail is sent if I define MAILTO.
That's not necessarily true.

Jan

 
  
  - Forwarded message from Jan Stary h...@stare.cz -
  
  Date: Sat, 3 Jan 2015 21:15:58 +0100
  From: Jan Stary h...@stare.cz
  To: m...@openbsd.org
  Subject: Re: Failed cron jobs are silent
  
  
  On Jan 03 19:05:11, open...@crowsons.com wrote:
   set the MAILTO variable in crontab.
   man 5 crontab not man 1 crontab
  
MAILTO
If MAILTO is defined and non-empty, mail is
sent to the user so named.  If MAILTO is defined but empty
(MAILTO = ), no mail will be sent. Otherwise mail is
sent to the owner of the crontab. This is useful for
pseudo-users that lack an alias that would otherwise
redirect the mail to a real person.
  
  There seems to be a slight discrepancy between
  what cron.1 says and what crontab.5 says.
  
  I just put
  
  * * * * *   true
  * * * * *   false
  * * * * *   echo -n
  * * * * *   echo
  
  into my crontab (current/amd64). Echo sends an email,
  because it has an output (even if just the newline).
  The mail goes either to me, or whatever I set MAILTO to be.
  None of the others send any mail, regardless of MAILTO,
  because there is no output from the command.
  
  So it seems crontab.5 is slightly inacurate.
  
  Jan
  
  
  Index: crontab.5
  ===
  RCS file: /cvs/src/usr.sbin/cron/crontab.5,v
  retrieving revision 1.33
  diff -u -p -r1.33 crontab.5
  --- crontab.5   30 Jan 2014 20:02:42 -  1.33
  +++ crontab.5   3 Jan 2015 20:12:08 -
  @@ -255,14 +255,16 @@ May not be overridden by settings in the
   If
   .Ev MAILTO
   is defined and non-empty,
  -mail is sent to the user so named.
  +mail is sent to the user so named
  +if the command produces any output.
   If
   .Ev MAILTO
   is defined but empty
   .Pq Ev MAILTO = Qq ,
   no mail will be sent.
   Otherwise mail is sent to the owner of the
  -.Nm .
  +.Nm
  +if the command produces any output.
   This is useful for pseudo-users that lack an alias
   that would otherwise redirect the mail to a real person.
   .It Ev SHELL
  
  
  - End forwarded message -
  



Re: [PATCH] pcap manpages

2015-03-27 Thread Jan Stary
On Mar 27 09:16:52, h...@stare.cz wrote:
 The diff below fixes what mandoc -Tlint complains about,
 anotates the authors' names with .An in pcap.3
 and removes a bit of cruft.

Damn, that was written against a non-current source.
Some of the changes are already in. Here's a smaller one,
just fixing the -Tlint complaint.

Jan


Index: pcap-filter.3
===
RCS file: /cvs/src/lib/libpcap/pcap-filter.3,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 pcap-filter.3
--- pcap-filter.3   19 Feb 2014 04:51:32 -  1.2
+++ pcap-filter.3   27 Mar 2015 10:16:36 -
@@ -342,7 +342,6 @@ it does for FDDI and 802.11;
 \fBatalk\fP
 the filter checks both for the AppleTalk etype in an Ethernet frame and
 for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11;
-.TP
 .RE
 .IP \fBdecnet src \fIhost\fR
 True if the DECNET source address is



[PATCH] pcap manpages

2015-03-27 Thread Jan Stary
The diff below fixes what mandoc -Tlint complains about,
anotates the authors' names with .An in pcap.3
and removes a bit of cruft.

I have more diffs lined up for this,
in case someone was about to do that.

Would it be beneficial to rewrite pcap-filter.3 in mdoc(7)?

Jan


Index: pcap-filter.3
===
RCS file: /cvs/src/lib/libpcap/pcap-filter.3,v
retrieving revision 1.2
diff -u -p -r1.2 pcap-filter.3
--- pcap-filter.3   19 Feb 2014 04:51:32 -  1.2
+++ pcap-filter.3   27 Mar 2015 08:07:37 -
@@ -342,7 +342,6 @@ it does for FDDI and 802.11;
 \fBatalk\fP
 the filter checks both for the AppleTalk etype in an Ethernet frame and
 for a SNAP-format packet as it does for FDDI, Token Ring, and 802.11;
-.TP
 .RE
 .IP \fBdecnet src \fIhost\fR
 True if the DECNET source address is
@@ -724,10 +723,9 @@ icmp[icmptype] != icmp-echo and icmp[icm
 .BR pcap ( 3 ),
 .BR tcpdump ( 8 )
 .SH AUTHORS
-The original authors are:
-.LP
 Van Jacobson,
-Craig Leres and
-Steven McCanne, all of the
-Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
-.\ Fixes should be submitted to http://sourceforge.net/tracker/?group_id=53067
+Craig Leres
+and
+Steven McCanne,
+all of the Lawrence Berkeley National Laboratory,
+University of California, Berkeley, CA.
Index: pcap.3
===
RCS file: /cvs/src/lib/libpcap/pcap.3,v
retrieving revision 1.35
diff -u -p -r1.35 pcap.3
--- pcap.3  25 Jun 2013 16:49:39 -  1.35
+++ pcap.3  27 Mar 2015 08:07:37 -
@@ -46,9 +46,9 @@
 .Ft void
 .Fn pcap_dump u_char *user struct pcap_pkthdr *h u_char *sp
 .Ft int
-.Fn pcap_inject pcap_t *p void *, size_t
+.Fn pcap_inject pcap_t *p void * size_t
 .Ft int
-.Fn pcap_sendpacket pcap_t *p void *, int
+.Fn pcap_sendpacket pcap_t *p void * int
 .Ft int
 .Fn pcap_compile pcap_t *p struct bpf_program *fp char *str int 
optimize bpf_u_int32 netmask
 .Ft int
@@ -562,7 +562,9 @@ routine to an error string.
 .Xr tcpdump 8
 .\ , tcpslice(1)
 .Sh AUTHORS
-Van Jacobson,
-Craig Leres and
-Steven McCanne, all of the
-Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
+.An Van Jacobson ,
+.An Craig Leres
+and
+.An Steven McCanne ,
+all of the Lawrence Berkeley National Laboratory,
+University of California, Berkeley, CA.



Re: [PATCH] pcap manpages

2015-03-29 Thread Jan Stary
The diff below fixes what seem to be errors in pcap.3,
either in factuality or markup or grammar.

Jan



--- pcap.3.orig Sun Mar 29 22:06:49 2015
+++ pcap.3  Sun Mar 29 22:16:50 2015
@@ -169,7 +169,7 @@ at packets on the network.
 .Fa source
 is a string that specifies the network device to open.
 .Fa snaplen
-specifies the maximum number of bytes to capture.
+specifies the maximum number of bytes to capture from one packet.
 .Fa promisc
 specifies if the interface is to be put into promiscuous mode.
 (Note that even if this parameter is false, the interface
@@ -209,7 +209,7 @@ for writing.
 The name
 .Ql -
 is a synonym for
-.Dv stdin .
+.Dv stdout .
 .Dv NULL
 is returned on failure.
 .Fa p
@@ -229,7 +229,7 @@ can be used to get the error text.
 .Pp
 .Fn pcap_dump_fopen
 allows the use of savefile functions on the already-opened stream
-.Dq f .
+.Fa f .
 .Pp
 .Fn pcap_lookupdev
 returns a pointer to a network device suitable for use with
@@ -276,7 +276,7 @@ pointer which is passed in from
 .Fn pcap_dispatch ,
 a pointer to the
 .Fa pcap_pkthdr
-struct (which precede the actual network headers and data),
+struct (which precedes the actual network headers and data),
 and a
 .Fa u_char
 pointer to the packet data.
@@ -351,7 +351,7 @@ return when live read timeouts occur.
 Rather, specifying a non-zero read timeout to
 .Fn pcap_open_live
 and then calling
-.Fn pcap_dispatch
+.Fn pcap_loop
 allows the reception and processing of any packets that arrive when the
 timeout occurs.
 A negative
@@ -490,10 +490,11 @@ It is typically used when just using libpcap for compi
 .Pp
 .Fn pcap_fopen_offline
 may be used to read dumped data from an existing open stream
-.Dq fp .
+.Fa fp .
 .Pp
 .Fn pcap_lib_version
 returns a string describing the version of libpcap.
+.Pp
 .Fn pcap_datalink_val_to_name
 and
 .Fn pcap_datalink_val_to_description



remove .Tn from /sys

2015-01-13 Thread Jan Stary
On Jan 13 07:02:30, schwa...@cvs.openbsd.org wrote:
 CVSROOT:  /cvs
 Module name:  src
 Changes by:   schwa...@cvs.openbsd.org2015/01/13 07:02:30
 
 Modified files:
   lib/libc/stdio : fgetln.3 fgetwln.3 fopen.3 fputs.3 funopen.3 
printf.3 tmpnam.3 
 
 Log message:
 remove .Tn from stdio manuals; Kaspars Bankovskis found one of these

This removes the .Tn markup from what O grepped in /usr/srs/sys

Jan


Index: arch/aviion/stand/a2coff/a2coff.8
===
RCS file: /cvs/src/sys/arch/aviion/stand/a2coff/a2coff.8,v
retrieving revision 1.4
diff -u -p -r1.4 a2coff.8
--- arch/aviion/stand/a2coff/a2coff.8   20 Oct 2013 07:40:43 -  1.4
+++ arch/aviion/stand/a2coff/a2coff.8   13 Jan 2015 23:21:00 -
@@ -37,9 +37,7 @@
 .Nm a2coff
 converts standalone binaries, such as kernels or boot blocks, from
 .Xr elf 5
-format to COFF format, suitable for booting from the
-.Tn Data General
-.Tn AViiON
-PROMs.
+format to COFF format, suitable for booting
+from the Data General AViiON PROMs.
 .Sh SEE ALSO
 .Xr elf 5
Index: arch/hppa/stand/mkboot/mkboot.8
===
RCS file: /cvs/src/sys/arch/hppa/stand/mkboot/mkboot.8,v
retrieving revision 1.9
diff -u -p -r1.9 mkboot.8
--- arch/hppa/stand/mkboot/mkboot.8 31 May 2007 19:20:03 -  1.9
+++ arch/hppa/stand/mkboot/mkboot.8 13 Jan 2015 23:21:00 -
@@ -41,11 +41,8 @@
 .Sh DESCRIPTION
 Creates the LIF file containing the bootstrap
 .Ar program
-and possibly other programs to be used by the
-.Tn HP 9000/700
-and
-.Tn HP 9000/800
-systems.
+and possibly other programs to be used
+by the HP 9000/700 and HP 9000/800 systems.
 .Pp
 An argument to the
 .Fl l
Index: arch/hppa64/stand/mkboot/mkboot.8
===
RCS file: /cvs/src/sys/arch/hppa64/stand/mkboot/mkboot.8,v
retrieving revision 1.3
diff -u -p -r1.3 mkboot.8
--- arch/hppa64/stand/mkboot/mkboot.8   31 May 2007 19:20:03 -  1.3
+++ arch/hppa64/stand/mkboot/mkboot.8   13 Jan 2015 23:21:00 -
@@ -41,11 +41,8 @@
 .Sh DESCRIPTION
 Creates the LIF file containing the bootstrap
 .Ar program
-and possibly other programs to be used by the
-.Tn HP 9000/700
-and
-.Tn HP 9000/800
-systems.
+and possibly other programs to be used
+by the HP 9000/700 and HP 9000/800 systems.
 .Pp
 An argument to the
 .Fl l
Index: arch/sparc/stand/installboot/installboot.8
===
RCS file: /cvs/src/sys/arch/sparc/stand/installboot/installboot.8,v
retrieving revision 1.12
diff -u -p -r1.12 installboot.8
--- arch/sparc/stand/installboot/installboot.8  20 Oct 2013 07:40:42 -  
1.12
+++ arch/sparc/stand/installboot/installboot.8  13 Jan 2015 23:21:00 -
@@ -71,9 +71,8 @@ The second-stage program commonly reside
 The utility
 .Pa /usr/mdec/binstall
 can be used to properly copy the second-stage bootprogram to its destination.
-This script takes care of post-processing that is required on
-.Pf non- Tn Openboot
-machines.
+This script takes care of post-processing
+that is required on non-Openboot machines.
 .Pp
 The options are as follows:
 .Bl -tag -width flag
@@ -86,9 +85,8 @@ can be one of
 .Dq sun4c
 or
 .Dq sun4m .
-Sun 4c models with
-.Tn Openboot
-PROMs need the header to be present, while Sun 4 systems with the
+Sun 4c models with Openboot PROMs need the header to be present,
+while Sun 4 systems with the
 .Dq old monitor
 interface require the header to be stripped off.
 This is normally taken care of by



struct sigcontext in a sa_sigaction handler

2015-04-14 Thread Jan Stary
The SYNOPSIS of sigaction(2) cites the sa_sigaction function as

void (*__sa_sigaction)(int, siginfo_t *, void *);

yet in the examples, the declaration is

void
handler(int sig, siginfo_t *sip, struct sigcontext *scp);

with the role of sigcontext described.

This is a discrepancy which the compiler complains about.
Perhaps the handler is supposed to take a void*,
as in the synopsis, and recast it.

No diff included as I don't really know.

Jan



comment typos

2015-04-14 Thread Jan Stary
Comments matter the most.

Jan


--- /usr/include/sys/siginfo.h  Tue Aug 13 07:52:26 2013
+++ ./siginfo.h Tue Apr 14 17:07:06 2015
@@ -135,7 +135,7 @@ typedef struct {
int si_errno;   /* error from errno.h */
union {
int _pad[SI_PAD];   /* for future growth */
-   struct {/* kill(), SIGCLD, siqqueue() */
+   struct {/* kill(),SIGCHLD,sigqueue() */
pid_t   _pid;   /* process ID */
union {
struct {



Re: [PATCH] pcap manpages

2015-04-06 Thread Jan Stary
Any comments?

On Mar 29 22:24:41, h...@stare.cz wrote:
 The diff below fixes what seem to be errors in pcap.3,
 either in factuality or markup or grammar.
 
   Jan
 
 
 
 --- pcap.3.orig   Sun Mar 29 22:06:49 2015
 +++ pcap.3Sun Mar 29 22:16:50 2015
 @@ -169,7 +169,7 @@ at packets on the network.
  .Fa source
  is a string that specifies the network device to open.
  .Fa snaplen
 -specifies the maximum number of bytes to capture.
 +specifies the maximum number of bytes to capture from one packet.
  .Fa promisc
  specifies if the interface is to be put into promiscuous mode.
  (Note that even if this parameter is false, the interface
 @@ -209,7 +209,7 @@ for writing.
  The name
  .Ql -
  is a synonym for
 -.Dv stdin .
 +.Dv stdout .
  .Dv NULL
  is returned on failure.
  .Fa p
 @@ -229,7 +229,7 @@ can be used to get the error text.
  .Pp
  .Fn pcap_dump_fopen
  allows the use of savefile functions on the already-opened stream
 -.Dq f .
 +.Fa f .
  .Pp
  .Fn pcap_lookupdev
  returns a pointer to a network device suitable for use with
 @@ -276,7 +276,7 @@ pointer which is passed in from
  .Fn pcap_dispatch ,
  a pointer to the
  .Fa pcap_pkthdr
 -struct (which precede the actual network headers and data),
 +struct (which precedes the actual network headers and data),
  and a
  .Fa u_char
  pointer to the packet data.
 @@ -351,7 +351,7 @@ return when live read timeouts occur.
  Rather, specifying a non-zero read timeout to
  .Fn pcap_open_live
  and then calling
 -.Fn pcap_dispatch
 +.Fn pcap_loop
  allows the reception and processing of any packets that arrive when the
  timeout occurs.
  A negative
 @@ -490,10 +490,11 @@ It is typically used when just using libpcap for compi
  .Pp
  .Fn pcap_fopen_offline
  may be used to read dumped data from an existing open stream
 -.Dq fp .
 +.Fa fp .
  .Pp
  .Fn pcap_lib_version
  returns a string describing the version of libpcap.
 +.Pp
  .Fn pcap_datalink_val_to_name
  and
  .Fn pcap_datalink_val_to_description



Re: pledge(2) in quiz(6)

2015-10-24 Thread Jan Stary
Any comments/OK?

On Oct 22 13:49:28, h...@stare.cz wrote:
> games/quiz.c popen()s a PAGER to display the help message.
> Throw that away and let the use pipe into a PAGER if needed.
> Then we can just pledge "stdio rpath".
> 
>   Jan
> 
> 
> Index: quiz.c
> ===
> RCS file: /cvs/src/games/quiz/quiz.c,v
> retrieving revision 1.21
> diff -u -p -u -p -r1.21 quiz.c
> --- quiz.c29 Aug 2013 20:22:18 -  1.21
> +++ quiz.c22 Oct 2015 11:42:42 -
> @@ -66,6 +66,9 @@ main(int argc, char *argv[])
>   int ch;
>   const char *indexfile;
>  
> + if (pledge("stdio rpath", NULL) == -1)
> + err(1, "pledge");
> +
>   indexfile = _PATH_QUIZIDX;
>   while ((ch = getopt(argc, argv, "i:t")) != -1)
>   switch(ch) {
> @@ -144,30 +147,21 @@ show_index(void)
>  {
>   QE *qp;
>   const char *p, *s;
> - FILE *pf;
> - const char *pager;
>  
> - if (!isatty(1))
> - pager = "/bin/cat";
> - else if (!(pager = getenv("PAGER")) || (*pager == 0))
> - pager = _PATH_PAGER;
> - if ((pf = popen(pager, "w")) == NULL)
> - err(1, "%s", pager);
> - (void)fprintf(pf, "Subjects:\n\n");
> + printf("Subjects:\n\n");
>   for (qp = qlist.q_next; qp; qp = qp->q_next) {
>   for (s = next_cat(qp->q_text); s; s = next_cat(s)) {
>   if (!rxp_compile(s))
>   errx(1, "%s", rxperr);
>   if ((p = rxp_expand()))
> - (void)fprintf(pf, "%s ", p);
> + printf("%s ", p);
>   }
> - (void)fprintf(pf, "\n");
> + printf("\n");
>   }
> - (void)fprintf(pf, "\n%s\n%s\n%s\n",
> + printf("\n%s\n%s\n%s\n",
>  "For example, \"quiz victim killer\" prints a victim's name and you reply",
>  "with the killer, and \"quiz killer victim\" works the other way around.",
>  "Type an empty line to get the correct answer.");
> - (void)pclose(pf);
>  }
>  
>  void



pledge(2) in quiz(6)

2015-10-22 Thread Jan Stary
games/quiz.c popen()s a PAGER to display the help message.
Throw that away and let the use pipe into a PAGER if needed.
Then we can just pledge "stdio rpath".

Jan


Index: quiz.c
===
RCS file: /cvs/src/games/quiz/quiz.c,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 quiz.c
--- quiz.c  29 Aug 2013 20:22:18 -  1.21
+++ quiz.c  22 Oct 2015 11:42:42 -
@@ -66,6 +66,9 @@ main(int argc, char *argv[])
int ch;
const char *indexfile;
 
+   if (pledge("stdio rpath", NULL) == -1)
+   err(1, "pledge");
+
indexfile = _PATH_QUIZIDX;
while ((ch = getopt(argc, argv, "i:t")) != -1)
switch(ch) {
@@ -144,30 +147,21 @@ show_index(void)
 {
QE *qp;
const char *p, *s;
-   FILE *pf;
-   const char *pager;
 
-   if (!isatty(1))
-   pager = "/bin/cat";
-   else if (!(pager = getenv("PAGER")) || (*pager == 0))
-   pager = _PATH_PAGER;
-   if ((pf = popen(pager, "w")) == NULL)
-   err(1, "%s", pager);
-   (void)fprintf(pf, "Subjects:\n\n");
+   printf("Subjects:\n\n");
for (qp = qlist.q_next; qp; qp = qp->q_next) {
for (s = next_cat(qp->q_text); s; s = next_cat(s)) {
if (!rxp_compile(s))
errx(1, "%s", rxperr);
if ((p = rxp_expand()))
-   (void)fprintf(pf, "%s ", p);
+   printf("%s ", p);
}
-   (void)fprintf(pf, "\n");
+   printf("\n");
}
-   (void)fprintf(pf, "\n%s\n%s\n%s\n",
+   printf("\n%s\n%s\n%s\n",
 "For example, \"quiz victim killer\" prints a victim's name and you reply",
 "with the killer, and \"quiz killer victim\" works the other way around.",
 "Type an empty line to get the correct answer.");
-   (void)pclose(pf);
 }
 
 void



Re: pidfile()

2015-10-27 Thread Jan Stary
>   usr.sbin/rbootd: rbootd.c 
>   usr.sbin/rarpd : rarpd.c 
>   usr.sbin/mrouted: main.c 
>   usr.bin/usbhidaction: usbhidaction.c 
>   usr.sbin/wsmoused: wsmoused.8 wsmoused.c wsmoused.h 
>   usr.sbin/ypserv/ypserv: Makefile ypserv.c 
>   usr.sbin/pppd  : main.c 

Below are the missing manpage bits.

While there, should the commented
.\" .It Pa /tftpboot
be removed from rarpd.8 ?

Also,
$ find /var/run/ -name \*pid 
/var/run/syslog.pid
/var/run/unbound.pid
/var/run/lpd.pid
/var/run/sshd.pid
/var/run/smtpd.pid
/var/run/cron.pid

- should these stop using pidfiles too?

Jan


Index: usr.sbin/mrouted/mrouted.8
===
RCS file: /cvs/src/usr.sbin/mrouted/mrouted.8,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 mrouted.8
--- usr.sbin/mrouted/mrouted.8  8 Sep 2014 01:27:55 -   1.25
+++ usr.sbin/mrouted/mrouted.8  27 Oct 2015 13:23:34 -
@@ -344,18 +344,11 @@ Dumps the internal routing tables to std
 .Nm
 was invoked with a non-zero debug level).
 .El
-.Pp
-For convenience in sending signals,
-.Nm
-writes its process ID to
-.Pa /var/run/mrouted.pid
-upon startup.
 .Sh FILES
 .Bl -tag -width /var/tmp/mrouted.cache -compact
 .It Pa /etc/mrouted.conf
 .It Pa /var/tmp/mrouted.cache
 .It Pa /var/tmp/mrouted.dump
-.It Pa /var/run/mrouted.pid
 .El
 .Sh EXAMPLES
 The routing tables look like this:
Index: usr.sbin/pppd/pppd.8
===
RCS file: /cvs/src/usr.sbin/pppd/pppd.8,v
retrieving revision 1.45
diff -u -p -u -p -r1.45 pppd.8
--- usr.sbin/pppd/pppd.814 Sep 2015 20:06:59 -  1.45
+++ usr.sbin/pppd/pppd.827 Oct 2015 13:23:34 -
@@ -1241,14 +1241,6 @@ script.
 .El
 .Sh FILES
 .Bl -tag -width Ds
-.It Pa /var/run/ppp Ns Ar n Ns .pid
-.\" (BSD or Linux),
-.\" /etc/ppp/ppp Ns Ar n Ns .pid
-.\" (others)
-Process-ID for
-.Nm
-process on PPP interface unit
-.Ar n .
 .It Pa /etc/ppp/pap-secrets
 Usernames, passwords and IP addresses for PAP authentication.
 This file should be owned by root and not readable or writable by any other
Index: usr.sbin/rarpd/rarpd.8
===
RCS file: /cvs/src/usr.sbin/rarpd/rarpd.8,v
retrieving revision 1.20
diff -u -p -u -p -r1.20 rarpd.8
--- usr.sbin/rarpd/rarpd.8  8 Sep 2014 01:27:55 -   1.20
+++ usr.sbin/rarpd/rarpd.8  27 Oct 2015 13:23:34 -
@@ -82,14 +82,11 @@ is the target IP address expressed in up
 (only the first 8 characters of filenames are checked).
 .El
 .Sh FILES
-.Bl -tag -width "/var/run/rarpd.pidXXX" -compact
+.Bl -tag -width /etc/ethers -compact
 .It Pa /etc/ethers
 Ethernet host name database.
 .It Pa /etc/hosts
 Host name database.
-.It Pa /var/run/rarpd.pid
-Process ID of
-.Nm .
 .\" .It Pa /tftpboot
 .El
 .Sh SEE ALSO
Index: usr.sbin/rbootd/rbootd.8
===
RCS file: /cvs/src/usr.sbin/rbootd/rbootd.8,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 rbootd.8
--- usr.sbin/rbootd/rbootd.815 Nov 2014 14:41:03 -  1.14
+++ usr.sbin/rbootd/rbootd.827 Oct 2015 13:23:34 -
@@ -143,8 +143,6 @@ configuration file
 debug output
 .It Pa /usr/mdec/rbootd
 directory containing boot files
-.It Pa /var/run/rbootd.pid
-process ID
 .El
 .Sh SEE ALSO
 .Xr kill 1 ,
Index: usr.sbin/ypserv/ypserv/ypserv.8
===
RCS file: /cvs/src/usr.sbin/ypserv/ypserv/ypserv.8,v
retrieving revision 1.27
diff -u -p -u -p -r1.27 ypserv.8
--- usr.sbin/ypserv/ypserv/ypserv.8 16 Jul 2013 11:13:34 -  1.27
+++ usr.sbin/ypserv/ypserv/ypserv.8 27 Oct 2015 13:23:34 -
@@ -98,9 +98,6 @@ map files and the
 or
 .Xr securenet 5
 configuration file.
-The process ID
-can be found in the file
-.Pa /var/run/ypserv.pid .
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
@@ -136,7 +133,6 @@ or
 .Bl -tag -width /var/yp/ypserv.log -compact
 .It Pa /var/yp/ypserv.log
 .It Pa /var/yp/securenet
-.It Pa /var/run/ypserv.pid
 .El
 .Sh SEE ALSO
 .Xr securenet 5 ,



Re: inteldrm(4) diff that needs testing

2015-10-26 Thread Jan Stary
On Oct 24 23:48:01, mark.kette...@xs4all.nl wrote:
> The diff below makes inteldrm(4) attach directly to pci(4) instead of
> vga(1).  Because inteldrm(4) depends on intagp(4), this also make
> intagp(4) a child of inteldrm(4).  Ultimately I'd like to integrate
> intagp(4) into inteldrm(4), but that's going to be a bit more work.
> 
> This diff is needed to make inteldrm(4) work when OpenBSD gets booted
> by UEFI firmware.  It will also make inteldrm(4) work on machines with
> discrete graphics.
> 
> This diff needs to be tested on a wide range of hardware.  So if you
> have a machine with inteldrm(4), please give it a shot.  I'm
> particularly interested in testing on an x40.

This is an old MacBook2,1 running current/amd64.
Both dmesg below, this is the hightlight of the dmesg diff:

-vga1 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
-intagp0 at vga1
+inteldrm0 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
+intagp0 at inteldrm0
 agp0 at intagp0: aperture at 0xc000, size 0x1000
-inteldrm0 at vga1
 drm0 at inteldrm0
 inteldrm0: apic 1 int 16
 inteldrm0: 1280x800
-wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
+wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
 wsdisplay0: screen 1-5 added (std, vt100 emulation)
 "Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
 vendor "Intel", unknown product 0x27a3 (class DASP subclass Time and 
Frequency, rev 0x03) at pci0 dev 7 function 0 not configured

With the patch applied, X seems to run just fine,
including video-heavy things like firefox or mplayer .

It suspends but does not resume correctly; the resume does happen
(see below for /var/log/messages), but the screen is mostly black
with seemingly random color patches.

Unfortunately, I do not have any other access to the machine right now
(will try again on one of my networks where I can connect remotely).


Jan


Before:

OpenBSD 5.8-current (GENERIC.MP) #1537: Tue Oct 20 09:44:09 MDT 2015
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 3171901440 (3024MB)
avail mem = 3071705088 (2929MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe (37 entries)
bios0: vendor Apple Inc. version "MB21.88Z.00A5.B07.0706270922" date 06/27/07
bios0: Apple Inc. MacBook2,1
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC MCFG ASF! SBST ECDT SSDT SSDT SSDT
acpi0: wakeup devices ADP1(S3) LID0(S3) PXS1(S4) PXS2(S4) USB1(S3) USB2(S3) 
USB3(S3) USB4(S3) USB7(S3) EC__(S3)
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)2 CPU T7400 @ 2.16GHz, 2161.61 MHz
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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR
cpu0: 4MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 166MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz, 2161.26 MHz
cpu1: 
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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR
cpu1: 4MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 0, remapped to apid 1
acpimcfg0 at acpi0 addr 0xf000, bus 0-255
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (RP01)
acpiprt2 at acpi0: bus 2 (RP02)
acpiprt3 at acpi0: bus 3 (PCIB)
acpicpu0 at acpi0: !C3(100@55 mwait@0x31), !C2(500@1 mwait@0x10), C1(1000@1 
mwait), PSS
acpicpu1 at acpi0: !C3(100@55 mwait@0x31), !C2(500@1 mwait@0x10), C1(1000@1 
mwait), PSS
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: LID0
acpibtn1 at acpi0: PWRB
acpibtn2 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "15253732082930497" type 15253732284385612 oem 
"15253732284387396"
acpivideo0 at acpi0: GFX0
cpu0: Enhanced SpeedStep 2161 MHz: speeds: 2167, 2000, 1833, 1667, 1500, 1333, 
1000 MHz
memory map conflict 0xbef0/0x10
memory map conflict 0xbf00/0x100
memory map conflict 0xf00f8000/0x1000
memory map conflict 0xfed1c000/0x4000
memory map conflict 0xfffb/0x3
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82945GM Host" rev 0x03
vga1 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
intagp0 at vga1
agp0 at intagp0: aperture at 0xc000, size 0x1000
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: apic 1 int 16
inteldrm0: 1280x800
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: 

newsyslog -r

2015-11-12 Thread Jan Stary
The -r option of newsyslog(8) removes the requirement
that newsyslog runs as root. Would it also make sense
to not try to send the SIGHUP to syslogd in that case?

Jan


Index: newsyslog.8
===
RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.8,v
retrieving revision 1.52
diff -u -p -u -p -r1.52 newsyslog.8
--- newsyslog.8 16 Sep 2014 16:27:23 -  1.52
+++ newsyslog.8 12 Nov 2015 21:20:52 -
@@ -123,7 +123,7 @@ Removes the restriction that
 must be running as root.
 Note that in this mode
 .Nm
-will not be able to send a
+will not try to send a
 .Dv SIGHUP
 signal to
 .Xr syslogd 8 .
Index: newsyslog.c
===
RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v
retrieving revision 1.95
diff -u -p -u -p -r1.95 newsyslog.c
--- newsyslog.c 20 Aug 2015 22:32:41 -  1.95
+++ newsyslog.c 12 Nov 2015 21:20:52 -
@@ -406,7 +406,7 @@ send_signal(char *pidfile, int signal)
warnx("%s pid file: %s", err, pidfile);
else if (noaction)
(void)printf("kill -%s %ld\n", sys_signame[signal], (long)pid);
-   else if (kill(pid, signal))
+   else if (needroot && kill(pid, signal))
warnx("warning - could not send SIG%s to PID from pid file %s",
sys_signame[signal], pidfile);
 }



apmd(8) messages

2015-11-16 Thread Jan Stary
When we set perf policy to high, we say "high".
So when we set to low, say "low", not "manual".
(Both manual high and manual low are manual.)

And it's not "client reply", it's a reply to the client, right?

Jan


Index: apmd.c
===
RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v
retrieving revision 1.77
diff -u -p -r1.77 apmd.c
--- apmd.c  11 Oct 2015 20:23:49 -  1.77
+++ apmd.c  16 Nov 2015 17:22:16 -
@@ -277,7 +277,7 @@ handle_client(int sock_fd, int ctl_fd)
case SETPERF_LOW:
doperf = PERF_MANUAL;
reply.newstate = NORMAL;
-   syslog(LOG_NOTICE, "setting hw.perfpolicy to manual");
+   syslog(LOG_NOTICE, "setting hw.perfpolicy to low");
setperfpolicy("low");
break;
case SETPERF_HIGH:
@@ -305,7 +305,7 @@ handle_client(int sock_fd, int ctl_fd)
reply.perfmode = doperf;
reply.vno = APMD_VNO;
if (send(cli_fd, , sizeof(reply), 0) != sizeof(reply))
-   syslog(LOG_INFO, "client reply botch");
+   syslog(LOG_INFO, "reply to client botched");
close(cli_fd);
 
return reply.newstate;



Re: newsyslog -r

2015-11-16 Thread Jan Stary
ping

On Nov 12 22:21:39, h...@stare.cz wrote:
> The -r option of newsyslog(8) removes the requirement
> that newsyslog runs as root. Would it also make sense
> to not try to send the SIGHUP to syslogd in that case?
> 
>   Jan
> 
> 
> Index: newsyslog.8
> ===
> RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.8,v
> retrieving revision 1.52
> diff -u -p -u -p -r1.52 newsyslog.8
> --- newsyslog.8   16 Sep 2014 16:27:23 -  1.52
> +++ newsyslog.8   12 Nov 2015 21:20:52 -
> @@ -123,7 +123,7 @@ Removes the restriction that
>  must be running as root.
>  Note that in this mode
>  .Nm
> -will not be able to send a
> +will not try to send a
>  .Dv SIGHUP
>  signal to
>  .Xr syslogd 8 .
> Index: newsyslog.c
> ===
> RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v
> retrieving revision 1.95
> diff -u -p -u -p -r1.95 newsyslog.c
> --- newsyslog.c   20 Aug 2015 22:32:41 -  1.95
> +++ newsyslog.c   12 Nov 2015 21:20:52 -
> @@ -406,7 +406,7 @@ send_signal(char *pidfile, int signal)
>   warnx("%s pid file: %s", err, pidfile);
>   else if (noaction)
>   (void)printf("kill -%s %ld\n", sys_signame[signal], (long)pid);
> - else if (kill(pid, signal))
> + else if (needroot && kill(pid, signal))
>   warnx("warning - could not send SIG%s to PID from pid file %s",
>   sys_signame[signal], pidfile);
>  }



pledge audioctl

2015-11-17 Thread Jan Stary
I am trying to add pledge(2) to audioctl(1),
but it gets SIGABRT'ed under any pledge promises.
(Indeed, I have pledged everything in a desperate attempt.)

Looking at gdb and a ktrace, /dev/audioctl gets opened fine,
but then it fails on an ioctl in getinfo()

 23472 audioctl CALL  ioctl(3,AUDIO_GETDEV,0x10d3bed03a20)
 23472 audioctl PLDG  ioctl, "ioctl", errno 1 Operation not permitted
 23472 audioctl PSIG  SIGABRT SIG_DFL code <1054761850>
 23472 audioctl NAMI  "audioctl.core"

Obviously, "ioctl" is in the pledge call.
Is it simply that AUDIO_GETDEV is not included in the ioctl pledge?
Is there a way to pledge audio stuff like this with current pledge?

Jan



Re: printf(3) wording

2015-11-17 Thread Jan Stary
On Nov 17 17:06:11, j...@kerhand.co.uk wrote:
> On Tue, Nov 17, 2015 at 10:38:41AM +0100, Jan Stary wrote:
> > I am not a native speaker, but the conversion specifiers
> > are "interpreted" by printf, not "interpolated", right?
> > 
> > Jan
> > 
> 
> i don;t know how these implementations work, so it's hard to say.
> perhaps they are interpolated. maybe use cvs to track down the author
> and ask them?
> 
> whatever the outcome, if you want to change this text you probably want
> to adjust a few more:
> 
> /usr/src/lib/libc/gen/err.3:for later interpolation by the
> /usr/src/lib/libc/gen/setproctitle.3:for later interpolation by
> /usr/src/lib/libc/gen/syslog.3:for later interpolation by
> /usr/src/lib/libc/stdio/printf.3:for later interpolation by

Hm, probably just my English;
sorry for the noise.

Jan

> jmc
> 
> > Index: printf.3
> > ===
> > RCS file: /cvs/src/lib/libc/stdio/printf.3,v
> > retrieving revision 1.74
> > diff -u -p -r1.74 printf.3
> > --- printf.313 Oct 2015 12:25:04 -  1.74
> > +++ printf.317 Nov 2015 09:36:19 -
> > @@ -852,7 +852,7 @@ This holds true even if the string has b
> >  using a function like
> >  .Fn snprintf ,
> >  as the resulting string may still contain user-supplied conversion 
> > specifiers
> > -for later interpolation by
> > +for later interpretation by
> >  .Fn printf .
> >  .Pp
> >  Be sure to use the proper secure idiom:
> > 



Re: fdisk(8) -l -c -h -s manpage bits

2015-11-17 Thread Jan Stary
On Nov 17 17:21:42, j...@kerhand.co.uk wrote:
> On Tue, Nov 17, 2015 at 09:36:26AM +0100, Jan Stary wrote:
> > On Nov 14 14:17:08, k...@openbsd.org wrote:
> > > Modified files:
> > >   sbin/fdisk : disk.c fdisk.c 
> > > 
> > > Log message:
> > > Since -l is ignored if -c/-h/-s are specified, make that combination
> > > invalid and mention the constraint in usage().
> > 
> > Mention it in the manpage too.
> > 
> > Jan
> > 
> > 
> 
> i agree it makes sense to document it. but there is already similar text
> there for -u and -i, and this makes it a little consistent.
> 
> i propose using the same text. are you happy with this?

I agree that this is better.


> 
> Index: fdisk.8
> ===
> RCS file: /cvs/src/sbin/fdisk/fdisk.8,v
> retrieving revision 1.87
> diff -u -r1.87 fdisk.8
> --- fdisk.8   26 Oct 2015 18:05:25 -  1.87
> +++ fdisk.8   17 Nov 2015 17:19:53 -
> @@ -79,6 +79,12 @@
>  or values that
>  .Em /boot
>  has passed to the kernel.
> +.Pp
> +Only one of
> +.Fl chs
> +or
> +.Fl l
> +can be specified.
>  .It Fl e
>  Use the
>  .Nm
> @@ -127,6 +133,12 @@
>  .It Fl l Ar blocks
>  Specify the number of blocks in the disk, and force the MBR to be in LBA
>  mode only.
> +.Pp
> +Only one of
> +.Fl chs
> +or
> +.Fl l
> +can be specified.
>  .It Fl u
>  Update MBR bootcode, preserving existing MBR partition table.
>  The MBR bootcode extends from offset 0x000 to the start of the MBR partition



Re: inteldrm(4) diff that needs testing

2015-11-01 Thread Jan Stary
On Oct 26 13:31:14, h...@stare.cz wrote:
> On Oct 24 23:48:01, mark.kette...@xs4all.nl wrote:
> > The diff below makes inteldrm(4) attach directly to pci(4) instead of
> > vga(1).  Because inteldrm(4) depends on intagp(4), this also make
> > intagp(4) a child of inteldrm(4).  Ultimately I'd like to integrate
> > intagp(4) into inteldrm(4), but that's going to be a bit more work.
> > 
> > This diff is needed to make inteldrm(4) work when OpenBSD gets booted
> > by UEFI firmware.  It will also make inteldrm(4) work on machines with
> > discrete graphics.
> > 
> > This diff needs to be tested on a wide range of hardware.  So if you
> > have a machine with inteldrm(4), please give it a shot.  I'm
> > particularly interested in testing on an x40.
> 
> This is an old MacBook2,1 running current/amd64.
> Both dmesg below, this is the hightlight of the dmesg diff:
> 
> -vga1 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
> -intagp0 at vga1
> +inteldrm0 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
> +intagp0 at inteldrm0
>  agp0 at intagp0: aperture at 0xc000, size 0x1000
> -inteldrm0 at vga1
>  drm0 at inteldrm0
>  inteldrm0: apic 1 int 16
>  inteldrm0: 1280x800
> -wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
> +wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
>  wsdisplay0: screen 1-5 added (std, vt100 emulation)
>  "Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
>  vendor "Intel", unknown product 0x27a3 (class DASP subclass Time and 
> Frequency, rev 0x03) at pci0 dev 7 function 0 not configured
> 
> With the patch applied, X seems to run just fine,
> including video-heavy things like firefox or mplayer .
> 
> It suspends but does not resume correctly; the resume does happen
> (see below for /var/log/messages), but the screen is mostly black
> with seemingly random color patches.
> 
> Unfortunately, I do not have any other access to the machine right now
> (will try again on one of my networks where I can connect remotely).

I can confirm the machine does wake up and can be accessed remotely;
but the screen remains garbled. This is with the latest current/amd64
snapshot and a kernel compiled with the patch.
(Is the patch already in?)

Please let me know if I can help test it further.

Jan

> 
> 
> Before:
> 
> OpenBSD 5.8-current (GENERIC.MP) #1537: Tue Oct 20 09:44:09 MDT 2015
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> real mem = 3171901440 (3024MB)
> avail mem = 3071705088 (2929MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe (37 entries)
> bios0: vendor Apple Inc. version "MB21.88Z.00A5.B07.0706270922" date 06/27/07
> bios0: Apple Inc. MacBook2,1
> acpi0 at bios0: rev 2
> acpi0: sleep states S0 S3 S4 S5
> acpi0: tables DSDT FACP HPET APIC MCFG ASF! SBST ECDT SSDT SSDT SSDT
> acpi0: wakeup devices ADP1(S3) LID0(S3) PXS1(S4) PXS2(S4) USB1(S3) USB2(S3) 
> USB3(S3) USB4(S3) USB7(S3) EC__(S3)
> 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)2 CPU T7400 @ 2.16GHz, 2161.61 MHz
> 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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR
> cpu0: 4MB 64b/line 16-way L2 cache
> cpu0: smt 0, core 0, package 0
> mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> cpu0: apic clock running at 166MHz
> cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2, IBE
> cpu1 at mainbus0: apid 1 (application processor)
> cpu1: Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz, 2161.26 MHz
> cpu1: 
> 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,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR
> cpu1: 4MB 64b/line 16-way L2 cache
> cpu1: smt 0, core 1, package 0
> ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
> ioapic0: misconfigured as apic 0, remapped to apid 1
> acpimcfg0 at acpi0 addr 0xf000, bus 0-255
> acpiec0 at acpi0
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpiprt1 at acpi0: bus 1 (RP01)
> acpiprt2 at acpi0: bus 2 (RP02)
> acpiprt3 at acpi0: bus 3 (PCIB)
> acpicpu0 at acpi0: !C3(100@55 mwait@0x31), !C2(500@1 mwait@0x10), C1(1000@1 
> mwait), PSS
> acpicpu1 at acpi0: !C3(100@55 mwait@0x31), !C2(500@1 mwait@0x10), C1(1000@1 
> mwait), PSS
> acpiac0 at acpi0: AC unit online
> acpibtn0 at acpi0: LID0
> acpibtn1 at acpi0: PWRB
> acpibtn2 at acpi0: SLPB
> acpibat0 at acpi0: BAT0 model "15253732082930497" type 15253732284385612 oem 
> "15253732284387396"
> acpivideo0 at acpi0: GFX0
> cpu0: Enhanced SpeedStep 2161 MHz: speeds: 2167, 2000, 1833, 1667, 1500, 
> 1333, 1000 MHz
> memory map conflict 0xbef0/0x10
> memory map 

reference syscall.h in pledge.2

2015-10-21 Thread Jan Stary
Does it make sense to reference the syscall numbers in pledge(2)?

Jan


--- /usr/src/lib/libc/sys/pledge.2  Thu Oct 15 00:39:04 2015
+++ ./pledge.2  Wed Oct 21 09:41:26 2015
@@ -468,6 +468,9 @@ All other paths will return
 .Er ENOENT .
 .Sh RETURN VALUES
 .Rv -std
+.Sh FILES
+.Pa /usr/include/sys/syscall.h
+defines the syscall numbers.
 .Sh ERRORS
 .Fn pledge
 will fail if:



Re: sndiod_flags=NO in /etc/rc.conf on recent snapshots

2015-11-18 Thread Jan Stary
On Nov 18 12:47:01, st...@openbsd.org wrote:
> On 2015/11/18 07:30, Maxim Khitrov wrote:
> > On Wed, Nov 18, 2015 at 12:02 AM, Theo de Raadt  
> > wrote:
> > >> I only just noticed that, trying to watch a video while having a web
> > >> browser open at the same time, I don't get any sound.
> > >>
> > >> Only going through recent daily insecurity emails, had I found out that:
> > >>
> > >> sndiod_flags=
> > >>
> > >> in /etc/rc.conf, has been changed to:
> > >>
> > >> sndiod_flags=NO
> > >>
> > >> on snapshots from around the 10th November.
> > >>
> > >> The source in CVS doesn't have that change. I couldn't find any
> > >> information about it in the mailing list archives either.
> > >>
> > >> What (if any) is the reason behind it?
> > >
> > > Testing reactions.
> > 
> > One down, two to go: check_quotas, pflogd_flags :)
> 
> It's really a required part of the audio layer for many uses.
> Various parts were removed from the kernel because they were moved to
> sndiod. Hopefully it will back after the cleanup. (I don't notice this
> on my workstation because I have sndiod_flags=-f rsnd/1..)

Exactly. Having specific sndiod_flags in rc.local
to accommodate my MIDI setup etc, I haven't noticed.
But having sndiod running is indispensable for much of the audio work.
Then again, anyone who needs that can craft their own sndiod_flags.



printf(3) wording

2015-11-17 Thread Jan Stary
I am not a native speaker, but the conversion specifiers
are "interpreted" by printf, not "interpolated", right?

Jan

Index: printf.3
===
RCS file: /cvs/src/lib/libc/stdio/printf.3,v
retrieving revision 1.74
diff -u -p -r1.74 printf.3
--- printf.313 Oct 2015 12:25:04 -  1.74
+++ printf.317 Nov 2015 09:36:19 -
@@ -852,7 +852,7 @@ This holds true even if the string has b
 using a function like
 .Fn snprintf ,
 as the resulting string may still contain user-supplied conversion specifiers
-for later interpolation by
+for later interpretation by
 .Fn printf .
 .Pp
 Be sure to use the proper secure idiom:



Re: fdisk(8) -l -c -h -s manpage bits

2015-11-17 Thread Jan Stary
On Nov 14 14:17:08, k...@openbsd.org wrote:
> Modified files:
>   sbin/fdisk : disk.c fdisk.c 
> 
> Log message:
> Since -l is ignored if -c/-h/-s are specified, make that combination
> invalid and mention the constraint in usage().

Mention it in the manpage too.

Jan


Index: fdisk.8
===
RCS file: /cvs/src/sbin/fdisk/fdisk.8,v
retrieving revision 1.87
diff -u -p -r1.87 fdisk.8
--- fdisk.8 26 Oct 2015 18:05:25 -  1.87
+++ fdisk.8 17 Nov 2015 08:34:38 -
@@ -79,6 +79,8 @@ These figures are taken from the in-core
 or values that
 .Em /boot
 has passed to the kernel.
+These options are mutually exclusive with
+.Fl l .
 .It Fl e
 Use the
 .Nm
@@ -127,6 +129,8 @@ can be specified.
 .It Fl l Ar blocks
 Specify the number of blocks in the disk, and force the MBR to be in LBA
 mode only.
+This option is mutually exclusive with
+.Fl c h s .
 .It Fl u
 Update MBR bootcode, preserving existing MBR partition table.
 The MBR bootcode extends from offset 0x000 to the start of the MBR partition



apmd ignoring ENXIO on /dev/apmctl

2015-11-17 Thread Jan Stary
Upon startup, apmd(8) opens /dev/apmctl like this:

if ((ctl_fd = open(fname, O_RDWR | O_CLOEXEC)) == -1) {
if (errno != ENXIO && errno != ENOENT)
error("cannot open device file `%s'", fname);
}

Why is it that we ignore ENXIO and ENOENT here?
apmd(8) seems to go on using the fd as if opening successfully.

Jan



no more _subdir in man.conf

2015-09-17 Thread Jan Stary
The new man.conf does not recognize _subdir

Jan


Index: man.1
===
RCS file: /cvs/src/usr.bin/mandoc/man.1,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 man.1
--- man.1   16 Feb 2015 16:18:02 -  1.11
+++ man.1   17 Sep 2015 14:51:34 -
@@ -173,12 +173,6 @@ must be a colon
 separated list of directories.
 This search path may also be set using the environment variable
 .Ev MANPATH .
-The subdirectories to be searched, and their search order,
-are specified by the
-.Dq _subdir
-line in the
-.Nm
-configuration file.
 .It Fl m Ar path
 Augment the list of standard directories which
 .Nm
@@ -194,12 +188,6 @@ the directories specified using the
 option or the
 .Ev MANPATH
 environment variable.
-The subdirectories to be searched, and their search order,
-are specified by the
-.Dq _subdir
-line in the
-.Nm
-configuration file.
 .It Fl O Ar option Ns = Ns Ar value
 Comma-separated output options.
 For each output format, the available options are described in the
@@ -370,12 +358,6 @@ variable.
 The format of the path is a colon
 .Pq Ql \&:
 separated list of directories.
-The subdirectories to be searched, as well as their search order,
-are specified by the
-.Dq _subdir
-line in the
-.Nm
-configuration file.
 .It Ev PAGER
 Specifies the pagination program to use when
 .Ev MANPAGER



Re: newsyslog -r

2015-12-03 Thread Jan Stary
ping

On Nov 12 22:21:39, h...@stare.cz wrote:
> The -r option of newsyslog(8) removes the requirement
> that newsyslog runs as root. Would it also make sense
> to not try to send the SIGHUP to syslogd in that case?
> 
>   Jan
> 
> 
> Index: newsyslog.8
> ===
> RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.8,v
> retrieving revision 1.52
> diff -u -p -u -p -r1.52 newsyslog.8
> --- newsyslog.8   16 Sep 2014 16:27:23 -  1.52
> +++ newsyslog.8   12 Nov 2015 21:20:52 -
> @@ -123,7 +123,7 @@ Removes the restriction that
>  must be running as root.
>  Note that in this mode
>  .Nm
> -will not be able to send a
> +will not try to send a
>  .Dv SIGHUP
>  signal to
>  .Xr syslogd 8 .
> Index: newsyslog.c
> ===
> RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v
> retrieving revision 1.95
> diff -u -p -u -p -r1.95 newsyslog.c
> --- newsyslog.c   20 Aug 2015 22:32:41 -  1.95
> +++ newsyslog.c   12 Nov 2015 21:20:52 -
> @@ -406,7 +406,7 @@ send_signal(char *pidfile, int signal)
>   warnx("%s pid file: %s", err, pidfile);
>   else if (noaction)
>   (void)printf("kill -%s %ld\n", sys_signame[signal], (long)pid);
> - else if (kill(pid, signal))
> + else if (needroot && kill(pid, signal))
>   warnx("warning - could not send SIG%s to PID from pid file %s",
>   sys_signame[signal], pidfile);
>  }



eeprom does not compile on current/macppc

2015-12-31 Thread Jan Stary
Rebuilding the userland on a current/maccppc MacMini filas with

===> usr.sbin/eeprom
cc -O2 -pipe  -Werror-implicit-function-declaration  -c getdate.c
/usr/src/usr.sbin/eeprom/getdate.y: In function 'get_date':
/usr/src/usr.sbin/eeprom/getdate.y:860: error: implicit declaration of
function 'yyparse'

Jan


[ using 560212 bytes of bsd ELF symbol table ]
console out [NVDA,Display-A] console in [keyboard], using USB
using parent NVDA,Parent:: memaddr 9800, size 800 : consaddr 98004000 : 
ioaddr 9100, size 100: width 1280 linebytes 1536 height 960 depth 8
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.9-beta (GENERIC) #0: Wed Dec 30 22:14:37 CET 2015
r...@emac.stare.cz:/usr/src/sys/arch/macppc/compile/GENERIC
real mem = 1073741824 (1024MB)
avail mem = 1029025792 (981MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root: model PowerMac4,4
cpu0 at mainbus0: 7450 (Revision 0x201): 700 MHz: 256KB L2 cache
mem0 at mainbus0
spdmem0 at mem0: 512MB SDRAM non-parity PC133CL2
spdmem1 at mem0: 512MB SDRAM non-parity PC133CL3
memc0 at mainbus0: uni-n rev 0x11
kiic0 at memc0 offset 0xf8001000
iic0 at kiic0
mpcpcibr0 at mainbus0 pci: uni-north
pci0 at mpcpcibr0 bus 0
pchb0 at pci0 dev 11 function 0 "Apple Uni-N2 AGP" rev 0x00
agp at pchb0 not configured
vgafb0 at pci0 dev 16 function 0 "NVIDIA GeForce2 MX" rev 0xb2
wsdisplay0 at vgafb0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
mpcpcibr1 at mainbus0 pci: uni-north
pci1 at mpcpcibr1 bus 0
macobio0 at pci1 dev 23 function 0 "Apple Keylargo" rev 0x03
openpic0 at macobio0 offset 0x4: version 0x4614 feature 3f0302 LE
macgpio0 at macobio0 offset 0x50
macgpio1 at macgpio0 offset 0x59: irq 47
pgs0 at macgpio0 offset 0x61: irq 55
"fan" at macgpio0 offset 0x0 not configured
"gpio7" at macgpio0 offset 0x71 not configured
"gpio5" at macgpio0 offset 0x6f not configured
"extint-gpio15" at macgpio0 offset 0x67 not configured
"extint-gpio4" at macgpio0 offset 0x5c not configured
"gpio6" at macgpio0 offset 0x70 not configured
"gpio11" at macgpio0 offset 0x75 not configured
"escc-legacy" at macobio0 offset 0x12000 not configured
zs0 at macobio0 offset 0x13000: irq 22,23
zstty0 at zs0 channel 0
zstty1 at zs0 channel 1
snapper0 at macobio0 offset 0x1: irq 30,1,2
"timer" at macobio0 offset 0x15000 not configured
adb0 at macobio0 offset 0x16000
apm0 at adb0: battery flags 0x9, 0% charged
piic0 at adb0
iic1 at piic0
"imic5002" at iic1 addr 0xe8 not configured
"imic5003" at iic1 addr 0xea not configured
"ivad-2" at iic1 addr 0x146 not configured
"ivad-eeprom" at iic1 addr 0x153 not configured
"ivad-pwm" at iic1 addr 0x14c not configured
kiic1 at macobio0 offset 0x18000
iic2 at kiic1
wdc0 at macobio0 offset 0x1f000 irq 19: DMA
wd0 at wdc0 channel 0 drive 0: 
wd0: 16-sector PIO, LBA, 39073MB, 80022600 sectors
wd0(wdc0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 4
wdc1 at macobio0 offset 0x2 irq 20: DMA
atapiscsi0 at wdc1 channel 0 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0:  ATAPI 5/cdrom 
removable
cd0(wdc1:0:0): using BIOS timings, DMA mode 2
wdc2 at macobio0 offset 0x21000 irq 21: DMA
audio0 at snapper0
ohci0 at pci1 dev 24 function 0 "Apple USB" rev 0x00: irq 27, version 1.0
ohci1 at pci1 dev 25 function 0 "Apple USB" rev 0x00: irq 28, version 1.0
usb0 at ohci0: USB revision 1.0
uhub0 at usb0 "Apple OHCI root hub" rev 1.00/1.00 addr 1
usb1 at ohci1: USB revision 1.0
uhub1 at usb1 "Apple OHCI root hub" rev 1.00/1.00 addr 1
mpcpcibr2 at mainbus0 pci: uni-north
pci2 at mpcpcibr2 bus 0
"AT/Lucent FW322 1394" rev 0x00 at pci2 dev 14 function 0 not configured
gem0 at pci2 dev 15 function 0 "Apple Uni-N GMAC" rev 0x01: irq 41, address 
00:03:93:c1:1b:d6
bmtphy0 at gem0 phy 0: BCM5221 100baseTX PHY, rev. 4
uhidev0 at uhub0 port 2 configuration 1 interface 0 "Logitech USB-PS/2 Optical 
Mouse" rev 2.00/11.10 addr 2
uhidev0: iclass 3/1
ums0 at uhidev0: 3 buttons, Z dir
wsmouse0 at ums0 mux 0
uhub2 at uhub1 port 1 "Mitsumi Electric Hub in Apple Extended USB Keyboard" rev 
1.10/4.10 addr 2
uhidev1 at uhub2 port 3 configuration 1 interface 0 "Mitsumi Electric Apple 
Extended USB Keyboard" rev 1.10/4.10 addr 3
uhidev1: iclass 3/1
ukbd0 at uhidev1: 8 variable keys, 6 key codes, country code 13
wskbd0 at ukbd0: console keyboard, using wsdisplay0
uhidev2 at uhub2 port 3 configuration 1 interface 1 "Mitsumi Electric Apple 
Extended USB Keyboard" rev 1.10/4.10 addr 3
uhidev2: iclass 3/0, 3 report ids
uhid0 at uhidev2 reportid 2: input=1, output=0, feature=0
uhid1 at uhidev2 reportid 3: input=3, output=0, feature=0
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
bootpath: /pci@f200/mac-io@17/ata-4@1f000/disk@0:/bsd
root on wd0a 

wump(6) does not need to fork

2015-11-30 Thread Jan Stary
- put the game description in the manpage,
  showing The Wumpus some damn respect by making
  at least a .Bl list of pits, bats, and the wump.
- remove wump.info, instructions(), and pathnames.h
- pledge a simple "stdio"

Jan

Index: Makefile
===
RCS file: /cvs/src/games/wump/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- Makefile23 May 2002 18:43:00 -  1.5
+++ Makefile30 Nov 2015 13:43:14 -
@@ -3,8 +3,4 @@
 PROG=  wump
 MAN=   wump.6
 
-beforeinstall:
-   ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
-   ${.CURDIR}/wump.info ${DESTDIR}/usr/share/games
-
 .include 
Index: pathnames.h
===
RCS file: pathnames.h
diff -N pathnames.h
--- pathnames.h 3 Jun 2003 03:01:42 -   1.3
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,35 +0,0 @@
-/* $OpenBSD: pathnames.h,v 1.3 2003/06/03 03:01:42 millert Exp $   */
-
-/*-
- * Copyright (c) 1989, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
- */
-
-#define_PATH_PAGER "/usr/bin/more"
-#define_PATH_WUMPINFO  "/usr/share/games/wump.info"
Index: wump.6
===
RCS file: /cvs/src/games/wump/wump.6,v
retrieving revision 1.9
diff -u -p -r1.9 wump.6
--- wump.6  31 May 2007 19:19:19 -  1.9
+++ wump.6  30 Nov 2015 13:43:14 -
@@ -58,6 +58,74 @@ Your quest is to find and shoot the evil
 the cave without running into any pits or using up your limited supply of
 arrows.
 .Pp
+While wandering through the cave you'll notice that, while there are tunnels
+everywhere, there are some mysterious quirks to the cave topology, including
+some tunnels that go from one room to another, but not necessarily back!
+Also, most pesky of all are the rooms that are home to large numbers of bats,
+which, upon being disturbed, will en masse grab you and move you to another
+portion of the cave (including those housing bottomless pits, sure
+death for unwary explorers).
+.Pp
+Fortunately, you're not going into the cave without any weapons or tools,
+and in fact your biggest aids are your senses; you can often smell the
+rather odiferous Wumpus up to
+.Em two
+rooms away, and you can always feel the drafts created by the occasional
+bottomless pit and hear the rustle of the bats in caves they might be
+sleeping within.
+.Pp
+To kill the wumpus, you'll need to shoot it with one of your magic arrows.
+Fortunately, you don't have to be in the same room as the creature, and can
+instead shoot the arrow from as far as three or four rooms away!
+.Pp
+When you shoot an arrow, you do so by typing in a list of rooms that you'd
+like it to travel to.
+If at any point in its travels it cannot find a tunnel to the room you
+specify from the room it's in, it will instead randomly fly down one of the
+tunnels, possibly, if you're real unlucky, even flying back into the room
+you're in and hitting you!
+.Pp
+The game has the following hazards for intrepid adventurers
+to wend their way through:
+.Bl -tag -width Wumpus
+.It Pits
+If you fall into one of the bottomless pits,
+you find yourself slung back out on the far side of the Earth
+and in very poor shape to continue your quest since you're dead.
+.It Bats
+As with any other cave, the Wumpus 

Re: pledge fish(6) plus a few more things

2015-11-30 Thread Jan Stary
On Nov 23 13:17:43, ser...@helheim.mooo.com wrote:
> Declared usage() as __dead since it won't return, instructions() called
> a handrolled pager (/bin/cat) using fork which I replaced for a simple
> cicle of while(fgets) then fputs (greatly inspired, to not saying it was
> bluntly copied, by a previous patch sent by tedu@ for another application).
> After instructions() function is run then fish(6) only needs pledge "stdio".

On Nov 30 01:42:03, t...@openbsd.org wrote:
> slightly interesting pledge for fish:
> start with "stdio rpath proc exec" since it pipes instructions to a pager
> afterwards "stdio" is enough

- just put the six lines of instructions into the manpage where they belong
- remove fish.instr, remove instructions()
- make the pledge a straightforward "stdio"
 
This is what we did with quiz(6) before,
and what I'm gonna do next with wump(6) and every other game
which forks a PAGER just to spit out a help message.
http://marc.info/?l=openbsd-tech=144576581513053=2

Jan



Re: pledge fish(6) plus a few more things

2015-11-30 Thread Jan Stary
On Nov 30 14:16:02, h...@stare.cz wrote:
> On Nov 23 13:17:43, ser...@helheim.mooo.com wrote:
> > Declared usage() as __dead since it won't return, instructions() called
> > a handrolled pager (/bin/cat) using fork which I replaced for a simple
> > cicle of while(fgets) then fputs (greatly inspired, to not saying it was
> > bluntly copied, by a previous patch sent by tedu@ for another application).
> > After instructions() function is run then fish(6) only needs pledge "stdio".
> 
> On Nov 30 01:42:03, t...@openbsd.org wrote:
> > slightly interesting pledge for fish:
> > start with "stdio rpath proc exec" since it pipes instructions to a pager
> > afterwards "stdio" is enough
> 
> - just put the six lines of instructions into the manpage where they belong
> - remove fish.instr, remove instructions()
> - make the pledge a straightforward "stdio"
>  
> This is what we did with quiz(6) before,
> and what I'm gonna do next with wump(6) and every other game
> which forks a PAGER just to spit out a help message.
> http://marc.info/?l=openbsd-tech=144576581513053=2

Forgot to remove pathnames.h;
and forgot the diff itself, sorry.

Jan


Index: Makefile
===
RCS file: /cvs/src/games/fish/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- Makefile23 May 2002 18:43:00 -  1.5
+++ Makefile30 Nov 2015 13:24:21 -
@@ -3,8 +3,4 @@
 PROG=  fish
 MAN=   fish.6
 
-beforeinstall: 
-   ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
-   ${.CURDIR}/fish.instr ${DESTDIR}/usr/share/games/fish.instr
-
 .include 
Index: fish.6
===
RCS file: /cvs/src/games/fish/fish.6,v
retrieving revision 1.8
diff -u -p -r1.8 fish.6
--- fish.6  10 Sep 2015 15:16:43 -  1.8
+++ fish.6  30 Nov 2015 13:24:21 -
@@ -55,7 +55,8 @@ For example, collecting four 2's would g
 The options are as follows:
 .Bl -tag -width indent
 .It Fl p
-Professional mode.
+Professional mode;
+makes the computer's game much smarter.
 .El
 .Pp
 The computer makes a random decision as to who gets to start the
@@ -79,7 +80,34 @@ the rank is no longer in play.
 The game ends when one player no longer has any cards.
 The player with the most books wins.
 .Pp
-.Nm
-provides instructions as to what input it accepts.
-.Sh BUGS
-The computer cheats only rarely.
+The player's input can be a card value
+.Po
+.Sq A ,
+.Sq 2 ,
+.Sq 3 ,
+.Sq 4 ,
+.Sq 5 ,
+.Sq 6 ,
+.Sq 7 ,
+.Sq 8 ,
+.Sq 9 ,
+.Sq 10 ,
+.Sq J ,
+.Sq Q ,
+.Sq K ,
+.Pc
+or the letter
+.Sq p ,
+or
+.Dq quit .
+The letter
+.Sq p
+is an equivalent of specifying the
+.Fl p
+option, and the line
+.Dq quit
+stops the game.
+Just hitting the carriage return key displays
+how many cards I have in my hand,
+how many are left in the deck,
+and which books I've gotten.
Index: fish.c
===
RCS file: /cvs/src/games/fish/fish.c,v
retrieving revision 1.18
diff -u -p -r1.18 fish.c
--- fish.c  30 Nov 2015 08:42:03 -  1.18
+++ fish.c  30 Nov 2015 13:24:21 -
@@ -43,7 +43,6 @@
 #include 
 #include 
 #include 
-#include "pathnames.h"
 
 #defineRANKS   13
 #defineHANDSIZE7
@@ -74,7 +73,6 @@ int   getans(const char *);
 intgofish(int, int, int *);
 void   goodmove(int, int, int *, int *);
 void   init(void);
-void   instructions(void);
 intnrandom(int);
 void   printhand(const int *);
 void   printplayer(int);
@@ -87,7 +85,7 @@ main(int argc, char *argv[])
 {
int ch, move;
 
-   if (pledge("stdio rpath proc exec", NULL) == -1)
+   if (pledge("stdio", NULL) == -1)
err(1, "pledge");
 
while ((ch = getopt(argc, argv, "ph")) != -1)
@@ -101,11 +99,6 @@ main(int argc, char *argv[])
usage();
}
 
-   instructions();
-
-   if (pledge("stdio", NULL) == -1)
-   err(1, "pledge");
-
init();
 
if (nrandom(2) == 1) {
@@ -446,48 +439,6 @@ getans(const char *prompt)
 "I don't understand your answer; please enter 'y' or 'n'!\n");
}
/* NOTREACHED */
-}
-
-void
-instructions(void)
-{
-   const char *pager;
-   pid_t pid;
-   int status;
-   int input;
-   int fd;
-
-   if (getans("Would you like instructions (y or n)? ") == 0)
-   return;
-
-   if ((fd = open(_PATH_INSTR, O_RDONLY)) == -1)
-   (void)printf("No instruction file found!\n");
-   else {
-   switch (pid = fork()) {
-   case 0: /* child */
-   if (!isatty(1))
-   pager = "/bin/cat";
-   else {
-   if (!(pager = getenv("PAGER")) || (*pager == 0))
-   pager = _PATH_MORE;
-   }
-   if (dup2(fd, 0) == -1)

Only use emails in .Mt

2015-11-30 Thread Jan Stary
Index: hack.6
===
RCS file: /cvs/src/games/hack/hack.6,v
retrieving revision 1.18
diff -u -p -r1.18 hack.6
--- hack.6  13 Mar 2015 19:58:40 -  1.18
+++ hack.6  30 Nov 2015 14:14:15 -
@@ -211,7 +211,3 @@ wrote the original hack, very much like 
 .An Andries Brouwer
 continuously deformed their sources into the current
 version \(en in fact an entirely different game.
-.Sh BUGS
-Probably infinite.
-Mail complaints to
-.Mt mcvax!aeb .



Re: sndio.1 vs -L

2015-11-18 Thread Jan Stary
On Nov 18 01:30:08, ratc...@openbsd.org wrote:
>   usr.bin/sndiod : sndiod.1 
> say that network communication is not secure

"listen _on_" an address,
even if -L is disabled for now.

Jan

Index: sndiod.1
===
RCS file: /cvs/src/usr.bin/sndiod/sndiod.1,v
retrieving revision 1.7
diff -u -p -r1.7 sndiod.1
--- sndiod.118 Nov 2015 08:30:08 -  1.7
+++ sndiod.118 Nov 2015 11:15:00 -
@@ -213,7 +213,7 @@ The default is
 .It Fl L Ar addr
 Specify a local network address
 .Nm
-should listen;
+should listen on;
 .Nm
 will listen on TCP port 11025+n, where n is the unit number
 specified with



install(1) typo

2016-02-01 Thread Jan Stary
There seems to be a "be" missing in install(1).

The whole phrase seems odd to a non-native speaker like me:
those options "should not be relied upon" because they are not portable,
not "for portability". (But I might easily be wrong.)

Jan



--- install.1.orig  Mon Feb  1 13:57:31 2016
+++ install.1   Mon Feb  1 13:58:00 2016
@@ -215,7 +215,7 @@ The
 .Fl p ,
 and
 .Fl S
-flags are non-standard and should not relied upon for portability.
+flags are non-standard and should not be relied upon for portability.
 .Pp
 Temporary files may be left in the target directory if
 .Nm



/usr/X11/README typo

2016-02-18 Thread Jan Stary
THere seems to be a typo in macppc's /usr/X11/README

Jan


--- README.orig Thu Feb 18 11:14:56 2016
+++ README  Thu Feb 18 11:15:25 2016
@@ -12,7 +12,7 @@ hardware.  If your hardware is not properly autodetect
 or not supported as you wish, you will have to create a configuration
 file.
 
-The 'r128 and 'ati' drivers are currently known to work on the
+The 'r128' and 'ati' drivers are currently known to work on the
 machines with ATI Rage 128 or Radeon cards. The 'nv' driver works for
 machines with nVidia cards, although some modes may experience
 problems.



faq11 typo

2016-02-18 Thread Jan Stary
--- faq11.html.orig Thu Feb 18 11:11:41 2016
+++ faq11.html  Thu Feb 18 11:12:14 2016
@@ -97,7 +97,7 @@ Some X applications are very lean; others will seeming
 all the processor and RAM you can give them.
 Of course, some users just like to use X to provide a large number of
 http://www.openbsd.org/cgi-bin/man.cgi?query=xterm;>xterm(1)
-windowss, which can be done on very modest hardware.
+windows, which can be done on very modest hardware.
 
 11.1.2 - Can I have any kind of graphics without X?
 



xdm in afterboot

2017-03-01 Thread Jan Stary
The transition from xdm to xenodm is not reflected in afterboot(8).

Jan

Index: share/man/man8/afterboot.8
===
RCS file: /cvs/src/share/man/man8/afterboot.8,v
retrieving revision 1.157
diff -u -p -u -p -r1.157 afterboot.8
--- share/man/man8/afterboot.8  5 Sep 2016 12:58:17 -   1.157
+++ share/man/man8/afterboot.8  1 Mar 2017 14:04:38 -
@@ -420,10 +420,10 @@ and
 .Xr rc.shutdown 8 .
 .Pp
 If you've installed X, you may want to turn on
-.Xr xdm 1 ,
+.Xr xenodm 1 ,
 the X Display Manager.
 To do this, change the value of
-.Va xdm_flags
+.Va xenodm_flags
 in
 .Pa /etc/rc.conf.local .
 .Ss Set keyboard type



list all iwm(4) firmware files

2016-09-16 Thread Jan Stary
Index: iwm.4
===
RCS file: /cvs/src/share/man/man4/iwm.4,v
retrieving revision 1.18
diff -u -p -r1.18 iwm.4
--- iwm.4   28 May 2016 18:31:14 -  1.18
+++ iwm.4   16 Sep 2016 08:44:13 -
@@ -71,8 +71,12 @@ which are loaded when an interface is br
 .Pp
 .Bl -tag -width Ds -offset indent -compact
 .It Pa /etc/firmware/iwm-3160-16
+.It Pa /etc/firmware/iwm-3160-9
 .It Pa /etc/firmware/iwm-7260-16
+.It Pa /etc/firmware/iwm-7260-9
 .It Pa /etc/firmware/iwm-7265-16
+.It Pa /etc/firmware/iwm-7265-9
+.It Pa /etc/firmware/iwm-7265D-16
 .It Pa /etc/firmware/iwm-8000C-16
 .El
 .Pp



locale in sort(1)

2016-10-07 Thread Jan Stary
The sort(1) manpage mentions the LC_* environment variables
and how they affect sorting and efficiency, but we only
support LC_CTYPE, right? Would it be an omprovement
to remove these from the manpage?

Jan


Index: sort.1
===
RCS file: /cvs/src/usr.bin/sort/sort.1,v
retrieving revision 1.54
diff -u -p -r1.54 sort.1
--- sort.1  5 Apr 2015 14:20:22 -   1.54
+++ sort.1  7 Oct 2016 10:37:14 -
@@ -56,9 +56,8 @@ newline (default) or NUL \'\\0\' charact
 A record can contain any printable or unprintable characters.
 Comparisons are based on one or more sort keys extracted from
 each line of input, and are performed lexicographically,
-according to the current locale's collating rules and the
-specified command-line options that can tune the actual
-sorting behavior.
+according to the command-line options
+that can tune the actual sorting behavior.
 By default, if keys are not given,
 .Nm
 uses entire lines for comparison.
@@ -173,10 +172,6 @@ Unknown strings are considered smaller t
 .It Fl n , Fl Fl numeric-sort, Fl Fl sort=numeric
 An initial numeric string, consisting of optional blank space, optional
 minus sign, and zero or more digits (including decimal point)
-.\" with
-.\" optional radix character and thousands
-.\" separator
-.\" (as defined in the current locale),
 is sorted by arithmetic value.
 Leading blank characters are ignored.
 .It Fl R, Fl Fl random-sort, Fl Fl sort=random
@@ -494,43 +489,6 @@ which has no
 equivalent.
 .Sh ENVIRONMENT
 .Bl -tag -width Fl
-.It Ev GNUSORT_NUMERIC_COMPATIBILITY
-If defined
-.Fl t
-will not override the locale numeric symbols, that is, thousand
-separators and decimal separators.
-By default, if we specify
-.Fl t
-with the same symbol as the thousand separator or decimal point,
-the symbol will be treated as the field separator.
-Older behavior was less definite: the symbol was treated as both field
-separator and numeric separator, simultaneously.
-This environment variable enables the old behavior.
-.It Ev LANG
-Used as a last resort to determine different kinds of locale-specific
-behavior if neither the respective environment variable nor
-.Ev LC_ALL
-are set.
-.It Ev LC_ALL
-Locale settings that override all of the other locale settings.
-This environment variable can be used to set all these settings
-to the same value at once.
-.It Ev LC_COLLATE
-Locale settings to be used to determine the collation for
-sorting records.
-.It Ev LC_CTYPE
-Locale settings to be used to case conversion and classification
-of characters, that is, which characters are considered
-whitespaces, etc.
-.It Ev LC_MESSAGES
-Locale settings that determine the language of output messages
-that
-.Nm
-prints out.
-.It Ev LC_NUMERIC
-Locale settings that determine the number format used in numeric sort.
-.It Ev LC_TIME
-Locale settings that determine the month format used in month sort.
 .It Ev TMPDIR
 Path to the directory in which temporary files will be stored.
 Note that
@@ -624,13 +582,10 @@ This implementation of
 has no limits on input line length (other than imposed by available
 memory) or any restrictions on bytes allowed within lines.
 .Pp
-The performance depends highly on locale settings,
+The performance depends highly on
 efficient choice of sort keys and key complexity.
-The fastest sort is with the C locale, on whole lines, with option
+The fastest sort is on whole lines, with option
 .Fl s .
-In general, the C locale is the fastest, followed by single-byte
-locales with multi-byte locales being the slowest.
-The correct collation order respected in all cases.
 For the key specification, the simpler to process the
 lines the faster the search will be.
 .Pp



tweek rcctl.8 spacing

2016-10-10 Thread Jan Stary
The postscript output of 'man -Tps rcctl' makes the 'stopped'
list item of 'rcctl ls' break a line, while all the other items
are compact one-liners. The diff below changes the width,
which is the same for ascci, but "stopped" is slightly wider
than "started" in the postscript output.

Jan


Index: rcctl.8
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.8,v
retrieving revision 1.33
diff -u -p -r1.33 rcctl.8
--- rcctl.8 19 Jun 2016 10:54:20 -  1.33
+++ rcctl.8 10 Oct 2016 12:16:59 -
@@ -108,7 +108,7 @@ Display a list of services and daemons m
 .Ar lsarg ,
 which can be one of:
 .Pp
-.Bl -tag -width started -offset indent -compact
+.Bl -tag -width stopped -offset indent -compact
 .It Cm all
 all services and daemons
 .It Cm failed



Re: tweek rcctl.8 spacing

2016-10-10 Thread Jan Stary
> > The postscript output of 'man -Tps rcctl' makes the 'stopped'
> > list item of 'rcctl ls' break a line, while all the other items
> > are compact one-liners. The diff below changes the width,
> > which is the same for ascci, but "stopped" is slightly wider
> > than "started" in the postscript output.
> 
> In practice, we cannot expect manual writers - who are mortal
> developers and not typography gods - to pay attention to proportional
> font glyph widths and kerning.  Those who are - like Doug McIlroy
> or Brian Kernighan - would do the right thing instinctively anyway,
> but the others just shouldn't need to bother.

(Needless to say, this was no typograhical insight on my part,
I simply printed out the postscript for once instead of plain man.)



Ignored .Pp in ksh.1

2016-09-30 Thread Jan Stary
The diff below removes a .Pp before an .It
which mandoc complains about and ignores.

Jan


Index: ksh.1
===
RCS file: /cvs/src/bin/ksh/ksh.1,v
retrieving revision 1.181
diff -u -p -r1.181 ksh.1
--- ksh.1   27 Sep 2016 23:58:38 -  1.181
+++ ksh.1   30 Sep 2016 15:16:39 -
@@ -4717,7 +4717,6 @@ offer a selection of signal names for th
 .Xr kill 1 :
 .Pp
 .Dl set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM
-.Pp
 .It complete-command: ^X^[
 Automatically completes as much as is unique of the command name having the
 partial word up to the cursor as its prefix, as in the



let globals be global in unexpand(1)

2016-10-10 Thread Jan Stary
In unexpand.c, the -a indicator is
both a global int and a local char.

Jan


Index: unexpand.c
===
RCS file: /cvs/src/usr.bin/unexpand/unexpand.c,v
retrieving revision 1.12
diff -u -p -r1.12 unexpand.c
--- unexpand.c  11 Nov 2015 02:52:46 -  1.12
+++ unexpand.c  10 Oct 2016 18:53:18 -
@@ -42,7 +42,7 @@ char  genbuf[BUFSIZ];
 char   linebuf[BUFSIZ];
 intall;
 
-void tabify(char);
+void tabify();
 
 int
 main(int argc, char *argv[])
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
continue;
if (cp > linebuf)
cp[-1] = 0;
-   tabify(all);
+   tabify();
printf("%s", linebuf);
}
} while (argc > 0);
@@ -84,7 +84,7 @@ main(int argc, char *argv[])
 }
 
 void
-tabify(char c)
+tabify()
 {
char *cp, *dp;
int dcol;
@@ -127,7 +127,7 @@ tabify(char c)
}
ocol++;
}
-   if (*cp == 0 || c == 0) {
+   if (*cp == 0 || all == 0) {
strlcpy(dp, cp, len);
return;
}



rcctl ls - services and daemons

2016-10-10 Thread Jan Stary
The rcctl(8) manpage makes the distinction between 'daemons' and 'services',
and the description of some items in the output of 'rcctl ls'
mentions only 'daemons'. But they are both 'services and deamons'
in all cases (tested with e.g. postgresql running, stopped, or failed).

Jan

Index: rcctl.8
===
RCS file: /cvs/src/usr.sbin/rcctl/rcctl.8,v
retrieving revision 1.33
diff -u -p -r1.33 rcctl.8
--- rcctl.8 19 Jun 2016 10:54:20 -  1.33
+++ rcctl.8 10 Oct 2016 16:37:06 -
@@ -112,15 +112,15 @@ which can be one of:
 .It Cm all
 all services and daemons
 .It Cm failed
-enabled but stopped daemons
+enabled but stopped services and daemons
 .It Cm off
 disabled services and daemons
 .It Cm on
 enabled services and daemons
 .It Cm started
-running daemons
+running services and daemons
 .It Cm stopped
-stopped daemons
+stopped services and daemons
 .El
 .It Cm order Op Ar daemon ...
 Move the specified package daemons to the beginning of



newlines in unexpand(1)

2016-10-10 Thread Jan Stary
Why do we need to trim the newlines in unexpand(1)?
The result seems to be the same without it.

Jan


Index: unexpand.c
===
RCS file: /cvs/src/usr.bin/unexpand/unexpand.c,v
retrieving revision 1.12
diff -u -p -r1.12 unexpand.c
--- unexpand.c  11 Nov 2015 02:52:46 -  1.12
+++ unexpand.c  10 Oct 2016 17:58:40 -
@@ -72,10 +72,6 @@ main(int argc, char *argv[])
argc--, argv++;
}
while (fgets(genbuf, BUFSIZ, stdin) != NULL) {
-   for (cp = linebuf; *cp; cp++)
-   continue;
-   if (cp > linebuf)
-   cp[-1] = 0;
tabify(all);
printf("%s", linebuf);
}



Re: newlines in unexpand(1)

2016-10-10 Thread Jan Stary
On Oct 10 15:22:01, t...@tedunangst.com wrote:
> Jan Stary wrote:
> > Why do we need to trim the newlines in unexpand(1)?
> > The result seems to be the same without it.
> > 
> > Jan
> > 
> > 
> > Index: unexpand.c
> > ===
> > RCS file: /cvs/src/usr.bin/unexpand/unexpand.c,v
> > retrieving revision 1.12
> > diff -u -p -r1.12 unexpand.c
> > --- unexpand.c  11 Nov 2015 02:52:46 -  1.12
> > +++ unexpand.c  10 Oct 2016 17:58:40 -
> > @@ -72,10 +72,6 @@ main(int argc, char *argv[])
> > argc--, argv++;
> > }
> > while (fgets(genbuf, BUFSIZ, stdin) != NULL) {
> > -   for (cp = linebuf; *cp; cp++)
> > -   continue;
> > -   if (cp > linebuf)
> > -   cp[-1] = 0;
> 
> this really looks like a bug using the wrong variable. genbuf and linebuf are
> different arrays. 

In the current code, these four lines are pointless,
because the linebuf gets overwritten anyway in the subsequent tabify().

Changing this to genbuf indeed trims the newlines from the _input_
(as was maybe intended), but then they are also missing
in the output,  wrongly.

Removing those four lines seems to give the expected output,
as long as the input line length is < BUFSIZ (= 1024).
On a line consisting of 1026 spaces, ten spaces will be left
- but that's because the buffer does not see far enough.

Maybe that's why the (botched) erasing of the newline is there?
To catch the case when \n happens to be the BUFSIZE-th char,
thus catching one extra tab that would be missed otherwise?

Jan



Re: let globals be global in unexpand(1)

2016-10-10 Thread Jan Stary
On Oct 10 15:30:52, t...@tedunangst.com wrote:
> Jan Stary wrote:
> > In unexpand.c, the -a indicator is
> > both a global int and a local char.
> 
> I think this is backwards. We want fewer globals, not more.

OK, other way round.

Jan


Index: unexpand.c
===
RCS file: /cvs/src/usr.bin/unexpand/unexpand.c,v
retrieving revision 1.12
diff -u -p -r1.12 unexpand.c
--- unexpand.c  11 Nov 2015 02:52:46 -  1.12
+++ unexpand.c  10 Oct 2016 19:35:08 -
@@ -40,13 +40,13 @@
 
 char   genbuf[BUFSIZ];
 char   linebuf[BUFSIZ];
-intall;
 
 void tabify(char);
 
 int
 main(int argc, char *argv[])
 {
+   int all = 0;
char *cp;
 
if (pledge("stdio rpath", NULL) == -1) {
@@ -84,7 +84,7 @@ main(int argc, char *argv[])
 }
 
 void
-tabify(char c)
+tabify(int all)
 {
char *cp, *dp;
int dcol;
@@ -127,7 +127,7 @@ tabify(char c)
}
ocol++;
}
-   if (*cp == 0 || c == 0) {
+   if (*cp == 0 || all == 0) {
strlcpy(dp, cp, len);
return;
}



remove pathnames.h from mv(1)

2016-10-10 Thread Jan Stary
With the embedded cp.c and rm.c,
the pathnames of "/bin/cp" and "/bin/rm" are not needed.

Jan



remove unused flags from the cp.c inside mv(1)

2016-10-10 Thread Jan Stary
The embedded cpmain() will never have _any_ flags set,
as mv.c calls it as

argv[0] = from;
argv[1] = to;
argv[2] = NULL;
cpmain(2, argv);

There is probably more code that could be romoved
form the embedded cp.c, along the lines of tedu's recent
cleanup of the embedded rm.c

Jan


Index: cp.c
===
RCS file: /cvs/src/bin/mv/cp.c,v
retrieving revision 1.7
diff -u -p -r1.7 cp.c
--- cp.c27 Dec 2015 01:25:57 -  1.7
+++ cp.c10 Oct 2016 19:27:02 -
@@ -84,7 +84,6 @@ static int setfile(struct stat *, in
 extern char *__progname;
 
 static uid_t myuid;
-static int fflag, iflag;
 static mode_t myumask;
 
 enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
@@ -463,13 +462,6 @@ copy_file(FTSENT *entp, int dne)
fs = entp->fts_statp;
 
/*
-* In -f (force) mode, we always unlink the destination first
-* if it exists.  Note that -i and -f are mutually exclusive.
-*/
-   if (!dne && fflag)
-   (void)unlink(to.p_path);
-
-   /*
 * If the file exists and we're interactive, verify with the user.
 * If the file DNE, set the mode to be the from file, minus setuid
 * bits, modified by the umask; arguably wrong, but it makes copying
@@ -477,17 +469,7 @@ copy_file(FTSENT *entp, int dne)
 * other choice is 666 or'ed with the execute bits on the from file
 * modified by the umask.)
 */
-   if (!dne && !fflag) {
-   if (iflag) {
-   (void)fprintf(stderr, "overwrite %s? ", to.p_path);
-   checkch = ch = getchar();
-   while (ch != '\n' && ch != EOF)
-   ch = getchar();
-   if (checkch != 'y' && checkch != 'Y') {
-   (void)close(from_fd);
-   return (0);
-   }
-   }
+   if (!dne) {
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
} else
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,



Re: newlines in unexpand(1)

2016-11-05 Thread Jan Stary
ping

On Oct 10 22:02:20, h...@stare.cz wrote:
> On Oct 10 15:22:01, t...@tedunangst.com wrote:
> > Jan Stary wrote:
> > > Why do we need to trim the newlines in unexpand(1)?
> > > The result seems to be the same without it.
> > > 
> > >   Jan
> > > 
> > > 
> > > Index: unexpand.c
> > > ===
> > > RCS file: /cvs/src/usr.bin/unexpand/unexpand.c,v
> > > retrieving revision 1.12
> > > diff -u -p -r1.12 unexpand.c
> > > --- unexpand.c11 Nov 2015 02:52:46 -  1.12
> > > +++ unexpand.c10 Oct 2016 17:58:40 -
> > > @@ -72,10 +72,6 @@ main(int argc, char *argv[])
> > >   argc--, argv++;
> > >   }
> > >   while (fgets(genbuf, BUFSIZ, stdin) != NULL) {
> > > - for (cp = linebuf; *cp; cp++)
> > > - continue;
> > > - if (cp > linebuf)
> > > - cp[-1] = 0;
> > 
> > this really looks like a bug using the wrong variable. genbuf and linebuf 
> > are
> > different arrays. 
> 
> In the current code, these four lines are pointless,
> because the linebuf gets overwritten anyway in the subsequent tabify().
> 
> Changing this to genbuf indeed trims the newlines from the _input_
> (as was maybe intended), but then they are also missing
> in the output,  wrongly.
> 
> Removing those four lines seems to give the expected output,
> as long as the input line length is < BUFSIZ (= 1024).
> On a line consisting of 1026 spaces, ten spaces will be left
> - but that's because the buffer does not see far enough.
> 
> Maybe that's why the (botched) erasing of the newline is there?
> To catch the case when \n happens to be the BUFSIZE-th char,
> thus catching one extra tab that would be missed otherwise?
> 
>   Jan
> 



zic(8) does not need locale.h

2016-11-05 Thread Jan Stary
Index: zic.c
===
RCS file: /cvs/src/usr.sbin/zic/zic.c,v
retrieving revision 1.22
diff -u -p -r1.22 zic.c
--- zic.c   15 Mar 2016 19:50:47 -  1.22
+++ zic.c   5 Nov 2016 13:07:52 -
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



does cron/crontab need locale?

2016-11-05 Thread Jan Stary
Index: cron.c
===
RCS file: /cvs/src/usr.sbin/cron/cron.c,v
retrieving revision 1.74
diff -u -p -r1.74 cron.c
--- cron.c  11 Jan 2016 14:23:50 -  1.74
+++ cron.c  5 Nov 2016 13:12:49 -
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -68,7 +67,7 @@ staticdouble  batch_maxload = BATCH_MA
 static int NoFork;
 static time_t  StartTime;
 
-static void
+static void __dead
 usage(void)
 {
 
@@ -81,8 +80,6 @@ main(int argc, char *argv[])
 {
struct sigaction sact;
sigset_t blocked, omask;
-
-   setlocale(LC_ALL, "");
 
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stderr, NULL, _IOLBF, 0);
Index: crontab.c
===
RCS file: /cvs/src/usr.sbin/cron/crontab.c,v
retrieving revision 1.92
diff -u -p -r1.92 crontab.c
--- crontab.c   11 Jan 2016 14:23:50 -  1.92
+++ crontab.c   5 Nov 2016 13:12:49 -
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -92,7 +91,6 @@ main(int argc, char *argv[])
user_gid = getgid();
crontab_gid = getegid();
 
-   setlocale(LC_ALL, "");
openlog(__progname, LOG_PID, LOG_CRON);
 
setvbuf(stderr, NULL, _IOLBF, 0);



remove useless extern declaration

2016-10-19 Thread Jan Stary
extern char *optarg is already declared in unistd.h
This is the only occurence in src/sbin and src/bin;
others will follow in separate mails.

Jan


Index: bioctl.c
===
RCS file: /cvs/src/sbin/bioctl/bioctl.c,v
retrieving revision 1.139
diff -u -p -r1.139 bioctl.c
--- bioctl.c21 Sep 2016 17:50:05 -  1.139
+++ bioctl.c19 Oct 2016 21:43:43 -
@@ -59,7 +59,7 @@ struct timing {
int start;
 };
 
-void   usage(void);
+static void __dead usage(void);
 const char *str2locator(const char *, struct locator *);
 const char *str2patrol(const char *, struct timing *);
 void   bio_status(struct bio_status *);
@@ -100,7 +100,6 @@ int
 main(int argc, char *argv[])
 {
struct bio_locate   bl;
-   extern char *optarg;
u_int64_t   func = 0;
char*devicename = NULL;
char*realname = NULL, *al_arg = NULL;
@@ -273,7 +272,7 @@ main(int argc, char *argv[])
return (0);
 }
 
-void
+static void __dead
 usage(void)
 {
extern char *__progname;



Re: iwm: rts for long frames only

2016-10-19 Thread Jan Stary
On Oct 06 17:56:50, s...@stsp.name wrote:
> Stop using RTS for every data frame sent by iwm(4).
> RTS adds unneccessary overhead if small data frames are sent.
> 
> The USE_RTS flag in iwm's LQ command enables RTS unconditionally, so only
> set it while the AP is enforcing protection. The flag will be kept up-to-date
> as a side effect of iwm_setrates(), which is called when the Tx rate changes.
> 
> RTS is still used for long frames since the Tx command takes care of that.
> (iwm firmware exposes 3 different flags which enable RTS... don't ask.)
> 
> ok?
> 
> Index: if_iwm.c
> ===
> RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
> retrieving revision 1.143
> diff -u -p -r1.143 if_iwm.c
> --- if_iwm.c  5 Oct 2016 18:13:25 -   1.143
> +++ if_iwm.c  6 Oct 2016 13:52:08 -
> @@ -5286,7 +5286,9 @@ iwm_setrates(struct iwm_node *in)
>  
>   memset(lq, 0, sizeof(*lq));
>   lq->sta_id = IWM_STATION_ID;
> - lq->flags = IWM_LQ_FLAG_USE_RTS_MSK;
> +
> + if (ic->ic_flags & IEEE80211_F_USEPROT)
> + lq->flags |= IWM_LQ_FLAG_USE_RTS_MSK;
>  
>   sgi_ok = ((ni->ni_flags & IEEE80211_NODE_HT) &&
>   (ni->ni_htcaps & IEEE80211_HTCAP_SGI20));
> 

Since I have applied this patch (dmesg below),
I haven't seen the errors I was seeing before
(don't know if it's related).

Oct 11 16:26:56 dell /bsd: iwm0: fatal firmware error
Oct 11 16:26:56 dell /bsd: iwm0: device timeout
Oct 11 16:26:56 dell /bsd: iwm0: device timeout
Oct 11 16:26:57 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 16:34:03 dell /bsd: iwm0: fatal firmware error
Oct 11 16:34:03 dell /bsd: iwm0: device timeout
Oct 11 16:34:03 dell /bsd: iwm0: device timeout
Oct 11 16:34:04 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 16:37:34 dell /bsd: iwm0: fatal firmware error
Oct 11 16:37:34 dell /bsd: iwm0: device timeout
Oct 11 16:37:34 dell /bsd: iwm0: device timeout
Oct 11 16:37:35 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:04:28 dell /bsd: iwm0: fatal firmware error
Oct 11 17:04:28 dell /bsd: iwm0: device timeout
Oct 11 17:04:28 dell /bsd: iwm0: device timeout
Oct 11 17:04:29 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:08:37 dell /bsd: iwm0: fatal firmware error
Oct 11 17:08:37 dell /bsd: iwm0: device timeout
Oct 11 17:08:37 dell /bsd: iwm0: device timeout
Oct 11 17:08:38 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:27:47 dell /bsd: iwm0: fatal firmware error
Oct 11 17:27:47 dell /bsd: iwm0: device timeout
Oct 11 17:27:47 dell /bsd: iwm0: device timeout
Oct 11 17:27:48 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:31:20 dell /bsd: iwm0: fatal firmware error
Oct 11 17:31:20 dell /bsd: iwm0: device timeout
Oct 11 17:31:20 dell /bsd: iwm0: device timeout
Oct 11 17:31:21 dell /bsd: iwm0: could not add MAC context (error 35)


Jan



OpenBSD 6.0-current (GENERIC.MP) #6: Fri Oct 14 10:39:16 CEST 2016
h...@dell.stare.cz:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 16810340352 (16031MB)
avail mem = 16296337408 (15541MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xeac10 (107 entries)
bios0: vendor Dell Inc. version "1.5.0" date 04/22/2016
bios0: Dell Inc. Latitude E5570
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT FIDT MCFG HPET SSDT LPIT SSDT SSDT SSDT DBGP 
DBG2 SSDT UEFI SSDT SSDT SLIC ASF!
acpi0: wakeup devices PEGP(S4) PEG0(S4) PEGP(S4) PEG1(S4) PEGP(S4) PEG2(S4) 
PXSX(S4) RP09(S4) PXSX(S4) RP10(S4) PXSX(S4) RP11(S4) PXSX(S4) RP12(S4) 
PXSX(S4) RP13(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-6440HQ CPU @ 2.60GHz, 2295.51 MHz
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,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,3DNOWP,PERF,ITSC,FSGSBASE,SGX,BMI1,HLE,AVX2,SMEP,BMI2,ERMS,INVPCID,RTM,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PT,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 23MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-6440HQ CPU @ 2.60GHz, 2294.64 MHz
cpu1: 

Re: drop unused locale junk from sort(1)

2016-10-19 Thread Jan Stary
ping

On Oct 11 15:37:03, schwa...@usta.de wrote:
> Jan Stary wrote on Tue, Oct 11, 2016 at 11:26:50AM +0200:
> 
> > Feeling encouraged by Ingo's ok to remove locale from cp/rm,
> > here's a diff that removes the locale stuff we don't actually do
> > from the code and documentation of sort(1). Leave just LC_CTYPE
> 
> You removed that too, but that's OK because the code doesn't
> currently use it.  Right now, even though some wide character
> code is there, it always operates in narrow mode.
> 
> > which determines isblank() and case conversions.
> 
> LC_CTYPE does NOT affect isblank(), all the wide-character-related
> functions are in dead code as far as i can see, and OpenBSD does
> not support wide character case conversions.
> 
> 
> Your diff is related to more than one thing:
> 
>  1. Kill LC_NUMERIC support.
> I very strongly agree with that.
> I think we should never support that anywhere.
> It is an absolutely terrible idea no matter how you look at it.
> Your removal was incomplete, though.
> In the patch below, i delete some additional bits
> that you left behind.
> 
>  2. Remove LC_COLLATE support for now.
> I also agree with that, even if not quite as strongly.
> In the distant future, we might or might not want LC_COLLATE support.
> In Belgrade, i talked to Baptiste Daroussin who just implemented
> LC_COLLATE in FreeBSD libc and who was utterly scared by the complexity.
> Knowing ourselves, we will be scared even more once we get there.
> So it will definitely not happen quickly.
> 
> If it ever does, the trivial bits that are present right now
> are so tiny that they won't help at all.  It might even be
> easier to have clean earth to till when starting.
> Who knows at this point.
> 
> In any case, deleting the incomplete pieces scattered around
> the current code makes maintenance easier until that time,
> which seems worthwhile.
> 
>  3. With step 2 above, some flags become explicitly const
> that appear to be variable now (but actually aren't).
> That would allow deleting large amounts of dead code,
> but i didn't add that to the patch below.
> 
> The grep multibyte code is absolutely horrible, with insanity
> up to and including unions of char and wchar_t coming with
> hosts of trivial non-standard wrapper functions and tons
> of duplicate, in some case triplicate code.  Another
> example:  Even though the code half-heartedly attempts to
> isolate multibyte stuff in bwstring.{c,h} - superficially
> reminding of our utf8.c technique, but half-hearted because
> the respective functions are numerous and called all over the
> place, such that isolation is effectively a failure -
> the main program (!) at one place abuses btowc(3) (!)
> on an ASCII (!) command line argument and stores the result
> as wchar_t in the top level global state structure (!) -
> that is obviously functionally completely futile, but very
> effective for polluting *all* of the code with complicated
> data types and headers.
> 
> But cleaning up all the parts of item 3 would be way too intrusive
> for this patch, so it leaves behind hundreds of lines of code
> that is already both dead and duplicate right now.
> 
> > Annotate a missed -z flag while there,
> 
> Committed.
> 
> > and change /var/tmp to /tmp.
> 
> No, according to file.c, the program still writes to /var/tmp,
> not to /tmp.  Before changing that in the manual, we would have
> to change it in the code.
> 
> 
> The following version of the patch survives our test suite,
> but it no doubt needs more testing.
> 
> Yours,
>   Ingo
> 
> 
> Index: bwstring.c
> ===
> RCS file: /cvs/src/usr.bin/sort/bwstring.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 bwstring.c
> --- bwstring.c1 Apr 2015 22:38:08 -   1.7
> +++ bwstring.c11 Oct 2016 13:20:59 -
> @@ -40,8 +40,8 @@
>  #include "bwstring.h"
>  #include "sort.h"
>  
> -bool byte_sort;
> -size_t sort_mb_cur_max = 1;
> +static const bool byte_sort = true;
> +const size_t sort_mb_cur_max = 1;
>  
>  static wchar_t **wmonths;
>  static char **cmonths;
> Index: bwstring.h
> ===
> RCS file: /cvs/src/usr.bin/sort/bwstring.h,v
> retrieving revision 1.2
> diff -u -p -r1.2 bwstring.h
> --- bwstring.h31 Dec 2015 16:09:31 -  1.2
> +++ bwstring.h11 Oct 2016 13:20:59 -
> @@ -37,8 +37,7 @@
>  
>  #include "

Re: let head(1) understand `-' as stdin

2016-10-12 Thread Jan Stary
> > > The diff below makes head(1) recognize `-'
> > > as a name for the standard input,
> > > as many other utilities do.

On Oct 11 23:55:26, schwa...@usta.de wrote:
> > Do standards permit that extension?
> 
> POSIX neither requires nor forbids it, but encourages consistency
> among all the utilities taking [file ...] arguments within a given
> operating system:
> 
>   http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html

> > This is command used in scripts.  Scripts are often portable.  If one
> > operating system has an extension, but others don't, then those
> > scripts become unportable to use use of these extensions.

[Ingo's detailed analysis snipped]

> > I'm not raising a new argument here, it's been raised numerous times
> > when it comes to commands commonly used in scripts.
> > 
> > So consider that first.
> 
> head(1) is firmly a BSD thingy, and all BSDs agree that "-" is a
> file name and not standard input.  POSIX explicitly encourages
> treating it as standard input ***if you do that for other utilities,
> too***, and GNU coreutils has the only head(1) implementation i
> found so far that actually does it.
> 
> The bigger picture seems to be that OpenBSD and illumos tend to resist
> treating "-" as standard input whereever resisting is allowed,
> while GNU embraces treating "-" as standard whereever allowed.
> Most other systems seem to be somewhat inconsistent, in particular
> in those cases where they imported GNU utilities.
> 
> So much for the facts.
> 
> 
> I see two ways forward that make sense to me:
> 
>  a) Either remain conservative - in line with both BSD and SysV
> heritage - and not do it unless required by the standard.
> 
>  b) Or switch over to doing it whereever allowed - but then we
> should do it not just for head(1), but also for tail(1),
> grep(1), sed(1) and probably several others, and then we
> should probably also try to push such patches to FreeBSD,
> DragonFly, NetBSD, and illumos, or at least give them heads-ups.
> 
> Changing only head(1) and leaving everything else as it is does not
> look like a complete plan to me.  Even POSIX wouldn't encourage that.

Thank you for the detailed analysis.

If there is any interest in possibly going b)
see below for a look at the other text filters.


Let me clarify the idea. 
If a filter recognizes '-' as a name for stdin,
then stdin can be one of the _multiple_ files being processed.
Filters that do not recognize '-' as a name, on the other hand,
only process stdin if it is the _only_ input.

For example cat(1) and paste(1) do that, head(1) and tail(1) don't.
And there are other utilities that could do that, but don't.
Below is a list of text filters from bin/ and usr.bin/
for which this seems relevant, separated into the two camps.

Jan


These recognize '-' as a name for stdin
as one of possibly many inputs:

cat
cmp
comm
cut
diff
file
join
lam
paste
pr
sdiff
sort


These process stdin only if it is
the only (unnamed) input:

column  
expand
fmt
fold
grep
head
hexdump
nl
rev
tail
ul
unexpand
unvis
vis
wc



Re: rm.c functions in mv(1)

2016-10-10 Thread Jan Stary
On Oct 10 12:25:39, h...@stare.cz wrote:
> bin/mv has its own copies of cp.c and mv.c.
> Apparently, they are modifications of cp's cp.c and rm's rm.c,
> used when moving as "copy and remove the source".
> 
> In bin/mv/rm.c, the following snippet of rm_file() confuses me:
> 
>   if (S_ISDIR(sb.st_mode)) {
>   warnx("%s: is a directory", f);
>   eval = 1;
>   continue;
>   }
>   if (S_ISDIR(sb.st_mode))
>   rval = rmdir(f);
>   else {
>   rval = unlink(f);
>   }
> 
> If it's a directory, give up.
> And if it's a directory, rmdir();
> 
> Is this intentional? In fact, rm_file() and check()
> are not used anywhere else in bin/mv code.

I mean "not used anywhere", not "not used anywhere else".
Sorry for the bad phrasing.

> Is it there to keep the diff to bin/rm smaller?
> 
>   Jan
> 
> 
> Index: rm.c
> ===
> RCS file: /cvs/src/bin/mv/rm.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 rm.c
> --- rm.c  27 Nov 2015 17:32:16 -  1.7
> +++ rm.c  10 Oct 2016 10:21:01 -
> @@ -52,9 +52,7 @@ extern char *__progname;
>  
>  static int eval, stdin_ok;
>  
> -static int   check(char *, char *, struct stat *);
>  static void  checkdot(char **);
> -static void  rm_file(char **);
>  static void  rm_tree(char **);
>  
>  static void __dead
> @@ -79,7 +77,6 @@ rmmain(int argc, char *argv[])
>  
>   if (*argv) {
>   stdin_ok = isatty(STDIN_FILENO);
> -
>   rm_tree(argv);
>   }
>  
> @@ -158,72 +155,6 @@ rm_tree(char **argv)
>   if (errno)
>   err(1, "fts_read");
>   fts_close(fts);
> -}
> -
> -static void
> -rm_file(char **argv)
> -{
> - struct stat sb;
> - int rval;
> - char *f;
> -
> - /*
> -  * Remove a file.  POSIX 1003.2 states that, by default, attempting
> -  * to remove a directory is an error, so must always stat the file.
> -  */
> - while ((f = *argv++) != NULL) {
> - /* Assume if can't stat the file, can't unlink it. */
> - if (lstat(f, )) {
> - if (errno != ENOENT) {
> - warn("%s", f);
> - eval = 1;
> - }
> - continue;
> - }
> -
> - if (S_ISDIR(sb.st_mode)) {
> - warnx("%s: is a directory", f);
> - eval = 1;
> - continue;
> - }
> - if (S_ISDIR(sb.st_mode))
> - rval = rmdir(f);
> - else {
> - rval = unlink(f);
> - }
> - if (rval && (errno != ENOENT)) {
> - warn("%s", f);
> - eval = 1;
> - }
> - }
> -}
> -
> -static int
> -check(char *path, char *name, struct stat *sp)
> -{
> - int ch, first;
> - char modep[15];
> -
> - /*
> -  * If it's not a symbolic link and it's unwritable and we're
> -  * talking to a terminal, ask.  Symbolic links are excluded
> -  * because their permissions are meaningless.  Check stdin_ok
> -  * first because we may not have stat'ed the file.
> -  */
> - if (!stdin_ok || S_ISLNK(sp->st_mode) || !access(name, W_OK) ||
> - errno != EACCES)
> - return (1);
> - strmode(sp->st_mode, modep);
> - (void)fprintf(stderr, "override %s%s%s/%s for %s? ",
> - modep + 1, modep[9] == ' ' ? "" : " ",
> - user_from_uid(sp->st_uid, 0),
> - group_from_gid(sp->st_gid, 0), path);
> - (void)fflush(stderr);
> -
> - first = ch = getchar();
> - while (ch != '\n' && ch != EOF)
> - ch = getchar();
> - return (first == 'y' || first == 'Y');
>  }
>  
>  /*
> 



Re: let head(1) understand `-' as stdin

2016-10-12 Thread Jan Stary
On Oct 12 23:23:18, t...@math.ethz.ch wrote:
> > Let me clarify the idea. 
> > If a filter recognizes '-' as a name for stdin,
> > then stdin can be one of the _multiple_ files being processed.
> > Filters that do not recognize '-' as a name, on the other hand,
> > only process stdin if it is the _only_ input.
> 
> I understand that - is convenient, but it's not strictly needed.
> If you need the standard input as one of several files (or as an
> explicit file argument), you can pass /dev/stdin.

This is probably what I was missing.
Thank you. Sorry for the noise.



Re: remove unused flags from the cp.c inside mv(1)

2016-10-14 Thread Jan Stary
ping

On Oct 10 21:39:16, h...@stare.cz wrote:
> The embedded cpmain() will never have _any_ flags set,
> as mv.c calls it as
> 
>   argv[0] = from;
>   argv[1] = to;
>   argv[2] = NULL;
>   cpmain(2, argv);
> 
> There is probably more code that could be romoved
> form the embedded cp.c, along the lines of tedu's recent
> cleanup of the embedded rm.c
> 
>   Jan
> 
> 
> Index: cp.c
> ===
> RCS file: /cvs/src/bin/mv/cp.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 cp.c
> --- cp.c  27 Dec 2015 01:25:57 -  1.7
> +++ cp.c  10 Oct 2016 19:27:02 -
> @@ -84,7 +84,6 @@ static int setfile(struct stat *, in
>  extern char *__progname;
>  
>  static uid_t myuid;
> -static int fflag, iflag;
>  static mode_t myumask;
>  
>  enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
> @@ -463,13 +462,6 @@ copy_file(FTSENT *entp, int dne)
>   fs = entp->fts_statp;
>  
>   /*
> -  * In -f (force) mode, we always unlink the destination first
> -  * if it exists.  Note that -i and -f are mutually exclusive.
> -  */
> - if (!dne && fflag)
> - (void)unlink(to.p_path);
> -
> - /*
>* If the file exists and we're interactive, verify with the user.
>* If the file DNE, set the mode to be the from file, minus setuid
>* bits, modified by the umask; arguably wrong, but it makes copying
> @@ -477,17 +469,7 @@ copy_file(FTSENT *entp, int dne)
>* other choice is 666 or'ed with the execute bits on the from file
>* modified by the umask.)
>*/
> - if (!dne && !fflag) {
> - if (iflag) {
> - (void)fprintf(stderr, "overwrite %s? ", to.p_path);
> - checkch = ch = getchar();
> - while (ch != '\n' && ch != EOF)
> - ch = getchar();
> - if (checkch != 'y' && checkch != 'Y') {
> - (void)close(from_fd);
> - return (0);
> - }
> - }
> + if (!dne) {
>   to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
>   } else
>   to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
> 



remove KOI8 after 5.9 is out

2016-10-14 Thread Jan Stary
Index: io.c
===
RCS file: /cvs/src/usr.bin/calendar/io.c,v
retrieving revision 1.44
diff -u -p -r1.44 io.c
--- io.c31 Aug 2016 09:38:47 -  1.44
+++ io.c14 Oct 2016 07:27:52 -
@@ -89,13 +89,9 @@ cal(void)
if (strncmp(buf, "LANG=", 5) == 0) {
(void) setlocale(LC_ALL, buf + 5);
setnnames();
-   /* XXX remove KOI8 lines after 5.9 is out */
if (!strcmp(buf + 5, "ru_RU.UTF-8") ||
!strcmp(buf + 5, "uk_UA.UTF-8") ||
-   !strcmp(buf + 5, "by_BY.UTF-8") ||
-   !strcmp(buf + 5, "ru_RU.KOI8-R") ||
-   !strcmp(buf + 5, "uk_UA.KOI8-U") ||
-   !strcmp(buf + 5, "by_BY.KOI8-B")) {
+   !strcmp(buf + 5, "by_BY.UTF-8")) {
bodun_maybe++;
bodun = 0;
free(prefix);



Re: usb disk dirty after every reboot

2016-10-19 Thread Jan Stary
On Oct 16 10:14:14, s...@sfritsch.de wrote:
> [moving to tech@]
> 
> On Tuesday, 20 September 2016 08:03:32 CEST Stefan Fritsch wrote:
> > On Tue, 20 Sep 2016, Darren Tucker wrote:
> > > On Tue, Sep 20, 2016 at 1:43 AM, Jan Stary <h...@stare.cz> wrote:
> > > > This is current/i386 on an ALIX.1E (demsg below).
> > > > I have an USB disk connected for /backup.
> > > > 
> > > > Upon every reboot, the filesystem on that disk is dirty:
> > > > WARNING: R/W mount of /backup denied.  Filesystem is not clean - run
> > > > fsck

Since then, I have used three different disks and USB enclosures,
each working flawlessly anywhere else. The problem is still there,
so it's most probably not the disk.

> > > I saw something similar on an APU where the root disk was on
> > > (USB-attached) sdcard:
> > > http://marc.info/?l=openbsd-misc=144237305322074=2
> > > 
> > > It seems to be a race.  There used to be a 4sec pause in the kernel
> > > that was removed:
> > > 
> > > """
> > > Remove 4 second delay on reboot/shutdown that was added 8 years
> > > ago to "workaround MP timeout/splhigh/scsi race at reboot time".
> > > """

> > I think before we re-add some arbitrary delays, we should check if we are
> > actually sending an explicit cache flush command to the disk controllers.
> > I have some code somewhere that does this for umount and mount -ur. I will
> > look for it and send it to tech@, but probably not today.

For now, I just put 'umount /backup' in my rc.shutdown
and that makes it umount cleanly.

> I found a few cases, where we should send a cache flush but don't. 
> Unfortunately, none of these cases explain the problem seen by Jan and Darren.
> 
> The cases I have found are:
> 
> * When a R/W mount is updated to R/O. I will send patches for this in a 
> separate mail.

Not this case.

> * When a R/W mount is unmounted but there is still another partition from the 
> same disk mounted.

Not this case.

> For the usb disk issue, some more debugging is necessary.

How can I help debug this?

Jan


Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x), AMD(0x1022), 
rev 1.00
 port 1 powered
 port 2 powered
 port 3 addr 2: high speed, self powered, config 1, Mass Storage 
Device(0x2506), Prolific Technology Inc.(0x067b), rev 1.00, iSerialNumber 

 port 4 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, OHCI root hub(0x), AMD(0x1022), 
rev 1.00
 port 1 powered
 port 2 powered
 port 3 powered
 port 4 powered



Re: drop unused locale junk from sort(1)

2016-10-11 Thread Jan Stary
On Oct 11 15:37:03, schwa...@usta.de wrote:
> > and change /var/tmp to /tmp.
> 
> No, according to file.c, the program still writes to /var/tmp,
> not to /tmp.  Before changing that in the manual, we would have
> to change it in the code.

I sent that in a separate email;
this is a leftover, sorry.

Jan



let head(1) understand `-' as stdin

2016-10-11 Thread Jan Stary
The diff below makes head(1) recognize `-'
as a name for the standard input,
as many other utilities do.

Jan

Index: head.1
===
RCS file: /cvs/src/usr.bin/head/head.1,v
retrieving revision 1.23
diff -u -p -r1.23 head.1
--- head.1  25 Oct 2015 21:50:32 -  1.23
+++ head.1  11 Oct 2016 13:33:23 -
@@ -47,6 +47,9 @@ utility copies the first
 lines of each specified
 .Ar file
 to the standard output.
+A name of
+.Sq -
+is recognized as standard input.
 If no files are named,
 .Nm
 copies lines from the standard input.
@@ -77,6 +80,16 @@ To display the first 500 lines of the fi
 .Ar foo :
 .Pp
 .Dl $ head -n 500 foo
+.Pp
+To display the first line of
+.Ar foo ,
+the standard input,
+.Ar bar
+and
+.Ar foo
+again:
+.Pp
+.Dl $ head -n 1 foo - bar foo
 .Pp
 .Nm
 can be used in conjunction with
Index: head.c
===
RCS file: /cvs/src/usr.bin/head/head.c,v
retrieving revision 1.21
diff -u -p -r1.21 head.c
--- head.c  20 Mar 2016 17:14:51 -  1.21
+++ head.c  11 Oct 2016 13:33:23 -
@@ -93,7 +93,9 @@ main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
} else {
-   if ((fp = fopen(*argv, "r")) == NULL) {
+   fp = (argv[0][0] == '-' && argv[0][1] == 0)
+   ? stdin : fopen(*argv, "r");
+   if (fp == NULL) {
warn("%s", *argv++);
status = 1;
continue;
@@ -101,7 +103,9 @@ main(int argc, char *argv[])
if (argc > 1) {
if (!firsttime)
putchar('\n');
-   printf("==> %s <==\n", *argv);
+   printf("==> %s <==\n",
+   (argv[0][0] == '-' && argv[0][1] == 0)
+   ? "(stdin)" : *argv);
}
++argv;
}



Re: let head(1) understand `-' as stdin

2016-10-11 Thread Jan Stary
On Oct 11 21:27:54, j...@wxcvbn.org wrote:
> Jan Stary <h...@stare.cz> writes:
> 
> > The diff below makes head(1) recognize `-'
> > as a name for the standard input,
> > as many other utilities do.
> 
> Makes sense to me.  The following points could be improved IMO:

Updated diff below.

> - using strcmp sounds cleaner than those char comparisons

OK

> - I don't think the man page bits are needed.  Utilities that read from
>   stdin are supposed to support `-'.  I'm not sure whether the extra
>   example is really helpful.

I have removed the example.
I think the one sentence about "-" should stay;
other utils which recognize "-" mention it.

> - should we avoid closing stdin (multiple times)?

fixed


OK?


Jan


Index: head.1
===
RCS file: /cvs/src/usr.bin/head/head.1,v
retrieving revision 1.23
diff -u -p -r1.23 head.1
--- head.1  25 Oct 2015 21:50:32 -  1.23
+++ head.1  11 Oct 2016 21:05:07 -
@@ -47,6 +47,9 @@ utility copies the first
 lines of each specified
 .Ar file
 to the standard output.
+A name of
+.Sq -
+is recognized as standard input.
 If no files are named,
 .Nm
 copies lines from the standard input.
Index: head.c
===
RCS file: /cvs/src/usr.bin/head/head.c,v
retrieving revision 1.21
diff -u -p -r1.21 head.c
--- head.c  20 Mar 2016 17:14:51 -  1.21
+++ head.c  11 Oct 2016 21:05:07 -
@@ -30,6 +30,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -93,7 +94,8 @@ main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
} else {
-   if ((fp = fopen(*argv, "r")) == NULL) {
+   fp = strcmp(*argv, "-") ? fopen(*argv, "r") : stdin;
+   if (fp == NULL) {
warn("%s", *argv++);
status = 1;
continue;
@@ -101,7 +103,8 @@ main(int argc, char *argv[])
if (argc > 1) {
if (!firsttime)
putchar('\n');
-   printf("==> %s <==\n", *argv);
+   printf("==> %s <==\n",
+   fp == stdin ? "(stdin)" : *argv);
}
++argv;
}
@@ -109,7 +112,8 @@ main(int argc, char *argv[])
while ((ch = getc(fp)) != EOF)
if (putchar(ch) == '\n')
break;
-   fclose(fp);
+   if (fp != stdin)
+   fclose(fp);
}
/*NOTREACHED*/
 }



Re: let head(1) understand `-' as stdin

2016-10-11 Thread Jan Stary
On Oct 11 13:35:34, dera...@openbsd.org wrote:
> This is command used in scripts.  Scripts are often portable.  If one
> operating system has an extension, but others don't, then those
> scripts become unportable to use use of these extensions.

GNU head(1) has it, Solaris does not.
(I don't have access to others right now.)



Re: hide iwn firmware error log

2016-10-11 Thread Jan Stary
On Oct 06 12:46:21, s...@stsp.name wrote:
> Disable the detailed fatal firmware error log in iwn(4) by default.

These are my iwm errors of today
on a Dell Latitude E5570.

Oct 11 16:26:56 dell /bsd: iwm0: fatal firmware error
Oct 11 16:26:56 dell /bsd: iwm0: device timeout
Oct 11 16:26:56 dell /bsd: iwm0: device timeout
Oct 11 16:26:57 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 16:34:03 dell /bsd: iwm0: fatal firmware error
Oct 11 16:34:03 dell /bsd: iwm0: device timeout
Oct 11 16:34:03 dell /bsd: iwm0: device timeout
Oct 11 16:34:04 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 16:37:34 dell /bsd: iwm0: fatal firmware error
Oct 11 16:37:34 dell /bsd: iwm0: device timeout
Oct 11 16:37:34 dell /bsd: iwm0: device timeout
Oct 11 16:37:35 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:04:28 dell /bsd: iwm0: fatal firmware error
Oct 11 17:04:28 dell /bsd: iwm0: device timeout
Oct 11 17:04:28 dell /bsd: iwm0: device timeout
Oct 11 17:04:29 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:08:37 dell /bsd: iwm0: fatal firmware error
Oct 11 17:08:37 dell /bsd: iwm0: device timeout
Oct 11 17:08:37 dell /bsd: iwm0: device timeout
Oct 11 17:08:38 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:27:47 dell /bsd: iwm0: fatal firmware error
Oct 11 17:27:47 dell /bsd: iwm0: device timeout
Oct 11 17:27:47 dell /bsd: iwm0: device timeout
Oct 11 17:27:48 dell /bsd: iwm0: could not add MAC context (error 35)
Oct 11 17:31:20 dell /bsd: iwm0: fatal firmware error
Oct 11 17:31:20 dell /bsd: iwm0: device timeout
Oct 11 17:31:20 dell /bsd: iwm0: device timeout
Oct 11 17:31:21 dell /bsd: iwm0: could not add MAC context (error 35)

I sure don't know what to do with them,
but I'm glad I can at least report them.
If this goes in, which one of them will disappear?
(Are they all firmware errors?)

I don't understand the motivation to hide them,
but I can build the kernel with IWN_DEBUG.

Jan



> Index: if_iwn.c
> ===
> RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v
> retrieving revision 1.172
> diff -u -p -r1.172 if_iwn.c
> --- if_iwn.c  5 Sep 2016 08:18:18 -   1.172
> +++ if_iwn.c  6 Oct 2016 10:42:41 -
> @@ -2595,6 +2595,7 @@ iwn_wakeup_intr(struct iwn_softc *sc)
>   }
>  }
>  
> +#ifdef IWN_DEBUG
>  /*
>   * Dump the error log of the firmware when a firmware panic occurs.  Although
>   * we can't debug the firmware because it is neither open source nor free, it
> @@ -2606,9 +2607,6 @@ iwn_fatal_intr(struct iwn_softc *sc)
>   struct iwn_fw_dump dump;
>   int i;
>  
> - /* Force a complete recalibration on next init. */
> - sc->sc_flags &= ~IWN_FLAG_CALIB_DONE;
> -
>   /* Check that the error log address is valid. */
>   if (sc->errptr < IWN_FW_DATA_BASE ||
>   sc->errptr + sizeof (dump) >
> @@ -2657,6 +2655,7 @@ iwn_fatal_intr(struct iwn_softc *sc)
>   printf("  rx ring: cur=%d\n", sc->rxq.cur);
>   printf("  802.11 state %d\n", sc->sc_ic.ic_state);
>  }
> +#endif
>  
>  int
>  iwn_intr(void *arg)
> @@ -2711,8 +2710,14 @@ iwn_intr(void *arg)
>   }
>   if (r1 & (IWN_INT_SW_ERR | IWN_INT_HW_ERR)) {
>   printf("%s: fatal firmware error\n", sc->sc_dev.dv_xname);
> +
> + /* Force a complete recalibration on next init. */
> + sc->sc_flags &= ~IWN_FLAG_CALIB_DONE;
> +
>   /* Dump firmware error log and stop. */
> +#ifdef IWN_DEBUG
>   iwn_fatal_intr(sc);
> +#endif
>   iwn_stop(ifp, 1);
>   task_add(systq, >init_task);
>   return 1;
> 



enforce zero options

2016-10-12 Thread Jan Stary
Some programs in bin/ and usr.bin/ use the following idiom
to make sure that there are no options present:
 
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:
usage();
/* NOTREACHED */
}

if (argc != optind) {
usage();
/* NOTREACHED */
}
 
Why is this better then simply checking that (argc == 1)?

Below is a diff to logname as an example.
(Remove the pointless locale while there.)

Jan


Index: logname.c
===
RCS file: /cvs/src/usr.bin/logname/logname.c,v
retrieving revision 1.9
diff -u -p -r1.9 logname.c
--- logname.c   9 Oct 2015 01:37:08 -   1.9
+++ logname.c   12 Oct 2016 08:38:49 -
@@ -32,7 +32,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -44,23 +43,11 @@ main(int argc, char *argv[])
int ch;
char *p;
 
-   setlocale(LC_ALL, "");
-
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
 
-   while ((ch = getopt(argc, argv, "")) != -1)
-   switch (ch) {
-   case '?':
-   default:
-   usage();
-   /* NOTREACHED */
-   }
-
-   if (argc != optind) {
+   if (argc != 1)
usage();
-   /* NOTREACHED */
-   }
 
if ((p = getlogin()) == NULL)
err(1, NULL);



remove locale from logname(1)

2016-10-12 Thread Jan Stary
Why does logname(1) need to setlocale?

Jan

Index: logname.c
===
RCS file: /cvs/src/usr.bin/logname/logname.c,v
retrieving revision 1.9
diff -u -p -r1.9 logname.c
--- logname.c   9 Oct 2015 01:37:08 -   1.9
+++ logname.c   12 Oct 2016 08:35:11 -
@@ -32,7 +32,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -43,8 +42,6 @@ main(int argc, char *argv[])
 {
int ch;
char *p;
-
-   setlocale(LC_ALL, "");
 
if (pledge("stdio", NULL) == -1)
err(1, "pledge");



Re: enforce zero options

2016-10-12 Thread Jan Stary
On Oct 12 15:00:23, j...@wxcvbn.org wrote:
> Jan Stary <h...@stare.cz> writes:
> 
> > Some programs in bin/ and usr.bin/ use the following idiom
> > to make sure that there are no options present:
> >  
> > while ((ch = getopt(argc, argv, "")) != -1)
> > switch (ch) {
> > case '?':
> > default:
> > usage();
> > /* NOTREACHED */
> > }
> >
> > if (argc != optind) {
> > usage();
> > /* NOTREACHED */
> > }
> >  
> > Why is this better then simply checking that (argc == 1)?
> 
> getopt(3) handles --.  Using getopt(3) everywhere is good for
> consistency.

I don't get it: why do we need to handle --
in utils which take no options and no arguments?

e.g. logname(1) is supposed to be launched just like "logname".
Does logname.c do the above just to handle "logname --" ?

Jan



cp.c and rm.c embedded in mv(1)

2016-10-11 Thread Jan Stary
mv's copies of cp.c and rm.c were imported about 10 months ago
so that mv can avoid the fork+exec; instead, mv just calls
the relevant cp/rm code itself.

What was the motivation for that? Was that a step needed
to have a stricter pledge() for mv (no forking and execing)?
Currently, mv does not make a pledge. Would it make sense
to pledge what cp+rm does (diff below)?

Or is having the embedded copies beneficial in itself,
even without the pledge? It saves a fork+exec,
but we have duplicit code now: while the imported copies
of cp.c and rm.c were streamlined a bit over the time
(usage, locale, unused flags), the actual fts traversal
and the copying/unlinking needs to be there, obviously.

Jan



Index: mv.c
===
RCS file: /cvs/src/bin/mv/mv.c,v
retrieving revision 1.43
diff -u -p -r1.43 mv.c
--- mv.c17 Nov 2015 18:34:00 -  1.43
+++ mv.c11 Oct 2016 06:46:19 -
@@ -92,6 +92,9 @@ main(int argc, char *argv[])
if (argc < 2)
usage();
 
+   if (pledge("stdio rpath wpath cpath fattr getpw", NULL) == -1)
+   err(1, "pledge");
+
stdin_ok = isatty(STDIN_FILENO);
 
/*



rm.c functions in mv(1)

2016-10-10 Thread Jan Stary
bin/mv has its own copies of cp.c and mv.c.
Apparently, they are modifications of cp's cp.c and rm's rm.c,
used when moving as "copy and remove the source".

In bin/mv/rm.c, the following snippet of rm_file() confuses me:

if (S_ISDIR(sb.st_mode)) {
warnx("%s: is a directory", f);
eval = 1;
continue;
}
if (S_ISDIR(sb.st_mode))
rval = rmdir(f);
else {
rval = unlink(f);
}

If it's a directory, give up.
And if it's a directory, rmdir();

Is this intentional? In fact, rm_file() and check()
are not used anywhere else in bin/mv code.
Is it there to keep the diff to bin/rm smaller?

Jan


Index: rm.c
===
RCS file: /cvs/src/bin/mv/rm.c,v
retrieving revision 1.7
diff -u -p -r1.7 rm.c
--- rm.c27 Nov 2015 17:32:16 -  1.7
+++ rm.c10 Oct 2016 10:21:01 -
@@ -52,9 +52,7 @@ extern char *__progname;
 
 static int eval, stdin_ok;
 
-static int check(char *, char *, struct stat *);
 static voidcheckdot(char **);
-static voidrm_file(char **);
 static voidrm_tree(char **);
 
 static void __dead
@@ -79,7 +77,6 @@ rmmain(int argc, char *argv[])
 
if (*argv) {
stdin_ok = isatty(STDIN_FILENO);
-
rm_tree(argv);
}
 
@@ -158,72 +155,6 @@ rm_tree(char **argv)
if (errno)
err(1, "fts_read");
fts_close(fts);
-}
-
-static void
-rm_file(char **argv)
-{
-   struct stat sb;
-   int rval;
-   char *f;
-
-   /*
-* Remove a file.  POSIX 1003.2 states that, by default, attempting
-* to remove a directory is an error, so must always stat the file.
-*/
-   while ((f = *argv++) != NULL) {
-   /* Assume if can't stat the file, can't unlink it. */
-   if (lstat(f, )) {
-   if (errno != ENOENT) {
-   warn("%s", f);
-   eval = 1;
-   }
-   continue;
-   }
-
-   if (S_ISDIR(sb.st_mode)) {
-   warnx("%s: is a directory", f);
-   eval = 1;
-   continue;
-   }
-   if (S_ISDIR(sb.st_mode))
-   rval = rmdir(f);
-   else {
-   rval = unlink(f);
-   }
-   if (rval && (errno != ENOENT)) {
-   warn("%s", f);
-   eval = 1;
-   }
-   }
-}
-
-static int
-check(char *path, char *name, struct stat *sp)
-{
-   int ch, first;
-   char modep[15];
-
-   /*
-* If it's not a symbolic link and it's unwritable and we're
-* talking to a terminal, ask.  Symbolic links are excluded
-* because their permissions are meaningless.  Check stdin_ok
-* first because we may not have stat'ed the file.
-*/
-   if (!stdin_ok || S_ISLNK(sp->st_mode) || !access(name, W_OK) ||
-   errno != EACCES)
-   return (1);
-   strmode(sp->st_mode, modep);
-   (void)fprintf(stderr, "override %s%s%s/%s for %s? ",
-   modep + 1, modep[9] == ' ' ? "" : " ",
-   user_from_uid(sp->st_uid, 0),
-   group_from_gid(sp->st_gid, 0), path);
-   (void)fflush(stderr);
-
-   first = ch = getchar();
-   while (ch != '\n' && ch != EOF)
-   ch = getchar();
-   return (first == 'y' || first == 'Y');
 }
 
 /*



Re: setlocale in cp/rm/mv

2016-10-11 Thread Jan Stary
On Oct 11 10:31:38, schwa...@usta.de wrote:
> > cp(1) and rm(1) call setlocale(LC_ALL, "") but mv(1) does not.
> > Why do they do that, and why mv doesn't?
> 
> That is useless and wasteful.
> 
> I think it comes from a time when people still thought that doing
> more and more and more might bring you closer to perfection.
> 
> Here is a simple diff to remove that junk

Can we confront
http://marc.info/?l=openbsd-tech=147586358208770=2
with this please? I still believe it should be removed
from sort(1) too (diff in a separate mail).

Jan




drop unused locale junk from sort(1)

2016-10-11 Thread Jan Stary
Feeling encouraged by Ingo's ok to remove locale from cp/rm,
here's a diff that removes the locale stuff we don't actually do
from the code and documentation of sort(1). Leave just LC_CTYPE
which determines isblank() and case conversions.

Annotate a missed -z flag while there,
and change /var/tmp to /tmp.

Jan


Index: sort.c
===
RCS file: /cvs/src/usr.bin/sort/sort.c,v
retrieving revision 1.86
diff -u -p -r1.86 sort.c
--- sort.c  14 Jul 2016 08:31:18 -  1.86
+++ sort.c  11 Oct 2016 09:21:45 -
@@ -252,55 +252,6 @@ conv_mbtowc(wchar_t *wc, const char *c, 
 }
 
 /*
- * Set current locale symbols.
- */
-static void
-set_locale(void)
-{
-   struct lconv *lc;
-   const char *locale;
-
-   setlocale(LC_ALL, "");
-
-   /* Obtain LC_NUMERIC info */
-   lc = localeconv();
-
-   /* Convert to wide char form */
-   conv_mbtowc(_decimal_point, lc->decimal_point,
-   symbol_decimal_point);
-   conv_mbtowc(_thousands_sep, lc->thousands_sep,
-   symbol_thousands_sep);
-   conv_mbtowc(_positive_sign, lc->positive_sign,
-   symbol_positive_sign);
-   conv_mbtowc(_negative_sign, lc->negative_sign,
-   symbol_negative_sign);
-
-   if (getenv("GNUSORT_NUMERIC_COMPATIBILITY"))
-   gnusort_numeric_compatibility = true;
-
-   locale = setlocale(LC_COLLATE, NULL);
-   if (locale != NULL) {
-   char *tmpl;
-   const char *byteclocale;
-
-   tmpl = sort_strdup(locale);
-   byteclocale = setlocale(LC_COLLATE, "C");
-   if (byteclocale && strcmp(byteclocale, tmpl) == 0) {
-   byte_sort = true;
-   } else {
-   byteclocale = setlocale(LC_COLLATE, "POSIX");
-   if (byteclocale && strcmp(byteclocale, tmpl) == 0)
-   byte_sort = true;
-   else
-   setlocale(LC_COLLATE, tmpl);
-   }
-   sort_free(tmpl);
-   }
-   if (!byte_sort)
-   sort_mb_cur_max = MB_CUR_MAX;
-}
-
-/*
  * Set directory temporary files.
  */
 static void
@@ -883,7 +834,6 @@ main(int argc, char *argv[])
 
atexit(clear_tmp_files);
 
-   set_locale();
set_tmpdir();
set_sort_opts();
 
@@ -1163,17 +1113,8 @@ main(int argc, char *argv[])
if (debug_sort) {
printf("Memory to be used for sorting: %llu\n",
available_free_memory);
-   printf("Using collate rules of %s locale\n",
-   setlocale(LC_COLLATE, NULL));
if (byte_sort)
printf("Byte sort is used\n");
-   if (print_symbols_on_debug) {
-   printf("Decimal Point: <%lc>\n", symbol_decimal_point);
-   if (symbol_thousands_sep)
-   printf("Thousands separator: <%lc>\n",
-   symbol_thousands_sep);
-   printf("Positive sign: <%lc>\n", symbol_positive_sign);
-   printf("Negative sign: <%lc>\n", symbol_negative_sign);
}
}
 
Index: sort.1
===
RCS file: /cvs/src/usr.bin/sort/sort.1,v
retrieving revision 1.54
diff -u -p -r1.54 sort.1
--- sort.1  5 Apr 2015 14:20:22 -   1.54
+++ sort.1  11 Oct 2016 09:21:45 -
@@ -52,13 +52,16 @@ The
 .Nm
 utility sorts text and binary files by lines.
 A line is a record separated from the subsequent record by a
-newline (default) or NUL \'\\0\' character (-z option).
+newline (default) or NUL \'\\0\' character
+.Po
+.Fl z
+option
+.Pc .
 A record can contain any printable or unprintable characters.
 Comparisons are based on one or more sort keys extracted from
 each line of input, and are performed lexicographically,
-according to the current locale's collating rules and the
-specified command-line options that can tune the actual
-sorting behavior.
+according to the specified command-line options
+that can tune the actual sorting behavior.
 By default, if keys are not given,
 .Nm
 uses entire lines for comparison.
@@ -110,7 +113,7 @@ Store temporary files in the directory
 The default path is the value of the environment variable
 .Ev TMPDIR
 or
-.Pa /var/tmp
+.Pa /tmp
 if
 .Ev TMPDIR
 is not defined.
@@ -173,10 +176,6 @@ Unknown strings are considered smaller t
 .It Fl n , Fl Fl numeric-sort, Fl Fl sort=numeric
 An initial numeric string, consisting of optional blank space, optional
 minus sign, and zero or more digits (including decimal point)
-.\" with
-.\" optional radix character and thousands
-.\" separator
-.\" (as defined in the current locale),
 is sorted by arithmetic value.
 Leading blank characters are ignored.
 .It Fl R, Fl Fl random-sort, Fl Fl sort=random
@@ 

ntpd.conf

2016-12-29 Thread Jan Stary
Markup a forgotten keyword.

Jan

Index: ntpd.conf.5
===
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.conf.5,v
retrieving revision 1.33
diff -u -p -r1.33 ntpd.conf.5
--- ntpd.conf.5 23 Oct 2015 14:52:20 -  1.33
+++ ntpd.conf.5 28 Dec 2016 20:58:06 -
@@ -127,7 +127,9 @@ sensor nmea0 refid GPS
 .Ed
 .Pp
 A stratum value other than the default of 1 can be assigned using
-the stratum keyword.
+the
+.Ic stratum
+keyword.
 .It Xo Ic server Ar address
 .Op Ic weight Ar weight-value
 .Xc



/dev/sound

2017-03-26 Thread Jan Stary
Now that /dev/sound is gone,
should AUDIO_DEV_SOUND be removed from audio.c ?

Jan



Index: audio.c
===
RCS file: /cvs/src/sys/dev/audio.c,v
retrieving revision 1.161
diff -u -p -r1.161 audio.c
--- audio.c 11 Mar 2017 10:12:45 -  1.161
+++ audio.c 26 Mar 2017 11:40:52 -
@@ -50,7 +50,6 @@
 #define DEVNAME(sc)((sc)->dev.dv_xname)
 #define AUDIO_UNIT(n)  (minor(n) & 0x0f)
 #define AUDIO_DEV(n)   (minor(n) & 0xf0)
-#define AUDIO_DEV_SOUND0   /* minor of /dev/sound0 */
 #define AUDIO_DEV_MIXER0x10/* minor of /dev/mixer0 */
 #define AUDIO_DEV_AUDIO0x80/* minor of /dev/audio0 */
 #define AUDIO_DEV_AUDIOCTL 0xc0/* minor of /dev/audioctl */
@@ -1137,7 +1136,6 @@ audio_detach(struct device *self, int fl
 * close uses device_lookup, it returns EXIO and does nothing
 */
mn = self->dv_unit;
-   vdevgone(maj, mn | AUDIO_DEV_SOUND, mn | AUDIO_DEV_SOUND, VCHR);
vdevgone(maj, mn | AUDIO_DEV_AUDIO, mn | AUDIO_DEV_AUDIO, VCHR);
vdevgone(maj, mn | AUDIO_DEV_AUDIOCTL, mn | AUDIO_DEV_AUDIOCTL, VCHR);
vdevgone(maj, mn | AUDIO_DEV_MIXER, mn | AUDIO_DEV_MIXER, VCHR);
@@ -1608,7 +1606,6 @@ audioopen(dev_t dev, int flags, int mode
error = ENXIO;
else {
switch (AUDIO_DEV(dev)) {
-   case AUDIO_DEV_SOUND:
case AUDIO_DEV_AUDIO:
error = audio_open(sc, flags);
break;
@@ -1634,7 +1631,6 @@ audioclose(dev_t dev, int flags, int ifm
if (sc == NULL)
return ENXIO;
switch (AUDIO_DEV(dev)) {
-   case AUDIO_DEV_SOUND:
case AUDIO_DEV_AUDIO:
error = audio_close(sc);
break;
@@ -1659,7 +1655,6 @@ audioread(dev_t dev, struct uio *uio, in
if (sc == NULL)
return ENXIO;
switch (AUDIO_DEV(dev)) {
-   case AUDIO_DEV_SOUND:
case AUDIO_DEV_AUDIO:
error = audio_read(sc, uio, ioflag);
break;
@@ -1684,7 +1679,6 @@ audiowrite(dev_t dev, struct uio *uio, i
if (sc == NULL)
return ENXIO;
switch (AUDIO_DEV(dev)) {
-   case AUDIO_DEV_SOUND:
case AUDIO_DEV_AUDIO:
error = audio_write(sc, uio, ioflag);
break;
@@ -1709,7 +1703,6 @@ audioioctl(dev_t dev, u_long cmd, caddr_
if (sc == NULL)
return ENXIO;
switch (AUDIO_DEV(dev)) {
-   case AUDIO_DEV_SOUND:
case AUDIO_DEV_AUDIO:
error = audio_ioctl(sc, cmd, addr);
break;
@@ -1744,7 +1737,6 @@ audiopoll(dev_t dev, int events, struct 
if (sc == NULL)
return POLLERR;
switch (AUDIO_DEV(dev)) {
-   case AUDIO_DEV_SOUND:
case AUDIO_DEV_AUDIO:
revents = audio_poll(sc, events, p);
break;



LC_NUMERIC in awk

2017-07-26 Thread Jan Stary
Does awk really need to set and reset LC_NUMERIC?
Does it need to set locale at all?

Jan


Index: main.c
===
RCS file: /cvs/src/usr.bin/awk/main.c,v
retrieving revision 1.19
diff -u -p -r1.19 main.c
--- main.c  22 Oct 2015 04:08:17 -  1.19
+++ main.c  26 Jul 2017 20:15:48 -
@@ -28,7 +28,6 @@ const char*version = "version 20110810"
 #define DEBUG
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -61,9 +60,6 @@ int main(int argc, char *argv[])
 {
const char *fs = NULL;
 
-   setlocale(LC_ALL, "");
-   setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
-
if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
fprintf(stderr, "%s: pledge: incorrect arguments\n",
cmdname);
@@ -185,7 +181,6 @@ int main(int argc, char *argv[])
if (!safe)
envinit(environ);
yyparse();
-   setlocale(LC_NUMERIC, ""); /* back to whatever it is locally */
if (fs)
*FS = qstring(fs, '\0');
   dprintf( ("errorflag=%d\n", errorflag) );



calendar vs KOI8

2017-07-26 Thread Jan Stary
Is 5.9 out yet?


Index: io.c
===
RCS file: /cvs/src/usr.bin/calendar/io.c,v
retrieving revision 1.44
diff -u -p -r1.44 io.c
--- io.c31 Aug 2016 09:38:47 -  1.44
+++ io.c26 Jul 2017 20:21:09 -
@@ -89,13 +89,9 @@ cal(void)
if (strncmp(buf, "LANG=", 5) == 0) {
(void) setlocale(LC_ALL, buf + 5);
setnnames();
-   /* XXX remove KOI8 lines after 5.9 is out */
if (!strcmp(buf + 5, "ru_RU.UTF-8") ||
!strcmp(buf + 5, "uk_UA.UTF-8") ||
-   !strcmp(buf + 5, "by_BY.UTF-8") ||
-   !strcmp(buf + 5, "ru_RU.KOI8-R") ||
-   !strcmp(buf + 5, "uk_UA.KOI8-U") ||
-   !strcmp(buf + 5, "by_BY.KOI8-B")) {
+   !strcmp(buf + 5, "by_BY.UTF-8")) {
bodun_maybe++;
bodun = 0;
free(prefix);



  1   2   3   >