Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / arch / all-unix / battclock / battclock_init.c
blob8d0277b89cdf3213a4dfcab93a1fe997574e5ecb
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
7 #include <aros/libcall.h>
8 #include <aros/symbolsets.h>
9 #include <proto/exec.h>
10 #include <proto/hostlib.h>
12 #include <time.h>
14 #include "battclock_intern.h"
16 #ifdef HOST_OS_linux
17 #ifndef HOST_OS_android
18 #define LIBC_NAME "libc.so.6"
19 #endif
20 #endif
22 #ifdef HOST_OS_darwin
23 #define LIBC_NAME "libSystem.dylib"
24 #endif
26 #ifndef LIBC_NAME
27 #define LIBC_NAME "libc.so"
28 #endif
30 static const char *Symbols[] = {
31 "time",
32 "localtime",
33 NULL
36 /* auto init */
37 static int BattClock_Init(struct BattClockBase *BattClockBase)
39 APTR HostLibBase;
40 ULONG r;
42 HostLibBase = OpenResource("hostlib.resource");
43 D(bug("[battclock] HostLibBase = 0x%08lX\n", HostLibBase));
45 if (HostLibBase)
47 BattClockBase->Lib = HostLib_Open(LIBC_NAME, NULL);
48 if (BattClockBase->Lib)
50 BattClockBase->SysIFace = (struct BattclockInterface *)HostLib_GetInterface(BattClockBase->Lib, Symbols, &r);
51 D(bug("[battclock] SysIFace = 0x%08lX, unresolved: %u\n", BattClockBase->SysIFace, r));
53 if (BattClockBase->SysIFace)
55 if (!r)
56 return 1;
57 HostLib_DropInterface((APTR)BattClockBase->SysIFace);
59 HostLib_Close(BattClockBase->Lib, NULL);
62 return 0;
65 ADD2INITLIB(BattClock_Init, 0)