File: substinsert.c

package info (click to toggle)
yodl 4.05.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,724 kB
  • sloc: ansic: 7,803; perl: 683; cpp: 570; sh: 411; xml: 190; makefile: 163
file content (22 lines) | stat: -rw-r--r-- 728 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "subst.ih"

void subst_insert(register Subst *sp, char const *fname,
                  char const *key, char const *value)
{
    char const *text;
    char *short_value = new_str(value); /* WAS: string_short(value) */

    if ((text = s_state_insert(sp->d_start_state_ptr, key, value)) == 0)
    {
        short_value = s_unsubstValue(&sp->d_strVector, short_value);
        strVector_add(&sp->d_strVector, key, short_value);

        if (message_show(MSG_NOTICE))
            message("%s(%s)(%s)", fname, key, short_value);
    }
    else if (message_show(MSG_ERR))
        message("%s(%s)(%s): Keeping existing definition `%s'",
                fname, key, short_value, string_short(text));

    free(short_value);
}