aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/dfc
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2012-04-01 16:27:11 +0800
committerbapt <bapt@FreeBSD.org>2012-04-01 16:27:11 +0800
commitcba706d2e309f2c51ac8d2d65039f7f527288c45 (patch)
tree64068e81216d53b830890a4c43c00033e43d6941 /sysutils/dfc
parentb39566996c7ab9c70ceb897fa902550e14a9b1c7 (diff)
downloadfreebsd-ports-gnome-cba706d2e309f2c51ac8d2d65039f7f527288c45.tar.gz
freebsd-ports-gnome-cba706d2e309f2c51ac8d2d65039f7f527288c45.tar.zst
freebsd-ports-gnome-cba706d2e309f2c51ac8d2d65039f7f527288c45.zip
Display file system space usage using graph and colors.
Feature safe: yes
Diffstat (limited to 'sysutils/dfc')
-rw-r--r--sysutils/dfc/Makefile21
-rw-r--r--sysutils/dfc/distinfo2
-rw-r--r--sysutils/dfc/files/patch-Makefile22
-rw-r--r--sysutils/dfc/files/patch-dfc.c147
-rw-r--r--sysutils/dfc/pkg-descr3
5 files changed, 195 insertions, 0 deletions
diff --git a/sysutils/dfc/Makefile b/sysutils/dfc/Makefile
new file mode 100644
index 000000000000..a915c3495fe5
--- /dev/null
+++ b/sysutils/dfc/Makefile
@@ -0,0 +1,21 @@
+# New ports collection makefile for: dfc
+# Date created: 2012-04-01
+# Whom: Baptiste Daroussin <bapt@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= dfc
+PORTVERSION= 2.3.0
+CATEGORIES= sysutils
+MASTER_SITES= http://projects.gw-computing.net/attachments/download/30/
+
+MAINTAINER= bapt@FreeBSD.org
+COMMENT= Display file system space usage using graph and colors
+
+LICENSE= BSD
+
+PLIST_FILES= bin/dfc
+MAN1= dfc.1
+
+.include <bsd.port.mk>
diff --git a/sysutils/dfc/distinfo b/sysutils/dfc/distinfo
new file mode 100644
index 000000000000..6e8beb2c3af2
--- /dev/null
+++ b/sysutils/dfc/distinfo
@@ -0,0 +1,2 @@
+SHA256 (dfc-2.3.0.tar.gz) = 153ee2e023be207d165db33183d7235d0dcb4f9ed4e435900984c2f55b310576
+SIZE (dfc-2.3.0.tar.gz) = 9732
diff --git a/sysutils/dfc/files/patch-Makefile b/sysutils/dfc/files/patch-Makefile
new file mode 100644
index 000000000000..435ffe820e6a
--- /dev/null
+++ b/sysutils/dfc/files/patch-Makefile
@@ -0,0 +1,22 @@
+--- ./Makefile.orig 2012-03-31 16:22:26.000000000 +0200
++++ ./Makefile 2012-04-01 10:18:51.224657259 +0200
+@@ -1,5 +1,5 @@
+ CC ?= gcc
+-CFLAGS = -O2 -std=c89
++CFLAGS ?= -O2 -std=c89
+ LDFLAGS +=
+ CFDEBUG = -g3 -pedantic -Wall -Wunused-parameter -Wlong-long\
+ -Wsign-conversion -Wconversion -Wimplicit-function-declaration
+@@ -18,10 +18,10 @@
+ ${CC} ${LDFLAGS} -o ${EXEC} ${OBJS}
+
+ install-main: dfc
+- install -Dm755 dfc ${DESTDIR}${BINDIR}/dfc
++ install -m755 dfc ${DESTDIR}${BINDIR}/dfc
+
+ install-data: dfc.1
+- install -Dm644 dfc.1 ${DESTDIR}${MANDIR}/man1/dfc.1
++ install -m644 dfc.1 ${DESTDIR}${MANDIR}/man1/dfc.1
+
+ install: all install-main install-data
+
diff --git a/sysutils/dfc/files/patch-dfc.c b/sysutils/dfc/files/patch-dfc.c
new file mode 100644
index 000000000000..9e7c19b4a9c8
--- /dev/null
+++ b/sysutils/dfc/files/patch-dfc.c
@@ -0,0 +1,147 @@
+--- ./dfc.c.orig 2012-03-31 16:22:26.000000000 +0200
++++ ./dfc.c 2012-04-01 10:18:26.366658586 +0200
+@@ -6,8 +6,10 @@
+ * Displays free disk space in an elegant manner.
+ */
+ #define _BSD_SOURCE
++#ifndef __FreeBSD__
+ #define _POSIX_C_SOURCE 2
+ #define _XOPEN_SOURCE 500
++#endif
+
+ #define STRMAXLEN 24
+
+@@ -15,14 +17,23 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <errno.h>
++#include <err.h>
+
++#ifndef __FreeBSD__
+ #include <mntent.h>
++#endif
+ #include <string.h>
+
++#include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/statvfs.h>
+ #include <sys/ioctl.h>
+
++#ifdef __FreeBSD__
++#include <sys/ucred.h>
++#include <sys/mount.h>
++#endif
++
+ #include "dfc.h"
+
+ /* set flags for options */
+@@ -384,9 +395,15 @@
+ fetch_info(struct list *lst)
+ {
+ FILE *mtab;
++ struct fsmntinfo *fmi;
++#ifdef __FreeBSD__
++ int nummnt;
++ struct statfs *entbuf;
++ struct statfs vfsbuf, **fs;
++#else
+ struct mntent *entbuf;
+ struct statvfs vfsbuf;
+- struct fsmntinfo *fmi;
++#endif
+
+ /* init fsmntinfo */
+ if ((fmi = malloc(sizeof(struct fsmntinfo))) == NULL) {
+@@ -396,6 +413,14 @@
+ }
+ *fmi = fmi_init();
+
++#ifdef __FreeBSD__
++ if ((nummnt = getmntinfo(&entbuf, MNT_WAIT)) <= 0)
++ err(EXIT_FAILURE, "Error while getting the list of mountpoints");
++
++ for (fs = &entbuf; nummnt--; (*fs)++) {
++ vfsbuf = **fs;
++
++#else
+ /* open mtab file */
+ if ((mtab = fopen("/etc/mtab", "r")) == NULL) {
+ perror("Error while opening mtab file ");
+@@ -421,7 +446,27 @@
+ /* NOTREACHED */
+ }
+ } else {
++#endif
+ /* infos from getmntent */
++#ifdef __FreeBSD__
++ if ((fmi->fsname = strdup(shortenstr(
++ trk(entbuf->f_mntfromname),
++ STRMAXLEN))) == NULL) {
++ fmi->fsname = "unknown";
++ }
++ if ((fmi->dir = strdup(shortenstr(
++ trk(entbuf->f_mntonname),
++ STRMAXLEN))) == NULL) {
++ fmi->dir = "unknown";
++ }
++ if ((fmi->type = strdup(shortenstr(
++ trk(entbuf->f_fstypename),
++ 9))) == NULL) {
++ fmi->type = "unknown";
++ }
++ /* TODO add the options */
++ fmi->opts = "non";
++#else
+ if ((fmi->fsname = strdup(shortenstr(
+ trk(entbuf->mnt_fsname),
+ STRMAXLEN))) == NULL) {
+@@ -438,16 +483,17 @@
+ if ((fmi->opts = strdup(trk(entbuf->mnt_opts))) == NULL) {
+ fmi->opts = "none";
+ }
++#endif
+
+ /* infos from statvfs */
+ fmi->bsize = vfsbuf.f_bsize;
+- fmi->frsize = vfsbuf.f_frsize;
++ fmi->frsize = 0; /*vfsbuf.f_frsize;*/
+ fmi->blocks = vfsbuf.f_blocks;
+ fmi->bfree = vfsbuf.f_bfree;
+ fmi->bavail = vfsbuf.f_bavail;
+ fmi->files = vfsbuf.f_files;
+ fmi->ffree = vfsbuf.f_ffree;
+- fmi->favail = vfsbuf.f_favail;
++ fmi->favail = 0; /*vfsbuf.f_favail;*/
+
+ /* pointer to the next element */
+ fmi->next = NULL;
+@@ -465,11 +511,13 @@
+ lst->typemaxlen);
+ }
+ }
++#ifndef __FreeBSD__
+ }
+
+ /* we need to close the mtab file now */
+ if (fclose(mtab) == EOF)
+ perror("Could not close mtab file ");
++#endif
+ }
+
+ /*
+@@ -563,9 +611,15 @@
+ (void)printf(" ");
+ }
+
++#ifdef __FreeBSD__
++ size = p->bsize * p->blocks;
++ avail = p->bsize * p->bavail;
++ used = p->bsize * (p->blocks - p->bfree);
++#else
+ size = (double)p->blocks *(double)p->frsize;
+ avail = (double)p->bavail * (double)p->frsize;
+ used = size - avail;
++#endif
+
+ /* calculate the % used */
+ if ((int)size == 0)
diff --git a/sysutils/dfc/pkg-descr b/sysutils/dfc/pkg-descr
new file mode 100644
index 000000000000..0e7354dd81f1
--- /dev/null
+++ b/sysutils/dfc/pkg-descr
@@ -0,0 +1,3 @@
+Display file system space usage using graph and colors.
+
+WWW: http://projects.gw-computing.net/projects/dfc