summaryrefslogtreecommitdiff
path: root/inotail.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2006-10-20 15:38:47 +0200
committerTobias Klauser <tklauser@xenon.tklauser.home>2006-10-20 15:38:47 +0200
commita1b88302d515b04255b5bd164378ee15d4c69a11 (patch)
tree735b638642c37aee2f6b7215dec22683c98da068 /inotail.c
parent0f170e71cd509a01e293bc51fbb927fbbdb235a1 (diff)
inotail.c: More n_units cleanup
Make n_units unsigned and rename some more variables to the appropriate form.
Diffstat (limited to 'inotail.c')
-rw-r--r--inotail.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/inotail.c b/inotail.c
index 7b55622..1c5f8f0 100644
--- a/inotail.c
+++ b/inotail.c
@@ -136,9 +136,9 @@ static off_t lines_to_offset(struct file_struct *f, unsigned int n_lines)
return offset;
}
-static int bytes_to_offset(struct file_struct *f, int n_lines)
+static int bytes_to_offset(struct file_struct *f, unsigned int n_bytes)
{
- int ret = f->st_size - n_lines;
+ int ret = f->st_size - n_bytes;
return (ret < 0 ? 0 : ret);
}
@@ -158,7 +158,7 @@ static int tail_pipe(struct file_struct *f)
return rc;
}
-static int tail_file(struct file_struct *f, int n_lines, char mode)
+static int tail_file(struct file_struct *f, unsigned int n_units, char mode)
{
int ret = -1;
ssize_t bytes_read = 0;
@@ -193,9 +193,9 @@ static int tail_file(struct file_struct *f, int n_lines, char mode)
f->st_size = finfo.st_size;
if (mode == M_LINES)
- offset = lines_to_offset(f, n_lines);
+ offset = lines_to_offset(f, n_units);
else /* Bytewise tail, n_lines is number of bytes here */
- offset = bytes_to_offset(f, n_lines);
+ offset = bytes_to_offset(f, n_units);
/* We only get negative offsets on errors */
if (offset < 0)
@@ -328,7 +328,7 @@ int main(int argc, char **argv)
{
int i, c, ret = 0;
int n_files = 0;
- int n_units = DEFAULT_N_LINES;
+ unsigned int n_units = DEFAULT_N_LINES;
char forever = 0, mode = M_LINES;
char **filenames;
struct file_struct *files;