Re: [dev] What is bad with Go [formerly: What is bad with Python]
On 04/03/2014, Bobby Powers bobbypow...@gmail.com wrote: Strake wrote: * Member selection is in some cases cumbersome, in which it would not be in C, which is related to ¬(variant types) Can you explain more what you mean? I can't quite remember the particulars. My case was a λ-calculus interpreter, which had to switch on program structure, and I remember solely that it was cumbersome. Perhaps I wrote unidiomatic code, but I couldn't find the appropriate idiom if any such is.
Re: [dev] What is bad with Python
FRIGN d...@frign.de wrote: You can write beautiful and readable code in any language. [assuming that you means the reader in general, not S. Jegen in particular] False. I can't write such code in MATLAB, for example. A question to everyone on this list: What do you think about the Go-language? I'm not a fan: • Case-sensitive exports seem wonky to me • Interfaces rather than variant types [but not interfaces per se] are weak • Member selection is in some cases cumbersome, in which it would not be in C, which is related to ¬(variant types) Mind, my experience is little, and this is merely what I found writing a λ-calculus interpreter in Go.
Re: [dev] l9fb: Linux framebuffer over 9p server
On 26/12/2013, yy yiyu@gmail.com wrote: You could maybe build such a thing on top of l9fb, but I don't think this would be such an improvement over directly using the fb device. The reason for l9fb is to have a common interface whether it's the raw framebuffer, an aggregate surface of many framebuffers, a window, an OpenGL texture on a spinning cube, or whatever else. So far only the first is made.
[dev] l9fb: Linux framebuffer over 9p server
https://github.com/strake/l9fb Future goals: * make a terminal emulator * make a tiling window organizer with same interface * make the X window system my ex-window system
Re: [dev] l9fb: Linux framebuffer over 9p server
On 25/12/2013, Lee Fallat ircsurfe...@gmail.com wrote: Neat although maybe not so practical. There would be lots of latency over a remote network, but locally I can see this being ok. Yes, this is meant to be local. Remote graphics likely ought to be vector rather than raster. How could you make it so that you can compress the out-going video? Variously, but it would unsimplify the system, and I'm not sure whether it would help much. If wanted, tho, one could reserve a compressed /img over 9p with another program.
Re: [dev] [sbase][RFC] Add a simplistic version of tr
On 24/12/2013, Silvan Jegen s.je...@gmail.com wrote: So I guess the question boils down to whether you would rather use libutf or the standardized, POSIX-locale-dependent wchar.h functions for the UTF-8 conversion. I see one advantage of the wchar.h functions: If we use them we could avoid adding an external dependency to sbase. The disadvantage is the fact that we would depend on the whole posix-locale-thing which seems unnecessarily complicated in places. Use wchar.h functions and a sane libc, e.g. musl, which has a pure UTF-8 C locale, which ISO C explicitly allows [1]. The 8-bit clarity what POSIX wants [1] seems nonsense to me, as one can use byte functions for that, but I may be wrong. [1] http://wiki.musl-libc.org/wiki/Functional_differences_from_glibc
Re: [dev][announce] Optimizing C compiler c++ compiler/runtime
On 20/12/2013, Rob robpill...@gmail.com wrote: https://github.com/bobrippling/ucc-c-compiler Why are you rewriting libc?
Re: [dev] wswsh: a mksh web framework
On 13/12/2013, Nick suckless-...@njw.me.uk wrote: On a related note, for those who like him, Eben Moglen just did an excellent series of talks It's not the FSF's doctrine that loses; it's GNU's shitty code. Browsing the web nowadays feels like having engineers and advertisers constantly shouting fuck you at me. This. I just tell them to take a number.
Re: [dev] [wiki] Add suckless init
On 12/12/2013, Strake strake...@gmail.com wrote: Rich Felker, author of musl, wrote an init too, but I can't find it now. Sorry, that ought to be primary author.
Re: [dev] wswsh: a mksh web framework
On 12/12/2013, Neo Romantique neoroma...@autistici.org wrote: C is generally more and efficient, I suppose. I assume you mean more efficient. It may be more for the machine but it's less for the programmer. We build machines to do tedious work so we needn't.
Re: [dev] wswsh: a mksh web framework
On 12/12/2013, Troels Henriksen at...@sigkill.dk wrote: No, that was year 100. 2014 is the year of MMXIV. Anyhow, this is actually the year 44.
Re: [dev] [sbase][RFC] Add a simplistic version of tr
On 28/11/2013, Silvan Jegen s.je...@gmail.com wrote: If I understand correctly you would use mmap to allocate a sparse memory area into which we could then directly index Yes. (either using UTF-8 or UTF-32 indices), right? I meant Unicodepoints; those are just Unicodecs. Since mmap needs a file descriptor argument It's ignored for anonymous map.
Re: [dev] [sbase][RFC] Add a simplistic version of tr
On 28/11/2013, Silvan Jegen s.je...@gmail.com wrote: On Thu, Nov 28, 2013 at 11:45:33AM -0500, Strake wrote: (either using UTF-8 or UTF-32 indices), right? I meant Unicodepoints; those are just Unicodecs. UTF-32 is an encoding that is identical to the unicode point as far as I know. So what I am thinking is that one would either use the UTF-8 representation of the Unicode point as an index, or the unicode point itself. Since using UTF-8 would not require any conversion (on UTF-8 locales) I think it would be preferrable. UTF-8 has variable width, so one must find the length of the sequence anyhow and shift it bytewise into an integer, so one may as well just use fgetwc or the like and work with codepoints.
Re: [dev] [sbase][RFC] Add a simplistic version of tr
On 26/11/2013, Silvan Jegen s.je...@gmail.com wrote: If you you would rather not take this version, what approach would you take for the character set mapping when using UTF-8? On Linux, one can easily make a sparse array with 1-page granularity with mmap, and so simply use a (wchar_t []) or (Rune []), but I'm not sure how portable this is.
Re: Asshole vs. reality [was: Re: [dev] Question about arg.h]
On 12/11/2013, Martti Kühne mysat...@gmail.com wrote: On Thu, Nov 7, 2013 at 3:54 PM, Strake strake...@gmail.com wrote: ... for an actual fault, for example a bottom post, is no flame. Logical fallacies that are obvious are an edge case, I guess... It's top posting we don't like. Sorry, yes, I meant top post.
Re: Asshole vs. reality [was: Re: [dev] Question about arg.h]
Asshole vs. reality would be an appropriate subtitle for suckless: the movie. Alas, the list smells ever of phosphorus and kerosene, as some would rather flame than argue rationally. But slamming someone for an actual fault, for example a bottom post, is no flame.
Re: [dev] [sbase] Command list
On 18/10/2013, sin s...@2f30.org wrote: find: Useless, just do `du -a | grep blabla' Yes, this is what one does on Plan 9. I realize when xargs is useful, I just hate it. Yep, the basic function is sane, but the other crap, insert mode and quotation and such, loses. On 18/10/2013, Truls Becken truls.bec...@gmail.com wrote: On 2013-10-18, at 12:29, sin wrote: find: Useless, just do `du -a | grep blabla' I'm not interested in disk usage, but finding files based on certain properties, such as update time, ownership, permissions, etc. du -a | cut -f 2 Cheers, Strake
[dev] Re: [st] XOpenIM failed
On 17/10/2013, Strake strake...@gmail.com wrote: I am trying to use st, but it fails with the message XOpenIM failed. Could not open input device. ... Never mind; I wrote my own lookupString function. It's not particularly good, lacking ability beyond ASCII, but I'll post it if someone asks.
Re: [dev] Some thoughts about XML
On 18/10/2013, Szymon Olewniczak szymon.olewnic...@rid.pl wrote: I believe that we can make the web the better place without huge revolutino s/HTML/XML+XSLT/g is quite a revolution. (such as changing HTTP to something else) Which is this about, HTTP or HTML? Pages writen in XML has readable source So have pages written in Microsoft Word; a read call will fill my buffer with it. Readable ≠ readily parsible.
[dev] [st] XOpenIM failed
I am trying to use st, but it fails with the message XOpenIM failed. Could not open input device. I checked the XOpenIM man page, which said that it opens an input method, so I checked the man page, the X11 header files, the Arch Linux package repos, and Google hits for XIM, X Input Method, and XOpenIM failed but couldn't find what the hell an input method is or how to actually get or make one. I found the Wikipedia page and the X Consortium Input Method Protocol spec, but the former is a stub and the latter is noisy and seems inessential to my case. I checked the libX11 source, which defines structs _XIM and _XIC, but they are not defined in a public header and thus opaque to users. I added some marker syscalls before and after XOpenIM and straced it, and it tries to open /usr/share/X11/locale.(alias dir) many times before final failure, so I copied them and the C directory over from stock Arch Linux, in vain. I am on Starch Linux, kernel 3.10.7, xorg-server 1.14.2 kdrive Xfbdev, on a Dell Latitude E4300. What must I do to use st?
Re: [dev] [st][patch] scrollback buffer
On 16/10/2013, Jochen Sprickerhof d...@jochen.sprickerhof.de wrote: I've implemented a (limited) scrollback buffer for st. Thanks to v4hn for testing and improving first versions. Thanks! This was the last reason against my st adoption. On 16/10/2013, Christoph Lohmann 2...@r-36.net wrote: You can add it as a patch to the wiki but it won’t be included in main‐ line. Scrollback is what you have other applications for. Because next you will want scrollback selection, scrollback editing and scrollback history files. Other people solved these problems in software already. Yes: * Clearly xterm, rxvt, et al have done, but their lossage is the reason for st. * Terminal multiplexers have done, but suckless already has its own terminal multiplexer what hasn't: dwm.
Re: [dev] Re: Talk about suckless
On 10/10/2013, Silvan Jegen s.je...@gmail.com wrote: A day before Christmas Eve, no less. and the Linux kernel cares what day it is?
Re: [dev] Re: Talk about suckless
On 10/10/2013, FRIGN d...@frign.de wrote: On Thu, 10 Oct 2013 08:31:03 -0500 Strake strake...@gmail.com wrote: On 10/10/2013, Silvan Jegen s.je...@gmail.com wrote: A day before Christmas Eve, no less. and the Linux kernel cares what day it is? Yep[1]. [1]: http://lxr.free-electrons.com/source/include/linux/time.h I said cares, not knows. Oh, it's Christmas, so I won't bother taking this system call today...
[dev] [announce] Starch Linux is bootable and self-hosting
I posted about Starch earlier [1]; to remind, it's static-linked Arch-based Linux distro built against musl. The basic system now works with a few small glitches. So far, packages for x86_64 are available. http://starchlinux.org/ [1] http://lists.suckless.org/dev/1210/13050.html
Re: [dev] [announce] Starch Linux is bootable and self-hosting
On 05/10/2013, Thorsten Glaser t...@mirbsd.de wrote: Strake dixit: http://starchlinux.org/ “HTTP/1.1 200 Schön”?! What, is this improper usage? One rather important thing: starchlinux.org has got an RR but the httpd does not listen on IP, only on Legacy IP. Please fix that, because otherwise, a good part of the ’net can’t ac‐ cess your site. Yes, sorry, I missed that it bound to IPv4 alone by default. Should work now. Thanks. bye, //mirabilos Cheers, S.
Re: [dev] [announce] Starch Linux is bootable and self-hosting
On 05/10/2013, Thorsten Glaser t...@mirbsd.de wrote: Yes, sorry, I missed that it bound to IPv4 alone by default. Should work now. Thanks. Nope – maybe it’s firewalled (looks like pf block drop)? tg@blau:~ $ nc -v6 starchlinux.org 80 nc: connect to starchlinux.org port 80 (tcp) failed: Operation timed out It's open on my router. Anyhow, I just deleted the record for now.
Re: [dev] coreutils / moreutils - DC a directory counter
On 17/07/2013, Calvin Morrison mutanttur...@gmail.com wrote: I came up with a utility[0] that i think could be useful, and I sent it to the moreutils page, but maybe it might fit better here. All it does is give a count of files in a directory. $ ls | wc -l I was sick of ls | wc -l being so damned slow on large directories, so I thought a more direct solution would be better. calvin@ecoli:~/big_folder time ls file2v1dir/ | wc -l 687560 real0m7.798s user0m7.317s sys 0m0.700s $ time sh -c 'ls test | wc -l' 371576 sh -c 'ls test | wc -l' 0.99s user 0.21s system 100% cpu 1.193 total No bother here. Not sure why yours is so slow. I know there is a naming conflict, what does that have to do with the usage of the program? Much; I call it by name. What was the last time you used the reverse polish notation calculator that precedes the invention of C? Today.
Re: [dev] [sbase] Adding tar
On 06/07/2013, Galos, David galos...@students.rowan.edu wrote: The attached patch shows my current work on adapting sltar to sbase. It is functional, but, there are still open questions regarding tar. The big deal is the argument parsing: I would like to use the ARG macros in tar, but I'm not sure how that fits with the average tar invocation. In short, how do you fine folks invoke your tar? $ curl whatever.tar.gz | tar -xz $ tar -C somewhere -xzf file.tar.gz $ tar -czf file.tar.gz files tho if z flag and others such were dropped I would soon adapt and not miss them. Archiver/compressor integration loses, for it needs a flag and code for each compression format. The question is how critical these goals each are in sbase: sanity and backward-compatibility. We may wish to have a saner core toolkit, and wrappers around them for legacy usage. Not sure yet about the C flag; one could do this: ; @{ cd somewhere; gzip -d | tar -x } file.tar.gz $ (chdir somewhere; gzip -d | tar -x) file.tar.gz but that may be a bit cumbersome to do often. Alternatively, we could have a utility, say in, what takes a directory and further arguments, and execs the further arguments in said directory.
Re: [dev] [sbase] [patch] Add sha1sum
On 04/07/2013, sin s...@2f30.org wrote: On Thu, Jul 04, 2013 at 12:34:14PM +, Robert Ransom wrote: sha1sum.c is very similar to md5sum.c; ideally, more of the common code between those programs would be in a library routine. Yeah they are very similar, however, the code is very simple and there is not going to be more programs in sbase that will use that code as far as I know. sha512sum?
[dev] [sbase] shell scripts
I see some utilities in sbase what could easily be shorter as shell/awk scripts. Some utilities I sent in earlier, e.g. cut, were turned down for this reason. For examples, head: #!/bin/sh n=10; while getopts 'n:' o; do case $o in (n) n=$OPTARG;; esac done shift $(dc -e $OPTIND 1 - p); for x in $@; do sed ${n}q $x; done # END pwd: #!/bin/sh echo $PWD #END Why are these in C? head.sh now needs dc, but could easily rather use intc [1], which we could include in sbase. [1] https://github.com/strake/intc
Re: [dev] [sbase] shell scripts
On 07/07/2013, Markus Teich markus.te...@stusta.mhn.de wrote: Why are these in C? Because shell scripts tend to run many processes compared to only one if you don't fork in the C code? Is this a matter of efficiency alone?
[dev] [swerc][PATCH] bin/handlers: roll up repeated code; factorize out suffixes
From 309ffdb318e67014b8565335cc1d95e4ff5d506c Mon Sep 17 00:00:00 2001 From: Strake strake...@gmail.com Date: Wed, 3 Jul 2013 07:26:16 -0500 Subject: [PATCH 1/2] bin/handlers: roll up repeated code --- bin/handlers.rc | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bin/handlers.rc b/bin/handlers.rc index cca6495..2055ed4 100644 --- a/bin/handlers.rc +++ b/bin/handlers.rc @@ -54,6 +54,10 @@ fn man_handler { echo '/pre' } +fn 1_handler { +man_handler $* +} + fn dir_listing_handler { d=`{basename -d $1} if(~ $#d 0) @@ -65,19 +69,12 @@ fn dir_listing_handler { } fn setup_handlers { -if(test -f $local_path.md) { -local_file=$local_path.md -handler_body_main=(md_handler $local_file) -} -if not if(test -f $local_path.1) { -local_file=$local_path.1 -handler_body_main=(man_handler $local_file) -} -if not if(test -f $local_path.tpl) { -local_file=$local_path.tpl -handler_body_main=(tpl_handler $local_file) +local_file=() +for(suffix in md 1 tpl) if(test -f $local_path.$suffix) { +local_file=$local_path.$suffix +handler_body_main=($suffix^_handler $local_file) } -if not if(test -f tpl^$req_path^.tpl) +if(~ $#local_file 0 test -f tpl^$req_path^.tpl) handler_body_main=(tpl_handler tpl^$req_path^.tpl) if(! ~ $#handler_body_main 0) { } # We are done -- 1.7.11.1 From de7dfb66068fe2feddcb7d30e95db24712bfe176 Mon Sep 17 00:00:00 2001 From: Strake strake...@gmail.com Date: Sun, 18 May 2003 15:11:04 -0500 Subject: [PATCH 2/2] factorize out suffixes --- bin/handlers.rc | 8 ++-- bin/werc.rc | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/handlers.rc b/bin/handlers.rc index 2055ed4..b68cff6 100644 --- a/bin/handlers.rc +++ b/bin/handlers.rc @@ -1,5 +1,9 @@ # Werc builtin handlers +suffixes=(md 1 tpl) + +suffix_alternation='('^`{echo $suffixes | tr ' ' '|'}^')' + fn nav_tree { echo 'ul' if(! ~ $#menuTitle 0) { @@ -12,7 +16,7 @@ fn nav_tree { # /./ to deal with p9p's ls failure to follow dir symlinks otherwise ls -F $sitedir/./$req_paths_list [2]/dev/null \ | { -sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|1)|\/)$/!d; s!^'$sitedir'!!; '$dirclean +sed $dirfilter'/\/[^_.\/][^\/]*(\.'^$suffix_alternation^'|\/)$/!d; s!^'$sitedir'!!; '$dirclean if(! ~ $#synth_paths 0) echo $synth_paths | tr ' ' $NEW_LINE } | sort -u | awk -F/ ' function p(x, y, s) { for(i=0; i x-y; i+=1) print s } @@ -70,7 +74,7 @@ fn dir_listing_handler { fn setup_handlers { local_file=() -for(suffix in md 1 tpl) if(test -f $local_path.$suffix) { +for(suffix in $suffixes) if(test -f $local_path.$suffix) { local_file=$local_path.$suffix handler_body_main=($suffix^_handler $local_file) } diff --git a/bin/werc.rc b/bin/werc.rc index 01f4714..dd77207 100755 --- a/bin/werc.rc +++ b/bin/werc.rc @@ -9,8 +9,8 @@ difs=$ifs # Used to restore default ifs when needed # Expected input: ls -F style, $sitedir/path/to/files/ # ls -F+xsymlink hackUseless?hiden files -dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'$forbidden_uri_chars'/d; /\/sitemap\.xml$/d; /\/index\.(md|tpl)$/d; /\/(robots|sitemap)\.txt$/d; /_werc\/?$/d; ' -dirclean=' s/\.(md|1)$//; ' +dirfilter='s/\*$//; s,/+\./+,/,g; s,^\./,,; /\/[._][^\/]/d; /'$forbidden_uri_chars'/d; /\/sitemap\.xml$/d; /\/index(\.'^$suffix_alternation^')+$/d; /\/(robots|sitemap)\.txt$/d; /_werc\/?$/d; ' +dirclean=' s/\.'^$suffix_alternation^'$//; ' # Careful, the proper p9p path might not be set until initrc.local is sourced path=(. $PLAN9/bin ./bin /bin /usr/bin) -- 1.7.11.1
[dev] Re: [swerc][PATCH] bin/handlers: roll up repeated code; factorize out suffixes
On 03/07/2013, Strake strake...@gmail.com wrote: ... Sorry, I thought that I tested both, but actually only tested the first. Second needs work yet.
Re: [dev] Re: Maintaining sbase
On 25/06/2013, Martti Kühne mysat...@gmail.com wrote: On Tue, Jun 25, 2013 at 4:58 PM, Calvin Morrison mutanttur...@gmail.com wrote: my votes are for at a minimum are for: sponge tee pee And a cloth to clean up the mess... No, that's what sponge is for.
Re: [dev] Re: Why HTTP is so bad?
On 24/05/2013, Bjartur Thorlacius svartma...@gmail.com wrote: On 05/24/2013 02:11 PM, Christian Neukirchen wrote: Types can't be declared properly in Unix. In Unix, filetype are defined on a per file basis. Yes — file type, not data type. Delimeters in IPC text streams are defined using $IFS. Rc is hailed exclusively because it makes less use if $IFS. Well, that and the Plan 9 label. It has saner syntax, too.
Re: [dev] Re: Why HTTP is so bad?
On 24/05/2013, random...@fastmail.us random...@fastmail.us wrote: On Fri, May 24, 2013, at 16:02, Strake wrote: Yes. A web browser ought to have a component to fetch documents and start the appropriate viewer, as in mailcap. The whole monolithic web browser model is flawed. And you spend a day on wikipedia or tvtropes and you've got two hundred HTML viewers open? Yes. You need _something_ monolithic to manage a linear (or, rather, branching only when you choose to, via open new window or new tab) browsing history, even if content viewers aren't part of it. When you click a link within the appropriate viewer, it needs to be _replaced_ with the viewer for the content at the link you clicked on. The viewer sends a go message back to the fetcher, which kills the old viewer and loads the new one, and can keep a URL log.
Re: [dev] [st] minor fix
On 06/05/2013, Johannes Hofmann johannes.hofm...@gmx.de wrote: Hi, there is a small glitch in the error handling of the select() call in st.c. See patch below. Regards, Johannes diff --git a/st.c b/st.c index 5251e70..689de26 100644 --- a/st.c +++ b/st.c @@ -3481,7 +3481,7 @@ run(void) { FD_SET(cmdfd, rfd); FD_SET(xfd, rfd); - switch(select(MAX(xfd, cmdfd)+1, rfd, NULL, NULL, tv) 0) { + switch(select(MAX(xfd, cmdfd)+1, rfd, NULL, NULL, tv)) { case -1: if(errno == EINTR) continue; Why are we even using switch here? From 8cf77d2d081702c7e0db2bb8724732ca0fa85410 Mon Sep 17 00:00:00 2001 From: Strake strake...@gmail.com Date: Mon, 6 May 2013 06:29:21 -0500 Subject: [PATCH] (if rather than switch) select ... --- st.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index bd157af..1191969 100644 --- a/st.c +++ b/st.c @@ -3347,12 +3347,12 @@ run(void) { FD_SET(cmdfd, rfd); FD_SET(xfd, rfd); - switch(select(MAX(xfd, cmdfd)+1, rfd, NULL, NULL, tv) 0) { - case -1: + if(select(MAX(xfd, cmdfd)+1, rfd, NULL, NULL, tv) 0) { if(errno == EINTR) continue; die(select failed: %s\n, SERRNO); - default: + } + else { if(FD_ISSET(cmdfd, rfd)) { ttyread(); if(blinktimeout) { @@ -3364,7 +3364,6 @@ run(void) { if(FD_ISSET(xfd, rfd)) xev = actionfps; - break; } gettimeofday(now, NULL); drawtimeout.tv_sec = 0; -- 1.7.11.1
[dev] [st][patch] SWAP macro
From d3455f61a5caaf5d94e2b6c1056fb03713772029 Mon Sep 17 00:00:00 2001 From: Strake strake...@gmail.com Date: Tue, 30 Apr 2013 23:53:04 -0500 Subject: [PATCH] swap --- st.c | 38 ++ 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/st.c b/st.c index 5251e70..8cf3483 100644 --- a/st.c +++ b/st.c @@ -72,6 +72,7 @@ char *argv0; #define DEFAULT(a, b) (a) = (a) ? (a) : (b) #define BETWEEN(x, a, b) ((a) = (x) (x) = (b)) #define LIMIT(x, a, b)(x) = (x) (a) ? (a) : (x) (b) ? (b) : (x) +#define SWAP(t, x, y) { t __SWAP_TEMPORARY; __SWAP_TEMPORARY = (x); (x) = (y); (y) = __SWAP_TEMPORARY; } #define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || (a).bg != (b).bg) #define IS_SET(flag) ((term.mode (flag)) != 0) #define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_usec-t2.tv_usec)/1000) @@ -1358,10 +1359,7 @@ tnew(int col, int row) { void tswapscreen(void) { - Line *tmp = term.line; - - term.line = term.alt; - term.alt = tmp; + SWAP(Line *, term.line, term.alt); term.mode ^= MODE_ALTSCREEN; tfulldirt(); } @@ -1369,16 +1367,13 @@ tswapscreen(void) { void tscrolldown(int orig, int n) { int i; - Line temp; LIMIT(n, 0, term.bot-orig+1); tclearregion(0, term.bot-n+1, term.col-1, term.bot); for(i = term.bot; i = orig+n; i--) { - temp = term.line[i]; - term.line[i] = term.line[i-n]; - term.line[i-n] = temp; + SWAP(Line, term.line[i], term.line[i-n]); term.dirty[i] = 1; term.dirty[i-n] = 1; @@ -1390,15 +1385,12 @@ tscrolldown(int orig, int n) { void tscrollup(int orig, int n) { int i; - Line temp; LIMIT(n, 0, term.bot-orig+1); tclearregion(0, orig, term.col-1, orig+n-1); for(i = orig; i = term.bot-n; i++) { -temp = term.line[i]; -term.line[i] = term.line[i+n]; -term.line[i+n] = temp; +SWAP(Line, term.line[i], term.line[i+n]); term.dirty[i] = 1; term.dirty[i+n] = 1; @@ -1531,12 +1523,12 @@ tsetchar(char *c, Glyph *attr, int x, int y) { void tclearregion(int x1, int y1, int x2, int y2) { - int x, y, temp; + int x, y; if(x1 x2) - temp = x1, x1 = x2, x2 = temp; + SWAP(int, x1, x2); if(y1 y2) - temp = y1, y1 = y2, y2 = temp; + SWAP(int, y1, y2); LIMIT(x1, 0, term.col-1); LIMIT(x2, 0, term.col-1); @@ -1711,15 +1703,9 @@ tsetattr(int *attr, int l) { void tsetscroll(int t, int b) { - int temp; - LIMIT(t, 0, term.row-1); LIMIT(b, 0, term.row-1); - if(t b) { - temp = t; - t = b; - b = temp; - } + if(t b) SWAP(int, b, t); term.top = t; term.bot = b; } @@ -2886,7 +2872,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { FcPattern *fcpattern, *fontpattern; FcFontSet *fcsets[] = { NULL }; FcCharSet *fccharset; - Colour *fg, *bg, *temp, revfg, revbg; + Colour *fg, *bg, revfg, revbg; XRenderColor colfg, colbg; Rectangle r; @@ -2954,11 +2940,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { } } - if(base.mode ATTR_REVERSE) { - temp = fg; - fg = bg; - bg = temp; - } + if(base.mode ATTR_REVERSE) SWAP(Colour *, fg, bg); if(base.mode ATTR_BLINK term.mode MODE_BLINK) fg = bg; -- 1.7.11.1
[dev] [st][patch] not roll our own utf functions
From c40205fe15f0da048128f8735fd2140605de5e9e Mon Sep 17 00:00:00 2001 From: Strake strake...@gmail.com Date: Sun, 5 May 2013 09:35:58 -0500 Subject: [PATCH] not roll our own utf functions --- README| 2 +- config.mk | 2 +- st.c | 129 +- 3 files changed, 11 insertions(+), 122 deletions(-) diff --git a/README b/README index 25606a2..2bbb859 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ st is a simple virtual terminal emulator for X which sucks less. Requirements -In order to build st you need the Xlib header files. +In order to build st you need libutf and the Xlib header files. Installation diff --git a/config.mk b/config.mk index 9431de2..36a0424 100644 --- a/config.mk +++ b/config.mk @@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib INCS = -I. -I/usr/include -I${X11INC} \ `pkg-config --cflags fontconfig` \ `pkg-config --cflags freetype2` -LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 -lutil -lXext -lXft \ +LIBS = -L/usr/lib -lc -lutf -L${X11LIB} -lX11 -lutil -lXext -lXft \ `pkg-config --libs fontconfig` \ `pkg-config --libs freetype2` diff --git a/st.c b/st.c index 8cf3483..da0b6b7 100644 --- a/st.c +++ b/st.c @@ -19,6 +19,7 @@ #include sys/wait.h #include time.h #include unistd.h +#include utf.h #include X11/Xatom.h #include X11/Xlib.h #include X11/Xutil.h @@ -394,10 +395,7 @@ static void selcopy(void); static void selscroll(int, int); static void selsnap(int, int *, int *, int); -static int utf8decode(char *, long *); -static int utf8encode(long *, char *); static int utf8size(char *); -static int isfullutf8(char *, int); static ssize_t xwrite(int, char *, size_t); static void *xmalloc(size_t); @@ -506,115 +504,6 @@ xcalloc(size_t nmemb, size_t size) { } int -utf8decode(char *s, long *u) { - uchar c; - int i, n, rtn; - - rtn = 1; - c = *s; - if(~c B7) { /* 0xxx */ - *u = c; - return rtn; - } else if((c (B7|B6|B5)) == (B7|B6)) { /* 110x */ - *u = c(B4|B3|B2|B1|B0); - n = 1; - } else if((c (B7|B6|B5|B4)) == (B7|B6|B5)) { /* 1110 */ - *u = c(B3|B2|B1|B0); - n = 2; - } else if((c (B7|B6|B5|B4|B3)) == (B7|B6|B5|B4)) { /* 0xxx */ - *u = c (B2|B1|B0); - n = 3; - } else { - goto invalid; - } - - for(i = n, ++s; i 0; --i, ++rtn, ++s) { - c = *s; - if((c (B7|B6)) != B7) /* 10xx */ - goto invalid; - *u = 6; - *u |= c (B5|B4|B3|B2|B1|B0); - } - - if((n == 1 *u 0x80) || - (n == 2 *u 0x800) || - (n == 3 *u 0x1) || - (*u = 0xD800 *u = 0xDFFF)) { - goto invalid; - } - - return rtn; -invalid: - *u = 0xFFFD; - - return rtn; -} - -int -utf8encode(long *u, char *s) { - uchar *sp; - ulong uc; - int i, n; - - sp = (uchar *)s; - uc = *u; - if(uc 0x80) { - *sp = uc; /* 0xxx */ - return 1; - } else if(*u 0x800) { - *sp = (uc 6) | (B7|B6); /* 110x */ - n = 1; - } else if(uc 0x1) { - *sp = (uc 12) | (B7|B6|B5); /* 1110 */ - n = 2; - } else if(uc = 0x10) { - *sp = (uc 18) | (B7|B6|B5|B4); /* 0xxx */ - n = 3; - } else { - goto invalid; - } - - for(i=n,++sp; i0; --i,++sp) - *sp = ((uc 6*(i-1)) (B5|B4|B3|B2|B1|B0)) | B7; /* 10xx */ - - return n+1; -invalid: - /* U+FFFD */ - *s++ = '\xEF'; - *s++ = '\xBF'; - *s = '\xBD'; - - return 3; -} - -/* use this if your buffer is less than UTF_SIZ, it returns 1 if you can decode - UTF-8 otherwise return 0 */ -int -isfullutf8(char *s, int b) { - uchar *c1, *c2, *c3; - - c1 = (uchar *)s; - c2 = (uchar *)++s; - c3 = (uchar *)++s; - if(b 1) { - return 0; - } else if((*c1(B7|B6|B5)) == (B7|B6) b == 1) { - return 0; - } else if((*c1(B7|B6|B5|B4)) == (B7|B6|B5) - ((b == 1) || - ((b == 2) (*c2(B7|B6)) == B7))) { - return 0; - } else if((*c1(B7|B6|B5|B4|B3)) == (B7|B6|B5|B4) - ((b == 1) || - ((b == 2) (*c2(B7|B6)) == B7) || - ((b == 3) (*c2(B7|B6)) == B7 (*c3(B7|B6)) == B7))) { - return 0; - } else { - return 1; - } -} - -int utf8size(char *s) { uchar c = *s; @@ -1230,7 +1119,7 @@ ttyread(void) { char *ptr; char s[UTF_SIZ]; int charsize; /* size of utf8 char in bytes */ - long utf8c; + Rune utf8c; int ret; /* append read bytes to unprocessed bytes */ @@ -1240,9
Re: [dev] [st][patch] not roll our own utf functions
On 05/05/2013, Christoph Lohmann 2...@r-36.net wrote: Greetings. On Sun, 05 May 2013 16:49:06 +0200 Strake strake...@gmail.com wrote: From c40205fe15f0da048128f8735fd2140605de5e9e Mon Sep 17 00:00:00 2001 From: Strake strake...@gmail.com Date: Sun, 5 May 2013 09:35:58 -0500 Subject: [PATCH] not roll our own utf functions Rejected due to dependency hell. It ain't even dependency heck, but meh.
Re: [dev] [surf] add 3-finger back and forward control
On 21/04/2013, Christoph Lohmann 2...@r-36.net wrote: Btw. »3 fingers« is really racist to people only having two or just one finger. Which race has n fingers | n 3?
Re: [dev] [surf] add 3-finger back and forward control
On 21/04/2013, Uli Armbruster uli.armbrus...@gmail.com wrote: * Strake strake...@gmail.com [21.04.2013 18:37]: Which race has n fingers | n 3? Seriously?!?!?! No.
Re: [dev] [st] wide characters
On 15/04/2013, random...@fastmail.us random...@fastmail.us wrote: On Mon, Apr 15, 2013, at 10:58, Martti Kühne wrote: According to a quick google those chars can become as wide as 6 bytes, No, they can't. I have no idea what your source on this is. In UTF-8 the maximum encoded character length is 6 bytes [1] [1] Linux docs: man 7 utf-8 This is more than a four-byte integer ('‿')
Re: [dev] web benchmark
On 14/04/2013, Christoph Lohmann 2...@r-36.net wrote: The benchmark consists of running every website on a RPi Model B in surf, count how long it takes to load the website and compare the value of reaction time and loading time to a reference website. If the website is unusable (reaction time 0.1s) automatically send a bomb threat to postmaster@website. Why loading time? Latency may well be due to the network between, not their server. Measuring the web's sanity with WebKit; the irony... All of this might result in websites offering a stripped down website (not just for mobile or tablets) for embedded devices or us just being ignored. ... or thrown in jail.
Re: [dev] [st] windows port?
On 12/04/2013, Max DeLiso maxdel...@gmail.com wrote: I really only still run windows because I play some games which only run on windows. Wine?
Re: [dev] [st] windows port?
On 11/04/2013, Max DeLiso maxdel...@gmail.com wrote: I completely agree that Windows is a legacy OS, but plenty of people are still forced to use it for many legitimate reasons. Forced? How? At knifepoint?
Re: [dev] [st] st 0.4 slow startup
On 06/04/2013, Igor Šarić karaba...@gmail.com wrote: Pardon my ignorance, but how do I find commit 9c44229c? All the commits on git webpage have longer (sha1?) hashes. That string should be a prefix of the hash.
Re: [dev] [st] New feature idea
On 29/03/2013, Calvin Morrison mutanttur...@gmail.com wrote: See opening images is not the same as having images on your buffer, namely for the reason of being able to look back in your buffer and see the images that have been opened say I wanted all my photos in my collection from 2012, 3rd month, for me this is now trivial, plus I can easily scroll up and down my buffer to look at them. but st has no scrollback buffer.
Re: [dev] Re: [slcon] Call for Papers 2013
On 23/03/2013, hiro 23h...@gmail.com wrote: initscripts are weak. what do you need them to do? what does weak really mean here? Sorry, my comment was indeed vague. I meant the Arch initscripts, tho this may well be true of many: * won't automatically re-start service that dies; network services in particular, e.g. tunnels, may fail due to transient network phenomena * can't automatically start services what another service needs * can't easily start non-root user services
Re: [dev] Re: [slcon] Call for Papers 2013
On 25/03/2013, hiro 23h...@gmail.com wrote: That's all fixable without creating huge systems or frameworks. I agree. I never said that I want a huge system or framework. I think you're just confused from what ubuntu made you think is useful. I think you're just confused about whether you're talking to a now or former Ubuntu user. I have no need for any of this shit to be done automagically. Acknowledged.
Re: [dev] Re: [slcon] Call for Papers 2013
On 25/03/2013, hiro 23h...@gmail.com wrote: So then weak is rather sufficient. Sorry, it sounded like this up there was your wishlist. It was. Now it got to be a good example of what I really don't need in my init scripts :) Glad to help.
Re: [dev] Re: [slcon] Call for Papers 2013
On 21/03/2013, Christian Neukirchen chneukirc...@gmail.com wrote: I would like to give a talk called runit ignite - a suckless init system?, but I'm asking whether there is interest first since I noticed these projects in the suckless context yet. runit is a reliable init system based on service supervision, and ignite is a set of shell scripts to convert the init system of a well-known Linux distribution starting with A to use runit. (No worries, the concepts are generic enough to be applied on every Linux or *BSD system.) I think a 30min talk would be enough to present it, and I'd like to have enough time for discussion later since this is a topic that is getting increasingly relevant given the current introduction of systemd everywhere. It's also interesting for the sta.li plans, I think. I won't be there but I would be very interested. initscripts are weak.
Re: [dev] web browsers
On 10/03/2013, hiro 23h...@gmail.com wrote: are there any other new usable browsers lately? other ideas, recommendations? Netsurf, maybe? It's written in pure C, at least. http://netsurf-browser.org Cheers, Strake
Re: [dev] [announce] linuxutils
On 02/03/2013, Chris Down ch...@chrisdown.name wrote: I like the idea. mountpoint.sh could be improved. Do you prefer patches as a GitHub pull request or by git format-patch? The former, tho either is cool. Cheers, Strake
[dev] [announce] linuxutils
rather than util-linux, which is crap. https://github.com/strake/linuxutils Very incomplete yet, just mount, umount, mountpoint, setsid, and pivot_root, but ultimately I hope to have a full tool set. Cheers, Strake
Re: [dev] Suckless and Wayland
On 13/02/2013, Hugues Moretto-Viry hugues.more...@gmail.com wrote: I already started a similar topic some months ago where I asked you your opinion. Now, the project seems to move fast, this is why I start another subject. The aim is different now, and I want to have some details from Suckless community / developpers about the upcoming technology. After reading many Wayland articles, I think it will completely change Linux ecosystem and I'm a bit worried. Well, what is its natural predator? Wayland introduces fuzzy aspects and they're not very clear for me (POSIX compliant, KMS and network transparency). Since I like many softwares like dwm st, I wonder how I'll do when Wayland will become the norm (as systemd). I really hope you consider porting your essentials softwares on Wayland, I really hope we don't. because major distribs like Fedora or Ubuntu plan to use it. They can use clay tablets for all I care. I think it's a dilemma: using your work on non-Wayland distribs or dropping my favorites softwares for Wayland... No dilemma here. Here my concerns (I'm not the only one, I guess). The only one in this thread so far.
Re: [dev] Suckless generic diagram creation software?
On 06/02/2013, Peter Hartman peterjohnhart...@gmail.com wrote: 2013/2/6 Manolo Martínez man...@austrohungaro.com: On 02/06/13 at 03:29pm, Peter Hartman wrote: LaTeX I use and love LaTeX, but LaTeX is *not* lightweight. Depends on the measure, but it is lighter both in terms of its source, memory footprint, and deps than any app based on gtk. That is a poor measure.
Re: [dev] [st] Shift+F1 should by F11?
On 10/01/2013, Mihail Zenkov mihail.zen...@gmail.com wrote: I have also tested in the virtual terminal of the kenel (you called it 'pure console') and I get the values you said: Shift-F1 = ^[[25~ F11 = ^[[23~ I check again - in my system I have ^[[23~ for Shift+F1 and F11. Can some one else also check this? I get the same as k0ga: F11 = ^[[23~ Shift-F1 = ^[[25~ Linux 3.4.6-1-ARCH This makes sense if indeed Shift-F1 = F13.
Re: ls -s vs. du (was: Re: [dev] [st] font fallback)
On 07/01/2013, Raphael Proust raphla...@gmail.com wrote: Real difference is du handles hard links (i.e. shows actual disk usage (as one would expect) by counting hard-linked files only once) while ls list files (as one would expect) (and optionally gives some information about them). Which wins. Ah, yes, I missed this. Unix wins again. Plan 9 ls has no R flag, which makes sense if truly ls's job is to list directories and du's job is to delve deep, tho Unix 8th ls has the flag. On another note, I find it sadly amusing how an unbelievable number of options [1] is fewer than most have today. [1] http://man.cat-v.org/unix_8th/1/ls
Re: ls -s vs. du (was: Re: [dev] [st] font fallback)
On 06/01/2013, pancake panc...@youterm.com wrote: Didnt checked, but i guess that ls -s show size in bytes and du in block bytes, which depends on filesystem. Nope. Both show size in blocks [1]. It seems proper to do so in ls alone, with a flag of whether to add sizes of all files below; thus we could drop du. One may argue that the job of ls is not to add sizes, but now we have 2 utilities what list files, which loses. [1] http://www.openbsd.org/cgi-bin/man.cgi?query=(ls, du)
Re: [dev] Re: Starch has a web site
On 08/12/2012, lordkrandel lordkran...@gmail.com wrote: On 08/12/2012 05:30, Kai Hendry wrote: Stick to a mailing list with Web archives. I've always thought that forums, bbs and mailing lists are plain old hierarchical filesystems gone astray. These tools represent bad implementations of written communication between users. Imagine threads as folders, mails as files, subthreads as subfolders. Users should be able to create their topics and posts, but not to modify or delete anything. The mantainer can compress the topics with gz when it's time to make an archive. If you do not care about their user base, and also do not care about integration with mail clients, just share a folder over 9p, FTP, HTTP or whatever. SMTP and POP suck hard. Well, web fora, yes, but a mailing list is actually a decent model of written communication between users. True about SMTP. I never use BBSs or POP so I can make no worthy comment. The forum could be a mere sticky directory, which would allow all normal forumnal activities. The difficulty is how to share it: the only user ID is the server's, so UID checks are in vain; even with 9p, which can authenticate a remote user, it must then set its UID, and I will not have such a server working as root! I could check UIDs in the server, but that means more code... A mailing list is easier to configure. In this case, I'm limited too by the host machine, which is not mine.
[dev] Starch has a mailing list
What it says. d...@lists.starchlinux.org http://lists.starchlinux.org/listinfo.cgi/dev-starchlinux.org Cheers, Strake
Re: [dev] Starch has a mailing list
On 08/12/2012, Hugues Moretto-Viry hugues.more...@gmail.com wrote: Subscribed. About installer, why not fork Arch-Install-Scripts? https://github.com/falconindy/arch-install-scripts I may at some time, but my priority is a full self-hosted build.
[dev] Re: Starch has a web site
On 07/12/2012, Hugues Moretto-Viry hugues.more...@gmail.com wrote: A lightweight forum could be useful too. I agree. Ergo, I added one. http://starchlinux.org/Forum/
[dev] Re: Starch has a web site
On 07/12/2012, hiro 23h...@gmail.com wrote: it asked me if tux is cute and after I answered it isn't the web site said I'm a robot. please just go on using mailing lists. forums (and most other web shit) suck. Try now (^_~)
Re: [dev] Re: Starch has a web site
On 07/12/2012, hiro 23h...@gmail.com wrote: forums and the plural is fora.
[dev] Re: Starch has a web site
Hugues Moretto-Viry wrote: Dude, I can tell you I'm very interested about this project. I will follow you. Good work! Thanks! James Christopher Hogg wrote: I am interested too. If you'll avoid systemd, dbus and similar stuff, I'll think about contribution. Like the plague. Prakhar Goel wrote: Have you thought of using something like NIX? Yes. The implementation sucks Horribly. but the idea there: completely reproducible builds is incredible. Yes, and easy portable configuration. These are neat ideas, and could be done well, but that's another distro. Raphael Proust wrote: Any plan to integrate an RSS feed? No. (or similar?) Maybe a 9p feed. Prakhar Goel wrote: Also, may I recommend s6 as the init system? It follows the suckless philosophy: mionimal, does exactly what is needed and is stable. Yes, thanks for the tip. I must further study the options. Cheers, Strake
[dev] Re: Starch has a web site
Julian Dammann wrote: What's a 9p feed? that I serve my news directory over 9p (^_~) Truls Becken wrote: Where should discussions take place? The home page does not mention any community links. Well, we have none yet, but we have a few options: * Mailing list My preferred, but as the site is on someone else's server, and unfortunately I had to delegate them the whole domain, this may be difficult. * werc bridge Tried it; not sure how to configure it. I had the form but posting a comment failed. I may try further in future, but mind, I will be busy with exams for the next 11 days or so. The installation guideline suggests using the Arch installer. That's fine, but I'd just like to mention that I always found it fascinating how you can install Arch by booting any Linux system you have at hand (an existing installation or some live cd), download a static build of pacman, mount the partition you want to install on, and simply run; ./pacman -S base -r /mnt Yes, true. I added a note to InstallationGuide. All the best with this new distro. Thanks. Cheers, Strake
[dev] Starch has a web site
Hello all. Starch Linux has its own web site now: http://starchlinux.org so further announcements will be made there. As a reminder, the earlier thread: http://lists.suckless.org/dev/1210/13050.html Ports: https://github.com/StarchLinux/starch-ports Cheers, Strake
Re: [dev] [suckless] Migration to git
On 27/11/2012, Raphael Proust raphla...@gmail.com wrote: darcs? (Yes, I know, it's not written in C. The interface is very clean though. There is no branching, no history rewritting, no bells and whistles.) It's not in C, but Haskell code can be easily compiled and distributed in binary form. Darcs has no history edition, as it essentially keeps no history, which is a win in my book. The main difficulty seems to be the corner-case exponential-time merge algorithm.
Re: [dev] I'm back
Jens Staal staal1...@gmail.com wrote: I agree with this. As an example distribution, Sabotage does things pretty well. One detail that I like a lot (but it sort of depends on your stance on symlinks) is the way applications usually are placed in it: Each application gets its own directory under /opt and then installed files get symlinks in / (the file system hierarchy is stali-inspired with everything in root and usr just pointing back to root). For me, this is a nicer solution than for example pacman to keep track on which files that belong to which package (no fragile databases needed). One may use stacking bind mounts rather than symlinks. I know no decent such fs in Linux kernel space, as aufsn and unionfs seem cumbersome, but it ought to not be too difficult in user space, as 9p server. What I have noticed lately is however how much of the broken stuff that are expected to build also relatively fundamental technologies. For example, mesa (which is needed if one ever wants to run wayland instead of X) expects libudev to build, and if the version requirements will increase further that will basically force systemd on peopole. Free software, captive society. I am starting to think of this as the Fragile X syndrome, which usually refers to a genetic disease causing mental retardation (http://en.wikipedia.org/wiki/Fragile_X_syndrome ). I am starting to feel that Linux is having a serious case of its digital variant. Ha! Nice. Anselm Garbe garb...@gmail.com wrote: I'm back in the game ;) Welcome back! It's your move.
Re: [dev] I'm back
On 18/11/2012, Bjartur Thorlacius svartma...@gmail.com wrote: GNU Stow also. Oh, yeah, that's what we need: more perl.
Re: [dev] [announce] rat - ridiculously abysmal tar
On 06/11/2012, Alex Hutton highspeed...@gmail.com wrote: Which languages qualify as suckless? Only Unicode-extended Lazy K. λ is for wimps.
Re: [dev] [announce] rat - ridiculously abysmal tar
On 07/11/2012, Joerg Zinke m...@umaxx.net wrote: Loglan is way to over-engineered and bloated. toki pona to the rescue! Training your mind to think in Toki Pona can lead to many deeper insights about yourself or the world around you. [1] Well, it can lead to many shallow insights about its creator. [1] http://en.tokipona.org/wiki/What_is_Toki_Pona%3F
Re: [dev] [announce] rat - ridiculously abysmal tar
On 07/11/2012, hiro 23h...@gmail.com wrote: Which languages qualify as suckless? C, body language. body Language /body
Re: [dev] [st] 0.3 release
On 05/11/2012, Brandon Invergo bran...@invergo.net wrote: The mission then is to put on some deep sea diving gear and wade into the murky depths of xterm code s/deep sea diving/hazmat/
Re: [dev] Troff for typsetting e-mails
On 28/10/2012, Luis Anaya papoan...@hotmail.com wrote: On Sun, Oct 28, 2012 at 01:21:40PM +0100, hiro wrote: typesetting? raw text can be typeset just fine with a keyboard. not sure what you're really up to. It is suckless answer to HTML email. It might as well *be* HTML email. Because it is. A rose of any other name is... ? Troff ≠ HTML.
Re: [dev] [announce] Starch Linux: static-linked Arch Linux
On 25/10/2012, Strake strake...@gmail.com wrote: Someone just told me that my server is unreachable. I thought I had it working again, but clearly I was wrong. Sorry about this; I'll try to unbreak it or find an alternative soon. Sorry about this. Ought to be reachable now. Got new IP, forgot to change DNS. Ports now also available on github: https://github.com/strake/starch-ports
Re: [dev] [announce] Starch Linux: static-linked Arch Linux
On 25/10/2012, Strake strake...@gmail.com wrote: Packages: http://strake.zanity.net:1104/starch/pkg/(core, extra) Build Scripts: http://strake.zanity.net:1104/starch/ports.git Someone just told me that my server is unreachable. I thought I had it working again, but clearly I was wrong. Sorry about this; I'll try to unbreak it or find an alternative soon. Cheers, Strake
Re: [dev] Wayland
On 23/10/2012, Hugues Moretto-Viry hugues.more...@gmail.com wrote: What do you think about Wayland? Guess: http://wayland.freedesktop.org/docs/html/chap-Protocol.html
Re: [dev] [surf] [patch] Multiple views, one process
On 19/10/2012, Calvin Morrison mutanttur...@gmail.com wrote: I think the largest benefit is the cache. Loading up many http://google.com's would mean you'd have to reload all of the images and such, whereas with one process, you wouldn't have an opportunity of overlap cache. So make a local HTTP caching proxy. Alternatively, to save memory perhaps, one could use local shared cache files, e.g. /var/cache/surf/hash of URL for unix-tooly-ness with kill, you could intercept signals and only have them apply to the current window. So to kill some window, I must first switch to it, then kill it. Not so bothersome interactively, but quite difficult in a script. That, and KILL is uncatchable, so it would kill them all; same for STOP.
Re: [dev] uriel is gone
On 14/10/2012, Kurt H Maier khm-suckl...@intma.in wrote: Sorry to have to let you guys know, uriel passed away peacefully a couple days ago. We'll miss him. Kurt I am very sorry to hear this. I never knew him in person, but I shall miss his keen commentary. Strake
[dev] [sbase/grep] [PATCH]: add z flag to use NULL separators
Not sure which would be better choice of flag: 'z' or '0', so I arbitrarily chose 'z'. commit 474a73ae118e6791fc56e616233dd9ccb5c8e92f Author: strake strake...@gmail.com Date: Thu Oct 4 19:50:23 2012 -0500 grep: add z flag to use NULL separators diff --git a/grep.c b/grep.c index 9716328..48a54c0 100644 --- a/grep.c +++ b/grep.c @@ -18,6 +18,8 @@ static bool many; static bool match = false; static char mode = 0; +static char delim = '\n'; + int main(int argc, char *argv[]) { @@ -41,6 +43,9 @@ main(int argc, char *argv[]) case 'v': vflag = true; break; + case 'z': + delim = '\0'; + break; default: usage(); } ARGEND; @@ -73,7 +78,7 @@ grep(FILE *fp, const char *str, regex_t *preg) long n, c = 0; size_t size = 0, len; - for(n = 1; afgets(buf, size, fp); n++) { + for(n = 1; getdelim(buf, size, delim, fp) = 0; n++) { if(buf[(len = strlen(buf))-1] == '\n') buf[--len] = '\0'; if(regexec(preg, buf, 0, NULL, 0) ^ vflag) @@ -92,7 +97,7 @@ grep(FILE *fp, const char *str, regex_t *preg) printf(%s:, str); if(mode == 'n') printf(%ld:, n); - printf(%s\n, buf); + printf(%s%c, buf, delim); break; } match = true;
Re: [dev] [st] Patches
On 19/09/2012, Roberto E. Vargas Caballero k...@shike2.com wrote: Maybe a good solution could be integrate tmux inside of st (for example if STTMUX is defined, run tmux in starup). Yeah! Oh, we could have a variable for everything that one could wish to start in st: STTMUX, STGNUSCREEN, STAALIBKDE... or we could just use -e.
Re: [dev] any update on stali?
On 27/08/2012, Kurt H Maier khm-suckl...@intma.in wrote: On Mon, Aug 27, 2012 at 10:30:32PM +, Bjartur Thorlacius wrote: Why Loongson? He means MIPS. Yes, sorry. OpenBSD calls it loongson rather than mips so I thought that binaries must be built for Loongson specifically, which now rather seems false.
Re: [dev] any update on stali?
On 23/08/2012, Joaquim Pedro França Simão osmano...@gmail.com wrote: I wonder if there is any news about stali. I searched the mail list, but had no activity on this recently. Most activity about stali seems to be such as this. I started to hate autotools further. Yes, no wonder. GNU Autotools is a system to cause build failures and other grief, portably. Basically I started to see many setbacks, not to mention faults in the current system of distributions. I'd really like to help any project doesn't sucks. I have for quite a while been trying to build a static-linked Arch-based system with, as its core, linux, pacman, sbase, and some tools from OpenBSD. It is highly experimental, not ready for general use, with no warranty, quite possibly likely to kill or maim, etc, etc. Not sure whether it will meet your criteria, but nevertheless it can be found here: Built packages, x86_64: http://strake.zanity.net:1104/starch/pkg/core/ Build scripts, i.s. PKGBUILDS: http://strake.zanity.net:1104/starch/abs.git Packages built against uClibc. Short-term goals are these: * make pacman and the associated tools and scripts, mainly makepkg, work with said core * diversify architecturally, e.g. i686, Loongson
Re: Regarding dogma words [Was: Re: Regarding make-systems [Was: Re: [dev] Build system: redo]]
On 10/08/2012, hiro 23h...@gmail.com wrote: well, this is an elitist list of mothafockas who don't give a shit about others. that's why communication theorists can go away. Yep. We're so elite, we're not bound by any mere laws of physics. Just watch us squeeze many GB of entropy into this tiny 4 kB memory chip.
Re: [dev] [PATCH] sbase: add cut
On 03/08/2012, Connor Lane Smith c...@lubutu.com wrote: % head -n -10 Not sbase head. $ seq 0 7 | head -n -2 $
Re: [dev] [PATCH] sbase: add chroot
On 01/08/2012, Džen yvl...@gmail.com wrote: why argu? On Wed, Aug 1, 2012 at 5:11 PM, Strake strake...@gmail.com wrote: [...] +void main (int argc, char *argu[]) { [...] Habit of mine.
Re: [dev] [PATCH] sbase: add cut
On 01/08/2012, Martin Kopta mar...@kopta.eu wrote: Also, I'm really curious why people use cut when awk exists. $ du -b /usr/bin/cut /usr/bin/gawk /opt/plan9/bin/awk 38600 /usr/bin/cut 400212 /usr/bin/gawk 105700 /opt/plan9/bin/awk Speed and simplicity I guess? Why would I use awk of which I don't remember syntax, when I could often do with trustworthy cut easily? This. Actually just simplicity; I'm not sure which has better speed. Meh.
Re: [dev] [PATCH] sbase: add cut
I rewrote cut cleaner, but am not sure whether I ought to bother to send it, if ye would rather keep sbase sans cut.
[dev] [PATCH] sbase: add chroot
diff -r 8cf300476909 chroot.8 --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/chroot.8 Wed Aug 01 04:46:43 2012 -0500 @@ -0,0 +1,25 @@ +.TH CHROOT 8 +.SH NAME +chroot \- change root directory +.SH SYNOPSIS +.B chroot +.I path +[ +.I x +[ +.I argument ... +] +] +.SH OPERATION +.B chroot +changes the root directory to +.I path +and starts +.I x +with +.I arguments +, or +.B $SHELL -i +if no +.I x +given. diff -r 8cf300476909 chroot.c --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/chroot.c Wed Aug 01 04:46:43 2012 -0500 @@ -0,0 +1,22 @@ +#include stdio.h +#include stdlib.h +#include unistd.h +#include util.h + +int main (int argc, char *argu[]) { + if (argc 2) { + fputs (No new root path given\n, stderr); + exit (1); + } + if (chroot (argu[1])) eprintf (chroot:); + if (argc == 2) { + char *x; + x = getenv (SHELL); + if (!x) { + fputs (chroot: SHELL not set\n, stderr); + return 1; + } + if (execl (x, x, -i, (char *)0) 0) eprintf (chroot: %s:, x); + } + else if (execv (argu[2], argu + 2) 0) eprintf (chroot: %s:, argu[2]); +}
Re: [dev] [PATCH] sbase: add chroot
On 01/08/2012, pancake panc...@youterm.com wrote: That is vulnerable on linux. Proper use is: chdir (path); chroot(.); Ah, sorry. --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/chroot.8 Wed Aug 01 05:09:36 2012 -0500 @@ -0,0 +1,25 @@ +.TH CHROOT 8 +.SH NAME +chroot \- change root directory +.SH SYNOPSIS +.B chroot +.I path +[ +.I x +[ +.I argument ... +] +] +.SH OPERATION +.B chroot +changes the root directory to +.I path +and starts +.I x +with +.I arguments +, or +.B $SHELL -i +if no +.I x +given. diff -r 8cf300476909 chroot.c --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/chroot.c Wed Aug 01 05:09:36 2012 -0500 @@ -0,0 +1,22 @@ +#include stdio.h +#include stdlib.h +#include unistd.h +#include util.h + +void main (int argc, char *argu[]) { + if (argc 2) { + fputs (No new root path given\n, stderr); + exit (1); + } + if (chdir(argu[1]) || chroot (.)) eprintf (chroot:); + if (argc == 2) { + char *x; + x = getenv (SHELL); + if (!x) { + fputs (chroot: SHELL not set\n, stderr); + exit (1); + } + if (execl (x, x, -i, (char *)0) 0) eprintf (chroot: %s:, x); + } + else if (execv (argu[2], argu + 2) 0) eprintf (chroot: %s:, argu[2]); +}
Re: [dev] [PATCH] sbase: add cut
On 01/08/2012, Kurt H Maier khm-suckl...@intma.in wrote: In fact, I'm fairly certain I could implement cut in sed. with shell script wrapper?
[dev] [PATCH] sbase: add cut
Will now need libutf. diff -r 8cf300476909 Makefile --- a/Makefile Sat Jun 09 18:53:39 2012 +0100 +++ b/Makefile Tue Jul 31 23:06:28 2012 -0500 @@ -27,6 +27,7 @@ cksum.c\ cmp.c \ cp.c \ + cut.c \ date.c \ dirname.c \ echo.c \ diff -r 8cf300476909 config.mk --- a/config.mk Sat Jun 09 18:53:39 2012 +0100 +++ b/config.mk Tue Jul 31 23:06:28 2012 -0500 @@ -10,7 +10,7 @@ LD = $(CC) CPPFLAGS = -D_POSIX_C_SOURCE=200112L CFLAGS = -g -ansi -Wall -pedantic $(CPPFLAGS) -LDFLAGS = -g +LDFLAGS = -g -lutf #CC = tcc #LD = $(CC) diff -r 8cf300476909 cut.1 --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/cut.1 Tue Jul 31 23:06:28 2012 -0500 @@ -0,0 +1,51 @@ +.TH CUT 1 +.SH NAME +cut \- select columns of file +.SH SYNOPSIS +.B cut -f +.I ranges +[ +.B -d +.I delimiter +] +[ +.I file ... +] +.br +.B cut -c +.I ranges +[ +.I file ... +] +.br +.B cut -b +.I ranges +[ +.I file ... +] +.br +.SH OPERATION +Cut reads from given files, or stdin if no files given, and for each line selects +.TP +.B columns, +with -f flag +.TP +.B characters, +with -c flag +.TP +.B bytes, +with -b flag +.LP +within given comma- or space-delimited ranges. +.LP +.br +Each range is either a single decimal number, or of this form: +.br +.I x +- +.I y +.br +where x and y are decimal numbers, or empty. +Empty x means first, and empty y means last column/character/byte on the line. +.LP +If -d option given, then the first character of its argument is the delimiter; otherwise it is tab. diff -r 8cf300476909 cut.c --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/cut.c Tue Jul 31 23:06:28 2012 -0500 @@ -0,0 +1,192 @@ +#include stdio.h +#include stdlib.h +#include utf.h +#include text.h + +typedef struct { + int min, max; +} range; + +int inRange (range r, unsigned int n) { + if ((0 == r.max || n = r.max) n = r.min) return 1; + else return 0; +} + +int fputrune (Rune r, FILE *f) { + char x[UTFmax]; + int n; + n = runetochar (x, r); + fwrite (x, 1, n, f); + return n; +} + +void cutLineF (Rune d, unsigned int s, range *rs, char *x) { + int ii, n; + if (!utfrune (x, d)) { + if (!s) fputs (x, stdout); + return; + } + /* kludge; be warned */ + for (ii = 0; rs[ii].min; ii++) { + char *y; + y = x; + for (n = 1; y; n++) { + char *z; + char ch; + z = utfrune (y, d); + if (z) { + ch = *z; + *z = 0; + } + if (inRange (rs[ii], n)) { + fputs (y, stdout); + fputrune (d, stdout); + } + if (z) { + *z = ch; + z += runelen (d); + } + y = z; + } + } +} + +void cutLineC (range *rs, char *x) { + Rune _r; + int ii, n; + for (ii = 0; rs[ii].min; ii++) { + char *y; + y = x; + for (n = 1; *y; n++) { + int l = chartorune (_r, y); + if (inRange (rs[ii], n)) fwrite (y, 1, l, stdout); + y += l; + } + } +} + +void cutLineB (range *rs, char *x) { + int ii, n; + for (ii = 0; rs[ii].min; ii++) { + for (n = rs[ii].min - 1; rs[ii].max ? n rs[ii].max : x[n]; n++) { + fputc (x[n], stdout); + } + } +} + +void go (int mode, Rune d, unsigned int s, range *rs) { + char *x; + size_t size = 0; + x = 0; + + while (afgets (x, size, stdin)) { + int ii; + /* must delete newline here, and redo later; + otherwise, unknown whether it was included in cut */ + for (ii = 0; x[ii]; ii++) if (x[ii] == '\n') x[ii] = 0; + switch (mode) { + case 'f': + if (!utfrune (x, d)) { + if (!s) { + fputs (x, stdout); + fputc ('\n', stdout); + } + } + else { + cutLineF (d, s, rs, x); + fputc ('\n', stdout); + } + break; + case 'c': cutLineC (rs, x); fputc ('\n', stdout); break; + case 'b': cutLineB (rs, x); fputc ('\n', stdout); break; + } + } +} + +int main (int argc, char *argu[]) { + int mode = 0; + Rune d = '\t'; + unsigned int s = 0; + range *rs = 0; + int
Re: [dev] [surf] port for gtk3
Another option would be Clutter: http://trac.webkit.org/wiki/clutter
Re: [dev] recommend suckless mail server
On 20/04/2012, sta...@cs.tu-berlin.de sta...@cs.tu-berlin.de wrote: Can anyone suggest a suckless mail server? We need encrypted IMAP and SMTP. Or a suckless tool chain which achieves the above (e.g. instead SSL aware IMAP server, rsync a maildir from server machine to local machine) To take incoming mail, I use netqmail, with these alterations: https://aur.archlinux.org/packages.php?ID=31137 which include TLS. Installation was a little grievous; I can't remember how I did it. Otherwise, it works well. Some documentation can be found at http://lifewithqmail.org To fetch my mail, I use dovecot. Installation was easy, and it works well and does TLS. Mind, my site is small — 1 user. Cheers, strake
Re: [dev] simple dhcp client
On 20/04/2012, pancake panc...@youterm.com wrote: lot of suckless tools exist nowadays.. mostly prefixed by 's'.. like star, sdhcp.. i would love to ser them all grouped in a single repo, site or linux distro. as far as we have 9base and musl can fill the gaps to have a fully suckless distro. i think that those commands should get the standard program name like tar, dhcp.. when we use them in stalin. anyway.. whats the status of stalin? :) On Apr 20, 2012, at 7:38, Christoph Lohmann 2...@r-36.net wrote: Greetings. On Fri, 20 Apr 2012 07:38:40 +0200 Kai Hendry hen...@iki.fi wrote: I know this is very lazy of me, though it would be good if you could have hints how to integrate it say with a typical Archlinux system and its /etc/network.d https://wiki.archlinux.org/index.php/Netcfg Netcfg is hardwired to dhcpcd. You will need to patch the whole netcfg system to add sdhcp support. A simple commandline argument wrapper or compatibility would work too. Sincerely, Christoph Lohmann
[dev] System, was: simple dhcp client
On 20/04/2012, pancake panc...@youterm.com wrote: lot of suckless tools exist nowadays.. mostly prefixed by 's'.. like star, sdhcp.. i would love to ser them all grouped in a single repo, site or linux distro. as far as we have 9base and musl can fill the gaps to have a fully suckless distro. Since we are on the topic anyhow: My very rough, very unfinished such work so far can be found at http://strake.zanity.net:1104/lnx/tutorial.txt I forsook this work, at least for now, while I try to install Plan 9.
Re: [dev] [ii] exposed password on process monitoring
On 19/04/2012, Ivan Kanakarakis ivan.ka...@gmail.com wrote: because ii takes as an argument the password/-k, the password is exposed to anyone that can see what processes are running (top/htop). As no process can hide its arguments, how should one go around this ? - reading the passwd from a file (overkill ?) Why overkill? $ ii -k `{cat pwf} Mind, the password is sent in the clear, so anyone on the same network segment, or otherwise in the way, can read it anyhow.