[dev] vis-cscope

2020-10-06 Thread Evan Gates
Announcing vis-cscope, a plugin to provide a cscope interface for the editor vis. It works similarly (but not identically) to vim's cscope support. It's new, there will be bugs, please report them and/or send patches to ~emg/d...@lists.sr.ht https://git.sr.ht/~emg/vis-cscope

Re: [dev] user interfaces on top of ii

2020-02-24 Thread Evan Gates
On Mon, Feb 24, 2020 at 8:54 AM Evan Gates wrote: > > On Thu, Feb 20, 2020 at 7:02 PM Greg Reagle wrote: > > > > I have figured out how to use pcw with multiple st windows running > > lchat. I understand the general idea now. I have this in pcw_win.sh: > > > &g

Re: [dev] user interfaces on top of ii

2020-02-24 Thread Evan Gates
On Thu, Feb 20, 2020 at 7:02 PM Greg Reagle wrote: > > I have figured out how to use pcw with multiple st windows running > lchat. I understand the general idea now. I have this in pcw_win.sh: > > exec st -t "$CPATH" -e lchat -n30 -p "$(basename "$CPATH")> " -t "$(basename > "$CPATH")>" "$CPAT

Re: [dev] [sbase] sed 'd' command after 'r' or 'a' (POSIX interpretation question)

2020-01-17 Thread Evan Gates
On Fri, Jan 17, 2020 at 5:17 AM Michael Forney wrote: > > All the other implementations I looked at *do* insert the contents of the > file. I think that's the important point. We should also check how other commands that "start the next cycle" behave in relation to r. E.g. I could see the same p

Re: [dev] Preprocessor

2019-04-23 Thread Evan Gates
On Tue, Apr 23, 2019 at 12:42 PM Hadrien Lacour wrote: > That was just shitposting. I use `find` to avoid most of the UNIX braindamage > in this case. Which is good as long as you use -exec correctly. Or if you're going to use xargs make sure to use nul separated lists. Xargs without the nul opti

Re: [dev] Preprocessor

2019-04-23 Thread Evan Gates
On Tue, Apr 23, 2019 at 9:24 AM Hadrien Lacour wrote: > What if "$1" is empty? POSIX sh doesn't have the nullglob shop, you know. [ "$1" ] || exit # add a message if you want [ -d "$1" ] || exit # if you want to check that the directory exists for p in "$1"/*; do [ -e "$p" ] || continue; ... # if

Re: [dev] Preprocessor

2019-04-22 Thread Evan Gates
On Mon, Apr 22, 2019 at 1:25 PM Adrian Grigore wrote: > > ls -1 "$1" | while IFS= read -r p > do Not sure about the preprocessor stuff, but this right here is terrible practice. Use a for loop and glob. Assuming that "$1" is a directory: for p in "$1"/*; do ... http://mywiki.wooledge.org/Parsin

Re: [dev] Learn C

2019-03-27 Thread Evan Gates
On Wed, Mar 27, 2019 at 12:40 PM wrote: > > On Wed, Mar 27, 2019 at 07:43:04AM -0700, Evan Gates wrote: > Style and the amount of actually used syntax is different. I'd disagree. Once you choose a language, any choices about how you write that language are style. > > &g

Re: [dev] Learn C

2019-03-27 Thread Evan Gates
On Tue, Mar 26, 2019 at 11:21 AM wrote: > C has already a syntax way too rich and flexible. Most of the > linux coding guidelines is nice. There is also a style page[0] at suckless. But again style is subjective and the most important thing is consistency within a project. > add a suffix to you

Re: [dev] Coding style: why /* */ and not //?

2018-12-27 Thread Evan Gates
On Wed, Dec 26, 2018 at 3:57 AM Martin Tournoij wrote: > > The coding style says: > > > Use /* */ for comments, not // > > Don't want to start a discussion about it, but I'm curious why // is > disallowed? AFAIK all compilers accept // these days, and have for a > long time? My understanding is t

Re: [dev] [sbase] Bugs in find

2018-09-27 Thread Evan Gates
On Wed, Sep 26, 2018 at 5:49 PM Tavian Barnes wrote: > > Hi! As the author of a find-compatible tool, whenever I find another > find implementation I run my testsuite against it to see if I find any > bugs in either one. sbase/find helped me identify many places in my > POSIX tests that use exte

Re: [dev] [sbase] find and xargs different results than busybox

