Re: [dev] deprecated projects

2012-03-25 Thread anonymous
On Sun, Mar 25, 2012 at 06:10:43PM +0200, Anselm R Garbe wrote:
> If anyone sees further potential for cleaning up
> 
>   http://hg.suckless.org/
> 
> please let me know.

Merge ssid into sbase?




Re: [dev] Environment variables

2012-02-12 Thread anonymous
On Sun, Feb 12, 2012 at 01:09:44PM +0100, Christoph Lohmann wrote:
> Greetings comrades.
> 
> Some of you might be more experienced in the old Unix ways and
> might know how in the good old days all the environment variables
> were standardized. What I am up to: There are these new stylish
> ways of running applications based on their file extensions or
> mime types, which is annoying and leads to many symlinks. Instead
> some environment variables do exist. But maybe history has evolved
> some other substandards than I know?
> 
> Variables:
>   $PAGER → pager (used by man)
>   $EDITOR → editor
> 
> 
>   $SOCKS_SERVER, $NO_PROXY, $AUTO_PROXY, $HTTP_PROXY,
>   $HTTPS_PROXY, $FTP_PROXY, $ALL_PROXY
>   → proxies and exceptions (used by chromium)
>   
> Variables my environment has:
>   $BROWSER → web browser
>   $XTERM → X terminal emulator
>   $MEDIAPLAYER → used for playing any media file
>   $DOWNLOADER → (wget)
>   $DOWNLOADDIR → where to download files to
> 

PATH=$PATH:$HOME/bin
LC_COLLATE=C to make capitalized filenames go first in `ls` output
BROWSER, EDITOR, VISUAL, MAILER, PAGER for programs
HISTFILE, LESSHISTFILE (/dev/null)
NNTPSERVER
MAIL

XDG_CACHE_HOME=$HOME/xdg/cache
XDG_CONFIG_HOME=$HOME/xdg/config
XDG_DATA_HOME=$HOME/xdg/data

XDG_DESKTOP_DIR, XDG_DOWNLOAD_DIR, ...




Re: [dev] sbase ls patch

2011-12-22 Thread anonymous
On Thu, Dec 22, 2011 at 11:10:49PM -, Bjartur Thorlacius wrote:
> >Tiny cleanup patch.  Now more memory is allocated than necessary.
> Is that a good thing or a typo?
> 

Now more memory is allocated than necessary, but after applying this
patch it will allocate just as much memory as required.




[dev] sbase ls patch

2011-12-22 Thread anonymous
Tiny cleanup patch.  Now more memory is allocated than necessary.
diff -r dcb29ce4485f ls.c
--- a/ls.c  Tue Nov 08 19:35:38 2011 +0100
+++ b/ls.c  Fri Dec 23 02:34:01 2011 +0400
@@ -62,7 +62,7 @@
many = (argc > optind+1);
 
if((n = argc - optind) > 0) {
-   if(!(ents = malloc((argc-1) * sizeof *ents)))
+   if(!(ents = malloc(n * sizeof *ents)))
eprintf("malloc:");
for(i = 0; i < n; i++)
mkent(&ents[i], argv[optind+i]);


Re: [dev] [dwm] 2000 SLOC

2011-11-01 Thread anonymous
On Mon, Oct 31, 2011 at 10:21:19PM +0100, Connor Lane Smith wrote:
> ... because it clashes with the developers' CSS. That's the problem. I
> think there ought to be pure style-free semantic HTML, and then users
> can style every site to fit their personal needs, without it resulting
> in ugly.

http://suckless.org/ is not style-free at all.  Navigation is done using
lists and there are divs with ids "container", "midHeader", "main-copy"
and classes "left" and "right".  If you disable CSS, all these lists
can nearly fill entire screen and these divs are usless if you want to
create your own style.

IMO navigation lines on top should be done without lists like on
http://cat-v.org/.  Or, much better, navigation can be completely
removed and replaced with simple links like on http://www.mutt.org/.

Nice guidelines are already present on http://port70.net/webless/




Re: [dev] [dmenu] An x, y, w patch for dmenu 4.4

2011-08-21 Thread anonymous
On Sun, Aug 21, 2011 at 02:24:27PM -0400, Kurt H Maier wrote:
> On Sun, Aug 21, 2011 at 12:52 PM, Bastien Dejean  wrote:
> > https://bbs.archlinux.org/viewtopic.php?id=124915
> 
> If it's not important enough to copy and paste the text from the
> stupid forum, it's not important enough for us to read.
> 
> 

It is attached.




Re: [dev] [dwm] scrot -s fails

2011-08-19 Thread anonymous
On Fri, Aug 19, 2011 at 10:34:28PM +, Bjartur Thorlacius wrote:
> Þann fös 19.ágú 2011 21:51, skrifaði anonymous:
> >I have tried to do the same thing.  Bound scrot to MODKEY+g, pressed
> >it and switched to first TTY.  It says "giblib error: couldn't grab
> >keyboard: Resource temporarily unavailable".  Don't know how to fix it,
> >but i think it is a problem in dwm.
> >
> I wonder whether if dwm and scrot are trying to grab the same keys
> on the root window. What keys does scrot bind?
> 
If it was the problem, scrot would not work from dmenu/terminal
emulator. It don't work only when you try to use it from dwm binding.




Re: [dev] [dwm] scrot -s fails

2011-08-19 Thread anonymous
On Fri, Aug 19, 2011 at 07:30:08PM +, Bjartur Thorlacius wrote:
> Þann fös 19.ágú 2011 18:22, skrifaði Bastien Dejean:
> >static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
> >
> I'd guess that the argument is never passed, as the string is
> terminated by the NUL after scrot.
> 
> If I read your code correctly, the array contains:
> s, c, r, o, t, NUL, -, s, NUL, NULL.
> 
> Where the trailing NULL is probably equal to NUL as well. That's
> three NUL instead of the intended one - as C's string notation
> appends NULs after the character array.
> 

The array contains tree pointers: pointer to NUL-terminated "scrot"
string, pointer to NUL-terminated "-s" string and NULL pointer.




Re: [dev] [dwm] scrot -s fails

2011-08-19 Thread anonymous
On Fri, Aug 19, 2011 at 08:22:12PM +0200, Bastien Dejean wrote:
> Hi,
> 
> The following command don't work (i.e. I can't select the region of the
> screen I'm willing to capture) when it's spawn from dwm:
> 
> static const char *partialshotcmd[]  = { "scrot", "-s", NULL };
> 
> Any idea why?
> 
> -- 
> Bastien
> 

I have tried to do the same thing.  Bound scrot to MODKEY+g, pressed
it and switched to first TTY.  It says "giblib error: couldn't grab
keyboard: Resource temporarily unavailable".  Don't know how to fix it,
but i think it is a problem in dwm.




[dev] [st] cleanup

2011-08-04 Thread anonymous
Little cleanup patch.
diff -r e64c97268f1a st.c
--- a/st.c  Thu Jun 09 18:25:56 2011 +0200
+++ b/st.c  Thu Aug 04 19:44:02 2011 +0300
@@ -523,8 +523,7 @@
xev.selection = xsre->selection;
xev.target = xsre->target;
xev.time = xsre->time;
-   /* reject */
-   xev.property = None;
+   xev.property = xsre->property;
 
xa_targets = XInternAtom(xw.dpy, "TARGETS", 0);
if(xsre->target == xa_targets) {
@@ -533,13 +532,12 @@
XChangeProperty(xsre->display, xsre->requestor, xsre->property,
XA_ATOM, 32, PropModeReplace,
(unsigned char *) &string, 1);
-   xev.property = xsre->property;
-   } else if(xsre->target == sel.xtarget) {
+   } else if(xsre->target == sel.xtarget)
XChangeProperty(xsre->display, xsre->requestor, xsre->property,
xsre->target, 8, PropModeReplace,
(unsigned char *) sel.clip, strlen(sel.clip));
-   xev.property = xsre->property;
-   }
+   else
+   xev.property = None; /* reject */
 
/* all done, send a notification to the listener */
if(!XSendEvent(xsre->display, xsre->requestor, True, 0, (XEvent *) 
&xev))


Re: [dev] [st] shift-insert patch (more general: key.mask and state)

2011-08-01 Thread anonymous
On Mon, Aug 01, 2011 at 03:52:37PM +0400, anonymous wrote:
> On Mon, Aug 01, 2011 at 03:34:46PM +0400, anonymous wrote:
> Patch is attached. 

Forgot to attach.

To make it work, you should reorder TAGKEYS, so masks with more modifiers are 
matched first.

#define TAGKEYS(KEY,TAG) \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag,  {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask,   KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag,{.ui = 1 << TAG} }, \
{ MODKEY,

diff -r b46ae56abe65 dwm.c
--- a/dwm.c Wed Jul 27 19:59:10 2011 +0200
+++ b/dwm.c Mon Aug 01 14:48:35 2011 +0300
@@ -42,7 +42,6 @@
 
 /* macros */
 #define BUTTONMASK  (ButtonPressMask|ButtonReleaseMask)
-#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & 
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
 #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= 
(RY) && (Y) < (RY) + (RH))
 #define ISVISIBLE(C)((C->tags & C->mon->tagset[C->mon->seltags]))
 #define LENGTH(X)   (sizeof X / sizeof X[0])
@@ -292,7 +291,6 @@
XClassHint ch = { 0 };
 
/* rule matching */
-   c->isfloating = c->tags = 0;
if(XGetClassHint(dpy, c->win, &ch)) {
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
@@ -453,8 +451,10 @@
}
for(i = 0; i < LENGTH(buttons); i++)
if(click == buttons[i].click && buttons[i].func && 
buttons[i].button == ev->button
-   && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
+   && (buttons[i].mask & ev->state) == buttons[i].mask) {
buttons[i].func(click == ClkTagBar && buttons[i].arg.i 
== 0 ? &arg : &buttons[i].arg);
+   break;
+   }
 }
 
 void
@@ -1078,9 +1078,11 @@
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < LENGTH(keys); i++)
if(keysym == keys[i].keysym
-   && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
-   && keys[i].func)
+   && (keys[i].mod & ev->state) == keys[i].mod
+   && keys[i].func) {
keys[i].func(&(keys[i].arg));
+   break;
+   }
 }
 
 void


Re: [dev] [st] shift-insert patch (more general: key.mask and state)

2011-08-01 Thread anonymous
On Mon, Aug 01, 2011 at 05:55:25PM +0200, Aurélien Aptel wrote:
> On Mon, Aug 1, 2011 at 1:34 PM, anonymous  wrote:
> > I think my patch is better.  There is no special case for 0 mask and state
> > and when we match for Ctrl and Shift it works only when they both are
> > pressed.  With your patch it will work for Ctrl only or for Shift only.
> 
> When a key in config.h has mask = 0 it's matched with ,
> not .

With my patch it is matched with any modifier too, because (key & 0) == 0.




Re: [dev] [st] shift-insert patch (more general: key.mask and state)

2011-08-01 Thread anonymous
On Mon, Aug 01, 2011 at 01:50:33PM +0100, Ethan Grammatikidis wrote:
> On Mon, 1 Aug 2011 15:52:37 +0400
> anonymous  wrote:
> 
> > On Mon, Aug 01, 2011 at 03:34:46PM +0400, anonymous wrote:
> > > Maybe it can be adopted for dwm so we would be able to remove this
> > > CLEANMASK macro.
> > 
> > Patch is attached.  Maybe I missed something because I don't understand
> > what numlockmask is for. Maybe my patch breaks something or maybe we
> > can remove all numlockmask stuff?
> 
> Did you test your patch both with numlock off and on? Years ago a lot of 
> keybindings wouldn't work if numlock was in the wrong state for the app. 
> Quite nasty, really.
> 

It works with numlock off and on.  It doesn't clean keycode and matches
it exactly with mask.  Instead it applies mask (with &) and checks if
all bits that are set in the mask are set in keycode.  If your mask
doesn't include numlock, numlock state can't change anything.

What changed is that when you bind Ctrl+A, Ctrl+Shift+A is matched
too. That is why I added "break" in the loop.  It means you should bind
Mod1+Shift+Return first and Mod1+Return later, but it is how it is done
in default config.h so there are no problems.

We still can't remove updatenumlockmask, because it is used in grabbuttons
and grabkeys.  Maybe it can be removed later.

If my patch doesn't break anything, I think it makes code a little cleaner.




Re: [dev] [st] shift-insert patch (more general: key.mask and state)

2011-08-01 Thread anonymous
On Mon, Aug 01, 2011 at 03:34:46PM +0400, anonymous wrote:
> Maybe it can be adopted for dwm so we would be able to remove this
> CLEANMASK macro.

