~ubuntu-branches/ubuntu/vivid/bc/vivid-proposed

« back to all changes in this revision

Viewing changes to dc/string.c

  • Committer: Bazaar Package Importer
  • Author(s): Ian Jackson
  • Date: 2006-04-04 17:21:02 UTC
  • Revision ID: james.westby@ubuntu.com-20060404172102-64vnydii80rn39jt
Tags: 1.06-19ubuntu1
Make dc notice read and write errors on its input and output.
I grepped for mentions of the strings `putc', `print', `getc', `FILE',
`stdin', `stdout' and `stderr' and added calls to new error-checking
functions unless it was clear from the immediately-surrounding code
that the program was exiting nonzero, or would exit nonzero if the
call failed.  I ignored hits in lib/getopt*, which seems to
pervasively ignore write errors when printing usage messages, in the
hope that these were correct.  I _think_ I got them all.  -iwj.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
        fwrite(value->s_ptr, value->s_len, sizeof *value->s_ptr, stdout);
102
102
        if (newline == DC_WITHNL)
103
103
                putchar('\n');
 
104
        checkferror_output(stdout);
104
105
        if (discard_flag == DC_TOSS)
105
106
                dc_free_str(&value);
106
107
}
176
177
                }
177
178
                *p++ = c;
178
179
        }
 
180
        checkferror_input(fp);
179
181
        return dc_makestring(line_buf, (size_t)(p-line_buf));
180
182
}
181
183