[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: pcb -> shell command



On Thu, Feb 01, 2007 at 04:23:45PM -0500, DJ Delorie wrote:
> 
> > i was wondering though if it is possible to use PCB to directly
> > invoke external shell comands, without using them to read or write
> > stuff. basicly what i want is to invoke 'make' from PCB, and
> > subsequentally reading in some files. i didn't find anything about
> > this in my first read of the PCB doc.
> 
> It doesn't at the moment, but it would be trivial to add.  Why not try
> to add it yourself?  The source file you're interested in is
> src/action.c, there's a table at the bottom of actions defined in that
> file.  Add one for "System()" or "Shell()", copy one of the smaller
> existing actions, and edit as needed.
> 
> ActionMessage() is probably a good function to copy from.
> 

indeed.
see attach for the code i've added.
thanks for the fast response!

/* --------------------------------------------------------------------------- */
static const char system_syntax[] =
  "System(commandline)";

static const char system_help[] = "Executes a system command.";

/* %start-doc actions System

This action executes a shell command through the libc call system().
If multiple arguments are given, each argument is executed in turn.

%end-doc */

static int
ActionSystem (int argc, char **argv, int x, int y)
{
  int i;

  if (argc < 1)
    AFAIL (system);

  for (i = 0; i < argc; i++)
    {
	system(argv[i]);
    }

  return 0;
}



/*

  {"System", 0, ActionSystem,
   system_help, system_syntax}
  ,

*/

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user