Patch is attached.  Maybe I missed something because I don't understand
what numlockmask is for. Maybe my patch breaks something or maybe we
can remove all numlockmask stuff?




Re: [dev] [st] shift-insert patch (more general: key.mask and state)

2011-08-01 Thread anonymous
I think my patch is better.  There is no special case for 0 mask and state
and when we match for Ctrl and Shift it works only when they both are
pressed.  With your patch it will work for Ctrl only or for Shift only.

Maybe it can be adopted for dwm so we would be able to remove this
CLEANMASK macro.
diff -r e64c97268f1a st.c
--- a/st.c  Thu Jun 09 18:25:56 2011 +0200
+++ b/st.c  Mon Aug 01 14:31:32 2011 +0300
@@ -1833,8 +1833,9 @@
 char*
 kmap(KeySym k, unsigned int state) {
int i;
+
for(i = 0; i < LEN(key); i++)
-   if(key[i].k == k && (key[i].mask == 0 || key[i].mask & state))
+   if(key[i].k == k && (state & key[i].mask) == key[i].mask)
return (char*)key[i].s;
return NULL;
 }


Re: [dev] [dwm] applications in floating layout mode by default

2011-07-29 Thread anonymous
By the way, why applyrules sets tags and isfloating to 0 before applying
rules?  It is already done by calloc() in manage().  And it doesn't set
c->mon to NULL, so I think we can just remove all initialization.

Code cleanup patch:

diff -r b46ae56abe65 dwm.c
--- a/dwm.c Wed Jul 27 19:59:10 2011 +0200
+++ b/dwm.c Fri Jul 29 16:44:57 2011 +0300
@@ -292,7 +292,6 @@
XClassHint ch = { 0 };
 
/* rule matching */
-   c->isfloating = c->tags = 0;
if(XGetClassHint(dpy, c->win, &ch)) {
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;




Re: [dev] [dwm] applications in floating layout mode by default

2011-07-29 Thread anonymous
On Fri, Jul 29, 2011 at 02:20:41PM +0200, mauro tonon wrote:
> Usually, in dwm, I prefer to have only terminals (xterm, rxvt, etc)
> in tiled mode and all other applications in floating mode...
> At first, I added many lines to the rules section in config.h
> but, now, I solved the problem in this way:
> 
> in file config.def.h, before the rules, add:
> 
> + /* Floating default rule for a generic window:
> + 0 if you want (current) tiled layout as default
> + 1 if you want floating layout as default */
> + #define FLOATING_AS_DEFAULT 1
> 
> with this rule:
> 
> +  { "XTerm",NULL,   NULL,   0,False, -1 },
> 
> and in file dwm.c, in function applyrules:
> 
> - c->isfloating = c->tags = 0;
> + c->isfloating = FLOATING_AS_DEFAULT;
> + c->tags = 0;
> 
> Note that this is not the same that to set "floating" as default layout mode
> (i.e. all applications in floating mode).
> With my patch, terminals are tiled, by default, but all others applications 
> not.
> 

Why not just add "default" rule first.  Like this:

{ NULL,NULL, NULL, 0, True,  -1 },
{ "XTerm", NULL, NULL, 0, False, -1 },

First rule sets isfloating=True.  Then it is changed to False for terminals.




Re: [dev] [dwm] code cleanup

2011-07-26 Thread anonymous
On Tue, Jul 26, 2011 at 11:54:14PM +0200, Peter Hartlich wrote:
> Hi,
> 
> >  void
> >  grabkeys(void) {
> > +   unsigned int i, j;
> > +   unsigned int modifiers[] = { 0, LockMask, numlockmask, 
> > numlockmask|LockMask };
> > +   KeyCode code;
> > +
> > updatenumlockmask();
> > -   {
> > -   unsigned int i, j;
> > -   unsigned int modifiers[] = { 0, LockMask, numlockmask, 
> > numlockmask|LockMask };
> > -   KeyCode code;
> 
> That would break the numlockmask stuff.
> 
> Regards,
> Peter
> 
Fixed patch attached.
diff -r 701f651eaecc dwm.c
--- a/dwm.c Sun Jul 24 10:41:43 2011 +0100
+++ b/dwm.c Wed Jul 27 01:22:44 2011 +0300
@@ -433,9 +433,9 @@
}
if(ev->window == selmon->barwin) {
i = x = 0;
-   do {
+   do
x += TEXTW(tags[i]);
-   } while(ev->x >= x && ++i < LENGTH(tags));
+   while(ev->x >= x && ++i < LENGTH(tags));
if(i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -720,12 +720,10 @@
if(!(m = selmon->next))
m = mons;
}
-   else {
-   if(selmon == mons)
-   for(m = mons; m->next; m = m->next);
-   else
-   for(m = mons; m->next != selmon; m = m->next);
-   }
+   else if(selmon == mons)
+   for(m = mons; m->next; m = m->next);
+   else
+   for(m = mons; m->next != selmon; m = m->next);
return m;
 }
 
@@ -1017,12 +1015,11 @@
KeyCode code;
 
XUngrabKey(dpy, AnyKey, AnyModifier, root);
-   for(i = 0; i < LENGTH(keys); i++) {
+   for(i = 0; i < LENGTH(keys); i++)
if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
for(j = 0; j < LENGTH(modifiers); j++)
XGrabKey(dpy, code, keys[i].mod | 
modifiers[j], root,
 True, GrabModeAsync, 
GrabModeAsync);
-   }
}
 }
 
@@ -1031,7 +1028,6 @@
char *def, **missing;
int n;
 
-   missing = NULL;
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
if(missing) {
while(n--)
@@ -1311,6 +1307,7 @@
return m;
return selmon;
 }
+
 void
 quit(const Arg *arg) {
running = False;
@@ -1415,10 +1412,9 @@
XEvent ev;
/* main event loop */
XSync(dpy, False);
-   while(running && !XNextEvent(dpy, &ev)) {
+   while(running && !XNextEvent(dpy, &ev))
if(handler[ev.type])
handler[ev.type](&ev); /* call handler */
-   }
 }
 
 void


Re: [dev] [dwm] code cleanup

2011-07-26 Thread anonymous
Forgot to attach.
diff -r 701f651eaecc dwm.c
--- a/dwm.c Sun Jul 24 10:41:43 2011 +0100
+++ b/dwm.c Tue Jul 26 21:58:41 2011 +0300
@@ -433,9 +433,9 @@
}
if(ev->window == selmon->barwin) {
i = x = 0;
-   do {
+   do
x += TEXTW(tags[i]);
-   } while(ev->x >= x && ++i < LENGTH(tags));
+   while(ev->x >= x && ++i < LENGTH(tags));
if(i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -720,12 +720,10 @@
if(!(m = selmon->next))
m = mons;
}
-   else {
-   if(selmon == mons)
-   for(m = mons; m->next; m = m->next);
-   else
-   for(m = mons; m->next != selmon; m = m->next);
-   }
+   else if(selmon == mons)
+   for(m = mons; m->next; m = m->next);
+   else
+   for(m = mons; m->next != selmon; m = m->next);
return m;
 }
 
@@ -1010,20 +1008,18 @@
 
 void
 grabkeys(void) {
+   unsigned int i, j;
+   unsigned int modifiers[] = { 0, LockMask, numlockmask, 
numlockmask|LockMask };
+   KeyCode code;
+
updatenumlockmask();
-   {
-   unsigned int i, j;
-   unsigned int modifiers[] = { 0, LockMask, numlockmask, 
numlockmask|LockMask };
-   KeyCode code;
 
-   XUngrabKey(dpy, AnyKey, AnyModifier, root);
-   for(i = 0; i < LENGTH(keys); i++) {
-   if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
-   for(j = 0; j < LENGTH(modifiers); j++)
-   XGrabKey(dpy, code, keys[i].mod | 
modifiers[j], root,
-True, GrabModeAsync, 
GrabModeAsync);
-   }
-   }
+   XUngrabKey(dpy, AnyKey, AnyModifier, root);
+   for(i = 0; i < LENGTH(keys); i++)
+   if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
+   for(j = 0; j < LENGTH(modifiers); j++)
+   XGrabKey(dpy, code, keys[i].mod | modifiers[j], 
root,
+True, GrabModeAsync, GrabModeAsync);
 }
 
 void
@@ -1031,7 +1027,6 @@
char *def, **missing;
int n;
 
-   missing = NULL;
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
if(missing) {
while(n--)
@@ -1311,6 +1306,7 @@
return m;
return selmon;
 }
+
 void
 quit(const Arg *arg) {
running = False;
@@ -1415,10 +1411,9 @@
XEvent ev;
/* main event loop */
XSync(dpy, False);
-   while(running && !XNextEvent(dpy, &ev)) {
+   while(running && !XNextEvent(dpy, &ev))
if(handler[ev.type])
handler[ev.type](&ev); /* call handler */
-   }
 }
 
 void


[dev] [dwm] code cleanup

2011-07-26 Thread anonymous
Style fixes, removed

missing = NULL;

line.  XCreateFontSet do it for you at the beginning of function [1].
Added missing blank line, still 5 lines removed.

dwm page [2] says "dwm is only a single binary, and its source code is
intended to never exceed 2000 SLOC".  wc -l says there are 2077 lines
(2072 with patch).  Some code should be removed or rewritten or dwm will
grow over 2100 lines soon.

[1] 
http://www.openbsd.org/cgi-bin/cvsweb/xenocara/lib/libX11/src/FSWrap.c?rev=1.3
[2] http://dwm.suckless.org/




Re: [dev] [dmenu] dmenu_run improvements

2011-07-24 Thread anonymous
On Sun, Jul 24, 2011 at 02:34:22PM +0800, lolilolicon wrote:
> > unset IFS
> > 
> > cmd=$(dmenu "$@" < "$CACHE") && eval exec "$cmd"
> Yeah, I see you just hate backticks :P
> 

There is a difference:

% echo `echo '\\'`
\
% echo $(echo '\\')
\\





Re: [dev] suckless http library

2011-07-04 Thread anonymous
On Mon, Jul 04, 2011 at 04:17:33PM +0100, Nick wrote:
> Or a nice suckless program that does HTTP that I can derive inspiration from?

http://hg.suckless.org/quark/




Re: [dev] [st] mutt and cursor

2011-07-04 Thread anonymous
On Mon, Jul 04, 2011 at 12:44:18PM +0100, Ethan Grammatikidis wrote:
> On Tue, 14 Jun 2011 06:34:03 +0400
> anonymous  wrote:
> 
> > Since revision 202 cursor is hidden after I quit from mutt. If I do
> > "update 201", everything is ok.  I don't know how to fix it right way.
> > 
> > Also "reset" command don't help, cursor is still hidden.  Is it a bug?
> > 
> > http://hg.suckless.org/st/rev/0f21f57006c9
> > 
> > 
> 
> I'd say definitely a bug if reset doesn't help, but reset may be unfixable 
> for inescapable historical reasons - the same reason I avoid terminals as 
> much as I can - VT100-descended terminals are too cluttered with crud to be 
> bug-free, and that includes st. In fact it includes any terminal which will 
> work with most ncurses apps.
> 
> Anyway, if reset doesn't work, "stty sane" may fix your problem. A 
> longer-term workaround would be to include a cursor-setting escape code in 
> your prompt.
> 
stty sane doesn't help.  With xterm, cursor appears again as soon as I quit 
mutt.




[dev] [sbase] echo.c cleanup

2011-06-28 Thread anonymous
Patch attached.
diff -r 2f259700e4f2 echo.c
--- a/echo.cSat Jun 25 18:49:32 2011 +0100
+++ b/echo.cTue Jun 28 15:29:52 2011 +0400
@@ -12,15 +12,12 @@
char c;
 
while((c = getopt(argc, argv, "n")) != -1)
-   switch(c) {
-   case 'n':
+   if(c == 'n')
nflag = true;
-   break;
-   default:
+   else
exit(EXIT_FAILURE);
-   }
-   for(; optind < argc; optind++)
-   putword(argv[optind]);
+   for(argv += optind; *argv; argv++)
+   putword(*argv);
if(!nflag)
putchar('\n');
return EXIT_SUCCESS;


[dev] [sbase] simplify nohup