2018-07-17 Thread Evan Gates
On Sun, Jul 15, 2018 at 12:41 PM andremw wrote: > -find /home/user -type d -print0 | xargs -0 chmod 0775 > -find /home/user -type f -print0 | xargs -0 chmod 0664 > > In busybox they work, in sbase they return- > -find: paths must precede expression: -print0 > -usage: xargs [-rtx] [-E eofstr] [-n n

Re: [dev] Shell script testing functions

2018-06-09 Thread Evan Gates
On Sat, Jun 9, 2018, 08:20 Adrian Grigore wrote: > I sometimes enjoy testing my shell scripts. Opinions? I'm away from my computer so I can't give full feedback but for now I'd recommend 1) use shellcheck. Check out shellcheck.net or install locally. It catches the most common shell scripting p

Re: [dev] [bc]

2018-03-15 Thread Evan Gates
On Tue, Mar 13, 2018 at 12:36 PM, Laslo Hunhold wrote: > - Point: In general I don't see the point of implementing bc directly, >given you can implement it as a dc script. Why don't you strip your >codebase down, write a simple rpn-parser and use your general >arithmetic to build some

Re: [dev] [bc]

2018-03-15 Thread Evan Gates
On Tue, Mar 13, 2018 at 1:56 PM, Michael Forney wrote: > I know next to nothing about bc and what GNU extensions are used by > timeconst.bc, but being able to build a linux kernel sounds like a > good goal to me. However, if timeconst.bc can be changed to use only > portable features of bc (in a w

Re: [dev] [ii]: path to apply action command

2017-09-18 Thread Evan Gates
Markus Teich wrote: > > According to my limited IRC usage the /me actions are used frequently and thus > this is worhtwhile to add upstream. In the end it's up to you as the > maintainer. > If you don't want to put it upstream, I'd like to see it at least replace the > current action patch in th

Re: [dev] Cataloging of contacts

2016-11-09 Thread Evan Gates
On Wed, Nov 9, 2016 at 11:36 AM, Thomas Levine <_...@thomaslevine.com> wrote: > I want to keep track of some information about people, and I have an > idea of what I want the user interface to be like. Perhaps is there > already something close to what I want? > > I want to record the following inf

Re: [dev] mailto: and customi URIs in surf?

2016-11-09 Thread Evan Gates
On Wed, Nov 9, 2016 at 9:49 AM, wrote: > It's definitely not beautiful, and breaks with the naming conventions > in order to avoid naming conflicts (uppercase names preceded by underscores > and so on). This is handled with the new headers, e.g. stdalign.h has #define alignas _Alignas etc.

Re: [dev] mailto: and customi URIs in surf?

2016-11-09 Thread Evan Gates
On Wed, Nov 9, 2016 at 12:17 AM, Jean Louis wrote: > Even I always wanted to learn C, in my country we did not have > documentation, so I did not know where to begin, and don't know it > even now. > > How did you start learning C? The best bet is still to buy a copy of "The C Programming Language

Re: [dev] [stali] How to view manpages?

2016-10-17 Thread Evan Gates
On Sat, Oct 15, 2016 at 5:57 AM, Bruno Vetter wrote: > Guten Tag, > > trying out stali I see that manpages are included, but how can I actually > view them? Before I install anything I want to ensure to do it in the most > suckless way. > > Thank you > Bruno The plan for now is to use 9 base tr

Re: [dev] [ii] Reconnect

2016-10-13 Thread Evan Gates
On Thu, Oct 13, 2016 at 7:47 AM, Thomas Levine <_...@thomaslevine.com> wrote: > I start ii and chat for a while. Then I lose my internet connection > for a few hours. What is a good way to have ii automatically connect > when I get my internet connection back? > > I guess I have determine whether i

Re: [dev] Simple shell with completion

2016-10-12 Thread Evan Gates
On Wed, Oct 12, 2016 at 7:56 AM, Thomas Levine <_...@thomaslevine.com> wrote: > Or I guess I could try zsh or bash bash completion is very powerful as you can write shell functions to generate the possible completions based on what is on the command line so far. That being said you may lose yo

Re: [dev] [stali] Why lksh?

2016-10-10 Thread Evan Gates
On Sun, Oct 9, 2016 at 7:47 PM, Anselm R Garbe wrote: > Looks like a man page fault to me, probably lksh.1 is copied over > sh.1. The binary should be definitely mksh. Yep, binary is named sh in stali.mk and bin.mk checks for $(BIN).1 so we get sh.1 which is for lksh instead of mksh.1. Simple sol

Re: [dev] sbase installed first impressions

2016-10-03 Thread Evan Gates
On Mon, Oct 3, 2016 at 4:34 PM, stephen Turner wrote: > @Evan > I am not too fluent at advanced shell at the moment so help me out > with this one please, I checked the advanced scripting guide but want > to make sure i understand this. Please do not read that, it's full of practices that are out

Re: [dev] sbase installed first impressions

2016-10-03 Thread Evan Gates
> I have never had ls without color or column included (i'm spoiled) and > google isn't being overly helpful at the moment. I found the cols > command and ls | cols solved that so i can just create an alias, what > about getting color? Is there a suckless solution? An alias won't work here as you

Re: [dev] several questions

2016-09-21 Thread Evan Gates
On Tue, Sep 20, 2016 at 11:02 PM, FRIGN wrote: > Of course, given there is only one implementation, it is highly > portable per-se, given the interpretation is equal everywhere and 9base > is quite easily portable. Sadly there are two implementations. This rc[0] claims to be a reimplementation fo

Re: [dev] Re: I wrote a pager

2016-09-19 Thread Evan Gates
On Sun, Sep 18, 2016 at 4:48 PM, Greg Reagle wrote: > On Sun, Sep 18, 2016, at 09:34 AM, Christian Neukirchen wrote: >> 1 loc! >> >> awk 'NR%22==0 { getline _ <"/dev/tty" } {print}' > > Great! And stali has awk. It works pretty well, but doesn't take into > account long lines. > #!/bin/sh IFS='

Re: [dev] I wrote a pager

2016-09-16 Thread Evan Gates
On Fri, Sep 16, 2016 at 9:25 AM, wrote > Thank you Greg for writing such a fantastic pager. I could increase lines > however to something more than 22. char *lines = getenv("LINES"); int page_size = lines ? atoi(lines) : 24;

Re: [stali] base tools and build system (Was [dev]Shell style guide)

2016-09-15 Thread Evan Gates
On Thu, Sep 15, 2016 at 2:34 PM, Greg Reagle wrote: > My two cents... > Granted that rc+mk are far superior to /bin/sh+GNU make, but if there > are already 3rd party (i.e. not from suckless) packages/programs that > depend on sh+gmake, you might as well just use them as is. Doing a > whole lot of

[stali] base tools and build system (Was [dev]Shell style guide)

2016-09-15 Thread Evan Gates
On Thu, Sep 8, 2016 at 10:29 PM, Anselm R Garbe wrote: > Nevertheless, after an excursion to sh for several years, I'm kind of > favouring 9base/rc again, after all. For stali I now tend to adopt rc > as primary scripting language for the target system as well. For the > build host environment I w

[dev] Re: [stali] updating package source

2016-09-14 Thread Evan Gates
On Wed, Sep 14, 2016 at 1:33 PM, Evan Gates wrote: > For those packages that are available through git, I think it would > make sense to have git submodules. After playing around with git some more, and reading more documentation, I realize I misunderstood submodules, and subtrees are a

[dev] [stali] updating package source

2016-09-14 Thread Evan Gates
The software stali uses will receive updates. What is the plan for integrating those updates? I noticed the .origin files, but I'm not sure exactly what their use is. For those packages that are available through git, I think it would make sense to have git submodules. We could have a stali branch

[dev] Re: [stali] man pages and troff for stali

2016-09-14 Thread Evan Gates
On Wed, Sep 14, 2016 at 11:40 AM, Evan Gates wrote: > 1) find/write mdoc macros and a pager I got the mdoc macros from heirloom troff working with 9base troff. That being said, still open to discussion of other options.

[dev] [stali] man pages and troff for stali

2016-09-14 Thread Evan Gates
While compiling rc for stali I noticed that stali is still missing troff. I found some old mails about neatroff but it seams nothing came of it. I now have 9base troff compiling for stali as well. However 9base troff doesn't come with the mdoc macro package so we still can't format any man pages fr

Re: [dev] Shell style guide

2016-09-09 Thread Evan Gates
On Thu, Sep 8, 2016 at 10:29 PM, Anselm R Garbe wrote: > I appreciate your efforts of coming up with some sh styleguide. A side > note to that, I prefer calling test explicitely, instead of using the > weirdo [ ] symlinks in while/if statements. > > Nevertheless, after an excursion to sh for sever

Re: [dev] Shell style guide

2016-09-08 Thread Evan Gates
On Thu, Sep 8, 2016 at 7:30 AM, Nick wrote: > I am against writing scripts that can deal with filenames with > newlines. Fuck such filenames. If you have to deal with them, shell > scripting is a terrible technology to use. I too think newlines in filenames is stupid. I never put newlines in my f

Re: [dev] Shell style guide

2016-09-08 Thread Evan Gates
On Thu, Sep 8, 2016 at 7:26 AM, Greg Reagle wrote: > On Thu, Sep 8, 2016, at 10:11 AM, Greg Reagle wrote: >> On Thu, Sep 8, 2016, at 10:05 AM, Kamil Cholewiński wrote: >> > Wow, shell quoting is just fucked up crazy. I was mostly using unquoted >> > $@ my whole life. And here I thought I knew enou

Re: [dev] Shell style guide

2016-09-08 Thread Evan Gates
On Wed, Sep 7, 2016 at 11:21 PM, Martin Kühne wrote: > As with read's -r flag, use <<'EOF' unless silly/potentially > devastating side effects are desired. To add on to this, if reading lines, use IFS= as well so you don't lose leading/trailing whitespace. e.g.: while IFS= read -r line; do s

Re: [dev] Shell style guide

2016-09-08 Thread Evan Gates
On Thu, Sep 8, 2016 at 12:27 AM, wrote: > is there a special reason people use `EOF` rather than anything else. > FWIW, I use a dot. looks very clear and natural to me, saves some > keystrokes, feels right, just as ending a sentence with full stop. > > cat <<. > 1st line > 2nd line > 3rd line > 4

Re: [dev] Shell style guide

2016-09-08 Thread Evan Gates
On Thu, Sep 8, 2016 at 5:44 AM, Nick wrote: > I think this is something one learns with time. There are several > good reasons not to quote substitutions, such as passing multiple > arguments to another program (e.g. cmd $@), or a for or case > statement. But yes, quoting is essential most of the

Re: [dev] Shell style guide

2016-09-07 Thread Evan Gates
On Wed, Sep 7, 2016 at 2:11 PM, Adrian Grigore wrote: > Rendering was just an example, I doubt a shell script would be rendering. > > Example of camelCase I find ok is here: > https://raw.githubusercontent.com/adriangrigore/bootstrap/master/bootstrap > > Be free to critique the script, but note th

Re: [dev] Shell style guide

2016-09-06 Thread Evan Gates
On Tue, Sep 6, 2016 at 5:23 PM, Adrian Grigore wrote: > What do you think of camelCase names for functions/variables? I personally am against camel case in all my code.

Re: [dev] Shell style guide

2016-09-06 Thread Evan Gates
On Tue, Sep 6, 2016 at 1:09 PM, Antenore Gatta wrote: > Remember to quote whatever is inside the the substitute commands and > that you can > nest them: > > $(whatever "$foo" $(othercmd "$bar")) almost, you'd need "$(whatever "$foo" "$(othercmd "$bar")")" as "$()" needs to be quoted as well >

Re: [dev] Shell style guide

2016-09-06 Thread Evan Gates
On Tue, Sep 6, 2016 at 12:51 PM, Thomas Levine <_...@thomaslevine.com> wrote: > Adherence to standards and legibility can be problematic if you care > about > portability to sucky systems and shells. For example, `...` is more > widely > supported than $(...). But in the case of stali, I suggest th

Re: [dev] Shell style guide

2016-09-06 Thread Evan Gates
On Tue, Sep 6, 2016 at 12:10 PM, hiro <23h...@gmail.com> wrote: > to me it sounds overly cautious, like a shell equivalent of: never use > goto, always use braces, etc.. i don't like writing like this. Most of it is avoiding things that are broken by design, like code that can't handle filenames t

Re: [dev] Shell style guide

2016-09-06 Thread Evan Gates
On Tue, Sep 6, 2016 at 12:07 PM, Ali H. Fardan wrote: > one more thing, multiline vs one-line statements: > > if [ expr ... ]; then > ... > fi > > versus > > if [ expr ... ] > then > ... > fi > > this applies to others as well: > > while [ expr ... ] > do > ... > done > > I'd stick wit

Re: [dev] Shell style guide

2016-09-06 Thread Evan Gates
On Tue, Sep 6, 2016 at 11:59 AM, S. Gilles wrote: > Perhaps http://www.etalabs.net/sh_tricks.html might be a useful reference > to add? There's some detail there that might be valuable, or at least > sobering to anyone who wants to write some complicated sh. Definitely! It's a great resource.

[dev] Shell style guide

2016-09-06 Thread Evan Gates
suckless.org projects have traditionally been small amounts of pure C. The code tends towards simplicity and correctness. I value this and have learned much over the past years from reading and contributing to various projects. The addition of stali means there will probably be a fair amount of sh

Re: [dev] what are these diffs meant to apply to?

2016-07-13 Thread Evan Gates
On Wed, Jul 13, 2016 at 7:31 PM, Eric Pruitt wrote: > On Wed, Jul 13, 2016 at 04:22:51PM -0800, Britton Kerin wrote: >> There are some diffs like this one from columns patch: >> >> dwm-r1580-col.diff >> >> What are these r1580-style things supposed to refer to? > > Some of the suckless projec

Re: [dev] [scc] typeof is a gcc keyword

2016-07-05 Thread Evan Gates
On Sun, Jul 3, 2016 at 7:49 AM, Marc Collin wrote: > >Any compiler following the c99 standard will work. > But a binary compiled with gcc or clang will suck. No? > Even if scc source is suckless, won't the binary suck with we use > gcc/clang to compile it? If you need to build a compiler, and don

Re: [dev] [query] A tool for filtering lists of filenames with return codes

2016-05-20 Thread Evan Gates
On Thu, May 19, 2016 at 5:09 PM, Eric Pruitt wrote: > I wrote a tool for filtering lists of files based on return codes of > subprocesses called "query:" https://github.com/ericpruitt/query . > > Find all dynamically linked executables: > > find -type f | query sh -c 'ldd "$QUERY_FILENAME"' >

Re: [dev] pledge(2) patches

2016-05-18 Thread Evan Gates
> #ifndef __OpenBSD__ > int pledge(const char *promises, const char *paths[]) { return 0; } > #endif Why the full function instead of #define pledge(x,y) 0 (perhaps to enforce correct types?) -emg

Re: [dev] Linux distros that don't suck too too much

2016-05-12 Thread Evan Gates
On Thu, May 12, 2016 at 1:16 PM, Charlton Head wrote: > You might be able to do this with just the sbase tools, but I don't know how > offhand as I pretty much know which of my programs are using TLS/SSL without > needing special commands. find -H /bin -type f -exec grep -lF TLS {} +

Re: [dev] High Order Calculator

2015-12-18 Thread Evan Gates
It's in 9base. http://git.suckless.org/9base/tree/hoc That being said, the tutorial in "The Unix Programming Environment" is a fantastic way to learn yacc. -emg

Re: [dev] suckless bignum library

2015-12-10 Thread Evan Gates
On Thu, Dec 10, 2015 at 7:30 AM, FRIGN wrote: > but just a library with just enough functions to get around with > to handle tasks like dc(1) and bc(1). The problem with that is bc can't use a normal bignum library and be POSIX compliant as all the internal math is required to be in base 10. "Int

Re: [dev] [st][PATCH] Preserve pixelsize fractions in font defaultsize.

2015-06-12 Thread Evan Gates
On Fri, Jun 12, 2015 at 11:56 AM, Matthew Wesley wrote: > Can you provide some of the history? Nothing in the st commit history > showed a previous Google contribution. If previous patches were able > to get through without a Google entry in LICENSE, I may be able to > take that precedent to our o

[dev] [sbase][sed] patch: delete pattern space before updating ranges on c,d,D

2015-06-03 Thread Evan Gates
saw the report on freenode/#2f30 -emg From 94df11a7ffefbae7277bc9dea5283aeea2aed919 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Wed, 3 Jun 2015 07:31:31 -0700 Subject: [PATCH] delete pattern space before updating ranges on c,d,D --- sed.c | 1 + 1 file changed, 1 insertion(+) diff --git a

Re: [dev] sed breaks utf8 in [ ]

2015-03-30 Thread Evan Gates
On Sat, Mar 28, 2015 at 2:04 PM, Dimitris Papastamos wrote: > On Sat, Mar 28, 2015 at 09:48:08PM +0100, isabella parakiss wrote: >> Please fix >> >> $ sed 's/[à]/x/' <<< è >> x¨ > > Interestingly, sbase sed linked with musl gives the correct result. > > Will look into it. > The problem is using g

[dev] [sbase][patch] sed: change estrlcpy back to strlcpy

2015-03-24 Thread Evan Gates
strlcpy was used here to purposely truncate the string -emg From 91e5e371106735f8536109d3867c13dcbfa64082 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 24 Mar 2015 13:43:04 -0700 Subject: [PATCH] change estrlcat back to strlcat strlcat is used to here to purposely truncate the string

[dev] [sbase][patch] untypedef expr, find, test

2015-03-17 Thread Evan Gates
As is existing style in sbase, get rid of typedefs for user defined types. Still have to do cut and sed. I assume we shouldn't untypedef libutf as that's an external project. -Evan From d22d6fb25f5fced8331b663c5d9eabf2e24f28fc Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 17 M

[dev] [sbase][patch] typedef new structs

2015-03-13 Thread Evan Gates
typedef the new history and recurse structs as per style guide -emg From 192bd627e01de5f66a1cd76ad733b55f21bfde52 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 13 Mar 2015 10:55:23 -0700 Subject: [PATCH] typedef History and Recursor as per style guide --- chgrp.c | 4

[dev] [sbase][patch] sed: handle utf8 characters as delimiter in s command correctly

2015-03-12 Thread Evan Gates
Was adding 1 to pointer instead of runelen(delim) in get_s_arg(). oops. -emg From 6f82aa0c42ef2ed59ab7bd14eaa3f835e9ab212d Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 12 Mar 2015 14:46:30 -0700 Subject: [PATCH] increment pointer by runelen(delim) not 1 --- sed.c | 4 ++-- 1 file

[dev] [sbase][patch] recurse work

2015-03-06 Thread Evan Gates
to finish const propagation, hit a wall in my understanding) I think it should be possible to get rid of most uses of fnck() now that recurse can find loops, but I have not dug in far enough yet to be sure. -emg From 520535d0b39b60764767fc556d7d059a8b9091c2 Mon Sep 17 00:00:00 2001 From: Evan

[dev] [sbase][patch] find: bug and style fixes

2015-03-06 Thread Evan Gates
bug and style fixes in find 1) don't mix declarations and code (leave recursion alone for now as I plan on changing/using recurse) 2) change **argv to *argv[] 3) check for error on fork() -emg From 744eb3d39037c944202bbd572b0f80594ba21e44 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: F

