clang-format

This commit is contained in:
2024-09-10 13:03:02 -04:00
parent 53c617d779
commit d66450e427
381 changed files with 28864 additions and 34170 deletions

View File

@@ -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;
}