1 /* $Id: gwave-exec.c,v 1.1 2000-11-06 06:39:09 sgt Exp $
3 * this is a generalized version of scwmexec,
4 * Copyright (C) 1997-2000, Maciej Stachowiak and Greg J. Badros
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this software; see the file COPYING.GPL. If not, write to
18 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 * Boston, MA 02111-1307 USA
39 if (!(dispName
= getenv("DISPLAY")))
41 if (!(display
= XOpenDisplay(dispName
)))
54 main(int argc
, char **argv
)
57 char *result
, *output
, *error
;
60 die("Usage: xgexec EXPRESSION\n");
62 die("Could not connect to server. Check your DISPLAY environment variable.\n");
64 w
=xgexec_init(display
);
67 die("Unable to establish xgexec connection.\n");
69 result
= xgexec_exec_full(display
,w
,argv
[1],&output
,&error
);
71 fputs(output
, stdout
);
72 if (strlen(error
)!=0) {
75 fputs(result
, stdout
);
78 if (result
) XFree(result
);
79 if (error
) XFree(error
);
80 if (output
) XFree(output
);
82 XCloseDisplay (display
);