summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-10 09:08:22 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-10 09:08:22 -0300
commit6a80cab5fd03d70272f7b620b36a9be096896546 (patch)
treefa3df4692c6eca7edc5a3f213dca879a90dc3e3e /main.c
parent626ab24debed4c0504369032366b148ba59c45ab (diff)
downloadeeshow-6a80cab5fd03d70272f7b620b36a9be096896546.tar.gz
eeshow-6a80cab5fd03d70272f7b620b36a9be096896546.tar.bz2
eeshow-6a80cab5fd03d70272f7b620b36a9be096896546.zip
eeshow/: option -N depth to limit history depth; -N-depth exits after parsing
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/main.c b/main.c
index 0960015..e678df6 100644
--- a/main.c
+++ b/main.c
@@ -47,17 +47,18 @@ static struct gfx_ops const *ops_list[] = {
void usage(const char *name)
{
fprintf(stderr,
-"usage: %s [gtk_flags] [-r] [[rev:]file.lib ...] [rev:]file.sch\n"
+"usage: %s [gtk_flags] [-r] [-N n] [[rev:]file.lib ...] [rev:]file.sch\n"
" %s [-r] [-v ...] [[rev:]file.lib ...] [rev:]file.sch\n"
" %*s[-- driver_spec]\n"
" %s [-v ...] -C [rev:]file\n"
" %s [-v ...] -H path_into_repo\n"
"\n"
-" rev git revision\n"
-" -r recurse into sub-sheets\n"
-" -v increase verbosity of diagnostic output\n"
-" -C 'cat' the file to standard output\n"
-" -H show history of repository on standard output\n"
+" rev git revision\n"
+" -r recurse into sub-sheets\n"
+" -v increase verbosity of diagnostic output\n"
+" -C 'cat' the file to standard output\n"
+" -H show history of repository on standard output\n"
+" -N n limit history to n revisions\n"
"\n"
"No driver spec: enter GUI\n"
"\n"
@@ -96,6 +97,7 @@ int main(int argc, char **argv)
const char *cat = NULL;
const char *history = NULL;
const char *fmt = NULL;
+ int limit = 0;
char c;
int arg, dashdash;
bool have_dashdash = 0;
@@ -112,7 +114,7 @@ int main(int argc, char **argv)
if (!have_dashdash)
gtk_init(&argc, &argv);
- while ((c = getopt(dashdash, argv, "rvC:F:H:")) != EOF)
+ while ((c = getopt(dashdash, argv, "rvC:F:H:N:")) != EOF)
switch (c) {
case 'r':
recurse = 1;
@@ -129,6 +131,9 @@ int main(int argc, char **argv)
case 'H':
history = optarg;
break;
+ case 'N':
+ limit = atoi(optarg);
+ break;
default:
usage(*argv);
}
@@ -173,7 +178,7 @@ int main(int argc, char **argv)
memcpy(args, argv + optind, sizeof(const char *) * n);
optind = 0; /* reset getopt */
- return gui(n, args, recurse);
+ return gui(n, args, recurse, limit);
}
sch_init(&sch_ctx, recurse);