diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-10-01 19:15:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-10-01 19:15:29 +0000 |
commit | 3e07621988521feb5cdd8a99760d8bad1707cb57 (patch) | |
tree | 8df7d39fbba8713398c5ca602fe73b0ddc163373 /locale/programs/linereader.c | |
parent | d77cd295eb5bde456868eb5d7c71042edaa88151 (diff) | |
download | glibc-3e07621988521feb5cdd8a99760d8bad1707cb57.zip glibc-3e07621988521feb5cdd8a99760d8bad1707cb57.tar.gz glibc-3e07621988521feb5cdd8a99760d8bad1707cb57.tar.bz2 |
Update.
2000-10-01 Bruno Haible <haible@clisp.cons.org>
* charmaps/BIG5: Add a width table.
* charmaps/GB18030: Likewise.
* charmaps/ISO-8859-6: Likewise.
* charmaps/ISO-8859-8: Likewise.
* charmaps/TIS-620: Likewise.
Diffstat (limited to 'locale/programs/linereader.c')
-rw-r--r-- | locale/programs/linereader.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 6237094..3638ba1 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -47,23 +47,29 @@ struct linereader * lr_open (const char *fname, kw_hash_fct_t hf) { FILE *fp; - struct linereader *result; - int n; if (fname == NULL || strcmp (fname, "-") == 0 || strcmp (fname, "/dev/stdin") == 0) - fp = stdin; + return lr_create (stdin, "<stdin>", hf); else { fp = fopen (fname, "r"); if (fp == NULL) return NULL; + return lr_create (fp, fname, hf); } +} + +struct linereader * +lr_create (FILE *fp, const char *fname, kw_hash_fct_t hf) +{ + struct linereader *result; + int n; result = (struct linereader *) xmalloc (sizeof (*result)); result->fp = fp; - result->fname = xstrdup (fname ? : "<stdin>"); + result->fname = xstrdup (fname); result->buf = NULL; result->bufsize = 0; result->lineno = 1; |