~ubuntu-branches/ubuntu/precise/9base/precise

« back to all changes in this revision

Viewing changes to awk/run.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-08-20 17:34:06 UTC
  • mfrom: (6.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090820173406-xpwqa9ruyevvc0ut
Tags: 1:3-3
* Updating maintainer field.
* Updating vcs fields.
* Updating package to standards version 3.8.3.
* Updatin variables writing in rules to consistent style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
 
134
134
Cell *execute(Node *u)  /* execute a node of the parse tree */
135
135
{
 
136
        int nobj;
136
137
        Cell *(*proc)(Node **, int);
137
138
        Cell *x;
138
139
        Node *a;
149
150
                                recbld();
150
151
                        return(x);
151
152
                }
152
 
                if (notlegal(a->nobj))  /* probably a Cell* but too risky to print */
 
153
                nobj = a->nobj;
 
154
                if (notlegal(nobj))     /* probably a Cell* but too risky to print */
153
155
                        FATAL("illegal statement");
154
 
                proc = proctab[a->nobj-FIRSTTOKEN];
155
 
                x = (*proc)(a->narg, a->nobj);
 
156
                proc = proctab[nobj-FIRSTTOKEN];
 
157
                x = (*proc)(a->narg, nobj);
156
158
                if (isfld(x) && !donefld)
157
159
                        fldbld();
158
160
                else if (isrec(x) && !donerec)
901
903
                        if (isnum(x)) {
902
904
                                if (getfval(x))
903
905
                                        sprintf(p, fmt, (int) getfval(x));
904
 
                                else
 
906
                                else{
905
907
                                        *p++ = '\0';
 
908
                                        *p = '\0';
 
909
                                }
906
910
                        } else
907
911
                                sprintf(p, fmt, getsval(x)[0]);
908
912
                        break;
1540
1544
 
1541
1545
Cell *printstat(Node **a, int n)        /* print a[0] */
1542
1546
{
 
1547
        int r;
1543
1548
        Node *x;
1544
1549
        Cell *y;
1545
1550
        FILE *fp;
1553
1558
                fputs(getsval(y), fp);
1554
1559
                tempfree(y);
1555
1560
                if (x->nnext == NULL)
1556
 
                        fputs(*ORS, fp);
 
1561
                        r = fputs(*ORS, fp);
1557
1562
                else
1558
 
                        fputs(*OFS, fp);
 
1563
                        r = fputs(*OFS, fp);
 
1564
                if (r == EOF)
 
1565
                        FATAL("write error on %s", filename(fp));
1559
1566
        }
1560
1567
        if (a[1] != 0)
1561
 
                fflush(fp);
1562
 
        if (ferror(fp))
1563
 
                FATAL("write error on %s", filename(fp));
 
1568
                if (fflush(fp) == EOF)
 
1569
                        FATAL("write error on %s", filename(fp));
1564
1570
        return(True);
1565
1571
}
1566
1572
 
1890
1896
        *pb_ptr = pb;
1891
1897
        *sptr_ptr = sptr;
1892
1898
}
 
1899