[dev] [sbase][patch] expr: don't mix declarations and code

2015-03-05 Thread Evan Gates
don't mix declarations and code (and one ** to *[]) -emg From 22ae7c861697a6fd7bd069cee59d8f629a5aa8e2 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 5 Mar 2015 17:20:40 -0800 Subject: [PATCH] don't mix declarations and code (and one ** to *[]) --- expr.c | 18

[dev] [sbase][patch] test: a little cleanup

2015-03-04 Thread Evan Gates
be662a51fb3504d Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Wed, 4 Mar 2015 17:28:18 -0800 Subject: [PATCH] test: use arg.h, !strcmp, *argv[], not reached, fix test to check if basename(argv0) == "[" but avoid basename(3p) as it may change the contents of the string passed to it an

Re: [dev] [style] variable declaration locations and varriable length arrays vs malloc

2015-03-02 Thread Evan Gates
Also how strict should the rule be? Is calling functions to define variables when declaring them considered mixing declarations and code? i.e. is this allowed? size_t len = strlen(s); char *buf = emalloc(len + 1); etc. etc. On Mon, Mar 2, 2015 at 3:43 PM, Markus Teich wrote: > Heyho, > > a suc

Re: [dev] [style] variable declaration locations and varriable length arrays vs malloc

2015-03-02 Thread Evan Gates
On Mon, Mar 2, 2015 at 3:56 PM, Anthony J. Bentley wrote: > VLAs are a fundamentally broken feature because they do not allow any > error checking. alloca() is the same. > > -- > Anthony J. Bentley > But when do you ever do error checking of stack size? Is recursion a fundamentally broken feature

