alsa.audio: limit the supported frequencies to common set
[AROS.git] / workbench / network / stacks / AROSTCP / netlib / dosio_init.c
blob6ddc788884bc75493e382a446a5fc4d7346e2d6c
1 /* $Id$
3 * dosio_init.c - SAS C auto initialization functions for DOSIO
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
7 * All rights reserved.
8 */
10 #include <exec/execbase.h>
11 extern struct ExecBase *SysBase;
13 #include <dos/dos.h>
14 #include <dos/dosextens.h>
15 #include <proto/exec.h>
17 #if __SASC
18 #include <proto/dos.h>
19 #elif __GNUC__
20 #include <inline/dos.h>
21 #else
22 #include <clib/dos_protos.h>
23 #endif
26 /****** netd.lib/dosio_init *********************************************
28 NAME
29 dosio_init - (std) io macros to dos.library V37 or newer
31 SYNOPSIS
32 long _STI_500_dosio_init(void)
34 FUNCTION
35 This function initializes the file table used by the stdio
36 look-a-like macros defined in <netinclude:stdio.h>.
38 These macros are taken in to use by defining the symbol
39 `USE_DOSIO' before including any include files. When this is
40 done, the normal stdio prototypes are replaced with macros,
41 which call the corresponding dos.library functions. The
42 netd.lib provides the initialization function mentioned above
43 and the functions VSPrintf(), SPrintf(), VCSPrintf() and
44 CSPrintf(), which are not found from the dos.library.
46 The stdio macros provided are suitable for stdin, stdout and
47 stderr usage. No file opening function (fopen()) is provided,
48 so the use is quite limited.
50 The netd.lib version of the net.lib is compiled with this
51 USE_DOSIO, so you will want to use that instead of the
52 net.lib to make your executable smaller if your own program
53 does not use stdio of the C runtime library.
55 NOTES
56 The stdio macros rely on dos.library 37 or newer being present.
58 The autoinitialization and autotermination functions are features
59 specific to the SAS C6. However, these functions can be used with
60 other (ANSI) C compilers, too. Example follows:
62 \* at start of main() *\
64 if (_STI_500_dosio_init() != 0)
65 exit(20);
67 BUGS
68 The same autoinitialization won't work for both SAS C 6.3 and SAS C
69 6.50 or latter. Only way to terminate an initialization function is
70 by exit() call with SAS C 6.3 binary. If an autoinitialization
71 function is terminated by exit() call with SAS C 6.50 binary, the
72 autotermination functions won't be called. Due this braindamage
73 the libraries must be separately compiled for each compiler version.
75 SEE ALSO
78 *****************************************************************************
81 BPTR __dosio_files[3];
84 * Using __stdargs prevents creation of register arguments entry point.
85 * If both stack args and reg. args entry points are created, this
86 * function is called _twice_, which is not wanted.
88 * The number 500 in the function names is the priority assigned to
89 * stdio autoinitialization functions by SAS/C 6.50.
91 long __stdargs
92 _STI_500_dosio_init(void)
94 struct Process *p = (struct Process *)FindTask(NULL);
96 __dosio_files[0] = p->pr_CIS; /* stdin */
97 __dosio_files[1] = p->pr_COS; /* stdout */
98 __dosio_files[2] = p->pr_CES; /* stderr */
100 if (__dosio_files[2] == 0)
101 __dosio_files[2] = __dosio_files[1];
103 return 0;