~ubuntu-branches/ubuntu/saucy/bc/saucy-proposed

« back to all changes in this revision

Viewing changes to dc/stack.c

  • Committer: Package Import Robot
  • Author(s): John G. Hasler
  • Date: 2012-06-22 21:00:45 UTC
  • Revision ID: package-import@ubuntu.com-20120622210045-cpu8v54e1x1z0ep0
Tags: 1.06.95-3
* Applied patch from Pádraig Brady.
  Closes: #608255: bc uses uninitialized memory

* Applied patch from Paul Dwerryhouse.
  Closes: #472250: please return support for .dcrc file

* Applied patch from Ian Jackson.
  Closes: #488735: notice read and write errors on input and output

* Generated bc.html and dc.html but something is still wrong.

* Added homepage field to debian/control.

* I can't see the problem with hyphens.

* Fixed doc-base white space.

* Added watch file.

* I believe that the above changes deal with 558188.
  Closes: #558188: Changes made in 1.06.94-3.1 NMU have been lost

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#include "dc-regdef.h"
39
39
 
40
40
/* an oft-used error message: */
41
 
#define Empty_Stack     fprintf(stderr, "%s: stack empty\n", progname)
 
41
#define Empty_Stack do{                                 \
 
42
    fprintf(stderr, "%s: stack empty\n", progname);     \
 
43
    checkferror_output(stderr);                         \
 
44
  }while(0)
42
45
 
43
46
 
44
47
/* simple linked-list implementation suffices: */
94
97
        if (dc_stack->value.dc_type!=DC_NUMBER
95
98
                        || dc_stack->link->value.dc_type!=DC_NUMBER){
96
99
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
100
                checkferror_output(stderr);
97
101
                return;
98
102
        }
99
103
        (void)dc_pop(&b);
134
138
        if (dc_stack->value.dc_type!=DC_NUMBER
135
139
                        || dc_stack->link->value.dc_type!=DC_NUMBER){
136
140
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
141
                checkferror_output(stderr);
137
142
                return;
138
143
        }
139
144
        (void)dc_pop(&b);
172
177
        if (dc_stack->value.dc_type!=DC_NUMBER
173
178
                        || dc_stack->link->value.dc_type!=DC_NUMBER){
174
179
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
180
                checkferror_output(stderr);
175
181
                return 0;
176
182
        }
177
183
        (void)dc_pop(&b);
209
215
                        || dc_stack->link->value.dc_type!=DC_NUMBER
210
216
                        || dc_stack->link->link->value.dc_type!=DC_NUMBER){
211
217
                fprintf(stderr, "%s: non-numeric value\n", progname);
 
218
                checkferror_output(stderr);
212
219
                return;
213
220
        }
214
221
        (void)dc_pop(&c);
327
334
        r = dc_register[regid];
328
335
        if (r==NULL || r->value.dc_type==DC_UNINITIALIZED){
329
336
                fprintf(stderr, "%s: register ", progname);
 
337
                checkferror_output(stderr);
330
338
                dc_show_id(stderr, regid, " is empty\n");
331
339
                return DC_FAIL;
332
340
        }
401
409
        r = dc_register[stackid];
402
410
        if (r == NULL){
403
411
                fprintf(stderr, "%s: stack register ", progname);
 
412
                checkferror_output(stderr);
404
413
                dc_show_id(stderr, stackid, " is empty\n");
405
414
                return DC_FAIL;
406
415
        }