1 //
2 //	aegis - project change supervisor
3 //	Copyright (C) 2003-2006, 2008 Peter Miller
4 //
5 //	This program is free software; you can redistribute it and/or modify
6 //	it under the terms of the GNU General Public License as published by
7 //	the Free Software Foundation; either version 3 of the License, or
8 //	(at your option) any later version.
9 //
10 //	This program is distributed in the hope that it will be useful,
11 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //	GNU General Public License for more details.
14 //
15 //	You should have received a copy of the GNU General Public License
16 //	along with this program. If not, see
17 //	<http://www.gnu.org/licenses/>.
18 //
19 
20 #include <common/ac/errno.h>
21 #include <common/ac/unistd.h>
22 
23 #include <aeget/get/command.h>
24 #include <libaegis/os.h>
25 #include <libaegis/sub.h>
26 
27 
28 void
get_command(const char * cmd)29 get_command(const char *cmd)
30 {
31     const char      *shell;
32     sub_context_ty  *scp;
33     int             errno_old;
34 
35     //
36     // invoke the command through sh(1)
37     //
38     shell = os_shell();
39     execl(shell, shell, "-ec", cmd, (char *)0);
40     errno_old = errno;
41     scp = sub_context_new();
42     sub_errno_setx(scp, errno_old);
43     sub_var_set_charstar(scp, "File_Name", shell);
44     fatal_intl(scp, i18n("exec \"$filename\": $errno"));
45     // NOTREACHED
46 }
47