add first command
This commit is contained in:
parent
d25851546c
commit
63f96d33e4
25
main.c
25
main.c
|
@ -20,7 +20,7 @@
|
||||||
#include "lint.h"
|
#include "lint.h"
|
||||||
|
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
const char *version = "1.0.7";
|
const char *version = "1.0.8";
|
||||||
unsigned long sysopts = 0;
|
unsigned long sysopts = 0;
|
||||||
unsigned long filterflags = 0;
|
unsigned long filterflags = 0;
|
||||||
static time_t latest_stamp = 0;
|
static time_t latest_stamp = 0;
|
||||||
|
@ -72,7 +72,8 @@ syntax()
|
||||||
);
|
);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" now Show what is currently on.\n"
|
" now Show what is currently on.\n"
|
||||||
" last Show the time of the latest record.\n"
|
" first Show the time of the earliest record.\n"
|
||||||
|
" last Show the time of the latest record.\n"
|
||||||
" parse Parse the EPG, no output.\n"
|
" parse Parse the EPG, no output.\n"
|
||||||
" search <text> Search programme names for text.\n"
|
" search <text> Search programme names for text.\n"
|
||||||
" searchall <text> "
|
" searchall <text> "
|
||||||
|
@ -110,6 +111,21 @@ latest(struct epg *epg __attribute__((unused)),
|
||||||
latest_stamp = tm;
|
latest_stamp = tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
earliest(struct epg *epg __attribute__((unused)),
|
||||||
|
struct section *s __attribute__((unused)),
|
||||||
|
struct data *d __attribute__((unused)),
|
||||||
|
struct descriptor **ds __attribute__((unused)),
|
||||||
|
void *var __attribute__((unused)))
|
||||||
|
{
|
||||||
|
time_t tm;
|
||||||
|
|
||||||
|
tm = mjd(d->start_date, d->start_hour, d->start_min, d->start_sec);
|
||||||
|
|
||||||
|
if (!latest_stamp || tm < latest_stamp)
|
||||||
|
latest_stamp = tm;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dumpraw(struct epg *epg __attribute__((unused)),
|
dumpraw(struct epg *epg __attribute__((unused)),
|
||||||
struct section *s, struct data *d, struct descriptor **ds,
|
struct section *s, struct data *d, struct descriptor **ds,
|
||||||
|
@ -814,6 +830,11 @@ nextopt:
|
||||||
parse(epgpath, latest, NULL, filter);
|
parse(epgpath, latest, NULL, filter);
|
||||||
printf("%ld\n", latest_stamp);
|
printf("%ld\n", latest_stamp);
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(argv[0], "first"))
|
||||||
|
{
|
||||||
|
parse(epgpath, earliest, NULL, filter);
|
||||||
|
printf("%ld\n", latest_stamp);
|
||||||
|
}
|
||||||
else if (!strcmp(argv[0], "dumpraw"))
|
else if (!strcmp(argv[0], "dumpraw"))
|
||||||
parse(epgpath, dumpraw, NULL, filter);
|
parse(epgpath, dumpraw, NULL, filter);
|
||||||
else if (!strcmp(argv[0], "sqldump"))
|
else if (!strcmp(argv[0], "sqldump"))
|
||||||
|
|
Loading…
Reference in New Issue