Move the sources to trunk
[opencv] / apps / cvenv / EiC / stdClib / fcntl.c
1 /* fcntl.c
2  *
3  *      (C) Copyright Dec 20 1998, Edmond J. Breen.
4  *                 ALL RIGHTS RESERVED.
5  * This code may be copied for personal, non-profit use only.
6  *
7  */
8
9 /* This file is broken into 2 parts
10  * the first part defines the interface routines
11  * and the 2nd part adds the interface routine
12  * to EiC's look up tables.
13  */
14
15
16
17 #include <fcntl.h>
18 #include <stdlib.h>
19
20 #include "eic.h"
21
22
23 /* FCNTL.H STUFF */
24 #ifndef NO_FCNTL
25 val_t eic_fcntl(void)
26 {
27     val_t v;
28
29     if(getargc() == 3) {
30         v.ival = fcntl(arg(0,getargs(),int),
31                       arg(1,getargs(),int),
32                       arg(2,getargs(),int));
33     } else
34         v.ival = fcntl(arg(0,getargs(),int),
35                       arg(1,getargs(),int));
36     return v;
37 }
38
39 val_t eic_open(void)
40 {
41     val_t v;
42     if(getargc() == 3) {
43         v.ival = open(arg(0,getargs(),ptr_t).p,
44                       arg(1,getargs(),int),
45                       arg(2,getargs(),mode_t));
46     } else
47         v.ival = open(arg(0,getargs(),ptr_t).p,
48                       arg(1,getargs(),int));
49     return v;
50 }
51
52 val_t eic_creat(void)
53 {
54     val_t v;
55     arg_list ap = getargs();
56     v.ival = creat(arg(0,ap,ptr_t).p,
57                    arg(1,ap,int));
58     return v;
59 }
60
61 #endif
62
63 /*******************************************************************/
64
65 void module_fcntl()
66 {
67
68 #ifndef NO_FCNTL
69
70     /* fcntl.h  */
71     EiC_add_builtinfunc("open", eic_open);
72     EiC_add_builtinfunc("creat", eic_creat);
73     EiC_add_builtinfunc("fcntl", eic_fcntl);
74
75 #endif
76 }
77
78
79
80
81
82
83
84
85