Date:2016-12-04 00:40:34 (1 year 9 months ago)
Author:Werner Almesberger
Commit:0acff965b0d5c474e331657a810577985d8af010
Message:new option -l (lower case L) to list package names

Files: fped.1 (2 diffs)
fped.c (7 diffs)

Change Details

fped.1
44.SH SYNOPSIS
55.TP
66.B fped
7[\-1 package] [\-g] [\-k]
7[\-1 package] [\-g] [\-k] [\-l]
88[\-p|\-P [\-K] [\-m] [\-s scale]]
99[\-T [\-T]] [cpp_option ...] [in_file [out_file]]
1010
...... 
2929\fB\-k\fR
3030write KiCad output, then exit
3131.TP
32\fB\-l\fR
33list package names, then exit
34.TP
3235\fB\-K\fR
3336show the pad type key (for \fB\-P\fR)
3437.TP
fped.c
11/*
22 * fped.c - Footprint editor, main function
33 *
4 * Written 2009-2012, 2015 by Werner Almesberger
5 * Copyright 2009-2012, 2015 by Werner Almesberger
4 * Written 2009-2012, 2015-2016 by Werner Almesberger
5 * Copyright 2009-2012, 2015-2016 by Werner Almesberger
66 *
77 * This program is free software; you can redistribute it and/or modify
88 * it under the terms of the GNU General Public License as published by
...... 
7979}
8080
8181
82static void list_packages(void)
83{
84    const struct pkg *pkg;
85
86    for (pkg = pkgs; pkg; pkg = pkg->next)
87        if (pkg->name)
88            printf("%s\n", pkg->name);
89}
90
91
8292static void usage(const char *name)
8393{
8494    fprintf(stderr,
...... 
8797" -g [-1 package]\n"
8898" write gnuplot output, then exit\n"
8999" -k write KiCad output, then exit\n"
100" -l list package names, then exit\n"
90101" -p [-m] write Postscript output, then exit\n"
91102" -P [-K] [-m] [-s scale] [-1 package]\n"
92103" write Postscript output (full page), then exit\n"
...... 
137148        batch_ps,
138149        batch_ps_fullpage,
139150        batch_gnuplot,
140        batch_test
151        batch_test,
152        batch_list,
141153    } batch = batch_none;
142154    char *name = *argv;
143155    char **fake_argv;
...... 
149161    const char *one = NULL;
150162    int c;
151163
152    while ((c = getopt(argc, argv, "1:gkmps:D:I:KPTU:")) != EOF)
164    while ((c = getopt(argc, argv, "1:gklmps:D:I:KPTU:")) != EOF)
153165        switch (c) {
154166        case '1':
155167            one = optarg;
...... 
164176                usage(*argv);
165177            batch = batch_kicad;
166178            break;
179        case 'l':
180            if (batch)
181                usage(*argv);
182            batch = batch_list;
183            break;
167184        case 'm':
168185            postscript_params.show_meas = 0;
169186            break;
...... 
265282        if (test_mode > 1)
266283            dump(stdout, NULL);
267284        break;
285    case batch_list:
286        list_packages();
287        break;
268288    default:
269289        abort();
270290    }

Archive Download the corresponding diff file

Branches:
master



interactive