| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _SEEN_UTILS_H |
| 10 | #define _SEEN_UTILS_H 1 |
| 11 | |
| 12 | #include <time.h> /* time_t */ |
| 13 | |
| 14 | #define PROPLENGTH 64 /* Max number of properties */ |
| 15 | |
| 16 | enum valtype { |
| 17 | INVALID = 0, |
| 18 | INT, |
| 19 | BOOLEAN, |
| 20 | STR, |
| 21 | MURI, |
| 22 | OTHER |
| 23 | }; |
| 24 | |
| 25 | typedef struct _confkeyval { |
| 26 | char *key; |
| 27 | char *val; |
| 28 | int ival; |
| 29 | enum valtype type; |
| 30 | } confkeyval; |
| 31 | |
| 32 | void readConfFile(confkeyval *list, FILE *cnf); |
| 33 | void readConfFileFull(confkeyval *list, FILE *cnf); |
| 34 | void freeConfFile(confkeyval *list); |
| 35 | int defaultProperty(const char *key); |
| 36 | confkeyval *findConfKey(confkeyval *list, const char *key); |
| 37 | char *getConfVal(confkeyval *list, const char *key); |
| 38 | int getConfNum(confkeyval *list, const char *key); |
| 39 | char *setConfVal(confkeyval *ckv, const char *val); |
| 40 | char *setConfValForKey(confkeyval *list, const char *key, const char *val); |
| 41 | void secondsToString(char *buf, time_t t, int longness); |
| 42 | void abbreviateString(char *ret, const char *in, size_t width); |
| 43 | void generateSalt(char *buf, unsigned int len); |
| 44 | char *generatePassphraseFile(const char *path); |
| 45 | void sleep_ms(size_t ms); |
| 46 | |
| 47 | #endif |
| 48 | |
| 49 | /* vim:set ts=4 sw=4 noexpandtab: */ |
| 50 | |