1974e9d9imp/*-
2974e9d9imp * Copyright (c) 2014 Pedro Souza <pedrosouza@freebsd.org>
3974e9d9imp * All rights reserved.
4974e9d9imp *
5974e9d9imp * Redistribution and use in source and binary forms, with or without
6974e9d9imp * modification, are permitted provided that the following conditions
7974e9d9imp * are met:
8974e9d9imp * 1. Redistributions of source code must retain the above copyright
9974e9d9imp *    notice, this list of conditions and the following disclaimer.
10974e9d9imp * 2. Redistributions in binary form must reproduce the above copyright
11974e9d9imp *    notice, this list of conditions and the following disclaimer in the
12974e9d9imp *    documentation and/or other materials provided with the distribution.
13974e9d9imp *
14974e9d9imp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15974e9d9imp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16974e9d9imp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17974e9d9imp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18974e9d9imp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19974e9d9imp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20974e9d9imp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21974e9d9imp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22974e9d9imp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23974e9d9imp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24974e9d9imp * SUCH DAMAGE.
25974e9d9imp *
26974e9d9imp * $FreeBSD$
27974e9d9imp */
28974e9d9imp
29974e9d9imp#ifndef LSTD_H
30974e9d9imp#define LSTD_H
31974e9d9imp
32974e9d9imp#include <stand.h>
33974e9d9imp#include <sys/types.h>
34974e9d9imp#include <sys/stdint.h>
35974e9d9imp#include <limits.h>
36974e9d9imp#include <string.h>
37974e9d9imp#include <machine/stdarg.h>
38974e9d9imp
39974e9d9imptypedef struct FILE
40974e9d9imp{
41974e9d9imp	int fd;
42974e9d9imp	size_t offset;
43974e9d9imp	size_t size;
44974e9d9imp} FILE;
45974e9d9imp
460a4cda7cemtypedef struct DIR
470a4cda7cem{
480a4cda7cem	int fd;
490a4cda7cem} DIR;
500a4cda7cem
51974e9d9impFILE *fopen(const char *filename, const char *mode);
52974e9d9impFILE *freopen( const char *filename, const char *mode, FILE *stream);
53974e9d9impsize_t fread(void *ptr, size_t size, size_t count, FILE *stream);
549ad97fakevanssize_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream);
55974e9d9impint fclose(FILE *stream);
56974e9d9impint ferror(FILE *stream);
57974e9d9impint feof(FILE *stream);
58974e9d9impint getc(FILE * stream);
590a4cda7cemDIR *opendir(const char *name);
600a4cda7cemDIR *fdopendir(int fd);
610a4cda7cemint closedir(DIR *);
62974e9d9imp
63974e9d9imp#ifndef EOF
64974e9d9imp#define EOF (-1)
65974e9d9imp#endif
66974e9d9imp
67974e9d9imp#define stdin ((FILE*)NULL)
68974e9d9imp#define stdout 1
69974e9d9imp
70974e9d9imp#ifndef BUFSIZ
71974e9d9imp#define BUFSIZ 512
72974e9d9imp#endif
73974e9d9imp
74974e9d9imp#define lua_writestringerror(s, p) do { printf((s), (p)); } while (0)
75974e9d9imp
76974e9d9impvoid luai_writestring(const char *, int);
77974e9d9imp
78974e9d9imp#define lua_writestring(s,l) luai_writestring(s,l)
79974e9d9imp
80974e9d9imp#define fflush	/* */
81974e9d9imp#define fgets(b, l, s) fgetstr((b), (l), 0)
82974e9d9imp
83974e9d9imp#endif /* LSTD_H */
84