some fixes
This commit is contained in:
parent
e0b3126e52
commit
e7f886a40a
12
peek/peek.c
12
peek/peek.c
@ -1,5 +1,5 @@
|
||||
#include <errno.h> /* errno */
|
||||
#include <stdio.h> /* fprintf(3), getc(3), putc(3), EOF */
|
||||
#include <stdio.h> /* fprintf(3), getc(3), putc(3), EOF, NULL */
|
||||
#include <stdlib.h> /* size_t */
|
||||
#include <string.h> /* strerror(3) */
|
||||
#if !defined EX_OK || !defined EX_OSERR || !defined EX_USAGE
|
||||
@ -37,11 +37,9 @@ int main(int argc, char *argv[]){
|
||||
case 'o': outputs[0] = STDOUT_FILENO; break;
|
||||
case 'e': outputs[1] = STDERR_FILENO; break;
|
||||
case 'p':
|
||||
if(pipe(p) != 0){
|
||||
fprintf(stderr, "%s: %s\n",
|
||||
argv[0], strerror(errno));
|
||||
return EX_OSERR;
|
||||
}else
|
||||
if(pipe(p) != 0)
|
||||
goto die;
|
||||
else
|
||||
outputs[2] = p[1];
|
||||
break;
|
||||
default: goto usage;
|
||||
@ -87,5 +85,5 @@ usage: fprintf(stderr, "Usage: %s (-1eno)"
|
||||
return EX_OK;
|
||||
|
||||
die: fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
|
||||
return EX_USAGE;
|
||||
return EX_OSERR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user