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

@@ -39,20 +39,16 @@
* ln -s symlinkcontents symlinkfile
*/
/*
* Create a symlink with filename PATH that contains text TEXT.
* When fed to ls -l, this produces something that looks like
*
* lrwxrwxrwx [stuff] PATH -> TEXT
*/
static
void
dosymlink(const char *text, const char *path)
{
if (symlink(text, path)) {
err(1, "%s", path);
}
static void dosymlink(const char *text, const char *path) {
if (symlink(text, path)) {
err(1, "%s", path);
}
}
/*
@@ -60,34 +56,27 @@ dosymlink(const char *text, const char *path)
* OLDFILE. Since it's a hard link, the two names for the file
* are equal; both are the "real" file.
*/
static
void
dohardlink(const char *oldfile, const char *newfile)
{
if (link(oldfile, newfile)) {
err(1, "%s or %s", oldfile, newfile);
exit(1);
}
static void dohardlink(const char *oldfile, const char *newfile) {
if (link(oldfile, newfile)) {
err(1, "%s or %s", oldfile, newfile);
exit(1);
}
}
int
main(int argc, char *argv[])
{
/*
* Just do whatever was asked for.
*
* We don't allow the Unix model where you can do
* ln [-s] file1 file2 file3 destination-directory
*/
if (argc==4 && !strcmp(argv[1], "-s")) {
dosymlink(argv[2], argv[3]);
}
else if (argc==3) {
dohardlink(argv[1], argv[2]);
}
else {
warnx("Usage: ln oldfile newfile");
errx(1, " ln -s symlinkcontents symlinkfile\n");
}
return 0;
int main(int argc, char *argv[]) {
/*
* Just do whatever was asked for.
*
* We don't allow the Unix model where you can do
* ln [-s] file1 file2 file3 destination-directory
*/
if (argc == 4 && !strcmp(argv[1], "-s")) {
dosymlink(argv[2], argv[3]);
} else if (argc == 3) {
dohardlink(argv[1], argv[2]);
} else {
warnx("Usage: ln oldfile newfile");
errx(1, " ln -s symlinkcontents symlinkfile\n");
}
return 0;
}