X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_tail.h;h=c47931976dda5551a0bdb492e39c2346e1c6efe5;hb=be99a844a40d7037a910d37a894988b807631a6e;hp=a456870c1f962122ef5a74d52fd6618acb60dcf6;hpb=b6daf13a37b3f3ec4b4b78bc4e97718efa2eeeeb;p=collectd.git diff --git a/src/utils_tail.h b/src/utils_tail.h index a456870c..c4793197 100644 --- a/src/utils_tail.h +++ b/src/utils_tail.h @@ -1,6 +1,6 @@ /** * collectd - src/utils_tail.h - * Copyright (C) 2007 C-Ware, Inc. + * Copyright (C) 2007-2008 C-Ware, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -30,7 +30,7 @@ struct cu_tail_s; typedef struct cu_tail_s cu_tail_t; -typedef int tailfunc(void *data, char *buf, int buflen); +typedef int tailfunc_t(void *data, char *buf, int buflen); /* * NAME @@ -59,7 +59,12 @@ int cu_tail_destroy (cu_tail_t *obj); * * Reads from the file until `buflen' characters are read, a newline * character is read, or an eof condition is encountered. `buf' is - * always null-terminated on successful return. + * always null-terminated on successful return and isn't touched when non-zero + * is returned. + * + * You can check if the EOF condition is reached by looking at the buffer: If + * the length of the string stored in the buffer is zero, EOF occurred. + * Otherwise at least the newline character will be in the buffer. * * Returns 0 when successful and non-zero otherwise. */ @@ -72,6 +77,7 @@ int cu_tail_readline (cu_tail_t *obj, char *buf, int buflen); * * Returns 0 when successful and non-zero otherwise. */ -int cu_tail_read (cu_tail_t *obj, char *buf, int buflen, tailfunc *func, void *data); +int cu_tail_read (cu_tail_t *obj, char *buf, int buflen, tailfunc_t *callback, + void *data); #endif /* UTILS_TAIL_H */