aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-05-19 18:16:31 +0200
committerDuncaen <mail@duncano.de>2017-05-19 18:41:03 +0200
commit6bf3c1c1e6553d3cafbd66200d192d4625e41b34 (patch)
treecd4d498f5ea1669691349130fef176fc9f064e48
parent8c7c7084b7ff813f1b7d012ddaa5d11d0eb55875 (diff)
downloadlobase-6bf3c1c1e6553d3cafbd66200d192d4625e41b34.tar.gz
usr.bin/stat: update to OPENBSD_6_1
-rw-r--r--usr.bin/stat/stat.c74
1 files changed, 0 insertions, 74 deletions
diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c
index 1408590..a7855d1 100644
--- a/usr.bin/stat/stat.c
+++ b/usr.bin/stat/stat.c
@@ -53,9 +53,6 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include <search.h>
-#include <mntent.h>
-#include <paths.h>
#if 0
#define DEF_FORMAT \
@@ -160,9 +157,6 @@
#define SHOW_filename 'N'
#define SHOW_sizerdev 'Z'
-static void *filesystems;
-static int scanned_filesystems;
-
void usage(const char *);
void output(const struct stat *, const char *,
const char *, int, int);
@@ -173,7 +167,6 @@ int format1(const struct stat *, /* stat info */
int, int, int, int, /* the parsed format */
int, int);
-
char *timefmt;
#define addchar(s, c, nl) \
@@ -184,73 +177,6 @@ char *timefmt;
extern char *__progname;
-struct idmap {
- long id;
- char *name;
-};
-
-static int fwid;
-
-int
-idorder(const void *a, const void *b)
-{
- struct idmap *ia = (struct idmap *)a;
- struct idmap *ib = (struct idmap *)b;
-
- if (ia->id == ib->id)
- return 0;
- else if (ia->id < ib->id)
- return -1;
- else
- return 1;
-}
-
-static void
-scan_filesystems()
-{
- FILE *mtab;
- struct mntent *mnt;
- struct stat st;
-
- /* Approach: iterate over mtab and memorize st_dev for each mountpoint.
- * this will fail if we are not allowed to read the mountpoint, but then
- * we should not have to look up this st_dev value... */
- mtab = setmntent(_PATH_MOUNTED, "r");
- if (!mtab)
- return;
-
- while ((mnt = getmntent(mtab))) {
- if (stat(mnt->mnt_dir, &st) < 0)
- continue;
-
- struct idmap *newkey = malloc(sizeof (struct idmap));
- newkey->id = st.st_dev;
- newkey->name = strdup(mnt->mnt_fsname);
- tsearch(newkey, &filesystems, idorder);
- };
-
- endmntent(mtab);
-
- scanned_filesystems = 1;
-}
-
-static char *
-devname(dev_t devid, mode_t mode)
-{
- struct idmap key, **result;
- key.id = devid;
- key.name = 0;
-
- if (!scanned_filesystems)
- scan_filesystems();
- result = tfind(&key, &filesystems, idorder);
-
- if (result && (int)strlen((*result)->name) > fwid)
- fwid = strlen((*result)->name);
-
- return result ? (*result)->name : "??";
-}
-
int
main(int argc, char *argv[])
{