* 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
*
*/
-#include "busybox.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;
break;
/* fallthrough */
default:
- usage(head_usage);
+ show_usage();
}
}
}
if (fp) {
if (need_headers) {
- fprintf(stdout, "==> %s <==\n", argv[optind]);
+ printf("==> %s <==\n", argv[optind]);
}
head(len, fp);
if (errno) {
errno = 0;
}
if (optind < argc - 1)
- fprintf(stdout, "\n");
+ putchar('\n');
if (fp != stdin)
fclose(fp);
}