} while (0)
#define print_to_socket(fh, ...) \
- if (fprintf (fh, __VA_ARGS__) < 0) { \
- char errbuf[1024]; \
- WARNING ("handle_listval: failed to write to socket #%i: %s", \
- fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
- free_everything_and_return (-1); \
- }
+ do { \
+ if (fprintf (fh, __VA_ARGS__) < 0) { \
+ char errbuf[1024]; \
+ WARNING ("handle_listval: failed to write to socket #%i: %s", \
+ fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
+ free_everything_and_return (-1); \
+ } \
+ fflush(fh); \
+ } while (0)
int handle_listval (FILE *fh, char *buffer)
{
char *command;
char **names = NULL;
- time_t *times = NULL;
+ cdtime_t *times = NULL;
size_t number = 0;
size_t i;
int status;
print_to_socket (fh, "%i Value%s found\n",
(int) number, (number == 1) ? "" : "s");
for (i = 0; i < number; i++)
- print_to_socket (fh, "%u %s\n", (unsigned int) times[i], names[i]);
+ print_to_socket (fh, "%.3f %s\n", CDTIME_T_TO_DOUBLE (times[i]),
+ names[i]);
free_everything_and_return (0);
} /* int handle_listval */