Re: [dev] Re: coreutils / moreutils - DC a directory counter

2013-07-26 Thread Thorsten Glaser
Calvin Morrison dixit:

>Its called unionfs if I recall

No. Go read it again.

>On Jul 25, 2013 9:28 PM, "Thorsten Glaser"  wrote:

And stop top-posting and full-quoting.

Read http://www.afaik.de/usenet/faq/zitieren/ (it’s in
German, English and Dutch, so no excuses).

bye,
//mirabilos
-- 
> emacs als auch vi zum Kotzen finde (joe rules) und pine für den einzig
> bedienbaren textmode-mailclient halte (und ich hab sie alle ausprobiert). ;)
Hallo, ich bin der Holger ("Hallo Holger!"), und ich bin ebenfalls
... pine-User, und das auch noch gewohnheitsmäßig ("Oooohhh").  [aus dasr]



[dev] [surf] [PATCH 1/1] remove unused function eval()

2013-07-26 Thread Christian Hesse
Hello everybody,

the function eval() is unused, so remove it. Patch is attached. Thanks!
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Chris   get my mail address:*/=0;b=c[a++];)
putchar(b-1/(/*   gcc -o sig sig.c && ./sig*/b/42*2-3)*42);}
From 741dda6976fd65c64eddeba16762c10f60e3ebc2 Mon Sep 17 00:00:00 2001
From: Christian Hesse 
Date: Fri, 26 Jul 2013 10:50:46 +0200
Subject: [PATCH 1/1] remove unused function eval()

---
 surf.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/surf.c b/surf.c
index 1a9b17a..ff4727e 100644
--- a/surf.c
+++ b/surf.c
@@ -112,7 +112,6 @@ static gboolean deletion_interface(WebKitWebView *view,
 static void destroyclient(Client *c);
 static void destroywin(GtkWidget* w, Client *c);
 static void die(const char *errstr, ...);
-static void eval(Client *c, const Arg *arg);
 static void find(Client *c, const Arg *arg);
 static void fullscreen(Client *c, const Arg *arg);
 static void geopolicyrequested(WebKitWebView *v, WebKitWebFrame *f,
@@ -1103,13 +1102,6 @@ spawn(Client *c, const Arg *arg) {
 }
 
 static void
-eval(Client *c, const Arg *arg) {
-	WebKitWebFrame *frame = webkit_web_view_get_main_frame(c->view);
-	evalscript(webkit_web_frame_get_global_context(frame),
-			((char **)arg->v)[0], "");
-}
-
-static void
 stop(Client *c, const Arg *arg) {
 	webkit_web_view_stop_loading(c->view);
 }
-- 
1.8.3.4



signature.asc
Description: PGP signature


Re: [dev] [surf] [PATCH 1/1] remove unused function eval()

2013-07-26 Thread Alexander Sedov
It is meant to be used in key bindings.

2013/7/26 Christian Hesse :
> Hello everybody,
>
> the function eval() is unused, so remove it. Patch is attached. Thanks!
> --
> main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
> "CX:;",b;for(a/*Chris   get my mail address:*/=0;b=c[a++];)
> putchar(b-1/(/*   gcc -o sig sig.c && ./sig*/b/42*2-3)*42);}



[dev] [sbase] [patch v4] Add df(1)

2013-07-26 Thread sin
Hi,

Incorporated Steve's changes as well to make it compile/work
on OpenBSD.  I realize #ifdef's are terrible but for now it should
do the trick until we come up with a proper solution to this.

Thanks,
sin
>From 34e65ec1b392a90f7d46c90c2d67a25dd6219a4d Mon Sep 17 00:00:00 2001
From: sin 
Date: Mon, 22 Jul 2013 13:17:32 +0100
Subject: [PATCH] Add df(1)

---
 Makefile |  1 +
 df.c | 90 
 2 files changed, 91 insertions(+)
 create mode 100644 df.c

diff --git a/Makefile b/Makefile
index 2e31f33..bb981ce 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,7 @@ SRC = \
comm.c \
cp.c   \
date.c \
+   df.c   \
dirname.c  \
echo.c \
env.c  \
diff --git a/df.c b/df.c
new file mode 100644
index 000..75be614
--- /dev/null
+++ b/df.c
@@ -0,0 +1,90 @@
+#ifdef __OpenBSD__
+#include 
+#include 
+#else
+#include 
+#endif
+
+#include 
+#include 
+#include 
+#include "util.h"
+
+static void mnt_show(const char *fsname, const char *dir);
+
+static void
+usage(void)
+{
+   eprintf("usage: %s\n", argv0);
+}
+
+int
+main(int argc, char *argv[])
+{
+#ifdef __OpenBSD__
+   struct statfs *mntbuf;
+   int len, i;
+#else
+   FILE *fp;
+   struct mntent *me;
+#endif
+
+   ARGBEGIN {
+   case 'a':
+   break;
+   case 's':
+   case 'h':
+   case 'i':
+   eprintf("not implemented\n");
+   default:
+   usage();
+   } ARGEND;
+
+   printf("Filesystem  512-blocks  Used Avail Capacity  Mounted 
on\n");
+
+#ifdef __OpenBSD__
+   len = getmntinfo(&mntbuf, MNT_WAIT);
+   if (len == 0)
+   eprintf("gemntinfo:");
+
+   for (i = 0; i < len; i++)
+   mnt_show(mntbuf[i].f_mntfromname,
+mntbuf[i].f_mntonname);
+#else
+   fp = setmntent("/proc/mounts", "r");
+   if (!fp)
+   eprintf("fopen /proc/mounts:");
+
+   while ((me = getmntent(fp)))
+   mnt_show(me->mnt_fsname, me->mnt_dir);
+
+   endmntent(fp);
+#endif
+   return 0;
+}
+
+static void
+mnt_show(const char *fsname, const char *dir)
+{
+   struct statvfs s;
+   unsigned long long total, used, avail;
+   int capacity = 0;
+   int bs;
+
+   statvfs(dir, &s);
+
+   bs = s.f_frsize / 512;
+   total = s.f_blocks * bs;
+   avail = s.f_bfree * bs;
+   used = total - avail;
+
+   if (used + avail) {
+   capacity = (used * 100) / (used + avail);
+   if (used * 100 != capacity * (used + avail))
+   capacity++;
+   }
+
+   printf("%-12s %9llu %9llu %9llu %7d%%  %s\n",
+  fsname, total, used, avail, capacity,
+  dir);
+}
-- 
1.8.3.4



Re: [dev] [sbase] [patch v4] Add df(1)

2013-07-26 Thread Nick
On Fri, Jul 26, 2013 at 01:51:01PM +0300, sin wrote:
> Incorporated Steve's changes as well to make it compile/work
> on OpenBSD.  I realize #ifdef's are terrible but for now it should
> do the trick until we come up with a proper solution to this.

Is there really no sensible way to get the required information for
most POSIXish systems? How does coreutils do it (I expect tons of
way more awful ifdefs than you've done here, but it's worth
checking)?

I wonder what the right approach for utilities that can't be made
portable should be? Are there any others that are likely to have
these problems?



RE: [dev] slock: anti OOM killer - proper priv dropping - etc.

2013-07-26 Thread Robert Schneider
>> hence shoul be in an ifdef linux or something.

On the other hand the code is just "Does the proc file exist? No? Then
skip this." But yes it could be wrapped in #ifdef __linux__ sections.

> Or use setpriority() to make it portable.

I don't see how scheduler priority has much influence on OOM killing.

How do the BSDs do memory overcommit + kill on OOM?
-- 
ziggomatic
  

Re: [dev] Re: coreutils / moreutils - DC a directory counter

2013-07-26 Thread Calvin Morrison
Yes master
On Jul 26, 2013 3:40 AM, "Thorsten Glaser"  wrote:

> Calvin Morrison dixit:
>
> >Its called unionfs if I recall
>
> No. Go read it again.
>
> >On Jul 25, 2013 9:28 PM, "Thorsten Glaser"  wrote:
>
> And stop top-posting and full-quoting.
>
> Read http://www.afaik.de/usenet/faq/zitieren/ (it’s in
> German, English and Dutch, so no excuses).
>
> bye,
> //mirabilos
> --
> > emacs als auch vi zum Kotzen finde (joe rules) und pine für den einzig
> > bedienbaren textmode-mailclient halte (und ich hab sie alle
> ausprobiert). ;)
> Hallo, ich bin der Holger ("Hallo Holger!"), und ich bin ebenfalls
> ... pine-User, und das auch noch gewohnheitsmäßig ("Oooohhh").  [aus
> dasr]
>
>


