libs: get rid of libstdio (and stdio.h); `mv ctype.h chartypes.h` in /sys/include
This commit is contained in:
parent
0a325039bf
commit
16c7924425
|
@ -1,16 +1,12 @@
|
|||
{
|
||||
"buildflags": {
|
||||
"Cflags": [
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fplan9-extensions",
|
||||
"-fvar-tracking",
|
||||
"-fvar-tracking-assignments",
|
||||
"-9",
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
"-ggdb",
|
||||
"-mcmodel=small",
|
||||
"-O0",
|
||||
"-static",
|
||||
"-Wall",
|
||||
"-Wno-main",
|
||||
"-Wno-missing-braces",
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void
|
||||
main(){
|
||||
char *correct="0.987650\n";
|
||||
static char result[128];
|
||||
|
||||
sprintf(result, "%f\n", 0.98765f);
|
||||
sprint(result, "%f\n", 0.98765f);
|
||||
|
||||
if(!strcmp(result, correct)){
|
||||
print("PASS\n");
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
{
|
||||
"SimplePOSIXTests": {
|
||||
"Include": [
|
||||
"/arch/$ARCH/include/cflags.json"
|
||||
],
|
||||
"Cflags": [
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
"-ggdb",
|
||||
"-mcmodel=small",
|
||||
"-O0",
|
||||
"-Wall",
|
||||
"-Wno-main",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-parentheses",
|
||||
"-Wno-unknown-pragmas",
|
||||
"-fstack-check",
|
||||
"-fstack-protector-all",
|
||||
"-O2",
|
||||
"-std=gnu11"
|
||||
],
|
||||
"Oflags": [
|
||||
"-static"
|
||||
],
|
||||
"Install": "/arch/$ARCH/qa/lib/newlib",
|
||||
"Post": [
|
||||
"rm -f *.o",
|
||||
|
@ -61,19 +65,23 @@
|
|||
]
|
||||
},
|
||||
"SIGCHLDTests": {
|
||||
"Include": [
|
||||
"/arch/$ARCH/include/cflags.json"
|
||||
],
|
||||
"Cflags": [
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
"-ggdb",
|
||||
"-mcmodel=small",
|
||||
"-O0",
|
||||
"-Wall",
|
||||
"-Wno-main",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-parentheses",
|
||||
"-Wno-unknown-pragmas",
|
||||
"-fstack-check",
|
||||
"-fstack-protector-all",
|
||||
"-O2",
|
||||
"-DWITH_SIGCHLD",
|
||||
"-std=gnu11"
|
||||
],
|
||||
"Oflags": [
|
||||
"-static"
|
||||
],
|
||||
"Install": "/arch/$ARCH/qa/lib/newlib/sigchld",
|
||||
"Post": [
|
||||
"rm -f *.o",
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
{
|
||||
"NewlibTestsuite": {
|
||||
"Include": [
|
||||
"/arch/$ARCH/include/cflags.json"
|
||||
],
|
||||
"Cflags": [
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
"-ggdb",
|
||||
"-mcmodel=small",
|
||||
"-O0",
|
||||
"-Wall",
|
||||
"-Wno-main",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-parentheses",
|
||||
"-Wno-unknown-pragmas",
|
||||
"-iquote", "/hacking/cross/pkgs/newlib/src/newlib/testsuite/include/",
|
||||
"-fstack-check",
|
||||
"-Wno-unused-variable",
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
#pragma src "/sys/src/lib/stdio"
|
||||
#pragma lib "libstdio.a"
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "../stdio.h"
|
||||
#include "9stdio.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <thread.h>
|
||||
#include <9P2000.h>
|
||||
#include <9p.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "dat.h"
|
||||
|
||||
void mainctl(void*);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <lib9.h>
|
||||
#include <libsec.h>
|
||||
#include <authsrv.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "authcmdlib.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "authcmdlib.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <authsrv.h>
|
||||
#include <mp.h>
|
||||
#include <libsec.h>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* write response: Chapreply or MSchapreply structure
|
||||
*/
|
||||
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "dat.h"
|
||||
|
||||
enum {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <authsrv.h>
|
||||
#include <9P2000.h>
|
||||
#include <bio.h>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <authsrv.h>
|
||||
#include "authcmdlib.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <authsrv.h>
|
||||
#include "authcmdlib.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <authsrv.h>
|
||||
#include "authcmdlib.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <authsrv.h>
|
||||
#include "authcmdlib.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <ip.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <mp.h>
|
||||
#include <libsec.h>
|
||||
#include <bio.h>
|
||||
|
|
|
@ -24,7 +24,7 @@ THIS SOFTWARE.
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "awk.h"
|
||||
#include "y.tab.h"
|
||||
|
|
|
@ -24,7 +24,7 @@ THIS SOFTWARE.
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "awk.h"
|
||||
#include "y.tab.h"
|
||||
|
|
|
@ -24,7 +24,7 @@ THIS SOFTWARE.
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <regexp.h>
|
||||
#include "awk.h"
|
||||
|
|
|
@ -24,7 +24,7 @@ THIS SOFTWARE.
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "awk.h"
|
||||
#include "y.tab.h"
|
||||
|
|
|
@ -25,7 +25,7 @@ THIS SOFTWARE.
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <envvars.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "awk.h"
|
||||
#include "y.tab.h"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"/arch/$ARCH/include/cflags.json"
|
||||
],
|
||||
"Cflags": [
|
||||
"-9",
|
||||
"-fstack-check",
|
||||
"-fstack-protector-all"
|
||||
],
|
||||
|
@ -22,7 +21,6 @@
|
|||
"-ldraw",
|
||||
"-lplumb",
|
||||
"-lregexp",
|
||||
"-lstdio",
|
||||
"-lString",
|
||||
"-l9p",
|
||||
"-lauth",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <disk.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -56,7 +56,7 @@ expr: NUMBER
|
|||
%%
|
||||
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "disk.h"
|
||||
#include "edit.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <disk.h>
|
||||
#include "edit.h"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <disk.h>
|
||||
#include "edit.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <regexp.h>
|
||||
|
||||
typedef struct Range Range;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <envvars.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <ip.h>
|
||||
#include <libsec.h>
|
||||
|
|
|
@ -144,7 +144,7 @@ arglist: /* nothing */ { $$ = 0; }
|
|||
%%
|
||||
/* end of grammar */
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
char *progname;
|
||||
int lineno = 1;
|
||||
jmp_buf begin;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <ip.h>
|
||||
#include <bio.h>
|
||||
#include <ndb.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "dat.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <auth.h>
|
||||
#include <9P2000.h>
|
||||
#include <draw.h>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/* ping for ip v4 and v6 */
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ip.h>
|
||||
#include <bio.h>
|
||||
#include <ndb.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <ndb.h>
|
||||
#include <ip.h>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
enum {
|
||||
F1,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
static int debug;
|
||||
static int lockwait;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <auth.h>
|
||||
#include <9P2000.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
#include <ip.h>
|
||||
#include <String.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <bio.h>
|
||||
#include <ndb.h>
|
||||
#include <ip.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "dns.h"
|
||||
|
||||
enum {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <ip.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "dns.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ip.h>
|
||||
#include <ndb.h>
|
||||
#include "dns.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
#include "dns.h"
|
||||
#include "ip.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
Biobuf in;
|
||||
Biobuf out;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <flate.h>
|
||||
#include <draw.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <draw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
Rawimage *readppm(Biobuf*, Rawimage*);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <draw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
enum {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <draw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
enum {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <draw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <lib9.h>
|
||||
#include <draw.h>
|
||||
#include <memdraw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <lib9.h>
|
||||
#include <draw.h>
|
||||
#include <memdraw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <lib9.h>
|
||||
#include <draw.h>
|
||||
#include <memdraw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <flate.h>
|
||||
#include "imagefile.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <lib9.h>
|
||||
#include <draw.h>
|
||||
#include <memdraw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include "imagefile.h"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <lib9.h>
|
||||
#include <draw.h>
|
||||
#include <memdraw.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
#include <flate.h>
|
||||
#include "imagefile.h"
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <plumb.h>
|
||||
#include "dat.h"
|
||||
#include "fns.h"
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
char Ebadwr[] = "bad rectangle in wctl request";
|
||||
char Ewalloc[] = "window allocation failed in wctl request";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <envvars.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <draw.h>
|
||||
#include <event.h>
|
||||
#include <keyboard.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <bio.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <9P2000.h> /* for %M */
|
||||
#include <String.h>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
#define SIZE 8000
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <9P2000.h>
|
||||
#include <thread.h>
|
||||
#include <9p.h>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <thread.h>
|
||||
#include <9P2000.h>
|
||||
#include <9p.h>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "cons.h"
|
||||
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
int wraparound = 1;
|
||||
int originrelative = 0;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <disk.h>
|
||||
|
||||
static Disk*
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ip.h>
|
||||
|
||||
char*
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ip.h>
|
||||
|
||||
static Ipifc**
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
static int nettrans(const char*, char*, int na, char*, int);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include "fmtdef.h"
|
||||
|
||||
enum
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
uint8_t _ctype[256] =
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
int
|
||||
jehanne_encodefmt(Fmt *f)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
/*
|
||||
* force a connection to hangup
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
/*
|
||||
* make an address, add the defaults
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
/*
|
||||
* This routine will convert to arbitrary precision
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
int
|
||||
jehanne_toupper(int c)
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
"/sys/src/lib/plumb/",
|
||||
"/sys/src/lib/regexp/",
|
||||
"/sys/src/lib/sec/",
|
||||
"/sys/src/lib/stdio/",
|
||||
"/sys/src/lib/thread/",
|
||||
"/sys/src/lib/posix/"
|
||||
]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
#include <u.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
/*
|
||||
* return ndb attribute type of an ip name
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
#include "ndbhf.h"
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
|
||||
Ndb*
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
#include "ndbhf.h"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <lib9.h>
|
||||
#include <envvars.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
#include "ndbhf.h"
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <u.h>
|
||||
#include <lib9.h>
|
||||
#include <bio.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
#include <ndb.h>
|
||||
#include "ndbhf.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "os.h"
|
||||
#include <mp.h>
|
||||
#include <libsec.h>
|
||||
#include <jehanne/ctype.h>
|
||||
#include <chartypes.h>
|
||||
|
||||
extern void jacobian_affine(mpint *p,
|
||||
mpint *X, mpint *Y, mpint *Z);
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio.h
|
||||
*/
|
||||
/*
|
||||
* According to X3J11, there is only one i/o buffer
|
||||
* and it must not be occupied by both input and output data.
|
||||
* If rp<wp, we must have state==RD and
|
||||
* if wp<rp, we must have state==WR, so that getc and putc work correctly.
|
||||
* On open, rp, wp and buf are set to 0, so first getc or putc will call _IO_getc
|
||||
* or _IO_putc, which will allocate the buffer.
|
||||
* If setvbuf(., ., _IONBF, .) is called, bufl is set to 0 and
|
||||
* buf, rp and wp are pointed at unbuf.
|
||||
* If setvbuf(., ., _IOLBF, .) is called, _IO_putc leaves wp and rp pointed at the
|
||||
* end of the buffer so that it can be called on each putc to check whether it's got
|
||||
* a newline. This nonsense is in order to avoid impacting performance of the other
|
||||
* buffering modes more than necessary -- putting the test in putc adds many
|
||||
* instructions that are wasted in non-_IOLBF mode:
|
||||
* #define putc(c, f) (_IO_ctmp=(c),\
|
||||
* (f)->wp>=(f)->rp || (f)->flags&LINEBUF && _IO_ctmp=='\n'\
|
||||
* ?_IO_putc(_IO_ctmp, f)\
|
||||
* :*(f)->wp++=_IO_ctmp)
|
||||
*
|
||||
*/
|
||||
typedef struct{
|
||||
int fd; /* UNIX file pointer */
|
||||
char flags; /* bits for must free buffer on close, line-buffered */
|
||||
char state; /* last operation was read, write, position, error, eof */
|
||||
char *buf; /* pointer to i/o buffer */
|
||||
char *rp; /* read pointer (or write end-of-buffer) */
|
||||
char *wp; /* write pointer (or read end-of-buffer) */
|
||||
char *lp; /* actual write pointer used when line-buffering */
|
||||
long bufl; /* actual length of buffer */
|
||||
char unbuf[1]; /* tiny buffer for unbuffered io (used for ungetc?) */
|
||||
}FILE;
|
||||
typedef long fpos_t;
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
/*
|
||||
* Third arg of setvbuf
|
||||
*/
|
||||
#define _IOFBF 1 /* block-buffered */
|
||||
#define _IOLBF 2 /* line-buffered */
|
||||
#define _IONBF 3 /* unbuffered */
|
||||
#define BUFSIZ 4096 /* size of setbuf buffer */
|
||||
#define EOF (-1) /* returned on end of file */
|
||||
#define FOPEN_MAX 128 /* max files open */
|
||||
#define FILENAME_MAX BUFSIZ /* silly filename length */
|
||||
#define L_tmpnam 20 /* sizeof "/tmp/abcdefghij9999 */
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#define SEEK_SET 0
|
||||
#define TMP_MAX 64 /* very hard to set correctly */
|
||||
#define stderr (&_IO_stream[2])
|
||||
#define stdin (&_IO_stream[0])
|
||||
#define stdout (&_IO_stream[1])
|
||||
#define _IO_CHMASK 0377 /* mask for 8 bit characters */
|
||||
FILE *tmpfile(void);
|
||||
char *tmpnam(char *);
|
||||
int fclose(FILE *);
|
||||
int fflush(FILE *);
|
||||
FILE *fopen(const char *, const char *);
|
||||
FILE *freopen(const char *, const char *, FILE *);
|
||||
void setbuf(FILE *, char *);
|
||||
int setvbuf(FILE *, char *, int, int32_t);
|
||||
int fprintf(FILE *, const char *, ...);
|
||||
int fscanf(FILE *, const char *, ...);
|
||||
int printf(const char *, ...);
|
||||
int scanf(const char *, ...);
|
||||
int sprintf(char *, const char *, ...);
|
||||
int sscanf(const char *, const char *, ...);
|
||||
int vfprintf(FILE *, const char *, va_list);
|
||||
int vprintf(const char *, va_list);
|
||||
int vsprintf(char *, const char *, va_list);
|
||||
int vfscanf(FILE *, const char *, va_list);
|
||||
int fgetc(FILE *);
|
||||
char *fgets(char *, int, FILE *);
|
||||
int fputc(int, FILE *);
|
||||
int fputs(const char *, FILE *);
|
||||
int getc(FILE *);
|
||||
#define getc(f) ((f)->rp>=(f)->wp?_IO_getc(f):*(f)->rp++&_IO_CHMASK)
|
||||
int _IO_getc(FILE *f);
|
||||
int getchar(void);
|
||||
#define getchar() getc(stdin)
|
||||
char *gets(char *);
|
||||
int putc(int, FILE *);
|
||||
#define putc(c, f) ((f)->wp>=(f)->rp?_IO_putc(c, f):(*(f)->wp++=c)&_IO_CHMASK)
|
||||
int _IO_putc(int, FILE *);
|
||||
int putchar(int);
|
||||
#define putchar(c) putc(c, stdout)
|
||||
int puts(const char *);
|
||||
int ungetc(int, FILE *);
|
||||
int32_t fread(void *, int32_t, int32_t, FILE *);
|
||||
int32_t fwrite(const void *, int32_t, int32_t, FILE *);
|
||||
int fgetpos(FILE *, fpos_t *);
|
||||
int fseek(FILE *, int32_t, int);
|
||||
int fsetpos(FILE *, const fpos_t *);
|
||||
int32_t ftell(FILE *);
|
||||
void rewind(FILE *);
|
||||
void clearerr(FILE *);
|
||||
int feof(FILE *);
|
||||
int ferror(FILE *);
|
||||
void perror(const char *);
|
||||
extern FILE _IO_stream[FOPEN_MAX];
|
||||
FILE *sopenr(const char *);
|
||||
FILE *sopenw(void);
|
||||
char *sclose(FILE *);
|
||||
char *dtoa(double, int, int, int*, int*, char**);
|
||||
void freedtoa(char*);
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- _IO_getc
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int _IO_getc(FILE *f){
|
||||
int cnt;
|
||||
switch(f->state){
|
||||
default: /* CLOSED, WR, ERR, EOF */
|
||||
return EOF;
|
||||
case OPEN:
|
||||
_IO_setvbuf(f);
|
||||
case RDWR:
|
||||
case RD:
|
||||
if(f->flags&STRING) return EOF;
|
||||
cnt=jehanne_read(f->fd, f->buf, f->buf==f->unbuf?1:f->bufl);
|
||||
switch(cnt){
|
||||
case -1: f->state=ERR; return EOF;
|
||||
case 0: f->state=END; return EOF;
|
||||
default:
|
||||
f->state=RD;
|
||||
f->rp=f->buf;
|
||||
f->wp=f->buf+cnt;
|
||||
return (*f->rp++)&_IO_CHMASK;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- _IO_putc, _IO_cleanup
|
||||
*/
|
||||
#include "iolib.h"
|
||||
void _IO_cleanup(void){
|
||||
fflush(NULL);
|
||||
}
|
||||
/*
|
||||
* Look this over for simplification
|
||||
*/
|
||||
int _IO_putc(int c, FILE *f){
|
||||
int cnt;
|
||||
static int first=1;
|
||||
switch(f->state){
|
||||
case RD:
|
||||
f->state=ERR;
|
||||
case ERR:
|
||||
case CLOSED:
|
||||
return EOF;
|
||||
case OPEN:
|
||||
_IO_setvbuf(f);
|
||||
/* fall through */
|
||||
case RDWR:
|
||||
case END:
|
||||
f->rp=f->buf+f->bufl;
|
||||
if(f->flags&LINEBUF){
|
||||
f->wp=f->rp;
|
||||
f->lp=f->buf;
|
||||
}
|
||||
else
|
||||
f->wp=f->buf;
|
||||
break;
|
||||
}
|
||||
if(first){
|
||||
atexit(_IO_cleanup);
|
||||
first=0;
|
||||
}
|
||||
if(f->flags&STRING){
|
||||
f->rp=f->buf+f->bufl;
|
||||
if(f->wp==f->rp){
|
||||
if(f->flags&BALLOC)
|
||||
f->buf=realloc(f->buf, f->bufl+BUFSIZ);
|
||||
else{
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
if(f->buf==NULL){
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
f->rp=f->buf+f->bufl;
|
||||
f->bufl+=BUFSIZ;
|
||||
}
|
||||
*f->wp++=c;
|
||||
}
|
||||
else if(f->flags&LINEBUF){
|
||||
if(f->lp==f->rp){
|
||||
cnt=f->lp-f->buf;
|
||||
if(f->flags&APPEND) sys_seek(f->fd, 0L, 2);
|
||||
if(cnt!=0 && jehanne_write(f->fd, f->buf, cnt)!=cnt){
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
f->lp=f->buf;
|
||||
}
|
||||
*f->lp++=c;
|
||||
if(c=='\n'){
|
||||
cnt=f->lp-f->buf;
|
||||
if(f->flags&APPEND) sys_seek(f->fd, 0L, 2);
|
||||
if(cnt!=0 && jehanne_write(f->fd, f->buf, cnt)!=cnt){
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
f->lp=f->buf;
|
||||
}
|
||||
}
|
||||
else if(f->buf==f->unbuf){
|
||||
f->unbuf[0]=c;
|
||||
if(f->flags&APPEND) sys_seek(f->fd, 0L, 2);
|
||||
if(jehanne_write(f->fd, f->buf, 1)!=1){
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(f->wp==f->rp){
|
||||
cnt=f->wp-f->buf;
|
||||
if(f->flags&APPEND) sys_seek(f->fd, 0L, 2);
|
||||
if(cnt!=0 && jehanne_write(f->fd, f->buf, cnt)!=cnt){
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
f->wp=f->buf;
|
||||
f->rp=f->buf+f->bufl;
|
||||
}
|
||||
*f->wp++=c;
|
||||
}
|
||||
f->state=WR;
|
||||
/*
|
||||
* Make sure EOF looks different from putc(-1)
|
||||
* Should be able to cast to unsigned char, but
|
||||
* there's a vc bug preventing that from working
|
||||
*/
|
||||
return c&0xff;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
{
|
||||
"libstdio": {
|
||||
"Include": [
|
||||
"../lib.json"
|
||||
],
|
||||
"Install": "/arch/$ARCH/lib/",
|
||||
"Library": "libstdio.a",
|
||||
"SourceFiles": [
|
||||
"_IO_getc.c",
|
||||
"_IO_putc.c",
|
||||
"clearerr.c",
|
||||
"dtoa.c",
|
||||
"fclose.c",
|
||||
"fdopen.c",
|
||||
"feof.c",
|
||||
"ferror.c",
|
||||
"fflush.c",
|
||||
"fgetc.c",
|
||||
"fgetpos.c",
|
||||
"fgets.c",
|
||||
"fileno.c",
|
||||
"fopen.c",
|
||||
"fprintf.c",
|
||||
"fputc.c",
|
||||
"fputs.c",
|
||||
"fread.c",
|
||||
"freopen.c",
|
||||
"fscanf.c",
|
||||
"fseek.c",
|
||||
"fseeko.c",
|
||||
"fsetpos.c",
|
||||
"ftell.c",
|
||||
"ftello.c",
|
||||
"fwrite.c",
|
||||
"getc.c",
|
||||
"gets.c",
|
||||
"printf.c",
|
||||
"putc.c",
|
||||
"puts.c",
|
||||
"rewind.c",
|
||||
"scanf.c",
|
||||
"sclose.c",
|
||||
"setbuf.c",
|
||||
"setvbuf.c",
|
||||
"snprintf.c",
|
||||
"sopenr.c",
|
||||
"sopenw.c",
|
||||
"sprintf.c",
|
||||
"sscanf.c",
|
||||
"tmpfile.c",
|
||||
"tmpnam.c",
|
||||
"ungetc.c",
|
||||
"vfprintf.c",
|
||||
"vfscanf.c",
|
||||
"vprintf.c",
|
||||
"vsnprintf.c",
|
||||
"vsprintf.c"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- clearerr
|
||||
*/
|
||||
#include "iolib.h"
|
||||
void clearerr(FILE *f){
|
||||
switch(f->state){
|
||||
case ERR:
|
||||
f->state=f->buf?RDWR:OPEN;
|
||||
break;
|
||||
case END:
|
||||
f->state=RDWR;
|
||||
break;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fclose
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fclose(FILE *f){
|
||||
int error=0;
|
||||
if(f->state==CLOSED) return EOF;
|
||||
if(fflush(f)==EOF) error=EOF;
|
||||
if(f->flags&BALLOC) free(f->buf);
|
||||
if(!(f->flags&STRING) && sys_close(f->fd)<0) error=EOF;
|
||||
f->state=CLOSED;
|
||||
f->flags=0;
|
||||
return error;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Posix stdio -- fdopen
|
||||
*/
|
||||
#include "iolib.h"
|
||||
/*
|
||||
* Open the named file with the given mode, using the given FILE
|
||||
* Legal modes are given below, `additional characters may follow these sequences':
|
||||
* r rb open to read
|
||||
* w wb open to write, truncating
|
||||
* a ab open to write positioned at eof, creating if non-existant
|
||||
* r+ r+b rb+ open to read and write, creating if non-existant
|
||||
* w+ w+b wb+ open to read and write, truncating
|
||||
* a+ a+b ab+ open to read and write, positioned at eof, creating if non-existant.
|
||||
*/
|
||||
FILE *fdopen(const int fd, const char *mode){
|
||||
FILE *f;
|
||||
qlock(&_stdiolk);
|
||||
for(f=_IO_stream;f!=&_IO_stream[FOPEN_MAX];f++)
|
||||
if(f->state==CLOSED)
|
||||
break;
|
||||
if(f==&_IO_stream[FOPEN_MAX]) {
|
||||
qunlock(&_stdiolk);
|
||||
return NULL;
|
||||
}
|
||||
f->fd=fd;
|
||||
if(mode[0]=='a')
|
||||
sys_seek(f->fd, 0L, 2);
|
||||
if(f->fd==-1) return NULL;
|
||||
f->flags=0;
|
||||
f->state=OPEN;
|
||||
f->buf=0;
|
||||
f->rp=0;
|
||||
f->wp=0;
|
||||
f->lp=0;
|
||||
qunlock(&_stdiolk);
|
||||
return f;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- feof
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int feof(FILE *f){
|
||||
return f->state==END;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- ferror
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int ferror(FILE *f){
|
||||
return f->state==ERR;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fflush
|
||||
*/
|
||||
#include "iolib.h"
|
||||
/*
|
||||
* pANS stdio -- data (put here, since loader won't load a separate file)
|
||||
*/
|
||||
FILE _IO_stream[]={
|
||||
/* fd flags state buf rp wp lp bufl unbuf */
|
||||
0, 0, OPEN, 0, 0, 0, 0, 0, 0,
|
||||
1, 0, OPEN, 0, 0, 0, 0, 0, 0,
|
||||
2, 0, OPEN, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
int _fflush(FILE *f){
|
||||
int error, cnt;
|
||||
|
||||
if(f==NULL){
|
||||
error=0;
|
||||
for(f=_IO_stream;f!=&_IO_stream[FOPEN_MAX];f++)
|
||||
if(f->state==WR && _fflush(f)==EOF)
|
||||
error=EOF;
|
||||
return error;
|
||||
}
|
||||
if(f->flags&STRING) return EOF;
|
||||
switch(f->state){
|
||||
default: /* OPEN RDWR EOF RD */
|
||||
return 0;
|
||||
case CLOSED:
|
||||
case ERR:
|
||||
return EOF;
|
||||
case WR:
|
||||
cnt=(f->flags&LINEBUF?f->lp:f->wp)-f->buf;
|
||||
if(cnt && jehanne_write(f->fd, f->buf, cnt)!=cnt){
|
||||
f->state=ERR;
|
||||
return EOF;
|
||||
}
|
||||
f->rp=f->wp=f->buf;
|
||||
f->state=RDWR;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int fflush(FILE *f)
|
||||
{
|
||||
int r;
|
||||
|
||||
qlock(&_stdiolk);
|
||||
r = _fflush(f);
|
||||
qunlock(&_stdiolk);
|
||||
return r;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fgetc
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fgetc(FILE *f){
|
||||
return getc(f);
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fgetpos
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fgetpos(FILE *f, fpos_t *pos){
|
||||
*pos=ftell(f);
|
||||
return *pos==-1?-1:0;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fgets
|
||||
*/
|
||||
#include "iolib.h"
|
||||
char *fgets(char *as, int n, FILE *f){
|
||||
int c;
|
||||
char *s=as;
|
||||
c = EOF;
|
||||
while(n>1 && (c=getc(f))!=EOF){
|
||||
*s++=c;
|
||||
--n;
|
||||
if(c=='\n') break;
|
||||
}
|
||||
if(c==EOF && s==as
|
||||
|| ferror(f)) return NULL;
|
||||
if(n) *s='\0';
|
||||
return as;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Posix stdio -- fileno
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fileno(FILE *f){
|
||||
if(f==NULL)
|
||||
return -1;
|
||||
else
|
||||
return f->fd;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fopen
|
||||
*/
|
||||
#include "iolib.h"
|
||||
FILE *fopen(const char *name, const char *mode){
|
||||
FILE *f;
|
||||
qlock(&_stdiolk);
|
||||
for(f=_IO_stream;f!=&_IO_stream[FOPEN_MAX];f++) {
|
||||
if(f->state==CLOSED) {
|
||||
qunlock(&_stdiolk);
|
||||
return freopen(name, mode, f);
|
||||
}
|
||||
}
|
||||
qunlock(&_stdiolk);
|
||||
return NULL;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fprintf
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fprintf(FILE *f, const char *fmt, ...){
|
||||
int n;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
n=vfprintf(f, fmt, args);
|
||||
va_end(args);
|
||||
return n;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fputc
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fputc(int c, FILE *f){
|
||||
return putc(c, f); /* This can be made more fair to _IOLBF-mode streams */
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fputs
|
||||
*/
|
||||
#include "iolib.h"
|
||||
int fputs(const char *s, FILE *f){
|
||||
while(*s) putc(*s++, f);
|
||||
return ferror(f)?EOF:0;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* pANS stdio -- fread
|
||||
*/
|
||||
#include "iolib.h"
|
||||
|
||||
#define BIGN (BUFSIZ/2)
|
||||
|
||||
int32_t fread(void *p, int32_t recl, int32_t nrec, FILE *f){
|
||||
char *s;
|
||||
int n, d, c;
|
||||
|
||||
s=(char *)p;
|
||||
n=recl*nrec;
|
||||
while(n>0){
|
||||
d=f->wp-f->rp;
|
||||
if(d>0){
|
||||
if(d>n)
|
||||
d=n;
|
||||
memmove(s, f->rp, d);
|
||||
f->rp+=d;
|
||||
}else{
|
||||
if(n >= BIGN && f->state==RD && !(f->flags&STRING) && f->buf!=f->unbuf){
|
||||
d=jehanne_read(f->fd, s, n);
|
||||
if(d<=0){
|
||||
f->state=(d==0)?END:ERR;
|
||||
goto ret;
|
||||
}
|
||||
}else{
|
||||
c=_IO_getc(f);
|
||||
if(c==EOF)
|
||||
goto ret;
|
||||
*s=c;
|
||||
d=1;
|
||||
}
|
||||
}
|
||||
s+=d;
|
||||
n-=d;
|
||||
}
|
||||
ret:
|
||||
return (s-(char *)p)/(recl?recl:1);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue