diff options
| author | Timo Savinen <tjsa@iki.fi> | 2005-10-23 11:36:39 +0000 |
|---|---|---|
| committer | Hadrien Dorio <hadrien.dorio@gmail.com> | 2017-12-16 00:24:06 +0100 |
| commit | 9794b5c44b97b5dda3064a96ca65376cb2b9ef4c (patch) | |
| tree | 9ab601eb14a3a789221334290b7c94339d387ed1 /src/buffer.c | |
| parent | d33af5172f7d8c403c097f0eadfcc35ed766e1fd (diff) | |
| download | binary-block-editor-9794b5c44b97b5dda3064a96ca65376cb2b9ef4c.tar.gz binary-block-editor-9794b5c44b97b5dda3064a96ca65376cb2b9ef4c.zip | |
0.1.5
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/buffer.c b/src/buffer.c index f05ffca..9566e08 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -20,7 +20,7 @@ * */ -/* $Id: buffer.c,v 1.32 2005/10/14 13:25:54 timo Exp $ */ +/* $Id: buffer.c,v 1.33 2005/10/19 18:39:13 timo Exp $ */ #include "bbe.h" #include <stdlib.h> @@ -50,13 +50,12 @@ set_output_file(char *file) if(file == NULL) { out_stream.fd = STDOUT_FILENO; - out_stream.file = "stdout"; + out_stream.file = "(stdout)"; } else { out_stream.fd = open(file,O_WRONLY | O_CREAT | O_TRUNC,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); if(out_stream.fd == -1) panic("Cannot open for writing",file,strerror(errno)); - out_stream.file = strdup(file); - if (out_stream.file == NULL) panic("Out of memory",NULL,NULL); + out_stream.file = xstrdup(file); } } @@ -95,13 +94,12 @@ set_input_file(char *file) if(file[0] == '-' && file[1] == 0) { new->fd = STDIN_FILENO; - new->file = "stdin"; + new->file = "(stdin)"; } else { new->fd = open(file,O_RDONLY); if(new->fd == -1) panic("Cannot open file for reading",file,strerror(errno)); - new->file = strdup(file); - if (new->file == NULL) panic("Out of menory",NULL,NULL); + new->file = xstrdup(file); } } |