Re: [dev] slock: anti OOM killer - proper priv dropping - etc.

2013-07-26 Thread koneu
On 26.07.2013, at 14:56, Robert Schneider  wrote:
> I don't see how scheduler priority has much influence on OOM killing.

Ya I just realized it after I sent the reply…
Turns out however, that it DOES. At least it says so here: 
http://blog.singhanuvrat.com/tech/the-linux-oom-killer …
However this is also most likely linux-only and can't even be sure it's real.

~koneu

Re: [dev] [sbase] [patch v4] Add df(1)

2013-07-26 Thread sin
On Fri, Jul 26, 2013 at 12:14:08PM +0100, Nick wrote:
> On Fri, Jul 26, 2013 at 01:51:01PM +0300, sin wrote:
> > Incorporated Steve's changes as well to make it compile/work
> > on OpenBSD.  I realize #ifdef's are terrible but for now it should
> > do the trick until we come up with a proper solution to this.
> 
> Is there really no sensible way to get the required information for
> most POSIXish systems? How does coreutils do it (I expect tons of
> way more awful ifdefs than you've done here, but it's worth
> checking)?

No idea, I have not looked at the coreutils code.  Will check it out.

> I wonder what the right approach for utilities that can't be made
> portable should be? Are there any others that are likely to have
> these problems?

If the build system can switch between between say Linux ops and
OpenBSD ops then we could have something like os/openbsd.c and
os/linux.c (for things that are not portable between them).

Then the df.c code can just call a function that will be implemented
by both OSes (with the same signature etc.).

The number of tools that might require this glue code is less than
2% of the overall number of tools.  So maybe leaving the #ifdef's for now
is enough until we encounter other situations as well?

Thanks,
sin



Re: [dev] [st] [PATCH] 8bit-meta like xterm

2013-07-26 Thread Mihail Zenkov
This changes break alt+i/alt+o/alt+p/etc in mc.