mirror of
https://github.com/linux-msm/qdl.git
synced 2026-10-07 06:29:17 -07:00
The repository root had accumulated ~45 .c/.h files sitting directly next to the project files (meson.build, scripts/, tests/, docs). Move all sources under src/ and the public header to include/ so the top level reflects the shape of the project rather than its source file count. This commit is a pure git mv with no content changes, so git log --follow keeps working across the move. Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
77 lines
1.3 KiB
C
77 lines
1.3 KiB
C
// SPDX-License-Identifier: BSD-3-Clause
|
|
#ifdef _WIN32
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdarg.h>
|
|
#include <string.h>
|
|
#include "oscompat.h"
|
|
|
|
extern const char *__progname;
|
|
|
|
void timeradd(const struct timeval *a, const struct timeval *b, struct timeval *result)
|
|
{
|
|
result->tv_sec = a->tv_sec + b->tv_sec;
|
|
result->tv_usec = a->tv_usec + b->tv_usec;
|
|
if (result->tv_usec >= 1000000) {
|
|
result->tv_sec += 1;
|
|
result->tv_usec -= 1000000;
|
|
}
|
|
}
|
|
|
|
void err(int eval, const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
fprintf(stderr, "%s: ", __progname);
|
|
if (fmt) {
|
|
vfprintf(stderr, fmt, ap);
|
|
fprintf(stderr, ": ");
|
|
}
|
|
fprintf(stderr, "%s\n", strerror(errno));
|
|
va_end(ap);
|
|
exit(eval);
|
|
}
|
|
|
|
void errx(int eval, const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
fprintf(stderr, "%s: ", __progname);
|
|
if (fmt)
|
|
vfprintf(stderr, fmt, ap);
|
|
fprintf(stderr, "\n");
|
|
va_end(ap);
|
|
exit(eval);
|
|
}
|
|
|
|
void warn(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
fprintf(stderr, "%s: ", __progname);
|
|
if (fmt) {
|
|
vfprintf(stderr, fmt, ap);
|
|
fprintf(stderr, ": ");
|
|
}
|
|
fprintf(stderr, "%s\n", strerror(errno));
|
|
va_end(ap);
|
|
}
|
|
|
|
void warnx(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
fprintf(stderr, "%s: ", __progname);
|
|
if (fmt)
|
|
vfprintf(stderr, fmt, ap);
|
|
fprintf(stderr, "\n");
|
|
va_end(ap);
|
|
}
|
|
|
|
#endif // _WIN32
|