[dev] [style] variable declaration locations and varriable length arrays vs malloc

2015-03-02 Thread Evan Gates
This came up recently in talks about style in sbase due to my misunderstanding of "Do not mix declarations and code" and subsequent addition of the line "All variable declarations at top of block" in the style guide. It was my understanding that "Do not mix declarations and code" meant stick to AN

[dev] [sbase][patch] add time

2015-02-27 Thread Evan Gates
nd in some cases impossible). For now leave it with execvp() and the possibility of doing a manual path search at a later time if we decide that it's not correct enough. -emg From 438b8adebc2d37935148c9376f841d340b1ed84a Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 27 Feb 2015 13:3

Re: [dev] [sbase][patch] expr: comments, cleanup, style, etc.

2015-02-26 Thread Evan Gates
is a fixed one so you're at least looking at a working patch when you decide whether or not it's worth the extra code. -emg From c2b5985ba92463d3b260a7b46a2ebfd8ee1dd3a9 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 26 Feb 2015 14:14:23 -0800 Subject: [PATCH] keep track of allocati

Re: [dev] [sbase][patch] expr: comments, cleanup, style, etc.

2015-02-26 Thread Evan Gates
d commit it. It's not too much code, but it's also a small problem. I'm torn... -emg On Thu, Feb 26, 2015 at 12:14 PM, Dimitris Papastamos wrote: > On Wed, Feb 25, 2015 at 08:20:18PM -0800, Evan Gates wrote: >> Went back and added some comments to expr where I thought it wo

