Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
Set TERM to linux if needed for su and login I think this is incorrect. If you don't have a value of TERM, then you should don't put anything, or put dumb, but why linux?, you expect login will be executed only in virtual terminals?. Regards, -- Roberto E. Vargas Caballero

Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
, but in the case of TERM, you only can take the correct value from the environment of the parent. I don't know what says POSIX about this issue, but maybe should be interesting take a look on it. -- Roberto E. Vargas Caballero

Re: [hackers] [ubase] Set TERM to linux if needed for su and login || sin

2014-06-03 Thread Roberto E. Vargas Caballero
Does it seem reasonable? Yup. Indeed -- Roberto E. Vargas Caballero

Re: [hackers] [quark] Rectify error-handling || FRIGN

2014-08-12 Thread Roberto E. Vargas Caballero
. -- Roberto E. Vargas Caballero [1] http://inetdxtra.sourceforge.net/

Re: [hackers] [ubase] Add lastlog(8) || Roberto E. Vargas Caballero

2014-08-18 Thread Roberto E. Vargas Caballero
password file, stderr); + exit(-1); + } + *p = ' ... -- Roberto E. Vargas Caballero

Re: [hackers] [st] Add missed names of charset sequences || Roberto E. Vargas Caballero

2014-09-26 Thread Roberto E. Vargas Caballero
This is the first patch serie in order to change the internal codification. I have pushed them in a new branch called wchar. I don't know why the hook has sent a different commit here. The head of wchar branch is e8f1308. Regards, -- Roberto E. Vargas Caballero

Re: [hackers] [st] Add missed names of charset sequences || Roberto E. Vargas Caballero

2014-09-27 Thread Roberto E. Vargas Caballero
) tohackers `git rev-list $oldrev..$newrev` ;; .) ;; esac And other point, how is it possible that ed, the standard editor!!!, is not installed in a suckless machine?!?!?!!! Regards, -- Roberto E. Vargas Caballero

Re: [hackers] [sbase] Rewrite foldline() in fold(1) || FRIGN

