1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-06-30 22:11:40 +03:00

For future extensions.

- fped.c: added cpp-like command-line options -D, -U, and -I



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5698 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-10-20 23:50:45 +00:00
parent cd830046fa
commit 549a15def5

19
fped.c
View File

@ -43,9 +43,12 @@ static void load_file(const char *name)
static void usage(const char *name)
{
fprintf(stderr, "usage: %s [-k|-p] [in_file [out_file]]\n\n", name);
fprintf(stderr, " -k write KiCad output, then exit\n");
fprintf(stderr, " -p write Postscript output, then exit\n");
fprintf(stderr,
"usage: %s [-k|-p] [cpp_option ...] [in_file [out_file]]\n\n"
" -k write KiCad output, then exit\n"
" -p write Postscript output, then exit\n"
" cpp_option -Idir, -Dname[=value], or -Uname\n"
, name);
exit(1);
}
@ -56,11 +59,12 @@ int main(int argc, char **argv)
char **fake_argv;
char *args[2];
int fake_argc;
char opt[] = "-?";
int error, batch;
int batch_write_kicad = 0, batch_write_ps = 0;
int c;
while ((c = getopt(argc, argv, "kp")) != EOF)
while ((c = getopt(argc, argv, "kpD:U:I:")) != EOF)
switch (c) {
case 'k':
batch_write_kicad = 1;
@ -68,6 +72,13 @@ int main(int argc, char **argv)
case 'p':
batch_write_ps = 1;
break;
case 'D':
case 'U':
case 'I':
opt[1] = c;
add_cpp_arg(opt);
add_cpp_arg(optarg);
break;
default:
usage(name);
}