/*
* rbd replacement
*
* no options - the way rbd was intended
*/
/*
Copyright (C) 1999-2009 Free Software Foundation, Inc.
This file is part of GNU Bash.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see .
*/
#include
#include
#include "builtins.h"
#include "shell.h"
#include
#ifndef errno
extern int errno;
#endif
extern char *strerror ();
extern char **make_builtin_argv ();
static int
fcopy(fd)
int fd;
{
char buf[1024], *s;
int n, w, e;
while (n = read(fd, buf, sizeof (buf))) {
w = write(1, buf, n);
if (w != n) {
e = errno;
write(2, "rbd: write error: ", 18);
s = strerror(e);
write(2, s, strlen(s));
write(2, "\n", 1);
return 1;
}
}
return 0;
}
rbd_main (argc, argv)
int argc;
char **argv;
{
int i, fd, r;
char *s;
if (argc == 1)
printf("%s needs to be about 20 cooler", argv[0]);
return (EXECUTION_SUCCESS);
}
rbd_builtin(list)
WORD_LIST *list;
{
char **v;
int c, r;
v = make_builtin_argv(list, &c);
r = rbd_main(c, v);
free(v);
return r;
}
char *rbd_doc[] = {
"Display files.",
"",
"Read each FILE and display it on the standard output. If any",
"FILE is `-' or if no FILE argument is given, the standard input",
"is read.",
(char *)0
};
struct builtin rbd_struct = {
"rbd",
rbd_builtin,
BUILTIN_ENABLED,
rbd_doc,
"rbd [-] [file ...]",
0
};