To make it compile with clang I added void to print_*() funcs' arguments. Also I had to remove inline specifiers because clang was throwing undefined reference.

This commit is contained in:
Alexander Andreev 2024-04-26 04:45:27 +04:00
parent 4b4e64500a
commit a9a649d280
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

16
main.c
View File

@ -11,11 +11,11 @@ typedef unsigned long interval_t;
int parse_arguments(const int argc, const char *const *const argv,
price_t *const price, wattage_t *const wattage, interval_t *const interval);
inline interval_t interval_to_seconds(const char *const interval);
inline price_t price_kwh_to_wattsecond(const price_t price);
interval_t interval_to_seconds(const char *const interval);
price_t price_kwh_to_wattsecond(const price_t price);
inline void print_version();
inline void print_usage();
void print_version(void);
void print_usage(void);
int main(const int argc, const char *const *const argv) {
price_t price;
@ -62,7 +62,7 @@ int parse_arguments(const int argc, const char *const *const argv,
return 0;
}
inline interval_t interval_to_seconds(const char *const interval) {
interval_t interval_to_seconds(const char *const interval) {
interval_t intrvl = (interval_t)atol(interval);
switch (interval[strlen(interval) - 1]) {
@ -80,18 +80,18 @@ inline interval_t interval_to_seconds(const char *const interval) {
}
}
inline price_t price_kwh_to_wattsecond(const price_t price) {
price_t price_kwh_to_wattsecond(const price_t price) {
return price / 1000.f / 3600.f;
}
inline void print_version() {
void print_version(void) {
fputs("kwh-cost Ver. " VERSION "\n"
"Copyright (C) 2021-2024 Alexander \"Arav\" Andreev <me@arav.su>. All rights reserved.\n"
"This program is distributed under the terms of MIT+NIGGER licence.\n"
"You can see a license for this program in /usr/share/licenses/kwh-cost/LICENSE.\n", stderr);
}
inline void print_usage() {
void print_usage(void) {
fputs("Usage: kwh-cost [OPTIONS] price wattage interval [interval ...]\n"
"Options:\n"
" --help, -h display this usage information.\n"