C - really weird behavior only at openbsd

2010-10-09 Thread merlyn
Hi all,

I'm facing really weird behavior of simple C program
running under OpenBSD (4.7 and CURRENT).

The code follows. The output also. The file to test the program with
is also inline attached.

The decomp procedure reads input, writes it to the stdout. All 4-chars
preceeded by number are printer number times (e.g. 4abcd -
abcdabcdabcdabcd).

./a.c  test_file.txt
should have output
a bb
ccc  

however it sometimes ( 1 from 3 tryies, sometimes 1 from 20 or even 1
from 40)

looks like
a bb
c
cc



I've tryied this code with OpenBSD 4.7, OpenBSD CURRENT, CentOS Linux,
FreeBSD 8.0 (all i386 arch), but the problem occurs only at OpenBSD (both
versions).

Does anyone know please where could be the problem? Because I have
really no idea.

Thanks a lot,
Milan Bartos



 CODE ---

#include stdio.h
#include stdlib.h

void decomp(unsigned int N){
char *pole;
pole=malloc( sizeof(char) * N );
char character;
int i,j;
int counter;
while( (character = getchar()) != EOF){
if( isdigit(character) ){
counter=atoi(character);
for( i=0 ; i  N ; i++){
pole[i]=getchar();
}
for( i=0 ; i  counter ; i++){
for( j=0 ; j  N ; j++){
putchar(pole[j]);
}
}

}
else {
putchar(character);
}
}
}

int main(){
  unsigned int N=4;
  decomp(N);
}

- END OF CODE ---



- OUTPUT ---

 ./a  out4.txt
a bb
ccc  
 ./a  out4.txt
a bb
ccc  
 ./a  out4.txt
a bb
c
cc

 ./a  out4.txt
a bb
ccc  


-- END OF OUTPUT ---


-- TEST FILE ---
a bb
2ccc  

-- END OF TEST FILE ---


--
merlyn mer...@merlyn.cz
OpenBSD mail.merlyn.cz 4.7 GENERIC.MP#1 i386

[demime 1.01d removed an attachment of type application/pgp-signature]



Re: Wireshark

2009-08-19 Thread merlyn
On Monday 17 August 2009 00:51:28 stan wrote:
 I realize that there is histroy here but I really need to make this tool
 work, and OpenBSD is my OS of choice for network related functions.

 Has anyone gotten wireshark to compile on OpenBSD 4.5? I am trying to build
 version 1.2.1, if that matters.

Hi stan,
last version of Wireshark I've successfully compiled was 0.99.8.
If you'll have more good luck than me, send a patch to this mailing list.

--
Merlyn
Aberdeen
Scotland


-- 
merlyn merlyn...@gmail.com
OpenBSD Padik.invalidnivozik.cz 4.5 GENERIC.MP#108 i386
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments



Re: CD-ROM doesn't play

2009-06-13 Thread merlyn
With cdio cdplay it works ok.
Thanks all!
Milan

-- 
merlyn merlyn...@gmail.com
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments



CD-ROM doesn't play

2009-06-12 Thread merlyn
 bus 2
iwn0 at pci2 dev 0 function 0 Intel WiFi Link 5100AGN rev 0x00: apic 2 int 
17 (irq 5), MIMO 1T2R, MoW, address 00:21:6b:92:f2:ec
ppb2 at pci0 dev 28 function 2 Intel 82801I PCIE rev 0x03: apic 2 int 18 
(irq 6)
pci3 at ppb2 bus 3
ppb3 at pci0 dev 28 function 3 Intel 82801I PCIE rev 0x03
pci4 at ppb3 bus 12
re0 at pci4 dev 0 function 0 Realtek 8168 rev 0x02: RTL8168C/8111C (0x3c00), 
apic 2 int 19 (irq 3), address 00:23:54:70:98:dc
rgephy0 at re0 phy 7: RTL8169S/8110S PHY, rev. 2
uhci3 at pci0 dev 29 function 0 Intel 82801I USB rev 0x03: apic 2 int 23 
(irq 10)
uhci4 at pci0 dev 29 function 1 Intel 82801I USB rev 0x03: apic 2 int 19 
(irq 3)
uhci5 at pci0 dev 29 function 2 Intel 82801I USB rev 0x03: apic 2 int 18 
(irq 6)
ehci1 at pci0 dev 29 function 7 Intel 82801I USB rev 0x03: apic 2 int 23 
(irq 10)
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev 0x93
pci5 at ppb4 bus 13
pcib0 at pci0 dev 31 function 0 vendor Intel, unknown product 0x2919 rev 
0x03
ahci0 at pci0 dev 31 function 2 Intel 82801I AHCI rev 0x03: apic 2 int 19 
(irq 3), AHCI 1.2
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: ATA, HITACHI HTS54252, BBFZ SCSI3 0/direct 
fixed
sd0: 238475MB, 512 bytes/sec, 488397168 sec total
cd0 at scsibus0 targ 1 lun 0: MATSHITA, DVD-RAM UJ870A, SB23 ATAPI 5/cdrom 
removable
usb2 at uhci0: USB revision 1.0
uhub2 at usb2 Intel UHCI root hub rev 1.00/1.00 addr 1
usb3 at uhci1: USB revision 1.0
uhub3 at usb3 Intel UHCI root hub rev 1.00/1.00 addr 1
usb4 at uhci2: USB revision 1.0
uhub4 at usb4 Intel UHCI root hub rev 1.00/1.00 addr 1
usb5 at uhci3: USB revision 1.0
uhub5 at usb5 Intel UHCI root hub rev 1.00/1.00 addr 1
usb6 at uhci4: USB revision 1.0
uhub6 at usb6 Intel UHCI root hub rev 1.00/1.00 addr 1
usb7 at uhci5: USB revision 1.0
uhub7 at usb7 Intel UHCI root hub rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: PC speaker
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
mtrr: Pentium Pro MTRR support
uvideo0 at uhub1 port 5 configuration 1 interface 0 Chicony Electronics Co., 
Ltd. CNF7237CNF7238 rev 2.00/9.63 addr 2
uvideo0: just 2 bytes bmControls supported yet!
video0 at uvideo0
ugen0 at uhub4 port 2 TouchStrip Fingerprint Sensor rev 1.00/0.33 addr 2
softraid0 at root
root on sd0a swap on sd0b dump on sd0b
---



-- 
merlyn merlyn...@gmail.com
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments