projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
This is vodz' latest patch. Sorry it took so long...
[oweals/busybox.git]
/
head.c
diff --git
a/head.c
b/head.c
index 92b43bae2f75bfaf47e0bc2a500b80389db4ce86..0c8ef3d5907b8f020b90a7780c964fe281c4e905 100644
(file)
--- a/
head.c
+++ b/
head.c
@@
-3,7
+3,7
@@
* Mini head implementation for busybox
*
*
* Mini head implementation for busybox
*
*
- * Copyright (C) 1999,2000 by Lineo, inc.
+ * Copyright (C) 1999,2000
,2001
by Lineo, inc.
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
* Written by John Beppu <beppu@lineo.com>
*
* This program is free software; you can redistribute it and/or modify
@@
-22,11
+22,14
@@
*
*/
*
*/
-#include "busybox.h"
#include <errno.h>
#include <stdio.h>
#include <errno.h>
#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <string.h>
+#include "busybox.h"
-int head(int len, FILE *fp)
+
static
int head(int len, FILE *fp)
{
int i;
char *input;
{
int i;
char *input;
@@
-55,7
+58,7
@@
int head_main(int argc, char **argv)
break;
/* fallthrough */
default:
break;
/* fallthrough */
default:
-
usage(head_usage
);
+
show_usage(
);
}
}
}
}
@@
-76,16
+79,16
@@
int head_main(int argc, char **argv)
}
if (fp) {
if (need_headers) {
}
if (fp) {
if (need_headers) {
-
fprintf(stdout,
"==> %s <==\n", argv[optind]);
+
printf(
"==> %s <==\n", argv[optind]);
}
head(len, fp);
if (errno) {
}
head(len, fp);
if (errno) {
-
errorMsg("%s: %s\n", argv[optind], strerror(errno)
);
+
perror_msg("%s", argv[optind]
);
status = EXIT_FAILURE;
errno = 0;
}
if (optind < argc - 1)
status = EXIT_FAILURE;
errno = 0;
}
if (optind < argc - 1)
-
fprintf(stdout, "\n"
);
+
putchar('\n'
);
if (fp != stdin)
fclose(fp);
}
if (fp != stdin)
fclose(fp);
}