diff --git a/WEGA/src/lib/libc/TODO b/WEGA/src/lib/libc/TODO index dd97d43..a885438 100644 --- a/WEGA/src/lib/libc/TODO +++ b/WEGA/src/lib/libc/TODO @@ -1,15 +1,12 @@ __callex.o __callex.c C atof.o atof.s ASM cnvt.o cnvt.c C -ctermid.o ctermid.c C -cuserid.o cuserid.c C decimal.o decimal.s ASM doprnt.o doprnt.c C ecvt.o ecvt.s ASM ffltioc.o ffltioc.c C fltioc.o fltioc.c C goodmagic.o goodmagic.c C -index.o index.c C length.o length.c C mpx.o mpx.c C pow10.o pow10.s ASM diff --git a/WEGA/src/lib/libc/TODO.done b/WEGA/src/lib/libc/TODO.done index d648d17..235516f 100644 --- a/WEGA/src/lib/libc/TODO.done +++ b/WEGA/src/lib/libc/TODO.done @@ -154,3 +154,6 @@ strout.o strout.c C system.o system.c C ungetc.o ungetc.c C tmpnam.o tmpnam.c C +ctermid.o ctermid.c C +cuserid.o cuserid.c C +index.o index.c C diff --git a/WEGA/src/lib/libc/gen/index.c b/WEGA/src/lib/libc/gen/index.c new file mode 100644 index 0000000..c0688ac --- /dev/null +++ b/WEGA/src/lib/libc/gen/index.c @@ -0,0 +1,19 @@ +/* @[$] index.c 2.1 09/12/83 11:25:08 - 87wega3.2 */ + +/* + * Return the ptr in sp at which the character c appears; + * NULL if not found + */ + +#define NULL 0 + +char * +index(sp, c) +register char *sp, c; +{ + do { + if (*sp == c) + return(sp); + } while (*sp++); + return(NULL); +} diff --git a/WEGA/src/lib/libc/stdio/ctermid.c b/WEGA/src/lib/libc/stdio/ctermid.c new file mode 100644 index 0000000..b2cdd44 --- /dev/null +++ b/WEGA/src/lib/libc/stdio/ctermid.c @@ -0,0 +1,14 @@ +/* @[$] ctermid.c 2.1 09/12/83 11:17:07 - 87wega3.2 */ + +#include + +char *ctermid(s) + char *s; +{ + static char res[L_ctermid]; + register char *r; + + r = s==NULL? res: s; + strcpy (r, "/dev/tty"); + return r; +} diff --git a/WEGA/src/lib/libc/stdio/cuserid.c b/WEGA/src/lib/libc/stdio/cuserid.c new file mode 100644 index 0000000..38bf6b4 --- /dev/null +++ b/WEGA/src/lib/libc/stdio/cuserid.c @@ -0,0 +1,29 @@ +/* @[$] cuserid.c 2.1 09/12/83 11:17:20 - 87wega3.2 */ + +#include +#include + +char *cuserid(s) +char *s; +{ + static char res[L_cuserid]; + struct passwd *pw, *getpwuid(); + char *getlogin(); + int getuid(); + register char *p, *r; + + r = s==NULL? res: s; + p = getlogin(); + if(p != NULL) + strcpy(r, p); + else { + pw = getpwuid(getuid()); + if(pw == NULL) { + *r = '\0'; + r = NULL; + } else + strcpy(r, pw->pw_name); + endpwent(); + } + return(r); +} diff --git a/WEGA/src/lib/libc/stdio/tmpnam.c b/WEGA/src/lib/libc/stdio/tmpnam.c index 52adbce..b9da0d4 100644 --- a/WEGA/src/lib/libc/stdio/tmpnam.c +++ b/WEGA/src/lib/libc/stdio/tmpnam.c @@ -1,6 +1,5 @@ /* @[$] tmpnam.c 2.1 09/12/83 11:18:21 - 87wega3.2 */ -/*LINTLIBRARY*/ #include char *tmpnam(s)