| 1 |
|
| 2 |
#include "sox.h" |
| 3 |
#include <stdio.h> |
| 4 |
|
| 5 |
#if defined(__STDC__) || defined(_MSC_VER) |
| 6 |
#include <stdarg.h> |
| 7 |
#include <stdlib.h> |
| 8 |
#else |
| 9 |
#include <varargs.h> |
| 10 |
#endif |
| 11 |
|
| 12 |
static int verbose = 0; |
| 13 |
static char *myname="iaxclient-sox"; |
| 14 |
|
| 15 |
void st_report(const char *fmt, ...) |
| 16 |
{ |
| 17 |
va_list args; |
| 18 |
|
| 19 |
if (! verbose) |
| 20 |
return; |
| 21 |
|
| 22 |
fprintf(stderr, "%s: ", myname); |
| 23 |
va_start(args, fmt); |
| 24 |
vfprintf(stderr, fmt, args); |
| 25 |
va_end(args); |
| 26 |
fprintf(stderr, "\n"); |
| 27 |
} |
| 28 |
|
| 29 |
void st_warn(const char *fmt, ...) |
| 30 |
{ |
| 31 |
va_list args; |
| 32 |
|
| 33 |
fprintf(stderr, "%s: ", myname); |
| 34 |
va_start(args, fmt); |
| 35 |
|
| 36 |
vfprintf(stderr, fmt, args); |
| 37 |
va_end(args); |
| 38 |
fprintf(stderr, "\n"); |
| 39 |
} |
| 40 |
|
| 41 |
void st_fail(const char *fmt, ...) |
| 42 |
{ |
| 43 |
va_list args; |
| 44 |
extern void cleanup(); |
| 45 |
|
| 46 |
fprintf(stderr, "%s: ", myname); |
| 47 |
|
| 48 |
va_start(args, fmt); |
| 49 |
vfprintf(stderr, fmt, args); |
| 50 |
va_end(args); |
| 51 |
fprintf(stderr, "\n"); |
| 52 |
exit(2); |
| 53 |
} |
| 54 |
|
| 55 |
long st_gcd(long a, long b) |
| 56 |
{ |
| 57 |
if (b == 0) |
| 58 |
return a; |
| 59 |
else |
| 60 |
return st_gcd(b, a % b); |
| 61 |
} |
| 62 |
|
| 63 |
|