From 5da21dbf415fb074856f3569bc1a0053d2760cdd Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 1 Jun 1996 00:05:08 +0000 Subject: [PATCH] more generalized. More fallback functions git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@551 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/gettimeofday.c | 20 ++++++++++++++++++++ lib/roken/swab.c | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 lib/roken/gettimeofday.c create mode 100644 lib/roken/swab.c diff --git a/lib/roken/gettimeofday.c b/lib/roken/gettimeofday.c new file mode 100644 index 000000000..f394c50cf --- /dev/null +++ b/lib/roken/gettimeofday.c @@ -0,0 +1,20 @@ +#ifdef HAVE_CONFIG_H +#include +RCSID("$Id$"); +#endif + +#ifndef HAVE_GETTIMEOFDAY +/* + * Simple gettimeofday that only returns seconds. + */ +int +gettimeofday (struct timeval *tp, void *ignore) +{ + time_t t; + + t = time(NULL); + tp->tv_sec = t; + tp->tv_usec = 0; + return 0; +} +#endif diff --git a/lib/roken/swab.c b/lib/roken/swab.c new file mode 100644 index 000000000..34aeeeeb7 --- /dev/null +++ b/lib/roken/swab.c @@ -0,0 +1,18 @@ +#ifdef HAVE_CONFIG_H +#include +RCSID("$Id$"); +#endif + +#ifndef HAVE_SWAB +void +swab (char *from, char *to, int nbytes) +{ + while(nbytes >= 2) { + *(to + 1) = *from; + *to = *(from + 1); + to += 2; + from += 2; + nbytes -= 2; + } +} +#endif