Re: c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
wow. thanks. that's looking really nice. i'll change my sources tomorrow after a good dose of sleep. ;) alex Alfred Perlstein schrieb am 2009-07-01: > Hey Alex, > People frown on macros, but this could be a good one: > #define SPRINT(f, fmt) \ > do {\ > for (_i = 0; _i <

Re: c question: *printf'ing arrays

2009-06-30 Thread Alfred Perlstein
Hey Alex, People frown on macros, but this could be a good one: #define SPRINT(f, fmt) \ do {\ for (_i = 0; _i < sizeof(f)/sizeof(f[0]); i++) \ printf(fmt, f[i]); \ }while(0) :D This should allow you to point to any _array_ and print each

Re: large pages (amd64)

2009-06-30 Thread Mel Flynn
On Tuesday 30 June 2009 00:24:00 Alan Cox wrote: > Mel Flynn wrote: > > On Sunday 28 June 2009 15:41:49 Alan Cox wrote: > >> Wojciech Puchar wrote: > >>> how can i check how much (or maybe - what processes) 2MB pages are > >>> actually allocated? > >> > >> I'm afraid that you can't with great preci

Re: c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
thanks for all the help. i decided to take the pill and coded all the fprintfs by hand. here's the result. usually i'd stick to a higher level languag, but i need C's inline assembly support: struct Header { u_int8_t rom_entry[4]; u_int8_t nintendo_logo[156]; u_char

Re: c question: *printf'ing arrays

2009-06-30 Thread Rick C. Petty
On Tue, Jun 30, 2009 at 08:21:03PM +0200, Alexander Best wrote: > thanks. now the output gets redirected using >. i'm quite new to programming > under unix. sorry for the inconvenience. No problem; we all had to learn sometime. But what I suggested should work for every platform that adheres to P

Re: c question: *printf'ing arrays

2009-06-30 Thread Stephen Montgomery-Smith
Alexander Best wrote: thanks. now the output gets redirected using >. i'm quite new to programming under unix. sorry for the inconvenience. so i guess there is no really easy way to output an inhomogeneous struct to stdout without using a loop to output each array contained in the struct. cheer

Re: c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
thanks. now the output gets redirected using >. i'm quite new to programming under unix. sorry for the inconvenience. so i guess there is no really easy way to output an inhomogeneous struct to stdout without using a loop to output each array contained in the struct. cheers. Rick C. Petty schrie

Re: c question: *printf'ing arrays

2009-06-30 Thread Igor Mozolevsky
2009/6/30 Alexander Best : > should be stdout. > > > struct Header *hdr = rom; > > int new_fd = open("/dev/stdout", O_RDWR); > > printf("SIZE: %d\n",sizeof(*hdr)); > > write(new_fd, hdr, sizeof(*hdr)); > > close(new_fd); You should really be checking what open returns, opening /dev/stdout for read

Re: c question: *printf'ing arrays

2009-06-30 Thread Rick C. Petty
On Tue, Jun 30, 2009 at 08:03:21PM +0200, Alexander Best wrote: > should be stdout. > > > struct Header *hdr = rom; > > int new_fd = open("/dev/stdout", O_RDWR); > printf("SIZE: %d\n",sizeof(*hdr)); > write(new_fd, hdr, sizeof(*hdr)); > close(new_fd); Why are you reopening stdout? It should al

Re: c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
should be stdout. struct Header *hdr = rom; int new_fd = open("/dev/stdout", O_RDWR); printf("SIZE: %d\n",sizeof(*hdr)); write(new_fd, hdr, sizeof(*hdr)); close(new_fd); Igor Mozolevsky schrieb am 2009-06-30: > 2009/6/30 Alexander Best : > > that works, but i really want to have a pretty out

Re: c question: *printf'ing arrays

2009-06-30 Thread Igor Mozolevsky
2009/6/30 Alexander Best : > that works, but i really want to have a pretty output to stdout. i guess i > have to stick with printf and use `for (i=0; i < sizeof(XXX); i++)` for each > array in the struct. just thought i could avoid it. > > btw. `./my-program | hexdump` works, but if i do `./my-pro

Re: c question: *printf'ing arrays

2009-06-30 Thread Igor Mozolevsky
2009/6/30 Alexander Best : > thanks. but that simply dumps the contents of the struct to stdout. but since > most of the struct's contents aren't ascii the output isn't really of much > use. How about ./your-program | hexdump ? -- Igor ___ freebsd-hacke

Re: c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
that works, but i really want to have a pretty output to stdout. i guess i have to stick with printf and use `for (i=0; i < sizeof(XXX); i++)` for each array in the struct. just thought i could avoid it. btw. `./my-program | hexdump` works, but if i do `./my-program > output` output is being creat

Re: c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
thanks. but that simply dumps the contents of the struct to stdout. but since most of the struct's contents aren't ascii the output isn't really of much use. cheers. Tom Evans schrieb am 2009-06-30: > On Tue, 2009-06-30 at 18:12 +0200, Alexander Best wrote: > > hi there, > > i need to output the

Re: c question: *printf'ing arrays

2009-06-30 Thread Tom Evans
On Tue, 2009-06-30 at 18:12 +0200, Alexander Best wrote: > hi there, > > i need to output the header of a file to stdout. the header looks like this: > > struct Header > { > u_int8_t rom_entry[4]; > u_int8_t nintendo_logo[156]; > u_char game_title[12]; > u_

c question: *printf'ing arrays

2009-06-30 Thread Alexander Best
hi there, i need to output the header of a file to stdout. the header looks like this: struct Header { u_int8_t rom_entry[4]; u_int8_t nintendo_logo[156]; u_char game_title[12]; u_char game_code[4]; u_char maker_code[2]; u_int8_t fixed_val;

good afternoon to all

2009-06-30 Thread malathi selvaraj
i am not able to made rcpbind, i get an error while making the rcpbind like this RPC: Unknown host showmount: can't do exports rpc Thanks in advance -- S.MALATHI ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/fre

Re: large pages (amd64)

2009-06-30 Thread Alan Cox
Mel Flynn wrote: On Sunday 28 June 2009 15:41:49 Alan Cox wrote: Wojciech Puchar wrote: how can i check how much (or maybe - what processes) 2MB pages are actually allocated? I'm afraid that you can't with great precision. For a given program execution, on an otherwise idl