diff options
Diffstat (limited to 'contrib/opie/libmissing')
-rw-r--r-- | contrib/opie/libmissing/Makefile.in | 34 | ||||
-rw-r--r-- | contrib/opie/libmissing/bogus.c | 1 | ||||
-rw-r--r-- | contrib/opie/libmissing/endutent.c | 19 | ||||
-rw-r--r-- | contrib/opie/libmissing/getutline.c | 63 | ||||
-rw-r--r-- | contrib/opie/libmissing/pututline.c | 64 | ||||
-rw-r--r-- | contrib/opie/libmissing/setutent.c | 18 |
6 files changed, 199 insertions, 0 deletions
diff --git a/contrib/opie/libmissing/Makefile.in b/contrib/opie/libmissing/Makefile.in new file mode 100644 index 0000000..fb3d5b2 --- /dev/null +++ b/contrib/opie/libmissing/Makefile.in @@ -0,0 +1,34 @@ +## +# Makefile.in/Makefile: Directions for building libmissing. +# +# %%% copyright-cmetz-96 +# This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved. +# The Inner Net License Version 3 applies to this software. +# You should have received a copy of the license with this software. If +# you didn't get a copy, you may request one from <license@inner.net>. +# +# History: +# +# Modified by cmetz for OPIE 2.4. Add current dir to include header path. +# Use ar 'cr' instead of 'r'. Renamed realclean to distclean. +# Created by cmetz for OPIE 2.3 using old Makefiles as a guide. + +OBJS=bogus.o @MISSING@ + +CC=@CC@ +CFLAGS=$(CFL) -I.. -I. +TARGET=libmissing.a + +all: $(TARGET) + +$(TARGET): $(OBJS) + @AR@ @ARFLAGS@ $(TARGET) $(OBJS) + @RANLIB@ $(TARGET) + +clean: + -rm -f $(OBJS) $(TARGET) + +realclean: distclean + +distclean: clean + -rm -f *~ core* "\#*\#" *.o *.a Makefile diff --git a/contrib/opie/libmissing/bogus.c b/contrib/opie/libmissing/bogus.c new file mode 100644 index 0000000..68dcc54 --- /dev/null +++ b/contrib/opie/libmissing/bogus.c @@ -0,0 +1 @@ +int _bogus; diff --git a/contrib/opie/libmissing/endutent.c b/contrib/opie/libmissing/endutent.c new file mode 100644 index 0000000..e0355b7 --- /dev/null +++ b/contrib/opie/libmissing/endutent.c @@ -0,0 +1,19 @@ +/* endutent.c: A replacement for the endutent function + +%%% copyright-cmetz-96 +This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved. +The Inner Net License Version 3 applies to this software. +You should have received a copy of the license with this software. If +you didn't get a copy, you may request one from <license@inner.net>. + + History: + + Modified by cmetz for OPIE 2.31. Use VOIDRET macro. + Created by cmetz for OPIE 2.3. +*/ +#include "opie_cfg.h" +#include "opie.h" + +VOIDRET endutent FUNCTION_NOARGS +{ +} diff --git a/contrib/opie/libmissing/getutline.c b/contrib/opie/libmissing/getutline.c new file mode 100644 index 0000000..929d024 --- /dev/null +++ b/contrib/opie/libmissing/getutline.c @@ -0,0 +1,63 @@ +/* getutline.c: A replacement for the getutline() function + +%%% copyright-cmetz-96 +This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved. +The Inner Net License Version 3 applies to this software. +You should have received a copy of the license with this software. If +you didn't get a copy, you may request one from <license@inner.net>. + + History: + + Modified by cmetz for OPIE 2.32. Fixed check for fread() return + value. + Modified by cmetz for OPIE 2.31. If the OS won't tell us where + _PATH_UTMP is, play the SVID game, then use + Autoconf-discovered values. + Created by cmetz for OPIE 2.3. +*/ + +#include "opie_cfg.h" +#include <stdio.h> +#include <utmp.h> +#include "opie.h" + +static struct utmp u; + +#ifndef _PATH_UTMP +#ifdef UTMP_FILE +#define _PATH_UTMP UTMP_FILE +#else /* UTMP_FILE */ +#define _PATH_UTMP PATH_UTMP_AC +#endif /* UTMP_FILE */ +#endif /* _PATH_UTMP */ + +struct utmp *getutline FUNCTION((utmp), struct utmp *utmp) +{ + FILE *f; + int i; + + if (!(f = __opieopen(_PATH_UTMP, 0, 0644))) + return 0; + +#if HAVE_TTYSLOT + if (i = ttyslot()) { + if (fseek(f, i * sizeof(struct utmp), SEEK_SET) < 0) + goto ret; + if (fread(&u, sizeof(struct utmp), 1, f) != 1) + goto ret; + fclose(f); + return &u; + } +#endif /* HAVE_TTYSLOT */ + + while(fread(&u, sizeof(struct utmp), 1, f) == 1) { + if (!strncmp(utmp->ut_line, u.ut_line, sizeof(u.ut_line) - 1)) { + fclose(f); + return &u; + } + } + +ret: + fclose(f); + return NULL; +} diff --git a/contrib/opie/libmissing/pututline.c b/contrib/opie/libmissing/pututline.c new file mode 100644 index 0000000..718ecba --- /dev/null +++ b/contrib/opie/libmissing/pututline.c @@ -0,0 +1,64 @@ +/* pututline.c: A replacement for the pututline() function + +%%% copyright-cmetz-96 +This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved. +The Inner Net License Version 3 applies to this software. +You should have received a copy of the license with this software. If +you didn't get a copy, you may request one from <license@inner.net>. + + History: + + Modified by cmetz for OPIE 2.32. Fixed check for fread() return + value. + Modified by cmetz for OPIE 2.31. If the OS won't tell us where + _PATH_UTMP is, use Autoconf-discovered values. + Created by cmetz for OPIE 2.3. +*/ + +#include "opie_cfg.h" +#include <stdio.h> +#include <utmp.h> +#include "opie.h" + +#ifndef _PATH_UTMP +#define _PATH_UTMP PATH_UTMP_AC +#endif /* _PATH_UTMP */ + +void pututline FUNCTION((utmp), struct utmp *utmp) +{ + FILE *f; + struct utmp u; + int i; + + if (!(f = __opieopen(_PATH_UTMP, 1, 0644))) + return; + +#if HAVE_TTYSLOT + if (i = ttyslot()) { + if (fseek(f, i * sizeof(struct utmp), SEEK_SET) < 0) + goto ret; + fwrite(utmp, sizeof(struct utmp), 1, f); + goto ret; + } +#endif /* HAVE_TTYSLOT */ + + while(fread(&u, sizeof(struct utmp), 1, f) == 1) { + if (!strncmp(utmp->ut_line, u.ut_line, sizeof(u.ut_line) - 1)) { + if ((i = ftell(f)) < 0) + goto ret; + if (fseek(f, i - sizeof(struct utmp), SEEK_SET) < 0) + goto ret; + fwrite(utmp, sizeof(struct utmp), 1, f); + goto ret; + } + } + + fclose(f); + + if (!(f = __opieopen(_PATH_UTMP, 2, 0644))) + return; + fwrite(utmp, sizeof(struct utmp), 1, f); + +ret: + fclose(f); +} diff --git a/contrib/opie/libmissing/setutent.c b/contrib/opie/libmissing/setutent.c new file mode 100644 index 0000000..865fcd1 --- /dev/null +++ b/contrib/opie/libmissing/setutent.c @@ -0,0 +1,18 @@ +/* setutent.c: A replacement for the setutent function + +%%% copyright-cmetz-96 +This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved. +The Inner Net License Version 3 applies to this software. +You should have received a copy of the license with this software. If +you didn't get a copy, you may request one from <license@inner.net>. + + History: + + Created by cmetz for OPIE 2.31. +*/ +#include "opie_cfg.h" +#include "opie.h" + +VOIDRET setutent FUNCTION_NOARGS +{ +} |