2011-06-24 Thread anonymous
Patch attached.
diff -r 0021d9f2b4e6 nohup.c
--- a/nohup.c   Thu Jun 23 02:08:41 2011 +0100
+++ b/nohup.c   Fri Jun 24 11:18:06 2011 +0400
@@ -13,16 +13,14 @@
 main(int argc, char *argv[])
 {
int fd;
-   struct sigaction sa;
 
if(getopt(argc, argv, "") != -1)
exit(Error);
if(optind == argc)
enprintf(Error, "usage: %s command [argument...]\n", argv[0]);
 
-   sa.sa_handler = SIG_IGN;
-   if(sigaction(SIGHUP, &sa, NULL) == -1)
-   enprintf(Error, "sigaction HUP:");
+   if(signal(SIGHUP, SIG_IGN) == SIG_ERR)
+   enprintf(Error, "signal HUP:");
if(isatty(STDOUT_FILENO)) {
if((fd = open("nohup.out", O_APPEND|O_CREAT, S_IRUSR|S_IWUSR)) 
== -1)
enprintf(Error, "open nohup.out:");


[dev] [st] mutt and cursor

2011-06-13 Thread anonymous
Since revision 202 cursor is hidden after I quit from mutt. If I do
"update 201", everything is ok.  I don't know how to fix it right way.

Also "reset" command don't help, cursor is still hidden.  Is it a bug?

http://hg.suckless.org/st/rev/0f21f57006c9




[dev] [st] fix segfault

2011-06-08 Thread anonymous
This patch fixes segfault.  To reproduce, start selecting, move your
mouse out of window and back while holding LMB.
diff -r 6c311c25323e st.c
--- a/st.c  Wed Jun 08 21:35:58 2011 +0200
+++ b/st.c  Thu Jun 09 01:27:14 2011 +0400
@@ -615,7 +615,7 @@
if(oldey != sel.ey || oldex != sel.ex) {
int starty = MIN(oldey, sel.ey);
int endy = MAX(oldey, sel.ey);
-   drawregion(0, (starty > 0 ? starty : 0), term.col, 
(sel.ey < term.row ? endy+1 : term.row));
+   drawregion(0, (starty > 0 ? starty : 0), term.col, 
(endy < term.row ? endy+1 : term.row));
}
}
 }


Re: [dev] [st] Font issues

2011-05-31 Thread anonymous
On Tue, May 31, 2011 at 07:19:26PM +0200, Aurélien Aptel wrote:
> > transparency support. In my opinion "st" seems like not very stable now,
> 
> If you found a bug, please report it. It's the only way we can fix it.

Code for text selection is buggy.  I can only see what I selected after
either I release mouse or when st is compiled with -fno-strict-aliasing.
Can't find how to fix it.

BTW I have found out-of-bounds read which causes SIGSEGV. Function
bmotion calls drawregion with y2 > term.row on line 603:

drawregion(0, (starty > 0 ? starty : 0), term.col, (sel.ey < term.row ?  endy+1 
: term.row));

It sets endy to MAX(oldey, sel.ey).  Everything is ok when sel.ey >
oldey, but oldey is not checked.  So if you, while selecting, move
mouse out of terminal window and back, it segfaults.

drawregion line should be changed to

drawregion(0, (starty > 0 ? starty : 0), term.col, (endy < term.row ?  endy+1 : 
term.row));

Another bug: while selecting, move mouse far higher than first row.
Text disappears until you move mouse back.




[dev] [st] code cleanup

2011-05-26 Thread anonymous
Attached.
diff -r 2effc50d2c4f st.c
--- a/st.c  Sun May 22 16:57:27 2011 +0200
+++ b/st.c  Thu May 26 14:30:53 2011 +0400
@@ -473,8 +473,7 @@
 
 void
 selnotify(XEvent *e) {
-   unsigned long nitems;
-   unsigned long ofs, rem;
+   unsigned long nitems, ofs, rem;
int format;
unsigned char *data;
Atom type;
@@ -484,7 +483,7 @@
if(XGetWindowProperty(xw.dpy, xw.win, XA_PRIMARY, ofs, BUFSIZ/4,
False, AnyPropertyType, &type, &format,
&nitems, &rem, &data)) {
-   fprintf(stderr, "Clipboard allocation failed\n");
+   fputs("Clipboard allocation failed\n", stderr);
return;
}
ttywrite((const char *) data, nitems * format / 8);
@@ -531,7 +530,7 @@
 
/* all done, send a notification to the listener */
if(!XSendEvent(xsre->display, xsre->requestor, True, 0, (XEvent *) 
&xev))
-   fprintf(stderr, "Error sending SelectionNotify event\n");
+   fputs("Error sending SelectionNotify event\n", stderr);
 }
 
 void
