diff --git a/fped.1 b/fped.1 index fea6b70..d011009 100644 --- a/fped.1 +++ b/fped.1 @@ -4,7 +4,7 @@ fped \- Footprint editor .SH SYNOPSIS .TP .B fped -[\-1 package] [\-g] [\-k] +[\-1 package] [\-g] [\-k] [\-l] [\-p|\-P [\-K] [\-m] [\-s scale]] [\-T [\-T]] [cpp_option ...] [in_file [out_file]] @@ -29,6 +29,9 @@ write gnuplot output, then exit \fB\-k\fR write KiCad output, then exit .TP +\fB\-l\fR +list package names, then exit +.TP \fB\-K\fR show the pad type key (for \fB\-P\fR) .TP diff --git a/fped.c b/fped.c index 8535318..337c59b 100644 --- a/fped.c +++ b/fped.c @@ -1,8 +1,8 @@ /* * fped.c - Footprint editor, main function * - * Written 2009-2012, 2015 by Werner Almesberger - * Copyright 2009-2012, 2015 by Werner Almesberger + * Written 2009-2012, 2015-2016 by Werner Almesberger + * Copyright 2009-2012, 2015-2016 by Werner Almesberger * * 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 @@ -79,6 +79,16 @@ void reload(void) } +static void list_packages(void) +{ + const struct pkg *pkg; + + for (pkg = pkgs; pkg; pkg = pkg->next) + if (pkg->name) + printf("%s\n", pkg->name); +} + + static void usage(const char *name) { fprintf(stderr, @@ -87,6 +97,7 @@ static void usage(const char *name) " -g [-1 package]\n" " write gnuplot output, then exit\n" " -k write KiCad output, then exit\n" +" -l list package names, then exit\n" " -p [-m] write Postscript output, then exit\n" " -P [-K] [-m] [-s scale] [-1 package]\n" " write Postscript output (full page), then exit\n" @@ -137,7 +148,8 @@ int main(int argc, char **argv) batch_ps, batch_ps_fullpage, batch_gnuplot, - batch_test + batch_test, + batch_list, } batch = batch_none; char *name = *argv; char **fake_argv; @@ -149,7 +161,7 @@ int main(int argc, char **argv) const char *one = NULL; int c; - while ((c = getopt(argc, argv, "1:gkmps:D:I:KPTU:")) != EOF) + while ((c = getopt(argc, argv, "1:gklmps:D:I:KPTU:")) != EOF) switch (c) { case '1': one = optarg; @@ -164,6 +176,11 @@ int main(int argc, char **argv) usage(*argv); batch = batch_kicad; break; + case 'l': + if (batch) + usage(*argv); + batch = batch_list; + break; case 'm': postscript_params.show_meas = 0; break; @@ -265,6 +282,9 @@ int main(int argc, char **argv) if (test_mode > 1) dump(stdout, NULL); break; + case batch_list: + list_packages(); + break; default: abort(); }