2013-01-31 06:42:33 +04:00
|
|
|
// 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[] )
|
|
|
|
{
|
2013-01-31 06:58:34 +04:00
|
|
|
fprintf(stderr,"%s: wrapper for OpenSCAD at %s\n", argv[0], QUOTE( BINPATH ) );
|
2013-01-31 07:14:09 +04:00
|
|
|
if ( argc != 3 ) {
|
2013-01-31 06:58:34 +04:00
|
|
|
fprintf(stderr,"%s: bad number of arguments: %i\n", argv[0], argc);
|
2013-01-31 06:42:33 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
char *newargs[6];
|
|
|
|
char *scadfilename = argv[1];
|
2013-01-31 08:42:19 +04:00
|
|
|
char *pngfilename = argv[2];
|
2013-01-31 06:58:34 +04:00
|
|
|
newargs[0] = const_cast<char *>(QUOTE( BINPATH ));
|
2013-01-31 06:42:33 +04:00
|
|
|
newargs[1] = scadfilename;
|
|
|
|
newargs[2] = const_cast<char *>("-o");
|
2013-01-31 08:42:19 +04:00
|
|
|
newargs[3] = pngfilename;
|
2013-01-31 06:42:33 +04:00
|
|
|
newargs[4] = const_cast<char *>("--render");
|
|
|
|
newargs[5] = NULL;
|
2013-01-31 07:14:09 +04:00
|
|
|
return execv( newargs[0], newargs );
|
2013-01-31 06:42:33 +04:00
|
|
|
}
|
|
|
|
|