summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-09-29 18:02:32 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-09-29 18:02:32 +0200
commit86dfce8a424dd088f261fcbb4d34e59135dfddfd (patch)
treec44d60b5e2be88e396dcc3648c3aad9c7bfc0a86
parent23029c351dacce90d78b5648ffc4bc7bcf6aa359 (diff)
make get_index_info_no_lines return actual line number
-rw-r--r--src/index.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/index.c b/src/index.c
index 448c0bb..844897c 100644
--- a/src/index.c
+++ b/src/index.c
@@ -438,10 +438,22 @@ void init_index_mode(void)
static int get_index_info_no_lines(void)
{
- if (opt.index_info)
- /* TODO */
- return 3;
- return 0;
+ static int no_lines = 0;
+ char *pos = opt.index_info;
+
+ if (no_lines)
+ return no_lines;
+
+ if (!opt.index_info)
+ return 0;
+
+ no_lines = 1;
+ while ((pos = strchr(pos, '\n'))) {
+ no_lines++;
+ pos++;
+ }
+
+ return no_lines;
}
static char *create_index_string(feh_file * file)