2015-03-17 Thread Roberto E. Vargas Caballero
Hi, + for (p = str, col = 0; *p *p != '\n'; p++) { + if (!UTF8_POINT(*p) !bflag) + continue; + if (col = width) { + off = (sflag spacesect) ? spacesect - str : p - str; + if (fwrite(str, 1, off,

Re: [hackers] [st] Remove strsep() call || Roberto E. Vargas Caballero

2015-03-20 Thread Roberto E. Vargas Caballero
first your loop is wrong. See what happens with the string ;, how many fields do you have there? 2, your code will return only 1. Second, to use directly the pointer or a variable is only a style question, and don't modify the simplicity of the loop. Regards,

Re: [hackers] [sbase] Audit printenv(1) || FRIGN

2015-02-28 Thread Roberto E. Vargas Caballero
On Sat, 28 Feb 2015 13:25:09 -0800 Evan Gates evan.ga...@gmail.com wrote: The arg loops can simply be for (; *argv; argv++) as the standard guarantees argv[argc] is NULL. Hey Evan, I discussed this with stateless and we came to the conclusion that the argc-approach is more idiomatic.

Re: [hackers] [sbase] tput should be in ubase || sin

2015-02-25 Thread Roberto E. Vargas Caballero
tabs -tput The following programs have been imported from OpenBSD and need replacing or cleaning up: The same applies to tabs. It needs terminfo. Regards,

Re: [hackers] [smdev] config.mk: default CC = cc || Hiltjo Posthuma

2015-04-14 Thread Roberto E. Vargas Caballero
-#CC = musl-gcc +CC = cc cc is the default value of CC, so you don't get anything new with this patch, and you create some problems with: CC=tcc make (of course you can use make -e, but I don't see the point) Regards,

Re: [hackers] [st] [patch] use goto in xloadfonts

2015-06-22 Thread Roberto E. Vargas Caballero
Hi, On Sat, Jun 20, 2015 at 01:32:45AM -0400, Michael Reed wrote: You just made the programmflow harder to grasp and removed the possibility to differentiate between the errors in the future. Also the patch adds 4 SLoC without achieving anything. I agree it's harder to grasp, but only

Re: [hackers] [sbase][patch] find: empty line means no for -ok

2015-06-19 Thread Roberto E. Vargas Caballero
Hi, Yes I most certainly did, this is what I get for submitting patches without testing. The shame. New patch attached, also protects against the glibc bug causing fgetc to hang after EOF was received. And what about if we send a patch to glibc instead? Regards,

Re: [hackers] st and combining characters

2015-06-15 Thread Roberto E. Vargas Caballero
Hi, I like the idea, but I think the patch needs some evolution. A patch of 500 lines is usually hard of reading, and in in this case the change is not trivial. On Wed, Jun 10, 2015 at 11:39:25PM +0200, Joakim Sindholt wrote: glyph now holds a union of two combining characters and a

Re: [hackers] [st] Patch to workaround missing st terminfo on remote SSH.

2015-08-13 Thread Roberto E. Vargas Caballero
On Thu, Aug 13, 2015 at 12:17:35PM +0100, Nick wrote: Quoth Roberto E. Vargas Caballero: I think a better aproach is to define an alias like this: alias ssh=TERM='TERM=xterm ssh' Syntax like that is one reason that I prefer one or two line shell scripts to aliases. Good idea, though

[hackers] [st][PATCH] Do not mark as invalid UTF8 control codes

2015-08-17 Thread Roberto E. Vargas Caballero
wcwidth() returns -1 in all the non visible characters, but it doesn't mind that they are incorrect. It only means that they are not printable. --- st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 1df4fde..35a840b 100644 --- a/st.c +++ b/st.c @@

Re: [hackers] [patch][scc] fix parsing end of comment

2015-07-15 Thread Roberto E. Vargas Caballero
Hi, On Thu, Jul 16, 2015 at 12:19:45AM +0100, Dimitris Papastamos wrote: diff --git a/cc1/lex.c b/cc1/lex.c index c35e401..111c6f8 100644 --- a/cc1/lex.c +++ b/cc1/lex.c @@ -184,8 +184,8 @@ comment(char type) { if (type == '*') { while (!eof) { -

[hackers] St style changes

2015-07-10 Thread Roberto E. Vargas Caballero
Hi, We are doing deep changes of style in st, and it means the style will not be ready until 2 or three weeks, so if you have to update some of your patches in the wiki, then it is better wait a bit (mainly because in other case you will have to update your patch several times). Thank

Re: [hackers] [dmenu][RFC][PATCH] History functionality

2015-12-09 Thread Roberto E. Vargas Caballero
On Wed, Dec 09, 2015 at 10:31:09AM +0100, Silvan Jegen wrote: > I realized that I am not dealing with the case that the history file > does not exist already. I added a simple check for that (although I > was considering just putting in a comment saying that it has to). > > +if [ ! -e

Re: [hackers][sbase][PATCH] Activate the "else if" branch

2015-12-16 Thread Roberto E. Vargas Caballero
On Tue, Dec 15, 2015 at 07:54:28PM +0100, Silvan Jegen wrote: > We checked the same condition in the "if" branch so it was never true > in the "else if" one. Removing this condition makes the "else if" > branch viable. I'm sorry, but you are wrong here. Setjmp saves the current state of the

Re: [hackers] [PATCH] yellow italics everywhere is for colorblind people

2016-01-05 Thread Roberto E. Vargas Caballero
On Tue, Jan 05, 2016 at 05:44:12PM +0800, Pickfire wrote: > On Tue, Jan 05, 2016 at 10:42:52AM +0100, FRIGN wrote: > >>Hi, I use `git send-email`, it won't be mentioned by default. > >>It is for st. As you can see in the patch. > > You can use git send-email --subject-prefix='st][PATCH'

[hackers] [sbase][PATCH v2] Fix pattern substitution

2016-01-07 Thread Roberto E. Vargas Caballero
Ed was falling doing substitution different of the first or all (s//%/, s//%/\1, s//%/g), because it was not adding the matches which were not going to be substituted. --- ed.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/ed.c b/ed.c index

[hackers] [sbase][PATCH] Stop matching when lastmatch points to '\n'

2016-01-07 Thread Roberto E. Vargas Caballero
This situation happens with something like s/$/test/, where rm_so == rm_eo == 0. Without this check, ed keeps looping forever. --- ed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ed.c b/ed.c index 69c7422..9dc6fda 100644 --- a/ed.c +++ b/ed.c @@ -1007,7 +1007,7 @@

[hackers] [sbase][PATCH] Add egrep and fgrep

2016-01-05 Thread Roberto E. Vargas Caballero
These tools are not part of POSIX, but they were part of the original UNIX and even today they are still wide used. The work done by this tools can be done by grep, so this implementation is only masking the code with different names to get the work done. --- Makefile | 4 +++- grep.c | 5 +

[hackers] [sbase][PATCH 1/3] ed: Correct error message when open file

2016-01-01 Thread Roberto E. Vargas Caballero
"input/output" error was to general and could create confusion. All the other ed implementations give a "cannot open input file" --- ed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index 7e7fbb6..96cfc3b 100644 --- a/ed.c +++ b/ed.c @@ -609,8 +609,8 @@

[hackers] [sbase][PATCH 2/3] ed: Don't show '!' in exec with -s

2016-01-01 Thread Roberto E. Vargas Caballero
POSIX indicates that this '!' is a diagnosis that must not be printed when -s is supplied. --- ed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ed.c b/ed.c index 96cfc3b..5369d60 100644 --- a/ed.c +++ b/ed.c @@ -871,7 +871,8 @@ execsh(void) if (repl)

[hackers] [sbase][PATCH] ed: Use TMPDIR to locate the temporal file

2016-01-01 Thread Roberto E. Vargas Caballero
The current behaviour of storing the scratch file in the current directory is a bit painful, because it generates files in all the directories where you execute ed. BSD ed uses TMPDIR for this purpouse, so if the user wants to put the scratch file in other place different of /tmp it only has to

[hackers] [sbase][PATCH] Handle explicitly the case of line 0

2016-01-06 Thread Roberto E. Vargas Caballero
Line 0 is a special line added to allow operations with empty buffers, and we have to ensure that it is not going to match any regular expression. The code was written in a way that this case was handle implicitily, but this solution was working only for the first file loaded in ed, while the

[hackers] [sbase][PATCH v2] Handle explicitly the case of line 0

2016-01-06 Thread Roberto E. Vargas Caballero
Line 0 is a special line added to allow operations with empty buffers, and we have to ensure that it is not going to match any regular expression. The code was written in a way that this case was handle implicitily, but this solution was working only for the first file loaded in ed, while the

Re: [hackers] [sbase] [PATCH] ed: Do not try to read-in a nonexistant file

2015-12-28 Thread Roberto E. Vargas Caballero
On Sat, Dec 26, 2015 at 05:02:39PM -0500, Wolfgang Corcoran-Mathe wrote: > This fixes a segfault caused by running ed with a > nonexistant filename argument, e.g. 'ed not_a_file_yet'. Good catch, but I don't like the solution. I think you are fixing the problem in the incorrect place. The

Re: [hackers] [st] startup options

2015-11-25 Thread Roberto E. Vargas Caballero
> Mainly I want scroll when compiling. It print a lot of information and > warnings. And I want to read them clearly without interrupting my > compilation. Other than that I don't use scrolling much. > > ofcourse, i can redirect std err to a log file and see it. But when I run > "make" I need to

Re: [hackers] [dmenu][RFC][PATCH 0/4] Using sort and simple C program to get dmenu history functionality

2015-11-30 Thread Roberto E. Vargas Caballero
On Mon, Nov 30, 2015 at 06:51:02PM +0100, Hiltjo Posthuma wrote: > Something like (quick hack): > > cat historyfile | awk '//{x[$0]++; } END { for (k in x) { print x[k] " >" k; }}' | sort -k 1rn,2 | cut -f 2- | dmenu >> historyfile > Avoid the death cat!!!. Use something like: awk

[hackers] [sbase][PATCH] [ed] Do not try to rematch patterns with ^ or $

2016-01-23 Thread Roberto E. Vargas Caballero
It is impossible to rematch a pattern which has one (or both) of these operators, so the simplest solucion is detect them while we are compiling the regular expression and break the match loop after the first iteration. --- ed.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-)

Re: [hackers] [dwm][PATCH] Fix signal race condition

2017-01-24 Thread Roberto E . Vargas Caballero
> If the signal(2) call within the signal handler fails, die() is called > which in turn is not signal-safe. Therefore, the change to sigaction > makes dwm() more portable among POSIX systems and fixes a signal race > condition. You are right with the original race condition, but I think your

Re: [hackers] [sbase] ed: Don't use strlcpy() || Roberto E. Vargas

2017-01-24 Thread Roberto E . Vargas Caballero
> I consider this way of thinking harmful, because it involves You are considered harmful. Regards,

Re: [hackers] [sbase] Revert "ed: remove double free in join()" ||

2017-01-24 Thread Roberto E . Vargas Caballero
Hello Thomas, Sorry for the delay, I had some problems with my mail lately, > The trouble with reverting my commit is that readding the double free > completely > crashes ed if more than one join is performed. I think this patch (which also > reverts > back to having no double free) should

Re: [hackers] [farbfeld] Overhaul Build-system || Laslo Hunhold

2017-03-29 Thread Roberto E . Vargas Caballero
>> +png2ff ff2png: LDFLAGS += -lpng >> +jpg2ff ff2jpg: LDFLAGS += -ljpeg >> > > This is invalid and breaks on OpenBSD (and other non-GNU make probably). It is not POSIX, so it is a syntax error for me.

Re: [hackers] [PATCH] Whitelist key event modifiers for shortcuts

2017-04-10 Thread Roberto E . Vargas Caballero
> I'm seeing a weird issue with my xserver where all key press events will > be set with (state & Button1Mask), which ends up breaking all st > keyboard shortcuts. xterm works correctly because it whitelists > modifiers relevant to key press events. Do the same in st. Uhmmm, it seems a bit

Re: [hackers] [sbase][PATCH v2] Add tests for some utilities

2018-08-03 Thread Roberto E. Vargas Caballero
Hi, On Wed, Aug 01, 2018 at 04:36:35PM +0200, Silvan Jegen wrote: > I definitely think we should have unit tests for sbase (and other > projects?) as soon as possible. What concerns me with your approach is > that we have about 700 lines of C code in testing-common.{c,h} of which > I feel quite a

Re: [hackers] [sbase][PATCH v2] Add tests for some utilities

2018-08-03 Thread Roberto E. Vargas Caballero
Hi, On Wed, Aug 01, 2018 at 09:16:26PM +0200, Silvan Jegen wrote: > > * `echo` is unportable and `printf` should be used instead. > > Didn't know that echo was not portable. Thought it was just a builtin > that should work the same everywhere. It's probably the flags that are > the issue...

Re: [hackers] [ii][patch] add support for OpenBSD unveil(2)

2018-09-12 Thread Roberto E. Vargas Caballero
On Tue, Sep 11, 2018 at 08:14:25PM -0300, Gleydson Soares wrote: > the following patch brings support for OpenBSD's unveil(2) mechanism for > ii. Guys, we should stop sending this kind of patches. If we begin to fill all the suckless projects with #ifdef __OpenBSD__, why do we not fill them with

[hackers] [sbase] Improve doglobal()

2018-03-06 Thread Roberto E. Vargas Caballero
Don't use directly the line numbers and call to getlst() when a line is matched. --- ed.c | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ed.c b/ed.c index 13c41c6..e6d92e2 100644 --- a/ed.c +++ b/ed.c @@ -1318,7 +1318,7 @@ chkglobal(void)

Re: [hackers] [st][patch] Increase the buffer size for escape sequences

2018-09-24 Thread Roberto E. Vargas Caballero
On Sun, Sep 23, 2018 at 03:56:43PM +0200, Ingo Heimbach wrote: > What is incorrect? I would say, why 1048576 and not 1000? or 1?. Is there a specific reason? Roberto

Re: [hackers] [st][patch] Increase the buffer size for escape sequences

2018-09-25 Thread Roberto E. Vargas Caballero
On Mon, Sep 24, 2018 at 05:45:29PM -0700, Eric Pruitt wrote: > I agree that the current buffer is too small. I'm pretty sure I've run > into this problem myself with Vim and Bash, but I hadn't gotten around > to digging into the problem. If we go to increase that size, I would go to use dynamic

Re: [hackers] [ii][patch] add support for OpenBSD unveil(2)

2018-09-12 Thread Roberto E. Vargas Caballero
On Wed, Sep 12, 2018 at 10:19:32AM +0200, Laslo Hunhold wrote: > Adding ifdefs of course is a tough decision in any case, though I > always think that suckless tools should be really more tuned towards > OpenBSD as it really is probably the most suckless operating system > around. You are wrong,

Re: [hackers] Re: [ubase] [PATCH] Include sys/sysmacros.h when major is not defined in sys/types.h

2019-11-10 Thread Roberto E. Vargas Caballero
On Mon, Nov 04, 2019 at 08:01:18AM +0100, Laslo Hunhold wrote: > Dimitris is the current maintainer, so you will have to talk to him, > but I'd say that nothing speaks against you maintaining it. I always > saw sbase and ubase to be siblings, so given you already maintain > sbase, it would make a

Re: [hackers] [st][PATCH] rm unnecessary explicit zeroing

2022-03-17 Thread Roberto E. Vargas Caballero
Hi, On Tue, Mar 15, 2022 at 04:30:52PM +0600, NRK wrote: > +static const char base64_digits[(unsigned char)-1] = { Any reason to write "(unsigned char)-1" instead of writing 256? Regards,

Re: [hackers] [st][PATCH] rm unnecessary explicit zeroing

2022-03-17 Thread Roberto E. Vargas Caballero
Hi, On Fri, Mar 18, 2022 at 03:16:56AM +0600, NRK wrote: > But yes, you're right, you'd need 256 elements to be able to index into > an array as any unsigned char. So maybe it *should* be 256. Uh, I didn't realize about it, I just saw that having 255 entries was wrong ^^!!!. I think the

Re: [hackers] st][PATCH - proper escape sequence for CTRL+HOME

2022-03-01 Thread Roberto e. Vargas Caballero
Hi, On Tue, Mar 01, 2022 at 08:54:15AM -0500, Sebastian LaVine wrote: > > Christ, why do you choose to be so rude to someone you've never talked > to over a simple email? He wants to write comments for a C program. It's > not the end of the world. I personally will be interested in what he >

Re: [hackers] st][PATCH - proper escape sequence for CTRL+HOME

2022-03-01 Thread Roberto E. Vargas Caballero
Hi, On Mon, Feb 28, 2022 at 09:27:22PM -0600, Dave Blanchard wrote: > > I have absolutely no idea what the 'appkey' and 'appcursor' fields do, as > there are almost no comments anywhere to be found in the source code, and I > haven't yet reverse engineered the code enough to figure out what

Re: [hackers] [st][PATCH v2] code-golfing: cleanup osc color related code

2022-03-21 Thread Roberto E. Vargas Caballero
Hi, A few small nitpicks about formating (fell free to ignore them if you want ;)): On Sun, Mar 20, 2022 at 06:25:40PM +0600, NRK wrote: > @@ -1843,39 +1844,25 @@ csireset(void) > } > > void > -osc4_color_response(int num) > +osc_color_response(int num, int index, int is_osc4) > { >

Re: [hackers] [st][PATCH] update FAQ regarding meta key

2022-04-12 Thread Roberto E. Vargas Caballero
Hi, > just changing $TERM to "st-meta" doesn't enable the meta key, at least > on vim. searching the mailing list, I learned that `tput smm` was needed > to enable 8bit mode[0]. This topic is a bit more complex. St is doing something a bit weird because we are a utf8 terminal, but we don't

Re: [hackers] [ubase][PATCH] Explicitly include sys/sysmacros.h for makedev etc

2023-09-21 Thread Roberto E. Vargas Caballero
On Sun, Aug 06, 2023 at 03:03:21PM +0200, Markus Rudy wrote: > This header used to be included by sys/types.h in glibc, and musl > adopted the behaviour. However, this dependency was never desired, so > glibc deprecated it in 2016 and finally removed it in 2019, and so Applied.

Re: [hackers] [sbase][PATCH] tr: fix behavior of cflag when using character classes

2023-09-21 Thread Roberto E. Vargas Caballero
Hi, On Sun, Aug 06, 2023 at 10:50:25PM +0200, noneofyourbusin...@danwin1210.de wrote: > a simple test case: > > printf ab3 | tr -c '[:alpha:]' '\n' Applied.

Re: [hackers] [sbase][PATCH] xargs: implement -I flag

2023-09-22 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jul 30, 2023 at 10:15:49AM +0300, sewn wrote: > From 9f4be567ff25fee986976c6afa193223496013a6 Mon Sep 17 00:00:00 2001 > From: sewn > Date: Fri, 28 Jul 2023 18:58:37 +0300 > Subject: [PATCH] xargs: add replace string flag (-I) I have applied the patch with some small modifications

Re: [hackers] [sbase][PATCH] Ensure commands are followed by a blank

2023-09-26 Thread Roberto E. Vargas Caballero
Applied.

Re: [hackers] [sbase] [PATCH] Use ar(1)'s s-flag instead of invoking ranlib(1)

2022-07-22 Thread Roberto E. Vargas Caballero
I disagree with this change. I think it adds nothing and reduce portability of the Makefiles. Regards,

Re: [hackers] [dwm][PATCH] do not call signal-unsafe function inside sighanlder

2022-07-22 Thread Roberto E. Vargas Caballero
Hi, > > Do you have a reference of a description of this behaviour in an other > > system, > > specification or standard? > > > > C89 (7.7.1.1), C99 (7.14.1.1), POSIX 2001 and 2008 all say that "the > equivalent of signal(sig, SIG_DFL)" may be executed prior to executing > the signal handler

Re: [hackers] [dwm] Revert "do not call signal-unsafe function inside sighanlder" || Hiltjo Posthuma

2022-07-26 Thread Roberto E. Vargas Caballero
Hi, > > void > > sigchld(int unused) > > { > > + if (signal(SIGCHLD, sigchld) == SIG_ERR) > > + die("can't install SIGCHLD handler:"); > > while (0 < waitpid(-1, NULL, WNOHANG)); > > } > > Calling `die` inside a signhandler is still an issue and can produce > bad behavior (I

Re: [hackers] [sbase] [PATCH] Use ar(1)'s s-flag instead of invoking ranlib(1)

2022-08-01 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jul 31, 2022 at 01:00:25AM +0200, Laslo Hunhold wrote: > why would it reduce the portability of the Makefiles? It can be > expected that all ar-implementations support the s-flag, and ranlib is > simply legacy. Because then you will support only the last systems. If you keep the

Re: [hackers] [st][PATCH] Add support for DSR response "OK" escape sequence

2023-02-06 Thread Roberto E. Vargas Caballero
Hi, On Mon, Feb 06, 2023 at 08:45:27AM +0200, Santtu Lakkala wrote: > > tsetattr(csiescseq.arg, csiescseq.narg); > > break; > > - case 'n': /* DSR – Device Status Report (cursor position) */ > > - if (csiescseq.arg[0] == 6) { > > + case 'n': /* DSR – Device

Re: [hackers] [st][PATCH] Add support for DSR response "OK" escape sequence

2023-02-07 Thread Roberto E. Vargas Caballero
On Tue, Feb 07, 2023 at 10:54:57AM -0500, Adam Price wrote: > On Mon, Feb 6, 2023 at 12:06 PM Roberto E. Vargas Caballero > wrote: > > > > Hi, > > > > On Mon, Feb 06, 2023 at 08:45:27AM +0200, Santtu Lakkala wrote: > > > >

[hackers] ed: Enable multi line commands

2023-12-13 Thread Roberto E. Vargas Caballero
It changes to read full lines before executing commands, escaping newlines when it is needed. It solves 2 different cases: - Substitution commands with newlines in the replace part - Global commands with append or insert commands Still, some additional problems were detected in

[hackers] [PATCH 1/6] ed: Add optional parameter to string()

2023-12-13 Thread Roberto E. Vargas Caballero
This makes possible to use the function to initialize the string from an existing char array. --- ed.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/ed.c b/ed.c index b430e74..13e956a 100644 --- a/ed.c +++ b/ed.c @@ -122,12 +122,24 @@

[hackers] [PATCH 2/6] ed: Add getinput() and setinput()

2023-12-13 Thread Roberto E. Vargas Caballero
These functions allow to read from stdin the full next line or seting as input a character array. These functions avoid all the complexity about repeat commands that is very fragile and depends on having multiple global variables with weak relation between them. --- ed.c | 171

[hackers] [PATCH 3/6] ed: Read from input in append()

2023-12-13 Thread Roberto E. Vargas Caballero
This enables using a and i commands in a global command because the input is not anymore taken from stdin. --- ed.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ed.c b/ed.c index 7881fba..ad6c81a 100644 --- a/ed.c +++ b/ed.c @@ -686,6 +686,15

[hackers] [PATCH 4/6] ed: Avoid dangling pointer in getrhs()

2023-12-13 Thread Roberto E. Vargas Caballero
If the string r.str is freed but error() is called then next call will see a pointer that maybe it will try to free because the call to error unwind the frame stack. --- ed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ed.c b/ed.c index ad6c81a..16fbe04 100644 --- a/ed.c

[hackers] [PATCH 5/6] ed: Improve execsh

2023-12-13 Thread Roberto E. Vargas Caballero
--- ed.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index 16fbe04..60673a2 100644 --- a/ed.c +++ b/ed.c @@ -1061,13 +1061,21 @@ execsh(void) } while ((c = input()) != '\0') { - if (c == '%' && (cmd.siz == 0 ||

[hackers] [PATCH 6/6] ed: Update TODO

2023-12-13 Thread Roberto E. Vargas Caballero
Remove the cases are tested to work correctly now. --- TODO | 16 1 file changed, 16 deletions(-) diff --git a/TODO b/TODO index a78cf8b..000fd06 100644 --- a/TODO +++ b/TODO @@ -28,10 +28,6 @@ Bugs ed -- -* Multi-line commands don't work in global commands: -g/^line/a \

[hackers] [PATCH 1/6] ed: Fix makeline

2023-12-28 Thread Roberto E. Vargas Caballero
Strings without newlines created problems in the function and the global field was not updated, making that new lines added were marked as global being processed in the current global command. --- ed.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index

[hackers] [PATCH 0/6] Fix global commands and signal improvements

2023-12-28 Thread Roberto E. Vargas Caballero
This patch serie fixes several problems related to how global commands are managed, fixing G and V commands, and it also adds several small improvements in how signals are handled. Roberto E. Vargas Caballero (6): ed: Fix makeline ed: Remove nothing comments ed: Fix G and V commands ed

[hackers] [PATCH 2/6] ed: Remove nothing comments

2023-12-28 Thread Roberto E. Vargas Caballero
Several bugs happened in the past due to this kind of comments and it is better to get rid of them. --- ed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index b6f4f1c..b94afa5 100644 --- a/ed.c +++ b/ed.c @@ -199,7 +199,7 @@ makeline(char *s, int *off)

[hackers] [PATCH 3/6] ed: Fix G and V commands

2023-12-28 Thread Roberto E. Vargas Caballero
--- ed.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ed.c b/ed.c index b94afa5..35fddf1 100644 --- a/ed.c +++ b/ed.c @@ -1242,7 +1242,6 @@ repeat: trunc = pflag = 0; switch (cmd) { case '&': - /* This

[hackers] [PATCH 4/6] ed: Print only last line in empty command

2023-12-28 Thread Roberto E. Vargas Caballero
--- ed.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ed.c b/ed.c index 35fddf1..eaa4ca9 100644 --- a/ed.c +++ b/ed.c @@ -1255,6 +1255,7 @@ repeat: case '\0': num = gflag ? curln : curln+1; deflines(num, num); + line1 = line2;

[hackers] [PATCH 5/6] ed: Simplify sighup dealing

2023-12-28 Thread Roberto E. Vargas Caballero
As we already have the dump() function we can move the modification check inside the new dump() function. --- ed.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ed.c b/ed.c index eaa4ca9..0705beb 100644 --- a/ed.c +++ b/ed.c @@ -710,6 +710,9 @@ dump(void) {

[hackers] [PATCH 6/6] ed: Don't undo commands in sigint

2023-12-28 Thread Roberto E. Vargas Caballero
If newcmd is 0 then error() undo all the modifications that happened since the last command, but this is not what POSIX mandates: SIGINT The ed utility shall interrupt its current activity, write the string "?\n" to standard output, and return to command mode (see the EXTENDED

Re: [hackers] [sbase][PATCH 1/2] expr: treat expressions as strs until evaluation

2024-01-16 Thread Roberto E. Vargas Caballero
Hi On Sun, Jan 07, 2024 at 11:02:17AM -0700, Randy Palamar wrote: > Comparison operations (>, <, =, etc.) and matching operations must > operate originally provided string not one that has gone back and > forth through string formatting. This caused operations such as > the following to give

Re: [hackers] [sbase][PATCH 2/2] expr: don't evaluate matched substr as a number

2024-01-16 Thread Roberto E. Vargas Caballero
Hi, On Sun, Jan 07, 2024 at 11:02:18AM -0700, Randy Palamar wrote: > POSIX specifies that if the pattern contains a subexpression then > the first matched subexpression should be returned if it exists. > > This fixes things like the following: > > ./expr 3 : '\(.*\)' > Before: 3 > After:

Re: [hackers] [PATCH 1/6] ed: Add optional parameter to string()

2023-12-28 Thread Roberto E. Vargas Caballero
Hi, On Tue, Dec 26, 2023 at 03:40:36PM +0100, Страхиња Радић wrote: > On 23/12/24 11:46AM, Rene Kita wrote: > > > + if (!from) { > > > + len = 0; > > > + t = NULL; > > > + } else { > > This seems redundant. Normally, NULL shouldn't be passed, and even if it is, > it > is the

Re: [hackers] ed: Enable multi line commands

2023-12-28 Thread Roberto E. Vargas Caballero
Hi, On Sun, Dec 24, 2023 at 12:07:44PM +0100, Rene Kita wrote: > On Wed, Dec 13, 2023 at 12:55:26PM +0100, Roberto E. Vargas Caballero wrote: > > It changes to read full lines before executing commands, escaping > > newlines when it is needed. It solves 2

Re: [hackers] [PATCH 1/6] ed: Add optional parameter to string()

2023-12-28 Thread Roberto E. Vargas Caballero
Hi, On Sun, Dec 24, 2023 at 11:46:26AM +0100, Rene Kita wrote: > Nit as it's more a matter of style: I'd prefer to have one function to > create a String and another function to create a String from a char > array. This would make a cleaner interface and avoids passing and > dealing with NULL all

Re: [hackers] [sbase] sbase-box: Fix segmentation fault when exe without args

2023-12-05 Thread Roberto E. Vargas Caballero
Hi, On Fri, Dec 01, 2023 at 01:33:36PM +0100, Jules Maselbas wrote: > when sbase-box is executed without argument, the check sbase-box > options doesn't verify the argument count leading to a segfault. > > Add a check on the argc before parsing sbase-box options (currently > only `-i`) Applied,

Re: [hackers] [sbase][PATCH] ed: Allow newlines in a Substitute Command

2023-12-05 Thread Roberto E. Vargas Caballero
Hi, On Wed, Nov 15, 2023 at 08:56:56AM +0100, Rene Kita wrote: > > I think the way to fix this problem is reading the full command before > > executing it, otherwise there are so many traps. I am going to try to > > fix this in th enext days. > > I had the same idea. Reading the full command

Re: [hackers] [sbase][PATCH] expr: tonum: handle case where result was previously calculated

2024-01-30 Thread Roberto E. Vargas Caballero
Hi, On Mon, Jan 22, 2024 at 02:18:10PM -0700, Randy Palamar wrote: > As pointed out in a mail to dev expr was segfaulting when multiple > math operations were specified on the command line: eg. 'expr 3 \* > 2 + 1'. This happens because the tonum(), introduced in e50d533, > assumed that v->str was

Re: [hackers] [PATCH 1/2] scripts: Fix non-portable usage of find -maxdepth

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH 2/2] scripts: Fix non-portable find -perm /mode

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH] make: fix rogue parameter in install target

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH] scripts: Force file copying on install

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [PATCH] find: Make parameter error messages more specific

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [sbase][PATCH] ed: Allow newlines in a Substitute Command

2023-11-14 Thread Roberto E. Vargas Caballero
Hi, On Sun, Nov 05, 2023 at 02:38:20PM +0100, Rene Kita wrote: > On Fri, Nov 03, 2023 at 01:32:37PM +0100, Rene Kita wrote: > > borked patch > > Patch is not sufficient, sorry for the noise. I have this problem in my radar. I began to write a solution for it, but I had to switch to implement

Re: [hackers] [sbase] TODO: add replacement bug reported for ed || Hiltjo Posthuma

2023-11-14 Thread Roberto E. Vargas Caballero
Applied, thanks.

Re: [hackers] [st] Fix cursor move with wide glyphs || Quentin Rameau

2024-02-25 Thread Roberto E. Vargas Caballero
Hi, On Sun, Feb 25, 2024 at 11:57:03AM +0100, g...@suckless.org wrote: > st would always move back 1 column, > even with wide glyhps (using more than a single column). > > The glyph rune is set on its first column, > and the other ones are to 0, > so loop until we detect

[hackers] Penfing patches for sbase and ubase

2024-02-26 Thread Roberto E. Vargas Caballero
Hi, I know that there are some pending patches for sbase and ubase, but I am a bit busy these days and I will not be able to look a bit deeper on them until next week. Be patient until then :) Thank you

Re: [hackers] [sbase][PATCH v2] tar: sanitize: leading zeros should be recognized

2024-03-05 Thread Roberto E. Vargas Caballero
Hi, On Sat, Feb 10, 2024 at 11:57:38PM +0100, Elie Le Vaillant wrote: > @@ -399,10 +400,17 @@ sanitize(struct header *h) > for (i = 0; i < LEN(fields); i++) > - for (j = 0; j < fields[i].l; j++) > + for (leading = 1, j = 0; j < fields[i].l; j++) >

Re: [hackers] [sbase][PATCH v2] tar: sanitize: leading zeros should be recognized

2024-03-05 Thread Roberto E. Vargas Caballero
On Tue, Mar 05, 2024 at 01:16:36PM +0100, Roberto E. Vargas Caballero wrote: > Hi, > > On Sat, Feb 10, 2024 at 11:57:38PM +0100, Elie Le Vaillant wrote: > > @@ -399,10 +400,17 @@ sanitize(struct header *h) > > for (i = 0; i < LEN(fields); i++) > > -

Re: [hackers] [sbase][PATCH v3] tar: sanitize, chktar: leading spaces should be skipped over

2024-03-05 Thread Roberto E. Vargas Caballero
Hi, On Sun, Feb 11, 2024 at 09:26:14AM +0100, Elie Le Vaillant wrote: > Some tar archives (eg. ftp://ftp.gnu.org/gnu/shtool/shtool-2.0.8.tar.gz) > use leading spaces instead of leading zeroes for numeric fields. > Although it is not allowed by the ustar specification, most tar > implementations

Re: [hackers] [sbase][PATCH] tar: chktar: fix conditional typo

2024-03-06 Thread Roberto E. Vargas Caballero
Hi, On Tue, Mar 05, 2024 at 09:20:57PM +0100, Elie Le Vaillant wrote: > --- > tar.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tar.c b/tar.c > index 0361b63..405b8d9 100644 > --- a/tar.c > +++ b/tar.c > @@ -423,7 +423,7 @@ chktar(struct header *h) >

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread Roberto E. Vargas Caballero
Hi, On Thu, Mar 07, 2024 at 02:18:28AM -0500, neeshy wrote: > It seems that the modifications you made break the use case where su is > called without a username. It would normally default to the root > user, but now it invokes usage() instead. My original patch worked as > intended. Could you

Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread Roberto E. Vargas Caballero
Hi, On Thu, Mar 07, 2024 at 02:52:49PM -0500, neeshy wrote: > On Thu Mar 7, 2024 at 1:19 PM EST, Roberto E. Vargas Caballero wrote: > > I think it makes it simpler while keeping the correct behaviour that I > > broke. > > Looks good to me! Pushed!

  1   2   >