~ubuntu-branches/debian/sid/bc/sid

« back to all changes in this revision

Viewing changes to dc/dc.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2009-04-16 10:23:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090416102339-l7970sr667eekbvw
Tags: 1.06.94-3.1
* Non-maintainer upload with John's permission.
* Apply patch to restore the .dcrc config file (closes: #472250)
* Merge patch from Ubuntu to notice read and write errors on
  input and output (closes: #488735)
* Include the bc manual (HTML) in the bc binary package

* Bump Standards Version to 3.8.1
* Bump debhelper compatibility to 7
* debian/rules: replace "dh_clean -k" with "dh_prep"
* debian/control: Add homepage field
* Fix hyphens in the bc and dc manpages
* Add a watch file
* debian/dc.doc-base: Remove leading whitespace
* debian/dc.doc-base: Move to section Science/Mathematics

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "config.h"
31
31
 
32
32
#include <stdio.h>
 
33
#include <unistd.h>
 
34
#include <sys/types.h>
 
35
#include <pwd.h>
33
36
#ifdef HAVE_STDLIB_H
34
37
# include <stdlib.h>
35
38
#endif
61
64
bug_report_info DC_DECLVOID()
62
65
{
63
66
        printf("Email bug reports to:  bug-dc@gnu.org .\n");
 
67
        checkferror_output(stdout);
64
68
}
65
69
 
66
70
static void
71
75
This is free software; see the source for copying conditions.  There is NO\n\
72
76
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,\n\
73
77
to the extent permitted by law.\n", DC_COPYRIGHT);
 
78
        checkferror_output(stdout);
74
79
}
75
80
 
76
81
/* your generic usage function */
87
92
\n\
88
93
", progname);
89
94
        bug_report_info();
 
95
        checkferror_output(f);
 
96
}
 
97
 
 
98
static void
 
99
try_rcfile(void)
 
100
{
 
101
    char *homedir;
 
102
    struct passwd *pw;
 
103
    char *rcfile;
 
104
    FILE *input;
 
105
 
 
106
    homedir=getenv("HOME");
 
107
    if (!homedir)
 
108
    {
 
109
       pw=getpwuid(getuid());
 
110
       homedir=pw->pw_dir;
 
111
    }
 
112
    rcfile=malloc(strlen(homedir)+8);
 
113
    sprintf(rcfile, "%s/.dcrc", homedir);
 
114
    if (!(input=fopen(rcfile, "r")))
 
115
       return;
 
116
    if (dc_evalfile(input))
 
117
       exit(EXIT_FAILURE);
 
118
    fclose(input);
90
119
}
91
120
 
92
121
/* returns a pointer to one past the last occurance of c in s,
297
326
                }
298
327
        }
299
328
 
 
329
        try_rcfile();
 
330
 
300
331
        for (; optind < argc; ++optind) {
301
332
                try_file(argv[optind]);
302
333
                did_eval = 1;