diff options
| author | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
| commit | 2035faf3f8aa95b888d9416c3cc7328c0ea18beb (patch) | |
| tree | f08a08d357c5d30455c569890f747c1d9b241316 /src/regress/lib/libc/telldir/utils.c | |
| parent | be03b61c1b8f59ccdd34dbe5f6c6b30de697d28b (diff) | |
| download | openbsd-bluhm_20181106.tar.gz openbsd-bluhm_20181106.tar.bz2 openbsd-bluhm_20181106.zip | |
This commit was manufactured by cvs2git to create tag 'bluhm_20181106'.bluhm_20181106
Diffstat (limited to 'src/regress/lib/libc/telldir/utils.c')
| -rw-r--r-- | src/regress/lib/libc/telldir/utils.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/regress/lib/libc/telldir/utils.c b/src/regress/lib/libc/telldir/utils.c deleted file mode 100644 index 7fb0401d70..0000000000 --- a/src/regress/lib/libc/telldir/utils.c +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | /* $OpenBSD: utils.c,v 1.2 2017/07/27 15:08:37 bluhm Exp $ */ | ||
| 2 | |||
| 3 | /* Written by Otto Moerbeek, 2006, Public domain. */ | ||
| 4 | |||
| 5 | #include <sys/types.h> | ||
| 6 | #include <sys/stat.h> | ||
| 7 | #include <dirent.h> | ||
| 8 | #include <err.h> | ||
| 9 | #include <fcntl.h> | ||
| 10 | #include <limits.h> | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <string.h> | ||
| 13 | #include <unistd.h> | ||
| 14 | |||
| 15 | #include "utils.h" | ||
| 16 | |||
| 17 | void | ||
| 18 | createfiles(int nfiles) | ||
| 19 | { | ||
| 20 | int i, fd; | ||
| 21 | char file[PATH_MAX]; | ||
| 22 | |||
| 23 | mkdir("d", 0755); | ||
| 24 | for (i = 0; i < nfiles; i++) { | ||
| 25 | snprintf(file, sizeof file, "d/%d", i); | ||
| 26 | if ((fd = open(file, O_CREAT | O_WRONLY, 0600)) == -1) | ||
| 27 | err(1, "open %s", file); | ||
| 28 | close(fd); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | void | ||
| 33 | delfiles(void) | ||
| 34 | { | ||
| 35 | DIR *dp; | ||
| 36 | struct dirent *f; | ||
| 37 | char file[PATH_MAX]; | ||
| 38 | |||
| 39 | dp = opendir("d"); | ||
| 40 | if (dp == NULL) | ||
| 41 | err(1, "opendir"); | ||
| 42 | while ((f = readdir(dp))) { | ||
| 43 | if (strcmp(f->d_name, ".") == 0 || | ||
| 44 | strcmp(f->d_name, "..") == 0) | ||
| 45 | continue; | ||
| 46 | snprintf(file, sizeof file, "d/%s", f->d_name); | ||
| 47 | if (unlink(file) == -1) | ||
| 48 | err(1, "unlink %s", f->d_name); | ||
| 49 | } | ||
| 50 | closedir(dp); | ||
| 51 | if (rmdir("d") == -1) | ||
| 52 | err(1, "rmdir"); | ||
| 53 | } | ||
