1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-12-22 12:53:19 +02:00

new option -l (lower case L) to list package names

This commit is contained in:
Werner Almesberger 2016-12-03 20:40:34 -03:00
parent c04bb8f4e8
commit 0acff965b0
2 changed files with 28 additions and 5 deletions

5
fped.1
View File

@ -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

28
fped.c
View File

@ -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();
}