/*
	muawk wrapper (by M. Andreoli)

muawk a b c d f ... is equivalent to  
mawk -f a -v arg="b c d f .."

Usefull for scripting with #!/usr/bin/muawk  
	
*/


#include <unistd.h>

char par[62]="", v[62]="";
int i;
int main(int argc, char *argv[])
{

if (argc==1) exit(0);

sprintf(par,"%s", argv[2]);
for (i=3; i<=argc-1; i++) sprintf(par,"%s %s",par, argv[i]);

sprintf(v,"arg=%s", par);

if ( argc>= 3)
execl ("/usr/bin/mawk", argv[1],"-f", argv[1], "-v",v, NULL); 
else
execl ("/usr/bin/mawk", argv[1],"-f", argv[1], NULL); 

}
