diff options
author | donbright <hugh.m.bright@gmail.com> | 2013-03-05 23:47:14 (GMT) |
---|---|---|
committer | donbright <hugh.m.bright@gmail.com> | 2013-03-05 23:47:14 (GMT) |
commit | 42f21c3a0850083d245aa3ac346a53e876f0679e (patch) | |
tree | facf41750e0fe27cc4cdaf352c9c8e687011d103 /tests/guiopencsgtest.cc | |
parent | 422c668dcb538f181683ae51305bf8d3404f48d6 (diff) | |
parent | 4734172c3a16cc06b09e4d2131aa8e380bd0f226 (diff) |
Merge pull request #288 from openscad/issue11_2
Issue11 2
Diffstat (limited to 'tests/guiopencsgtest.cc')
-rw-r--r-- | tests/guiopencsgtest.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/guiopencsgtest.cc b/tests/guiopencsgtest.cc new file mode 100644 index 0000000..75e6abd --- /dev/null +++ b/tests/guiopencsgtest.cc @@ -0,0 +1,27 @@ +// Wrapper around openscad gui binary, so it can act like a 'test' + +#include <unistd.h> +#include <stdio.h> +#ifndef BINPATH +#error please define BINPATH=/some/path/openscad when compiling +#endif +#define PREQUOTE(x) #x +#define QUOTE(x) PREQUOTE(x) +int main( int argc, char * argv[] ) +{ + fprintf(stderr,"%s: wrapper for OpenSCAD at %s\n", argv[0], QUOTE( BINPATH ) ); + if ( argc != 3 ) { + fprintf(stderr,"%s: bad number of arguments: %i\n", argv[0], argc); + return 1; + } + char *newargs[6]; + char *scadfilename = argv[1]; + char *pngfilename = argv[2]; + newargs[0] = const_cast<char *>(QUOTE( BINPATH )); + newargs[1] = scadfilename; + newargs[2] = const_cast<char *>("-o"); + newargs[3] = pngfilename; + newargs[4] = NULL; + return execv( newargs[0], newargs ); +} + |