clang-format
This commit is contained in:
@@ -47,35 +47,29 @@
|
||||
|
||||
char buffer[BUFSIZE];
|
||||
|
||||
static
|
||||
void
|
||||
tail(int file, off_t where, const char *filename)
|
||||
{
|
||||
int len;
|
||||
static void tail(int file, off_t where, const char *filename) {
|
||||
int len;
|
||||
|
||||
if (lseek(file, where, SEEK_SET)<0) {
|
||||
err(1, "%s", filename);
|
||||
}
|
||||
if (lseek(file, where, SEEK_SET) < 0) {
|
||||
err(1, "%s", filename);
|
||||
}
|
||||
|
||||
while ((len = read(file, buffer, sizeof(buffer))) > 0) {
|
||||
write(STDOUT_FILENO, buffer, len);
|
||||
}
|
||||
while ((len = read(file, buffer, sizeof(buffer))) > 0) {
|
||||
write(STDOUT_FILENO, buffer, len);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int file;
|
||||
int main(int argc, char **argv) {
|
||||
int file;
|
||||
|
||||
if (argc < 3) {
|
||||
errx(1, "Usage: tail <file> <location>");
|
||||
}
|
||||
file = open(argv[1], O_RDONLY);
|
||||
if (file < 0) {
|
||||
err(1, "%s", argv[1]);
|
||||
}
|
||||
tail(file, atoi(argv[2]), argv[1]);
|
||||
close(file);
|
||||
return 0;
|
||||
if (argc < 3) {
|
||||
errx(1, "Usage: tail <file> <location>");
|
||||
}
|
||||
file = open(argv[1], O_RDONLY);
|
||||
if (file < 0) {
|
||||
err(1, "%s", argv[1]);
|
||||
}
|
||||
tail(file, atoi(argv[2]), argv[1]);
|
||||
close(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user