Mercurial > hg > Members > kono > nitros9-code
changeset 534:032365886652
Mainly section structures added.
author | roug |
---|---|
date | Sat, 12 Oct 2002 12:03:22 +0000 |
parents | 74609258dd88 |
children | 30480200b0f1 |
files | docs/ccguide/os9.refentry docs/ccguide/setbuf.refentry |
diffstat | 2 files changed, 51 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/ccguide/os9.refentry Sat Oct 12 12:03:22 2002 +0000 +++ b/docs/ccguide/os9.refentry Sat Oct 12 12:03:22 2002 +0000 @@ -22,4 +22,55 @@ Placeholder </para> </refsect1> + +<refsect1><title>Diagnostics</title> +<para> +-1 is returned is the OS-9 call failed. 0 is returned on success. +</para> +</refsect1> + +<refsect1><title>Program Example</title> +<programlisting> +#include <os9.h> +#include <modes.h> + +/* this program does an I$GETSTT call to get file size */ +main(argc,argv) +int argc; +char **argv; +{ + struct registers reg; + int path; + +/* tell linker we need longs */ + pflinit(); + +/* low level open(file name is first command line param */ + path=open(*++argv,S_IREAD); + +/* set up regs for call to OS-9 */ + reg.rg_a=path; + reg.rg_b=SS_SIZE; + + if(_os9(I_GETSTT,&reg) == 0) + printf("filesize = %lx\n", /* success */ + (long) (reg.rg_x << 16)+reg.rg_u); + else printf("OS9 error #%d\n",reg.rg_b & 0xff); /*failed*/ + + dumpregs(&reg); /* take a look at the registers */ +} + +dumpregs(r) +register struct registers *r; +{ + printf("cc=%02x\n",r->rg_cc & 0xff); + printf(" a=%02x\n",r->rg_a & 0xff); + printf(" b=%02x\n",r->rg_b & 0xff); + printf("dp=%02x\n",r->rg_dp & 0xff); + printf(" x=%02x\n",r->rg_x); + printf(" y=%02x\n",r->rg_u); + printf(" u=%02x\n",r->rg_y); +} +</programlisting> +</refsect1> </refentry>