[dev] [sbase][patch] expr: comments, cleanup, style, etc.

2015-02-25 Thread Evan Gates
readable. I added a FIXME? comment. There is a strdup() that is never free()d. Is it worth keeping track of it at a global level just to free when we're done? -emg From ba26e69fbdb229276c76d9fb4cf62938afcae0f9 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Wed, 25 Feb 2015 20:12:14 -0800 Su

[dev] [sbase][patch] test: style fixes

2015-02-25 Thread Evan Gates
came up on IRC, use return with a NOTREACHED comment instead of comma operator also typedef Test -emg From 6cdfb37982fe7c9d4ead731f2b5aad67ca92821c Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Wed, 25 Feb 2015 09:01:20 -0800 Subject: [PATCH] re-typedef Test, use NOTREACHED comment instead of

[dev] [sbase][patch] find: a bunch of cleanup

2015-02-24 Thread Evan Gates
cleanup, code deduplication, fix the one instance in parsing we were checking which primary we had -emg From 023000839da6ad4b7758092e25db84a001544d71 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 24 Feb 2015 19:34:36 -0800 Subject: [PATCH] a bunch of cleanup --- find.c | 190

[dev] [sbase][patch] find: use struct literal

2015-02-24 Thread Evan Gates
use a struct literal instead of filling in fields one at a time why use four lines when you can use one? -emg From bb01bad0cdc669c21338e54f9c05ce7a0ad733c1 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 24 Feb 2015 18:44:13 -0800 Subject: [PATCH] use struct literal instead of filling each