@@ -594,8 +593,7 @@
 void
 bmotion(XEvent *e) {
if(sel.mode) {
-   int oldey = sel.ey,
-   oldex = sel.ex;
+   int oldey = sel.ey, oldex = sel.ex;
getbuttoninfo(e, NULL, &sel.ex, &sel.ey);
 
if(oldey != sel.ey || oldex != sel.ex) {
@@ -675,7 +673,7 @@
static int col;
fprintf(stderr, " %02x '%c' ", c, isprint(c)?c:'.');
if(++col % 10 == 0)
-   fprintf(stderr, "\n");
+   fputc('\n', stderr);
 }
 
 void
@@ -753,7 +751,7 @@
term.row = row, term.col = col;
term.line = malloc(term.row * sizeof(Line));
term.alt  = malloc(term.row * sizeof(Line));
-   for(row = 0 ; row < term.row; row++) {
+   for(row = 0; row < term.row; row++) {
term.line[row] = malloc(term.col * sizeof(Glyph));
term.alt [row] = malloc(term.col * sizeof(Glyph));
}
@@ -1007,7 +1005,7 @@
switch(escseq.mode) {
default:
unknown:
-   fprintf(stderr, "erresc: unknown csi ");
+   fputs("erresc: unknown csi ", stderr);
csidump();
/* die(""); */
break;


Re: [dev] Re: dmenu-4.3

2011-05-20 Thread anonymous
On Thu, May 19, 2011 at 09:10:36PM +0200, Christian Neukirchen wrote:
> anonymous  writes:
> 
> > On Wed, May 18, 2011 at 04:45:24PM +0100, Connor Lane Smith wrote:
> >> I've just released dmenu-4.3, which is basically smaller and faster.
> >
> >> smaller and faster
> >
> >> faster
> >
> > For me it is slower.  It lists all my files with find, and it is very
> > slow.  Why should it list all my files and directories?
> 
> You seem to have . in your $PATH.

Thanks, removing "." from $PATH works.  It is not good idea to have "."
in $PATH anyway.




Re: [dev] dmenu-4.3

2011-05-19 Thread anonymous
On Wed, May 18, 2011 at 04:45:24PM +0100, Connor Lane Smith wrote:
> I've just released dmenu-4.3, which is basically smaller and faster.

> smaller and faster

> faster

For me it is slower.  It lists all my files with find, and it is very
slow.  Why should it list all my files and directories?




Re: [dev] st patch for draw() etc.

2011-04-27 Thread anonymous
On Sat, Apr 23, 2011 at 03:48:46PM +0400, anonymous wrote:
> On Fri, Apr 22, 2011 at 12:31:37AM +0200, Aurélien Aptel wrote:
> > On Wed, Apr 20, 2011 at 5:46 PM, Magnus Leuthner
> >  wrote:
> > > Please note that the drawing for the selection while selecting only works 
> > > if
> > > the -Os option to GCC is omitted. I have not idea why but I would be very
> > > interested if someone would care to elaborate.
> > 
> > It works here :/ Can anyone someone else try? (-Os is already the
> > default optimisation in the current makefile, just type make)
> > 
> Works with -Os for me.
Now it don't work with -Os and work with -Os -fno-strict-aliasing.

% CFLAGS=-Wstrict-aliasing=2 make
st build options:
CFLAGS   = -Wstrict-aliasing=2 -std=c99 -pedantic -Wall -Os -I.
-I/usr/include -I/usr/X11R6/include -DVERSION="0.1.1"
LDFLAGS  = -s -L/usr/lib -lc -L/usr/X11R6/lib -lX11 -lutil
CC   = cc
cp config.def.h config.h
CC st.c
st.c: In function 'selrequest':
st.c:503: warning: dereferencing type-punned pointer might break
strict-aliasing rules
CC -o st




Re: [dev] [st] cleanup patch

2011-04-26 Thread anonymous
GLYPH_DIRTY is not used at all.  drawregion is called only from draw, so
screen is refreshed every time.  This is really slow: try to start
Midnight Commander in st and uxterm and compare. 




Re: [dev] [st] cleanup patch

2011-04-26 Thread anonymous
It would be also nice to remove debugging code from st.c:

void
ttywrite(const char *s, size_t n) {
{size_t nn;
for(nn = 0; nn < n; nn++)
dump(s[nn]);
}




Re: [dev] [st] cleanup patch

2011-04-26 Thread anonymous
There is a problem with old code commented out with #ifdef:

% CFLAGS=-DDEBUG make
st build options:
CFLAGS   = -DDEBUG -std=c99 -pedantic -Wall -Os -I. -I/usr/include
-I/usr/X11R6/include -DVERSION="0.1.1"
LDFLAGS  = -s -L/usr/lib -lc -L/usr/X11R6/lib -lX11 -lutil
CC   = cc
CC st.c
st.c: In function ‘xdrawc’:
st.c:1685: error: ‘struct ’ has no member named ‘fs’
st.c:1685: error: ‘struct ’ has no member named ‘fs’
make: *** [st.o] Error 1

Fix attached.
diff -r 2a6ed7b26469 st.c
--- a/st.c  Fri Apr 22 00:42:58 2011 +0200
+++ b/st.c  Tue Apr 26 19:00:38 2011 +0400
@@ -1639,7 +1639,7 @@
}
}
 
-   XmbDrawImageString(xw.dpy, xw.buf, base.mode & ATTR_BOLD ? dc.bfont.set 
: dc.font.set,
+   XmbDrawImageString(xw.dpy, xw.buf, (base.mode & ATTR_BOLD ? dc.bfont : 
dc.font).set,
dc.gc, winx, winy, s, bytelen);

if(base.mode & ATTR_UNDERLINE)
@@ -1682,8 +1682,7 @@
XRectangle r = { x * xw.cw, y * xw.ch, xw.cw, xw.ch };
XSetBackground(xw.dpy, dc.gc, dc.col[g.bg]);
XSetForeground(xw.dpy, dc.gc, dc.col[g.fg]);
-   XmbDrawImageString(xw.dpy, xw.buf, 
g.mode&ATTR_BOLD?dc.bfont.fs:dc.font.fs,
-   dc.gc, r.x, r.y+dc.font.ascent, g.c, sl);
+   XmbDrawImageString(xw.dpy, xw.buf, (g.mode & ATTR_BOLD ? dc.bfont : 
dc.font).set, dc.gc, r.x, r.y+dc.font.ascent, g.c, sl);
 }
 
 void 


[dev] [st] cleanup patch

2011-04-23 Thread anonymous
Whitespace fixes and small changes in brelease(): code for selecting
word is no longer executed when you triple-click.
diff -r 2a6ed7b26469 st.c
--- a/st.c  Fri Apr 22 00:42:58 2011 +0200
+++ b/st.c  Sat Apr 23 15:36:45 2011 +0400
@@ -363,11 +363,11 @@
 utf8size(char *s) {
unsigned char c = *s;
 
-   if (~c&B7)
+   if(~c&B7)
return 1;
-   else if ((c&(B7|B6|B5)) == (B7|B6))
+   else if((c&(B7|B6|B5)) == (B7|B6))
return 2;
-   else if ((c&(B7|B6|B5|B4)) == (B7|B6|B5))
+   else if((c&(B7|B6|B5|B4)) == (B7|B6|B5))
return 3;
else
return 4;
@@ -523,20 +523,25 @@
 void
 brelease(XEvent *e) {
int b;
+
sel.mode = 0;
getbuttoninfo(e, &b, &sel.ex, &sel.ey);
-   
if(sel.bx == sel.ex && sel.by == sel.ey) {
sel.bx = -1;
if(b == 2)
selpaste();
-
else if(b == 1) {
-   /* double click to select word */
struct timeval now;
gettimeofday(&now, NULL);
 
-   if(TIMEDIFFERENCE(now, sel.tclick1) <= 
DOUBLECLICK_TIMEOUT) {
+   if(TIMEDIFFERENCE(now, sel.tclick2) <= 
TRIPLECLICK_TIMEOUT) {
+   /* triple click on the line */
+   sel.b.x = sel.bx = 0;
+   sel.e.x = sel.ex = term.col;
+   sel.b.y = sel.e.y = sel.ey;
+   selcopy();
+   } else if(TIMEDIFFERENCE(now, sel.tclick1) <= 
DOUBLECLICK_TIMEOUT) {
+   /* double click to select word */
sel.bx = sel.ex;
while(term.line[sel.ey][sel.bx-1].state & 
GLYPH_SET && 
  term.line[sel.ey][sel.bx-1].c[0] != ' 
') sel.bx--;
@@ -547,19 +552,9 @@
sel.b.y = sel.e.y = sel.ey;
selcopy();
}
-
-   /* triple click on the line */
-   if(TIMEDIFFERENCE(now, sel.tclick2) <= 
TRIPLECLICK_TIMEOUT) {
-   sel.b.x = sel.bx = 0;
-   sel.e.x = sel.ex = term.col;
-   sel.b.y = sel.e.y = sel.ey;
-   selcopy();
-   }
}
-   } else {
-   if(b == 1) 
-   selcopy();
-   }
+   } else if(b == 1) 
+   selcopy();
memcpy(&sel.tclick2, &sel.tclick1, sizeof(struct timeval));
gettimeofday(&sel.tclick1, NULL);
draw();
@@ -605,7 +600,7 @@
 void 
 sigchld(int a) {
int stat = 0;
-   if(waitpid(pid, &stat, 0) < 0)
+   if(waitpid(pid, &stat, 0) == -1)
die("Waiting for pid %hd failed: %s\n", pid, SERRNO);
if(WIFEXITED(stat))
exit(WEXITSTATUS(stat));
@@ -619,7 +614,7 @@

/* seems to work fine on linux, openbsd and freebsd */
struct winsize w = {term.row, term.col, 0, 0};
-   if(openpty(&m, &s, NULL, NULL, &w) < 0)
+   if(openpty(&m, &s, NULL, NULL, &w) == -1)
die("openpty failed: %s\n", SERRNO);
 
switch(pid = fork()) {
@@ -631,7 +626,7 @@
dup2(s, STDIN_FILENO);
dup2(s, STDOUT_FILENO);
dup2(s, STDERR_FILENO);
-   if(ioctl(s, TIOCSCTTY, NULL) < 0)
+   if(ioctl(s, TIOCSCTTY, NULL) == -1)
die("ioctl TIOCSCTTY failed: %s\n", SERRNO);
close(s);
close(m);
@@ -663,7 +658,7 @@
int ret;
 
/* append read bytes to unprocessed bytes */
-   if((ret = read(cmdfd, buf+buflen, LEN(buf)-buflen)) < 0)
+   if((ret = read(cmdfd, buf+buflen, LEN(buf)-buflen)) == -1)
die("Couldn't read from shell: %s\n", SERRNO);
 
/* process every complete utf8 char */
@@ -698,7 +693,7 @@
w.ws_row = term.row;
w.ws_col = term.col;
w.ws_xpixel = w.ws_ypixel = 0;
-   if(ioctl(cmdfd, TIOCSWINSZ, &w) < 0)
+   if(ioctl(cmdfd, TIOCSWINSZ, &w) == -1)
fprintf(stderr, "Couldn't set window size: %s\n", SERRNO);
 }
 
@@ -921,9 +916,9 @@
term.c.attr.mode &= ~ATTR_REVERSE;   
break;
case 38:
-   if (i + 2 < l && attr[i + 1] == 5) {
+   if(i + 2 < l && attr[i + 1] == 5) {
i += 2;
-   if (BETWEEN(attr[i], 0, 255))
+   if(BETWEEN(attr[i], 0, 255))
term.c.attr.fg = attr[i];
else
fprintf(stderr, "er

Re: [dev] st patch for draw() etc.

2011-04-23 Thread anonymous
On Fri, Apr 22, 2011 at 12:31:37AM +0200, Aurélien Aptel wrote:
> On Wed, Apr 20, 2011 at 5:46 PM, Magnus Leuthner
>  wrote:
> > Please note that the drawing for the selection while selecting only works if
> > the -Os option to GCC is omitted. I have not idea why but I would be very
> > interested if someone would care to elaborate.
> 
> It works here :/ Can anyone someone else try? (-Os is already the
> default optimisation in the current makefile, just type make)
> 
Works with -Os for me.




Re: [dev] Config files

2011-02-09 Thread anonymous
Methods discussed in this thread (environment variables and shell
scripts) are already covered in TAOUP:





[dev] dwm cleanup patch

2011-01-07 Thread anonymous
-3 LOC
diff -r 23b71491e149 dwm.c
--- a/dwm.c Thu Dec 02 10:16:47 2010 +
+++ b/dwm.c Fri Jan 07 18:23:41 2011 +0300
@@ -980,7 +980,7 @@
 void
 initfont(const char *fontstr) {
char *def, **missing;
-   int i, n;
+   int n;
 
missing = NULL;
dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
@@ -996,7 +996,7 @@
dc.font.ascent = dc.font.descent = 0;
XExtentsOfFontSet(dc.font.set);
n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names);
-   for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) 
{
+   while(n--) {
dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent);
dc.font.descent = 
MAX(dc.font.descent,(*xfonts)->descent);
xfonts++;
@@ -1014,14 +1014,13 @@
 
 Bool
 isprotodel(Client *c) {
-   int i, n;
+   int n;
Atom *protocols;
Bool ret = False;
 
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
-   for(i = 0; !ret && i < n; i++)
-   if(protocols[i] == wmatom[WMDelete])
-   ret = True;
+   while(!ret && n--)
+   ret = protocols[n] == wmatom[WMDelete];
XFree(protocols);
}
return ret;
@@ -1029,12 +1028,10 @@
 
 #ifdef XINERAMA
 static Bool
-isuniquegeom(XineramaScreenInfo *unique, size_t len, XineramaScreenInfo *info) 
{
-   unsigned int i;
-
-   for(i = 0; i < len; i++)
-   if(unique[i].x_org == info->x_org && unique[i].y_org == 
info->y_org
-   && unique[i].width == info->width && unique[i].height == 
info->height)
+isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) {
+   while(n--)
+   if(unique[n].x_org == info->x_org && unique[n].y_org == 
info->y_org
+   && unique[n].width == info->width && unique[n].height == 
info->height)
return False;
return True;
 }


Re: [dev] [dmenu] Patch for XDG Base Directory specification of dmenu_path

2011-01-02 Thread anonymous
On Sat, Jan 01, 2011 at 06:04:45PM +, Bjartur Thorlacius wrote:
> On 12/30/10, Anselm R Garbe  wrote:
> > On 30 December 2010 20:47, Jon Raphaelson  wrote:
> >> Attached is a patch to dmenu_path which (if enabled in the config.mk)
> >> changes the cache file location to be XDG Base Directory Specification
> >> compliant. After enabling the change, the cache file will live at
> >> $XDG_CACHE_HOME/dmenu/path.cache (or $HOME/.cache/dmenu/path.cache if
> >> $XDG_CACHE_HOME is not set), rather than in the home directory at
> >> ~/.dmenu_cache.
> >> This patch relies on libxdg-basedir [2] being installed.
> >
> > I think using some pseudo-directory standard and library to retrieve
> > the location of a cache file is quite odd.
> >
> I think storing cache files under $HOME is even odder. $HOME is quite
> often accessed over a network. Storing it under /var seems saner.
> 
dmenu cache should be stored under $HOME because different users use
different $PATH.  In my .profile I set

export XDG_CONFIG_HOME="$HOME/etc"
export XDG_CACHE_HOME="$HOME/var/cache"

In dmenu_path.c I set

#define CACHE "var/cache/dmenu"

BTW under $HOME/lib I store various databases like browser bookmarks,
calendars and other things like that.




Re: [dev] [libdc] default font and unicode

2010-09-30 Thread anonymous
On Thu, Sep 30, 2010 at 11:49:52AM +0200, sta...@cs.tu-berlin.de wrote:
> Hi,
> 
> I've switched to newer dmenu (one with libdc) these days and noticed that
> with the deafult font Cyrillic characters are broken.
> 
> The attached tiny patch selects a fixed font aware of unicode and works for
> me. 
> 
> cheers,

Same thing with dwm.  It selects (non-unicode on my machine) terminus.
Maybe change it to 'fixed' too?




Re: [dev] nscript - a little stack-based scripting language interpretter I wrote

2010-08-26 Thread anonymous
On Thu, Aug 26, 2010 at 01:11:00AM +0200, pancake wrote:
> *) about using 'def' instead of $ ..is probably more forthy, but reduces the 
> performance of the VM.. having 'def' will enable
>to override 'def' definition..which is one of the most important features 
> of lisp/fortran. the same applies to math
>operators like '+'.

> which is one of the most important features of lisp/fortran
> lisp/fortran
> fortran

Fortran?




Re: [dev] Stripping html from email

2010-08-24 Thread anonymous
On Tue, Aug 24, 2010 at 04:26:46PM -0700, Robert Ransom wrote:
> On Tue, 24 Aug 2010 20:01:10 +0400
> The ‘tdb’ library is actually LGPLed.

Ok, tdb.h says it is under LGPL.  But both on SourceForge page and in
Arch Linux package it is said it is under GPLv3.  Probably it was just
copied from SourceForge page.  Also there is ctdb tree with GPLed
database library, maybe it is a newer version, tdb.h says tdb is
1999-2004.

Now everything is ok, I have simple and BSD licensed MDA.  Looks like
it didn't updated for half year but very useful anyway.




Re: [dev] nscript - a little stack-based scripting language interpretter I wrote

2010-08-24 Thread anonymous
In C variables can only be created in the start of block ({}
brackets).  You sometimes declare new variables anywhere like in C++.

You include files include include files.  IMO one external include
file (that is placed into /usr/include) should be enough.  And
internal include files can be placed into src/, one .h file for each
c file.  Then you can remove #ifdef guards.  Read "Notes on
Programming in C"[1], nice tips there.  Then user would only need to
#include 

Looks like you are using your 'dynarray' both in library code and as
object type for your language.  But user should not know about
structure of these objects.  Maybe move dynarray.h into src/ and
replace 'union' with 'void *'?  That way your library will be binary
compatible with previous versions even if you add more types or
change/remove existing.  I don't want to say that you should care
about binary compatibility, but that means internal things are hidden
better.

[1] http://doc.cat-v.org/bell_labs/pikestyle




Re: [dev] nscript - a little stack-based scripting language interpretter I wrote

2010-08-24 Thread anonymous
Looks like Forth.




Re: [dev] [9base] /bin/rc

2010-08-24 Thread anonymous
On Tue, Aug 24, 2010 at 09:45:14PM +0200, Moritz Wilhelmy wrote:
> ever heard of symlinks?
> ln -s /path/to/plan9port/bin/rc /bin/rc

I heard, but even moving rc in installation script is a better
solution.




[dev] [9base] /bin/rc

2010-08-24 Thread anonymous
On page http://suckless.org/people/Kris there are scripts that starts
with /bin/rc she-bang.  Someone have also sent some script with
#!/bin/rc in it to this list.

So I want to ask what is the best way to put rc into /bin under Linux.
Is there any options in plan9port or 9base that allow to install
non-conflicting utilities in /bin?  Of course, I can just move 'rc'
into 'bin' using mv in my build script but maybe someone know any
better way?

Hope to get Kris reply, looks like he already use /bin/rc without
problems.  Also strange that he uses #!/usr/bin/env rc in 'vp'.




Re: [dev] Stripping html from email

2010-08-24 Thread anonymous
On Mon, Aug 23, 2010 at 11:55:35PM -0400, Josh Rickmar wrote:
> Yeah, not quite what I'm looking for.  Basically I want something
> that I can pipe the message to with my MDA (fdm) before it is
> delievered to my maildir.

Thanks, I didn't know about fdm and used getmail+procmail.  Now I have
switched to fdm and my config is only 6 lines without comments and
blank lines.

Looks like it is BSD licensed but uses tdb that is GPLv3 licensed.  Is
it ok?




Re: [dev] Stripping html from email

2010-08-24 Thread anonymous
On Tue, Aug 24, 2010 at 08:57:12AM -0400, Kurt H Maier wrote:
> On Tue, Aug 24, 2010 at 8:38 AM, Nick  wrote:
> > On Tue, Aug 24, 2010 at 07:31:18AM -0400, Kurt H Maier wrote:
> >> http://search.cpan.org/~kilinrax/HTML-Strip-1.06/Strip.pm
> >
> > Umm. Is no-one reading the body of the original request? We can all
> > strip XML easily, that isn't the question.
> 
> 
> On Mon, Aug 23, 2010 at 11:32 PM, Josh Rickmar  
> wrote:
> > Is there currently a tool or script that I can use to strip html
> > from emails?
> 
> DESCRIPTION ^
> 
> This module simply strips HTML-like markup from text in a very quick
> and brutal manner.

But it is not what OP asks for.  Tool should process MIME emails and
remove text/html attachments.




Re: [dev] Re: [dev] Re: [dev] Re : [dev] [dev] Usage, -h, --help, help, synops is, …

2010-08-18 Thread anonymous
On Wed, Aug 18, 2010 at 05:55:10PM +0200, Alexander Teinum wrote:
> Is it okay to use three dots in the usage text? (See echo’s man page.)
> I think it means that you can repeat what’s before the three dots.

It is ok and they should be used.  And it should be 3 dots, not … so
usage is in ASCII.  And … look bad with monospace font.

> How do you feel about sorting the options? Should it always be done?

IMO yes.




Re: [dev] [surf] URI handling, with patch

2010-08-18 Thread anonymous
On Tue, Aug 17, 2010 at 06:52:40PM -0400, Ryan Mullen wrote:
> Second, dmenu's "suggested" integration with surf is a bit dodgy. If,
> for example, a user is viewing surf.suckless.org and they wish to
> navigate to suckless.org, they would be required to strike
> shift+return in order to actually visit suckless.org. If the shift key
> is not used, the current page will simply refresh. The reason for the
> refresh is because dmenu matches the input text against the selected
> text, and if it is a substring of the selected text, it will just
> output the selected text when return has been struck, which means the
> page simply refreshes because the new URI is the same as the current
> one.

> As far as I know, the dmenu problem is a feature for one set of users
> and an issue for another set. I wouldn't know how to please everyone
> on this. Feedback appreciated.

Maybe just make return act like shift-return and remove shift-return?
So dmenu will act like shell with tab-completion.




Re: [dev] Re: [dev] Re: [dev] Us age, -h, --help, help, synopsis, …

2010-08-18 Thread anonymous
On Tue, Aug 17, 2010 at 09:36:14PM +0200, Alexander Teinum wrote:
> It would be a nice challenge to write a really small getopt()
> replacement, and a program that generates usage text.

Check getflags(8)[1], it parse options and generate usage messages for
rc scripts.

For C there are ARGBEGIN, ARGEND[2] and other macros.  They don't
generate usage, but they solve another problem of getopt(): you don't
have to check that the string that you pass to getopt() lists all
options that you accept in switch.

[1] http://plan9.bell-labs.com/magic/man2html/8/getflags
[2] http://plan9.bell-labs.com/magic/man2html/2/arg




Re: [dev] Re: [dev] Usage, -h, - -help, help, synopsis, …

2010-08-18 Thread anonymous
On Tue, Aug 17, 2010 at 07:35:15PM +0100, Connor Lane Smith wrote:
> Hey,
> 
> > Options without values are combined? Is that correct?
> 
> Can be. Though, many suckless projects don't accept this and use, eg,
> strcmp(argv[i], "-sb"). A number of non-suckless programs are similar.

Most default X11 programs are similar, because they use XrmParseCommand.




Re: [dev] Re: [dev] [dev] Usage , -h, --help, help, synopsis, …

2010-08-18 Thread anonymous
On Tue, Aug 17, 2010 at 08:07:05PM +0200, Alexander Teinum wrote:
> > I think the best format for usage is something like what Plan 9
> > utilities use (BSD use the same):
> >
> > usage: cmd [-abcde] [-f file] [-g pattern] [file ...]
> 
> Options without values are combined? Is that correct?

Yes.  If you don't use getopt like most suckless projects then no.

> > With these rules flo usage should be
> >
> > usage: flo [-c id] [-f from] [-r id] [-t to] [-w what] [what[,from][-to]]
> 
> What if the values are of the same type? -c and -r have id as value.
> -f and -t have date as value. I think your usage-text looks prettier,
> but out of curiosity, can they be combined like this?
> 
> usage: flo [-cr id] [-ft date] …

Didn't see anything like that.  Even when the types are same, options
mean different things so they are listed like [-f from] [-t to].  crop
utility from Plan 9 have two arguments that accept rgb colors and they
are listed separately.

> If I decide to ditch getopt(), then I’d like to be able to type “flo
> -c -f” to clear the from-field, which means that -f and -t have
> optional arguments. Is it valid for an option to have an optional
> argument?

No.  If there is no argument but some option goes after it like

flo -c -f -t

then -t would become argument for -f.  That way you always have to
make sure that -f is the last argument or write parser that don't
allow you to use -t as argument or something like this.

Most unix utilities use getopt() so you can look at Plan 9 utilities
for examples of man pages and usage.  suckless.org utilities use their
own simple parsers that don't allow you to group options with one '-'
so they list their options like [-a] [-b] [-c].  If you write your own
parser that allow optional arguments and strange things like this,
then there can be no examples or guidelines.

> I found some guidelines here:
> 
> http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_01c
> 
> Do you agree with the guidelines listed in 12.2? I’ll find a pen and a
> paper and try to digest those.

Disagree with Guideline 6.  awk can accept both -Farg and -F arg.  I
think all options should be listed like '[-o arg]' but accept both
-oarg or '-o arg'.  For ssuckless projects they should be listed like
'[-o arg]' and accept only '-o arg' form.

Guideline 8 is strange.  crop utility from Plan 9 have options that
get 3 arguments and it is ok.  But with GNU getopt it would fail
because it move 2nd and 3rd arguments to the end so they become
non-option arguments.

Guideline 9 is like BSD getopt work.  GNU getopt allow you to put
options after arguments but I don't like it.

I wonder why glibc developers put arguments sorting in getopt.  It
would be much better to place it in bash and enable only when runned
in interactive mode.  I use mksh anyway :-p

Guideline 13 should be deprecated.  It is not compatible with Plan 9
cat and only leads to additional code complexity.  Use /dev/stdin
instead.




Re: [dev] [dev] Usage, -h, --hel p, help, synopsis, …

2010-08-17 Thread anonymous
On Tue, Aug 17, 2010 at 05:40:40PM +0200, Alexander Teinum wrote:
> What is the most concise way of outputting a usage and help text?
> 
> Must the usage text be unambiguous when it comes to valid combinations?

No, compatibility of options should be described in man page.

> What should the program option or options be named that show the usage
> or help text?

There should be no help options at all: if you need help, use man
page.  Usage should be displayed when program is called with wrong
options.

> Are there any existing standards for usage and help text?
> 
> How should the usage text and help text be formatted?
> 
> – Keep it within 80 characters?
> – Use of whitespace
> – Use of lower- and uppercase
> – Wether to use “typographical correct” punctuation marks (“, ”, ‘, ’,
> … instead of ", ", ', ', ...) or not

I think the best format for usage is something like what Plan 9
utilities use (BSD use the same):

usage: cmd [-abcde] [-f file] [-g pattern] [file ...]

With these rules flo usage should be

usage: flo [-c id] [-f from] [-r id] [-t to] [-w what] [what[,from][-to]]

> E-mail from pancake:
> 
> > The help messages in unix have different standards. And they aim to be
> > short, simple and keep some common rules. The reason is because this way you
> > can read them faster.
> >
> > In bsd. Help message is just one line. If you want description you have to
> > refer to the manpage or readme.
> >
> > In gnu they tend to display a 4screenscrolling help message which is really
> > anoying.
> >
> > Theorically the help length is another way to measure the complexity of the
> > program.
> >
> > feel free to fwd this mail to the mailing list and continue the discussion
> > there. It can be another interesting topic.
> >
> > For flo. I would suggest a oneline help or maybe somethung like this:
> >
> > flo [-r id] [-wch] [msg]
> > -r id : remove reminder with id.
> > ...
> >
> > Im just telling the flags as an idea.
> >
> > another thing..is that in suckless sw we usually prefer to not use getopt.
> > The code looks ok. But the implementation in libc is horrendous. So a single
> > switchcase would be better.

That depends on what libc you use.  GNU libc sort arguments so options
go first, BSD implementation is simplier.




Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-16 Thread anonymous
On Sun, Aug 15, 2010 at 10:04:18PM +0200, Alexander Teinum wrote:
> I realize that there are ways to do this that are closer to the Unix
> way of thinking. Editor of choice for adding and editing. Instead of
> tagging items, one would should have one file for university and
> another one for work items. And 25 aliases and helper scripts to make
> it flo’.

Tagging is easy to do with grep: you can add tags right into items
description text (like "[work] [university]" or ":w:u:") and then use
grep like "flo | grep :u:".  So you don't need one file for each tag.




Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-15 Thread anonymous
What I would really like to see is a some kind of `when` clone with
cron-like syntax written in C.

I have just written very simple prototype of it in rc:

#!/usr/bin/env rc
date=`{date}
month=$date(2)
day=$date(3)

while (line=`{read}) {
if ({~ $line(1) '*' || ~ $line(1) $day} &&
{~ $line(2) '*' || ~ $line(2) $month})
echo $line(3-)
}

Syntax looks like this:

# DAY MONTH TEXT
15  Aug ok
16  Aug not ok
*   *   always ok

When started with

when <~/lib/calendar

it outputs

ok
always ok

It will output "not ok" tomorrow.

I don't think this should be written in shell scripting language: it
is not too easy to calculate what date it will be tomorrow without
libc and it should be very fast.  Also there should be more fields for
hours, minutes, year and day of week, items should be sorted by time
and there should be some items with dates that are in the feature.

I store my TODO items in file named "TODO" so no need to support for
them in personal calendar program.

- - -

Also just found "calendar" program in plan9port:
http://plan9.bell-labs.com/magic/man2html/1/calendar

I will try it, probably it is even better than my idea.




Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-15 Thread anonymous
On Sat, Aug 14, 2010 at 03:29:35PM -0700, Suraj Kurapati wrote:
> Congratulations on choosing the ISC license for your project.  Too
> many projects still use MIT/X these days when ISC is clearly more
> suckless IMHO: because it has less LOL (lines of license ;-)  Cheers.

"License: ISC" don't mean anything in fact.  If you want to apply
license, you should at least copy its text.




Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-15 Thread anonymous
If you use $XDG_CONFIG_HOME, don't use dot in the name of config file.
Look into your $XDG_CONFIG_HOME for examples.

Looks like you have removed support for XDG_CONFIG_HOME.  I don't like
dotfiles and my XDG_CONFIG_HOME is set to $HOME/lib (and
XDG_CACHE_HOME is set to $HOME/var).  Directory names are taken from
Plan 9.  For example, news(1) from plan9port use $HOME/lib/newstime.
It would be nice if instead of using .flo your program would use
something like $HOME/lib/calendar.

Adding XDG_CONFIG_HOME support is not neccessary: you can just always
save into $HOME/lib even if XDG_CONFIG_HOME is set to $HOME/.config.
I think it is a good solution that let you get rid of dotfiles and
don't require adding support for complex FreeDesktop.org standard.

I have used when[1] for some time, it is useful, but inside it is a
long file with Perl code.  Maybe you can get some ideas from it.  For
example, to simplify code, you can remove editing from flo and let
user edit items file by hand.

[1] http://www.lightandmatter.com/when/when.html




Re: [dev] flo - a command line program for organizing events, to-dos, and deadlines

2010-08-15 Thread anonymous
Another similar program: http://www.lightandmatter.com/when/when.html




Re: [dev] [sic] srw - simple read wrapper

2010-06-23 Thread anonymous
Works nice, but with 9term it is possible to move cursor and edit
line.  If you don't want to use readline (because of license), you can
use libedit from BSD.




Re: [dev] [sic] srw - simple read wrapper

2010-06-23 Thread anonymous
On Wed, Jun 23, 2010 at 05:50:32PM -0700, Evan Gates wrote:
> I just took a stab at writing a simple wrapper to make sic and ii more
> usable, althought it can be used for other things, too.  When using
> this with sic, new messages don't interupt your typing, and when you
> send a message, it doesn't show up twice (echoed from the terminal and
> through sic).

It can also be solved by using 9term.




Re: [dev] Surf 0.4 issues

2010-06-21 Thread anonymous
On Mon, Jun 21, 2010 at 09:13:44AM -0400, Donald Allen wrote:
> 1. Gmail complains that "your browser has cookies disabled" unless the
> sessiontime variable in config.def.h is set to something non-zero. Perhaps
> something non-zero should be the default (said without understanding the
> implications of that).

Already fixed in 0.4.1.

> 2. When I change config.def.h and redo the make, config.h does *not* get
> replaced with the new config.def.h. I think the config.h target in the
> makefile is missing a dependency on config.def.h.

http://lists.suckless.org/dev/1005/4363.html

Maybe that way your config.h don't get replaced when you update
sources from hg?  But I think config.def.h should be a dependency of
config.h beacuse config.h can't be created automatically without it.




Re: [dev] picture

2010-06-21 Thread anonymous
On Sun, Jun 20, 2010 at 09:46:12PM +0200, ⚖ Alexander "Surma" Surma wrote:
> I was just about to ask, Creatives Common BY-SA?

Already discussed on this list, but for software instead of art.
Unlicense[1] for software, CC0[2] for art if you want to place your
work into "public domain" and allow anyone do to anything with it.

[1] http://unlicense.org/
[2] http://creativecommons.org/publicdomain/zero/1.0/ 




Re: [dev] Suckless operating system

2010-06-15 Thread anonymous
On Tue, Jun 15, 2010 at 12:48:34PM +0100, Nick wrote:
> Incidentally, can anyone recommend a good gopher client? I missed it 
> the first time 'round, and I'd be curious to see a different 
> paradigm of web type thing.

Lynx and Mozilla Firefox support Gopher.




[dev] [surf] Disabled JavaScript

2010-06-09 Thread anonymous
I have disabled JavaScript (and plugins) in surf by replacing line
static gboolean loadimage = 1, plugin = 1, script = 1;
with
static gboolean loadimage = TRUE, plugin = FALSE, script = FALSE;

BTW: why don't you use TRUE and FALSE constants here but use them in line
static gboolean showxid = FALSE;
?

But that way scripts from $HOME/.surf/script.js don't work.  Is there
any way to enable them and keep other scripts disabled?

Another idea is do like Arora and implement link hinting in C with
WebKit API, but Arora is GPL'ed so it should be done from scratch.




Re: [dev] dwm-5.8 / dmenu-4.1

2010-05-28 Thread anonymous
Why config.def.h is not named config.h.def?  Extra "extensions" are
usually added after existing, like "config.h.bak".

That way it would be possible to write

config.h:
@echo creating $@ from $...@.def
@cp $...@.def $@

Or even better (will work if you don't rename it too):

config.h: config.h.def
@echo creating $@ from $<
@cp $< $@




Re: [dev] [sic] null pointer in printf

2010-05-24 Thread anonymous
On Mon, May 24, 2010 at 07:51:48AM -0400, Kris Maglione wrote:
> On Mon, 24 May 2010 10:02:47 +0200
> Premysl Hruby  wrote:
> What version of sic are you using? The current version doesn't have
> that code anymore.

Looks like 1.0.




Re: [dev] [surf] User-Agent string.

2010-05-19 Thread anonymous
On Wed, May 19, 2010 at 01:56:22PM +0200, Marvin Vek wrote:
> Hang on, do you suggest the code for sending the User-Agent string
> should be removed, or have the User-Agent string empty by default?

Is it possible to remove User-Agent completely without patching
WebKit?




Re: [dev] [surf] User-Agent string.

2010-05-18 Thread anonymous
On Tue, May 18, 2010 at 11:13:47PM +0200, Szabolcs Nagy wrote:
> On 5/18/10, Marvin Vek  wrote:
> >> the user agent string is unnecessary
> >
> > According to the RFC, it's required.
> 
> "User agents SHOULD include this field with requests."
> 
> SHOULD: "This word, or the adjective "RECOMMENDED", mean that there
>  may exist valid reasons in particular circumstances to ignore.."
> 
> there is only one header that "MUST" be present in a http 1.1 request
> and that's the "Host:" header field
> (btw this is a stupid requirement as well and was not present in http 1.0)

Is it possible to remove this header completely in surf?  Or it is
impossible with WebKit?




Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-17 Thread anonymous
On Mon, May 17, 2010 at 02:40:25PM +, Bjartur Thorlacius wrote:
> On 5/17/10, Kurt H Maier  wrote:
> > On Mon, May 17, 2010 at 9:39 AM, Bjartur Thorlacius
> >  wrote:
> >> I just felt that it was weird that the program that draws borders around
> >> my
> >> windows is also a keyboard shortcut handler/dispatcher/whatever.
> >
> > Now dwm draws statusbar for you (if you use dwm).  It also runs dmenu
> > and st/urxvt/xterm too.  Most of global user keybindings just run
> > commands so it is ok if these keybindings will be window manager
> > keybindings.
> I run WMII, but the situation is similiar there. But why is the statusbar
>  the same program? So it doesn't get focused? That should be possible
>  with some sort of window property, right?

Yes, it is possible.  Maybe it is because dwm uses tags (something
like virtual desktops, but you can select more than one at one time)
and common statusbars (and WM standards) don't support them.

There is http://hg.suckless.org/2wm/ repository.  It is dwm with no
tags and statusbar.  There are some notes about "sbar" in changelog,
probably it is something like statusbar.

If the only problem is tags, maybe replace them with more common
"virtual desktops"?  If you look at screenshots
[http://dwm.suckless.org/screenshots/], there is only one tag selected
on each desktop - tags are used as virtual desktops.




Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-17 Thread anonymous
On Mon, May 17, 2010 at 01:39:38PM +, Bjartur Thorlacius wrote:
> On 5/17/10, anonymous  wrote:
> > What you mean by user shortcuts?  To create shortcut you can configure
> > your window manager.  So user shortcuts start with Alt.  User should
> > make sure that his shortcuts don't overlap with default shortcuts of
> > window manager.  Some kind of standard should be created only for
> > programs, so their *default* shortcuts don't overlap.
> I just felt that it was weird that the program that draws borders around my
> windows is also a keyboard shortcut handler/dispatcher/whatever.

Now dwm draws statusbar for you (if you use dwm).  It also runs dmenu
and st/urxvt/xterm too.  Most of global user keybindings just run
commands so it is ok if these keybindings will be window manager
keybindings.

Or if you disagree, then keybindings that run dmenu and terminal
emulator should be removed from dwm code and placed somewhere else.
But I think it will just make things more complex.




Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-17 Thread anonymous
On Sun, May 16, 2010 at 04:25:45AM +0400, anonymous wrote:
> Also removing Alt keybindings will simplify dmenu code: there will be
> only one switch instead of two, one "default" branch instead of two,
> less manipulation with masks and everytihing else related.
> 

Patch (-7 loc) attached.  BTW can someone explain where Alt-g and
Alt-G originated from?

Even if it will not be applied, line 430
default: return;
should be changed to
default:
return;
to follow common style (lines 383-384).
diff -r 545ec6141dc4 dmenu.c
--- a/dmenu.c   Wed May 05 11:42:39 2010 +0100
+++ b/dmenu.c   Mon May 17 17:43:33 2010 +0400
@@ -15,7 +15,6 @@
 #endif
 
 /* macros */
-#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
 #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= 
(RY) && (Y) < (RY) + (RH))
 #define MIN(a, b)   ((a) < (b) ? (a) : (b))
 #define MAX(a, b)   ((a) > (b) ? (a) : (b))
@@ -386,6 +385,10 @@
case XK_A:
ksym = XK_Home;
break;
+   case XK_b:
+   case XK_B:
+   ksym = XK_Left;
+   break;
case XK_c:
case XK_C:
ksym = XK_Escape;
@@ -394,6 +397,10 @@
case XK_E:
ksym = XK_End;
break;
+   case XK_f:
+   case XK_F:
+   ksym = XK_Right;
+   break;
case XK_h:
case XK_H:
ksym = XK_BackSpace;
@@ -406,6 +413,14 @@
case XK_J:
ksym = XK_Return;
break;
+   case XK_n:
+   case XK_N:
+   ksym = XK_Next;
+   break;
+   case XK_p:
+   case XK_P:
+   ksym = XK_Prior;
+   break;
case XK_u:
case XK_U:
memmove(text, text + cursor, sizeof text - cursor + 1);
@@ -423,30 +438,8 @@
match(text);
}
break;
-   }
-   }
-   if(CLEANMASK(e->state) & Mod1Mask) {
-   switch(ksym) {
-   default: return;
-   case XK_h:
-   ksym = XK_Left;
-   break;
-   case XK_l:
-   ksym = XK_Right;
-   break;
-   case XK_j:
-   ksym = XK_Next;
-   break;
-   case XK_k:
-   ksym = XK_Prior;
-   break;
-   case XK_g:
-   ksym = XK_Home;
-   break;
-   case XK_G:
-   ksym = XK_End;
-   break;
-   case XK_p:
+   case XK_y:
+   case XK_Y:
{
FILE *fp;
char *s;


Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-17 Thread anonymous
On Mon, May 17, 2010 at 12:22:52PM +, Bjartur Thorlacius wrote:
> > 1. Window manager
> > 2. Windows.
>3. User shortcuts

What you mean by user shortcuts?  To create shortcut you can configure
your window manager.  So user shortcuts start with Alt.  User should
make sure that his shortcuts don't overlap with default shortcuts of
window manager.  Some kind of standard should be created only for
programs, so their *default* shortcuts don't overlap.




Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-15 Thread anonymous
On Sun, May 16, 2010 at 04:22:27AM +0400, anonymous wrote:
Also removing Alt keybindings will simplify dmenu code: there will be
only one switch instead of two, one "default" branch instead of two,
less manipulation with masks and everytihing else related.




Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-15 Thread anonymous
On Sat, May 15, 2010 at 11:56:43PM +, Connor Lane Smith wrote:
> On 15/05/2010, anonymous  wrote:
> dmenu uses alt for a couple of bindings. Apparently ctrl binds are
> shell-like and alt binds are vim-like, which is a bit weird (also
> M-p). I'd prefer to remove the alt ones. That said I do like ^[HJKL]
> in dwm, surf, etc.

vi, shell and other original unix programs don't use Alt.  In dmenu
A-h, A-l, A-j, A-k and others can be changed to readline-like ^b, ^f,
^n and ^p. A-p can be changed to S-Insert or ^y, it is more common.

> wrt uriel's unix shortcuts page, where do ^K and the other common ones come 
> in?

Don't know, probably ^K are common now but were not used in UNIX?  ^P
and ^N are common now too, but i think they were popularized by EMACS,
readline and other GNU projects.




Re: [dev] stali and static surf binary

2010-05-15 Thread anonymous
On Sat, May 15, 2010 at 05:11:48PM -0400, Ersin Akinci wrote:
> Thus, dynamic libraries would still be used, but at least they would
> be duplicated, independent, and isolated for each program that needed it.

What problem you are trying to solve?  You want to make binaries
independent from environment so you can get your directory with
program and it's libraries and run on every Linux machine?  I think
main goal of stali is to get rid of complex dynamic library loader and
make loading faster.  Looks like you are trying to use static linking
for different purpose.

If it is too hard to compile these complex web browser engines, it is
possible to switch to Netsurf or Dillo.  Dillo uses FLTK, it is
developed for static linking from the start.  Browser engine is
internal so there is no problem.  These browsers are not so functional
as WebKit-based browsers like surf but they are more simple in fact.

BTW there are no commits to stali repository recently, it is developed
privately or it is not developed now?




Re: [dev] my suckless.org compatible ideas: vim like mapping for any tools, C scripts, vi clone

2010-05-15 Thread anonymous
On Fri, May 14, 2010 at 08:02:57PM +, Bjartur Thorlacius wrote:
> > 1. good tools should have a way to define easily keyboard shortcuts.
> True. It's quite irritating that some tools use the arrow keys for scrolling,
> others use hjkl (which doesn't make sense on all keyboards) and one
> has to configure each seperately to use the keybindings you like.
> > 1.1. Preferably good tools should have at least one predefined set of
> > shortcuts that is compatible with vimi
> I don't think imitiating vim is a good idea. When in a windowing system
> at least it would be nice if apps grabbed all keys they wanted
> (e.g. text boxes could grab all printing characters) but all other keys would
> bubble up (as I think they already do in X) but if they reach the root window
> they could be rethrown in the original window, but as some other user-defined
> keys. For example if one presses  when focused on an image
> inside web page, it would bubble through e.g. xloadimage, surf, tabbed, root
> and then root would look it up and see that  should be rethrown as
>  which would bubble through xloadimage to surf which would scroll
> down. But I doubt it's possible in X (or does XEmbed allow for this?).

Mostly agree, but chaning X is nearly impossible.  Currently it is
possible to use modifiers for this.  Alt (and A-C, A-S-C, A-S) for
window manager, Ctrl (and S-C) for special actions in programs,
everything else (with Shift or not) for typing.  If we don't have
plugins, embedded windows and other things like that, there are only
two classes:

1. Window manager
2. Windows.

So it is easy to determine who should react to keypress:

1. If Alt is pressed then it is for window manager.
2. If Ctrl is pressed then it is for focused window.
3. In other case it is for focused widget (letters types text, return presses 
buttons etc.).

Super and other modifiers are for for user, he can use it as Compose
key, for switching layout etc.

This behaviour is compatible with unix keybindings
(http://unix-kb.cat-v.org/).  Most (all?) suckless tools follow these
rules so there are no problems.  Maybe they should be documented
somewhere?

What I don't like in current suckless programs is hjkl keybindings.
They are designed only for one layout.  I think it is better to use
some kind of mnemonics like ^f for forward, ^b for backward, ^n for
next, ^p for previous etc.  Something like this is used in Lynx, Dillo
(f for forward), most GNU programs (readline, emacs for example),
ratpoison, screen, tmux and many others.  These keybindings are
independent from layout so you can use Dvorak layout or any other
layout that sucks less than current default created for typewriters
(which AFAIK was created to slow down typists, but I am not really
sure if it is not a myth; anyway it was not carefully designed to make
typing faster).




Re: [dev] SWK: The simple widget kit

2010-05-15 Thread anonymous
On Thu, May 13, 2010 at 06:11:08PM +0200, pancake wrote:
> Check t/ui.c and you will understand why SwkWindow is not global variable.
> 
> Do somebody noticed this file? I mean..the UI can be done not only by code..
> also in ascii art. About the other questions..I think i'm not the
> right person
> to reply those questions :)

This reminds me about HTML forms.




Re: [dev] [surf] fix for running script.js

2010-05-12 Thread anonymous
Really nice patch.  There were threads about this bug, but nobody
fixed it.  Now it is fixed and ^f (links numbering script) works on
suckless.org.




Re: [dev] SWK: The simple widget kit

2010-05-12 Thread anonymous
On Wed, May 12, 2010 at 08:24:43AM +0100, Anselm R Garbe wrote:
> because it's quite a nightmare to work with existing ones for rapid
> prototyping unless you don't want to use something very heavyweight
> like Qt.

What about Tk? It is very useful for prototyping.




[dev] [surf] What Works

2010-04-22 Thread anonymous
Do we really need that "What Works" list on http://surf.suckless.org/?
It tells reader what sites works with WebKit?




Re: [dev] Anyone have the traditional vi working on the xterm?

2010-04-16 Thread anonymous
On Sat, Apr 17, 2010 at 12:06:16AM +0200, pmarin wrote:
> I am a Vim user but besides the highlight syntax and the multiple undo
> I don't need  a bloated editor, I usually prefer to write my own
> scritpt in sed/ed/awk than the Vim scripting language. The traditonal
> Vi have macros, abbreviations and a nice lisp mode that is all I need.

Also vi has a nice "!" command that can sort lines, format email
messages and run all your sed/ed/awk scripts.




Re: [dev] tabbed-list patch

2010-04-16 Thread anonymous
On Thu, Apr 15, 2010 at 11:31:28PM -0400, Samuel Baldwin wrote:
> Currently it uses popen() to open a pipe to dmenu, which then sets an
> xproperty, which on update switches to the window matching that title.
> As you can imagine this is a little hackish and I'm not particularly
> proud of this, but it works for the most part and I figured other
> people may be willing to expand on the idea.

Instead of popen() you can use fcntl(or dup, or dup2) like inetd or
netcat -e.  Then you can both read and write.




Re: [dev] [sic] tok and ctok functions

2010-04-16 Thread anonymous
Update.  Renamed one variable (msg to par, cause it is for command
parameters), rearranged parsein so it don't repeat the same line two
times.

Is there any maintainer for "sic"?  Please review patch, I hope it can
be applied, it is not for adding features, it just cleans and fixes
the code.
diff -r 10f41d80803e sic.c
--- a/sic.c Tue Mar 23 18:00:37 2010 +
+++ b/sic.c Sat Apr 17 01:57:26 2010 +0400
@@ -55,76 +55,77 @@
 }
 
 static void
-parsein(char *msg) {
-   char *p;
-   char c;
+parsein(char *s) {
+   char c, *p;
 
-   if(msg[0] == '\0')
+   if(s[0] == '\0')
return;
-   msg = ctok(&msg, '\n');
-   if(msg[0] != ':') {
-   privmsg(channel, msg);
+   skip(s, '\n');
+   if(s[0] != ':') {
+   privmsg(channel, s);
return;
}
-   c = *++msg;
-   if(!c || !isspace(msg[1]))
-   sout("%s", msg);
-   else {
-   if(msg[1])
-   msg += 2;
+   c = *++s;
+   if(c != '\0' && isspace(s[1])) {
+   p = s + 2;
switch(c) {
case 'j':
-   sout("JOIN %s", msg);
+   sout("JOIN %s", p);
if(channel[0] == '\0')
-   strlcpy(channel, msg, sizeof channel);
-   break;
+   strlcpy(channel, p, sizeof channel);
+   return;
case 'l':
-   p = tok(&msg);
+   s = eat(p, isspace, 1);
+   p = eat(s, isspace, 0);
+   if(!*s)
+   s = channel;
+   if(*p)
+   *p++ = '\0';
if(!*p)
-   p = channel;
-   if(!*msg)
-   msg = "sic - 250 LOC are too much!";
-   sout("PART %s :%s", p, msg);
-   break;
+   p = "sic - 250 LOC are too much!";
+   sout("PART %s :%s", s, p);
+   return;
case 'm':
-   p = tok(&msg);
-   privmsg(p, msg);
-   break;
+   s = eat(p, isspace, 1);
+   p = eat(s, isspace, 0);
+   if(*p)
+   *p++ = '\0';
+   privmsg(s, p);
+   return;
case 's':
-   strlcpy(channel, msg, sizeof channel);
-   break;
-   default:
-   sout("%c %s", c, msg);
-   break;
+   strlcpy(channel, p, sizeof channel);
+   return;
}
}
+   sout("%s", s);
 }
 
 static void
-parsesrv(char *msg) {
-   char *cmd, *p, *usr, *txt;
+parsesrv(char *cmd) {
+   char *usr, *par, *txt;
 
usr = host;
-   if(!msg || !*msg)
+   if(!cmd || !*cmd)
return;
-   if(msg[0] == ':') {
-   msg++;
-   p = tok(&msg);
-   if(!*msg)
+   if(cmd[0] == ':') {
+   usr = cmd + 1;
+   cmd = skip(usr, ' ');
+   if(cmd[0] == '\0')
return;
-   usr = ctok(&p, '!');
+   skip(usr, '!');
}
-   txt = ctok(&msg, '\r');
-   msg = ctok(&txt, ':');
-   cmd = tok(&msg);
+   skip(cmd, '\r');
+   par = skip(cmd, ' ');
+   txt = skip(par, ':');
+   trim(par);
if(!strcmp("PONG", cmd))
return;
if(!strcmp("PRIVMSG", cmd))
-   pout(msg, "<%s> %s", usr, txt);
+   pout(par, "<%s> %s", usr, txt);
else if(!strcmp("PING", cmd))
sout("PONG %s", txt);
else {
-   pout(usr, ">< %s: %s", cmd, txt);
+   pout(usr, ">< %s (%s): %s", cmd, par, txt);
if(!strcmp("NICK", cmd) && !strcmp(usr, nick))
strlcpy(nick, txt, sizeof nick);
}
diff -r 10f41d80803e util.c
--- a/util.cTue Mar 23 18:00:37 2010 +
+++ b/util.cSat Apr 17 01:57:26 2010 +0400
@@ -47,35 +47,28 @@
to[l-1] = '\0';
 }
 
-static void
-eat(char **s, int (*p)(int), int r) {
-   char *q;
-
-   for(q = *s; *q && p(*q) == r; q++)
-   ;
-   *s = q;
+static char *
+eat(char *s, int (*p)(int), int r) {
+   while(s != '\0' && p(*s) == r)
+   s++;
+   return s;
 }
 
 static char*
-tok(char **s) {
-   char *p;
-
-   eat(s, isspace, 1);
-   p = *s;
-   eat(s, isspace, 0);
-   if(**s)
-   *(*s)++ = '\0';
-   return p;
+skip(char *s, char c) {
+while(*s != c && *s != '\0')
+s++;
+if (*s !

Re: [dev] [sic] tok and ctok functions

2010-04-15 Thread anonymous
Patch attached.  What I have changed:

 * Replaced `tok` and `ctok` functions with `skip` and (already
   existing, but a little different) `eat`

 * Changed parsing of separators ( from RFC) in server
 responses.  Now tabs are not skipped.  Also no more than one space is
 skipped.  RFC says there can be more than one space but I have seen
 no server that will add extra separator characters.  It is not hard
 to parse but simplicity > correctness.

 * Removed always true `if(msg[1])` check

 * Added output of command parameters:
-   pout(usr, ">< %s: %s", cmd, txt);
+   pout(usr, ">< %s (%s): %s", cmd, msg, txt);
   Now it is possible to use such commands as "LIST"

 * Added function `trim` for removing trailing whitespace.
   It is now used on `msg` variable before outputting it so instead of
reticulum.oftc.net: 04/15/10 17:45 >< NOTICE (AUTH ): *** Looking up your 
hostname...
   you get
reticulum.oftc.net: 04/15/10 17:45 >< NOTICE (AUTH): *** Looking up your 
hostname...
   It is not a problem when you output it with "%-12s" format like
   first argument of pout, but it is easy to see the problem when you
   output it in parenthesis.

Code is one line less now.
diff -r 10f41d80803e sic.c
--- a/sic.c Tue Mar 23 18:00:37 2010 +
+++ b/sic.c Thu Apr 15 17:53:34 2010 +0400
@@ -55,68 +55,74 @@
 }
 
 static void
-parsein(char *msg) {
+parsein(char *s) {
char *p;
char c;
 
-   if(msg[0] == '\0')
+   if(s[0] == '\0')
return;
-   msg = ctok(&msg, '\n');
-   if(msg[0] != ':') {
-   privmsg(channel, msg);
+   skip(s, '\n');
+   if(s[0] != ':') {
+   privmsg(channel, s);
return;
}
-   c = *++msg;
-   if(!c || !isspace(msg[1]))
-   sout("%s", msg);
+   c = *++s;
+   if(c == '\0' || !isspace(s[1]))
+   sout("%s", s);
else {
-   if(msg[1])
-   msg += 2;
+   p = s + 2;
switch(c) {
case 'j':
-   sout("JOIN %s", msg);
+   sout("JOIN %s", p);
if(channel[0] == '\0')
-   strlcpy(channel, msg, sizeof channel);
+   strlcpy(channel, p, sizeof channel);
break;
case 'l':
-   p = tok(&msg);
+   s = eat(p, isspace, 1);
+   p = eat(s, isspace, 0);
+   if(!*s)
+   s = channel;
+   if(*p)
+   *p++ = '\0';
if(!*p)
-   p = channel;
-   if(!*msg)
-   msg = "sic - 250 LOC are too much!";
-   sout("PART %s :%s", p, msg);
+   p = "sic - 250 LOC are too much!";
+   sout("PART %s :%s", s, p);
break;
case 'm':
-   p = tok(&msg);
-   privmsg(p, msg);
+   s = eat(p, isspace, 1);
+   p = eat(s, isspace, 0);
+   if(*p)
+   *p++ = '\0';
+   privmsg(s, p);
break;
case 's':
-   strlcpy(channel, msg, sizeof channel);
+   strlcpy(channel, p, sizeof channel);
break;
default:
-   sout("%c %s", c, msg);
+   sout("%s", s);
break;
}
}
 }
 
 static void
-parsesrv(char *msg) {
-   char *cmd, *p, *usr, *txt;
+parsesrv(char *cmd) {
+   char *msg, *usr, *txt;
 
usr = host;
-   if(!msg || !*msg)
+   if(!cmd || !*cmd)
return;
-   if(msg[0] == ':') {
-   msg++;
-   p = tok(&msg);
-   if(!*msg)
+   if(cmd[0] == ':') {
+   usr = cmd + 1;
+   cmd = skip(usr, ' ');
+   if(cmd[0] == '\0')
return;
-   usr = ctok(&p, '!');
+   skip(usr, '!');
}
-   txt = ctok(&msg, '\r');
-   msg = ctok(&txt, ':');
-   cmd = tok(&msg);
+   skip(cmd, '\r');
+   msg = skip(cmd, ' ');
+   txt = skip(msg, ':');
+   trim(msg);
if(!strcmp("PONG", cmd))
return;
if(!strcmp("PRIVMSG", cmd))
@@ -124,7 +130,7 @@
else if(!strcmp("PING", cmd))
sout("PONG %s", txt);
else {
-   pout(usr, ">< %s: %s", cmd, txt);
+   pout(usr, ">< %s (%s): %s", cmd, msg, txt);
if(!strcmp("NICK", cmd) && !strcmp(usr, nick))
strlcpy(nick, txt, sizeof nick);
}
diff -r 10

Re: [dev] [sic] tok and ctok functions

2010-04-15 Thread anonymous
Another two bugs.

Lines 70-73:
if(!c || !isspace(msg[1]))
sout("%s", msg);
else {
if(msg[1])

If line 73 is executed, isspace(msg[1]) is true.  So it can't be equal
to '\0'.  Therefore, condition `msg[1]` is always true.

* * *

When you type

:abcd

line 97

sout("%c %s", c, msg);

will send "a bcd" (tab replaced by space) to server.





Re: [dev] [sic] tok and ctok functions

2010-04-14 Thread anonymous
On Thu, Apr 15, 2010 at 02:57:59AM +0400, anonymous wrote:
> Also sometimes sic.c uses tok(&s) function instead of ctok(&s, ' ')
> even if RFC says there should be only one space character.

Fix: RFC says there should be only spaces, while tok accepts tabs,
newlines etc.

Here is a patch that use `skip` instead of ctok.  It also adds output
of command parameters so you can see channel names when you execute
LIST command (by typing :list).

There are two FIXMEs because there could be more than one space.

Maybe it is possible to use strchr() sometimes.  In implementation of
skip(), for example.

diff -r 10f41d80803e sic.c
--- a/sic.c Tue Mar 23 18:00:37 2010 +
+++ b/sic.c Thu Apr 15 04:19:20 2010 +0400
@@ -61,7 +61,7 @@
 
if(msg[0] == '\0')
return;
-   msg = ctok(&msg, '\n');
+   skip(msg, '\n');
if(msg[0] != ':') {
privmsg(channel, msg);
return;
@@ -101,22 +101,22 @@
 }
 
 static void
-parsesrv(char *msg) {
-   char *cmd, *p, *usr, *txt;
+parsesrv(char *cmd) {
+   char *msg, *usr, *txt;
 
usr = host;
-   if(!msg || !*msg)
+   if(!cmd || !*cmd)
return;
-   if(msg[0] == ':') {
-   msg++;
-   p = tok(&msg);
-   if(!*msg)
+   if(cmd[0] == ':') {
+   usr = cmd + 1;
+   cmd = skip(usr, ' '); /* FIXME: skip more than 1 space */
+   if(cmd[0] == '\0')
return;
-   usr = ctok(&p, '!');
+   skip(usr, '!');
}
-   txt = ctok(&msg, '\r');
-   msg = ctok(&txt, ':');
-   cmd = tok(&msg);
+   skip(cmd, '\r');
+   msg = skip(cmd, ' '); /* FIXME too */
+   txt = skip(msg, ':');
if(!strcmp("PONG", cmd))
return;
if(!strcmp("PRIVMSG", cmd))
@@ -124,7 +124,7 @@
else if(!strcmp("PING", cmd))
sout("PONG %s", txt);
else {
-   pout(usr, ">< %s: %s", cmd, txt);
+   pout(usr, ">< %s (%s): %s", cmd, msg, txt);
if(!strcmp("NICK", cmd) && !strcmp(usr, nick))
strlcpy(nick, txt, sizeof nick);
}
diff -r 10f41d80803e util.c
--- a/util.cTue Mar 23 18:00:37 2010 +
+++ b/util.cThu Apr 15 04:19:20 2010 +0400
@@ -69,13 +69,10 @@
 }
 
 static char*
-ctok(char **s, int c) {
-   char *p, *q;
-
-   q = *s;
-   for(p = q; *p && *p != c; p++)
-   ;
-   if(*p) *p++ = '\0';
-   *s = p;
-   return q;
+skip(char *s, char c) {
+while(*s != c && *s != '\0')
+s++;
+if (*s != '\0')
+*s++ = '\0';
+return s;
 }




[dev] [sic] tok and ctok functions

2010-04-14 Thread anonymous
I have written the following function:

static char*
skip(char *s, char c) {
while(*s != c && *s != '\0')
s++;
if (*s != '\0')
*s++ = '\0';
return s;
}

Then I can rewrite `ctok` like this:

static char*
ctok(char **s, int c) {
char *p;
 
p = *s; 
*s = skip(p, c);
return p; 
}

This means every line that looks like

p = ctok(&s, c);

can be rewritten as

p = s;
s = skip(p, c);

Then we can rewrite these lines (117-119 in sic.c):

txt = ctok(&msg, '\r');
msg = ctok(&txt, ':');

as

txt = msg;
msg = skip(txt, '\r');
msg = txt;
txt = skip(msg, ':');

and then as

skip(msg, '\r');
txt = skip(msg, ':');

We can't remove skip(msg, '\r') because it has side effect of
replacing '\r' with '\0'.

First of all, maybe I did something wrong, but I did this with my copy
and can see no regression.  If everything I did was correct then it
means ctok and tok functions are really confusing so even their
authors can't understand it and use properly (or do you think that
using parsing function for replacing last character is proper use?).
I will try to rewrite sic using my `skip` function.  It don't operate
with pointers to pointers and do less operations so I think it is
easier to understand what it is doing.

Also sometimes sic.c uses tok(&s) function instead of ctok(&s, ' ')
even if RFC says there should be only one space character.




Re: [dev] sed 10q or sed 11q

2010-04-12 Thread anonymous
http://www.plan9.bell-labs.com/wiki/plan9/Unix_to_Plan_9_command_translation/index.html

head = sed 10q




Re: [dev] Re: stali and OpenBSD userland etc.

2010-04-12 Thread anonymous
On Sat, Apr 10, 2010 at 06:26:12PM +0200, finkler wrote:
> This is my collection of redundancy so far:
> arch  uname -m
> dir   ls -C
> groupsid -nG
> head  sed 11q
> mkfifomknod FILE q
> nlgrep -n
> rmdir rm -r
> tac   tail -r
> vdir  ls -l
> whoamiid -nu

grep requires some pattern, grep -n . works.
Another variant of nl:
awk '{ print NR"\t"$0 }'

rmdir will delete only empty directories, rm -r will delete them recursive.

dir is replaced by lc on Plan 9, lc is alias for ls -p | mc




Re: [dev] [sw] Suckless web-framework

2010-04-07 Thread anonymous
On Wed, Apr 07, 2010 at 10:23:46AM -0400, Kurt H Maier wrote:
> On Wed, Apr 7, 2010 at 10:05 AM, anonymous  wrote:
> > If "back" moves you to upper level, it is not same as above, it require
> > only 1 click.  If "back" moves you to previous page in your history,
> > 1 click too.
> 
> Right, back should act like cd -

It already act like this in most browsers.

> > Adding links to main page in every document is like adding symlink
> > to root/home directory in every directory of your filesystem.  Almost
> > nobody do it, why should we add these links in case of Web?
> 
> Nobody makes those symlinks because that functionality is handled by
> cd.  'cd' for $HOME, 'cd /' for root.
> 
> There's no 'cd /' on the web.  It has to be implemented by a link to
> the main page.  Since almost every website has an identification
> string on it, it hurts nothing to make it link to the main page.

In case of "modern" websites (based on werc for example) some
directory like /usr/share/doc/slrn/ also contains links to
/usr/share/doc/, /usr/share/ and /usr/.




Re: [dev] [sw] Suckless web-framework

2010-04-07 Thread anonymous
On Tue, Apr 06, 2010 at 10:05:09PM +0100, twfb wrote:
> On 21:26 Tue 06 Apr, Claudio M. Alessi wrote:
> Well crafted index pages combined with breadcrumbs can create very
> usable websites, even when they are quite large. It is also useful in
> printed documents as it shows where the document can be found. Skipping
> the sidebar can also avoid the curious Werc issue that result in the
> same stuff being repeated in the body and the sidebar. 

Breadcrumbs should be a feature of browser, not site.  Navigation
(interface, not links like '..') is not a part of file system, it is
part of file manager or shell.

Even if your articles contain navigation, I think navigation elements
should be hidden with CSS or at least "printable version".  No matter
how minimalistic they are.  Printed articles and reports never contain
navigation information, why articles from web should?

> The trouble is the automation, an index page with only a simple list of
> subfolders is rarely enough. You need to add some further information
> with the links. Perhaps the first line in the md file can be appended
> behind the file/dir link in the index list? If a index.md file is
> present it overrides the lazy automated index. 

If you don't put navigation into every article of your website, you don't
need automation.  You can create index.html with names of articles in
every directory, it is enough.  It was enough for filesystems and FTP
sites (INDEX file) for years.

And another example of simple website (except wiki):
http://plan9.bell-labs.com/plan9/index.html




Re: [dev] [sw] Suckless web-framework

2010-04-07 Thread anonymous
On Tue, Apr 06, 2010 at 09:26:14PM +0200, Claudio M. Alessi wrote:
> On Tue, Apr 06, 2010 at 08:50:07PM +0400, anonymous wrote:
> > You don't put same symlinks (to ~/doc, ~/src etc.) in every directory of
> > your filesystem.  Most directories have only one link to them.  Then why
> > should you put links to upper levels in every directory (and even file)
> > of your website?
> It makes sense. The '..' link allow you to directly go back to the upper level
> which, in the case of N sub-levels (e.g., docs/unix/foo/bar/mydoc) you have to
> use the browesr back feature N times (where N is the amount of sub-levels)
> while a '..' link allow you to switch to the upper level with only one click.

"Back" is not related to levels/sublevels.  It moves you to that page
from where you moved to current.

What you mean under "'..' link"?  It moves you from
/docs/unix/foo/bar/ to /?  In unix it moves you to /docs/unix/foo/

> E.g. on http://werc.cat-v.org/docs/web_server_setup/apache2 you have to use 
> the
> back feature 2 times to back to docs/ (and 3 for the home page) while with a
> '..' link you only have to click it once.

Picture attached.  Even better if you use Opera or some Firefox plugin
and can see it as a tree.  Or you can open history sidebar in
Netscape/SeaMonkey/IE.

> > For example look at http://www.fidonet.org/ When you go to "What is
> > FidoNet?" or "How to Join FidoNet", there is no link back.  You can press
> > "back" in your browser, edit URL or something like this.
> Well, same problem here: http://www.fidonet.org/old/genlinfo.html You need two
> clicks to back to the home page (unless you use gU with Vimperator or other
> evil stuff -- which I use :P); with the dot-dot link you only need one click.

"Back" will move you to http://www.fidonet.org/ if you jumped to
current page from http://www.fidonet.org/

> > Another example is http://www.mutt.org/ There is link "more news",
> > but no link to main page in http://www.mutt.org/news.html.
> Same as above.

If "back" moves you to upper level, it is not same as above, it require
only 1 click.  If "back" moves you to previous page in your history,
1 click too.

Adding links to main page in every document is like adding symlink
to root/home directory in every directory of your filesystem.  Almost
nobody do it, why should we add these links in case of Web?
<>

Re: [dev] [sw] Suckless web-framework

2010-04-06 Thread anonymous
On Sun, Apr 04, 2010 at 05:49:18PM +0100, Kai Hendry wrote:
> As for HTML, don't use . Use .
> Same goes for 
> Instead of , use 

Instead of  you can use .   is deprecated alias for
 in HTML 4 and redefined for another purpose in HTML 5, but it is
still for creating lists.

By the way, I don't like navigation in HTML pages.  Separate index
pages are better.  They require less bandwidth and you can save
_article_ without snapshot of website navigation.  And then you don't
need any CGI script to insert navigation into every page.  Simplier
solution for this problem is "don't repeat yourself".

You don't put same symlinks (to ~/doc, ~/src etc.) in every directory of
your filesystem.  Most directories have only one link to them.  Then why
should you put links to upper levels in every directory (and even file)
of your website?

For example look at http://www.fidonet.org/ When you go to "What is
FidoNet?" or "How to Join FidoNet", there is no link back.  You can press
"back" in your browser, edit URL or something like this.

Another example is http://www.mutt.org/ There is link "more news",
but no link to main page in http://www.mutt.org/news.html.





Re: [dev] dmenu visibility issue (+patch)

2010-04-01 Thread anonymous
What if we run 2 dmenu?  They will raise themselfs forever?  When
first raises, second hides and vice versa.




Re: [dev] [surf] script.js

2010-03-23 Thread anonymous
On Tue, Mar 23, 2010 at 01:43:41PM +, Anselm R Garbe wrote:
> More sucking technologies don't work on suckless.org ;)

Seriously, it is possible to throw javascript away. Arora implements hints (hit 
ctrl) without javascript, it manipulates DOM through WebKit API. Maybe hints 
can be distributed as patch, not as script?




Re: [dev] terminal that accepts any size

2010-03-23 Thread anonymous
You can use gvim if you really need vim.

Instead of screen you can use your tiling window manager.




Re: [dev] [surf] script.js

2010-03-16 Thread anonymous
On Tue, Mar 16, 2010 at 09:56:53PM +0100, julien steinhauser wrote:
> I know it won't help you a lot but both middle_click
> (which also work with ^click) and link_hints
> work here in my ~/.surf/script.js.
> 
> I only have little issue with link_hints on a very few sites
> (including suckless.org) where the numbers don't display.

Anyway, even if this thread is repost, problem is not solved
completely. Looks like problem is not with link_hints. script.js sometimes
don't work at suckless.org at all even if it is just for `alert("hello,
world")`. Looks like loading script.js is bound to wrong event.




Re: [dev] [surf] script.js

2010-03-16 Thread anonymous
Sorry, it is repost. Something strange happened with my MUA, don't know
why it reposted it. I have started this thread some time ago and problem
is already solved. 




  1   2   >