2 * Copyright 1993, 1995 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
7 * command.c - maintain lists of commands
9 * 01/20/00 (seiwald) - Upgraded from K&R to ANSI C
10 * 09/08/00 (seiwald) - bulletproof PIECEMEAL size computation
25 * cmd_new() - return a new CMD or 0 if too many args
27 CMD
*cmd_new (RULE
*rule
, LIST
*targets
, LIST
*sources
, LIST
*shell
, int maxline
) {
28 CMD
*cmd
= (CMD
*)malloc(sizeof(CMD
));
34 lol_add(&cmd
->args
, targets
);
35 lol_add(&cmd
->args
, sources
);
36 /* we don't free targets/sources/shell if bailing */
37 if (var_string(rule
->actions
, &cmd
->buf
, &cmd
->args
, ' ') < 0) { cmd_free(cmd
); return NULL
; }
43 * cmd_free() - free a CMD
45 void cmd_free (CMD
*cmd
) {
48 list_free(cmd
->shell
);