summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-02 16:38:21 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-02 16:38:21 -0300
commit8473f728db4bb377d76094821de67ebaec7f254d (patch)
treeb7115ffb907e5dac98f51a751923d7eff2f7c65a /main.c
parent29fe8c46c08fcaae008181d0dc8383f28782de39 (diff)
downloadeeshow-8473f728db4bb377d76094821de67ebaec7f254d.tar.gz
eeshow-8473f728db4bb377d76094821de67ebaec7f254d.tar.bz2
eeshow-8473f728db4bb377d76094821de67ebaec7f254d.zip
eeshow/: make libraries "related" to the [main] schematics sheet
That way, we can use relative paths on the command line, ideally just ./eeshow foo.lib bar.lib com/plex/path/foo.sch
Diffstat (limited to 'main.c')
-rw-r--r--main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/main.c b/main.c
index 8b947de..af323ba 100644
--- a/main.c
+++ b/main.c
@@ -81,6 +81,7 @@ int main(int argc, char *const *argv)
{
struct lib lib;
struct sch_ctx sch_ctx;
+ struct file sch_file;
bool recurse = 0;
const char *cat = NULL;
char c;
@@ -122,9 +123,12 @@ int main(int argc, char *const *argv)
if (dashdash - optind < 1)
usage(*argv);
+ sch_init(&sch_ctx, recurse);
+ file_open(&sch_file, argv[dashdash - 1], NULL);
+
lib_init(&lib);
for (arg = optind; arg != dashdash - 1; arg++)
- lib_parse(&lib, argv[arg]);
+ lib_parse(&lib, argv[arg], &sch_file);
if (dashdash == argc) {
gfx_argc = 1;
@@ -151,8 +155,9 @@ found:
optind = 0; /* reset getopt */
- sch_init(&sch_ctx, recurse);
- sch_parse(&sch_ctx, argv[dashdash - 1], &lib);
+ sch_parse(&sch_ctx, &sch_file, &lib);
+ file_close(&sch_file);
+
gfx_init(*ops, gfx_argc, gfx_argv);
if (recurse) {
const struct sheet *sheet;