r5698 - trunk/eda/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Wed Oct 21 01:50:45 CEST 2009


Author: werner
Date: 2009-10-21 01:50:45 +0200 (Wed, 21 Oct 2009)
New Revision: 5698

Modified:
   trunk/eda/fped/fped.c
Log:
For future extensions.

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



Modified: trunk/eda/fped/fped.c
===================================================================
--- trunk/eda/fped/fped.c	2009-10-19 16:36:24 UTC (rev 5697)
+++ trunk/eda/fped/fped.c	2009-10-20 23:50:45 UTC (rev 5698)
@@ -43,9 +43,12 @@
 
 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 @@
 	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 @@
 		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);
 		}




More information about the commitlog mailing list