File: execfpri.c

package info (click to toggle)
icmake 7.21.01-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,856 kB
  • ctags: 1,498
  • sloc: ansic: 7,791; makefile: 3,879; sh: 320; cpp: 83
file content (43 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
                             E X E C F P R I . C

*/

#include "iccomp.h"

ESTRUC_ *exec_fprintf(type, args)
    E_TYPE_
        type;
    ESTRUC_
        *args;
{
    register int
        ok;
    ESTRUC_
        *e0;

    if (args->type < 2)                     /* argcount must be at least 2 */
    {
        semantic(illegal_argcount, funstring[type]);
        return (args);
    }

    e0 = codestruc(args, 0);                /* pointer to first arg */

    switch ((FUNNR_)type)
    {
        case f_fprintf:                     /* first arg must be string */
            ok = test_type(e0, e_str);
        break;

        default:                            /* 1st arg must be int,   */
            ok = test_type(e0, e_int) &&    /* 2nd arg must be string */
                 test_type(codestruc(args, 1), e_str);
    }

    if (ok)
        return (specials(type, args));      /* return specials call */

    semantic(type_conflict, funstring[type]); /* type conflict error */
    return (args);
}