[dev] [sbase][patch] find: simplify comparisons for numerical arguments

2015-02-24 Thread Evan Gates
was needlessly using an array of function pointers and an enum to index when the function pointer in place of the enum is sufficient. -emg From afb70f8d94a086bbb4d864436913ee68d9b22173 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 24 Feb 2015 18:19:49 -0800 Subject: [PATCH] no need for

[dev] [sbase][patch] find: cleanup and fix

2015-02-23 Thread Evan Gates
sbase-remove_dupe_decls.diff: removes duplicate declarations for get_n_arg (copy pasta) sbase-space_for_end.diff: increases the infix[] array size by one to assure there's space for the END token -emg From 91b386ea6f4974306cf87988b752a7e9497e61bc Mon Sep 17 00:00:00 2001 From: Evan Gates

[dev] [sbase][patch] find: insert implicit -a after primary before !

2015-02-20 Thread Evan Gates
See attached. -emg From dd9c359d5a6b6731860e4b2693b043dfac056529 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 20 Feb 2015 17:51:04 -0800 Subject: [PATCH] insert implicit -a after primary before ! --- find.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff

[dev] [sbase][patch] find: change execv to execvp

2015-02-20 Thread Evan Gates
-emg From 77d3af375670e3406aa9320cb06f23e07aef6169 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 20 Feb 2015 17:30:28 -0800 Subject: [PATCH] make gobals static, change execv to execvp, fix a comment, change some data types, rearrange struct members from largest to smallest (no affect due to small structs, goo

Re: [dev] [sbase][patch] add [ alias to test, makefile cleanup

2015-02-20 Thread Evan Gates
On Fri, Feb 20, 2015 at 3:36 PM, Nick wrote: > Quoth Evan Gates: >> sbase-use_pe.diff : use parameter expansion instead of basename when >> building sbase-box. simpler, shorter, no extra processes > > I don't like this. The sbase Makefile is a really standard, basic, &g

[dev] Re: [sbase][patch] add [ alias to test, makefile cleanup

2015-02-20 Thread Evan Gates
And of course I forgot to remove [ on uninstall. One more patch to do that. -emg From a2145f934990b56b17c1faa564142b1bad42396f Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 20 Feb 2015 14:02:12 -0800 Subject: [PATCH] remember to remove [ on uninstall --- Makefile | 4 ++-- 1 file changed

[dev] [sbase][patch] add [ alias to test, makefile cleanup

2015-02-20 Thread Evan Gates
0af9987ba583a96b2cc61a85a553b066c40edf06 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 20 Feb 2015 12:08:13 -0800 Subject: [PATCH] add [ alias for test --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 124bfa4..4665605 100644 --- a/Makefile +++ b

[dev] [sbase][patch] remove libutf from test.c

2015-02-20 Thread Evan Gates
l or not. -emg From ebf480d8b31027f72860132f3088e916453c4a4c Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Fri, 20 Feb 2015 11:19:02 -0800 Subject: [PATCH] no need for libutf in test, a null byte is a null byte --- README | 2 +- test.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README b/

[dev] [sbase][find] find implementation

2015-02-19 Thread Evan Gates
let other people take a look and switch back to sed. With my limited testing it works as expected. Please test it and report any bugs you find. -emg From 137e1457f1b7442f7bbf90898d76fa890a7b8d53 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 19 Feb 2015 17:47:21 -0800 Subject: [PATCH]

Re: [dev] [sbase][sed] first pass at sed, request for comments

2015-02-03 Thread Evan Gates
On Tue, Feb 3, 2015 at 5:07 PM, hiro <23h...@gmail.com> wrote: > posix is not suck less. I agree, however it seems sbase aims to be "mostly" POSIX compliant.

[dev] [sbase][sed] first pass at sed, request for comments

2015-02-03 Thread Evan Gates
Hello, I finally have a new sed implementation. It's littered with FIXMEs and there are some points that need to be discussed, but for the most part it works like it should. It definitely has some work until it sucks less. A summary of points that should be discussed, for more detail read the sou

[dev] [sbase] what is a text file?

2014-11-21 Thread Evan Gates
POSIX defines a text file as: 3.397 Text File A file that contains characters organized into zero or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the character. Although POSIX.1-2008 does not distinguish between text files and binar

[dev] [sbase]building

2014-11-19 Thread Evan Gates
As we recently found out POSIX make is lacking. For fun I started to write a POSIX sh script to build sbase (attached and linked[0]). I don't know if we should use it, but it's food for thought after the recent pain (including requiring a GNU tool). If there's interest I can finish fleshing it out.

Re: [dev] [sbase] style

2014-11-19 Thread Evan Gates
On Wed, Nov 19, 2014 at 6:23 AM, Anselm R Garbe wrote: > I suggest http://suckless.org/style[.md], to be the central place for this. > > @Evan, feel free to proceed ;) I just submitted a first draft doing my best to include everything that was mentioned here. As always it is most definitely a wor

Re: [dev] [sbase][patch]cat stdin if arg is exactly "-" not begins with '-'

2014-11-19 Thread Evan Gates
On Wed, Nov 19, 2014 at 2:01 AM, v4hn wrote: > You meant to write "./-foo", didn't you? Yes I did. My apologies. emg

[dev] [sbase][patch]cat stdin if arg is exactly "-" not begins with '-'

2014-11-18 Thread Evan Gates
This patch makes cat -- -foo cat the file ./foo and not stdin. emg From 71b02bf573c5345ee0994192ad74d591dc89a7d4 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 18 Nov 2014 13:41:52 -0800 Subject: [PATCH] read stdin if arg is exactly "-" not just begins with '-' ---

[dev] [sbase][patch] remove agetline

2014-11-18 Thread Evan Gates
agetline was a straight passthrough to getline, here's a patch to remove it. emg From cffea4efd18fc818b1529f8276a688f5a77fc93a Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 18 Nov 2014 12:49:30 -0800 Subject: [PATCH] remove agetline --- Makefile | 1 - cut.c

[dev] [sbase][patch] clear and reorder suffix list

2014-11-18 Thread Evan Gates
file index 5357bca..f60985c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ include config.mk -.SUFFIXES: .c .o +.SUFFIXES: +.SUFFIXES: .o .c HDR =\ arg.h\ -- 2.1.3 From 051f20fe06e03dd265122854d733241a7c618923 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Tue, 18 Nov 2014 12:12:14 -0800 Subj

Re: [dev] [sbase] style

2014-11-17 Thread Evan Gates
On Mon, Nov 17, 2014 at 1:47 PM, FRIGN wrote: > I must honestly say that you gotta work on your coding style a bit better. > I spent all evening yesterday and some hours this afternoon to untangle > your expr.c. It wasn't too bad, but for instance, you had unnecessary > global variables, unsafe po

[dev] [sbase] style

2014-11-17 Thread Evan Gates
sbase has no unified style. Many things change from file to file. I am more annoyed by this than I should be. I propose a style document for sbase. I have included a starting point in order to promote discussion. You will disagree with some of these points. Speak up and explain your alternative and

Re: [dev] [sbase][patch] new expr, take 2 (and makefile improvements)

2014-11-13 Thread Evan Gates
Realized I forgot to switch from spaces to tabs, again. Here's the expr patch with tabs this time: sbase-new_expr_tabs.diff emg From f1fb78215c3bb691b4bf6234ea2702add259d0b7 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 13 Nov 2014 15:07:15 -0800 Subject: [PATCH] new expr using shu

Re: [dev] [sbase][patch] new expr, take 2 (and makefile improvements)

2014-11-13 Thread Evan Gates
I should add that in trying to write code that sucks less, this implementation is minimally POSIX compliant. That is, strict POSIX compliance with no extensions. As such operators cannot be used as strings, which is acceptable and explicitly mentioned in the POSIX specification for expr[0]. [0]htt

[dev] [sbase][patch] new expr, take 2 (and makefile improvements)

2014-11-13 Thread Evan Gates
.diff And lastly I added -D_DEFAULT_SOURCE in config.mk so gcc will shutup about -D_BSD_SOURCE being deprecated. Included patch: sbase-default_source.diff emg [0]https://en.wikipedia.org/wiki/Shunting-yard_algorithm From c19ec21790e6402125349fbc9e7b4eab0cea4144 Mon Sep 17 00:00:00 2001 From: Evan G

Re: [dev] [sbase][patch] new expr

2014-11-08 Thread Evan Gates
On Sat, Nov 8, 2014 at 5:53 AM, Dimitris Papastamos wrote: > Is the manpage still relevant or do we need to strip out certain bits? The only thing currently missing is taking into account LC_COLLATE when doing string comparisons.

  1   2   >