2 * Copyright 1993, 1995 Christopher Seiwald.
4 * This file is part of Jam - see jam.c for Copyright information.
8 * command.c - maintain lists of commands
10 * 01/20/00 (seiwald) - Upgraded from K&R to ANSI C
11 * 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
));
35 lol_add(&cmd
->args
, targets
);
36 lol_add(&cmd
->args
, sources
);
38 /* Bail if the result won't fit in maxline */
39 /* We don't free targets/sources/shell if bailing. */
40 if (var_string(rule
->actions
, cmd
->buf
, maxline
, &cmd
->args
) < 0) {
50 * cmd_free() - free a CMD
52 void cmd_free (CMD
*cmd
) {
54 list_free(cmd
->shell
);