[hackers] [farbfeld] Fix 2ff stderr-redirect || FRIGN

2016-01-05 Thread git
commit b1868127e4102b2e073750c7f55fd445bee028be
Author: FRIGN 
AuthorDate: Tue Jan 5 20:41:57 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 20:41:57 2016 +0100

Fix 2ff stderr-redirect

Thanks izabera for spotting this!

diff --git a/2ff b/2ff
index 19946df..6d89499 100755
--- a/2ff
+++ b/2ff
@@ -12,13 +12,13 @@ FORMAT=$(file -ib $TMP | cut -d ";" -f 1);
 case "$FORMAT" in
 image/png)  png2ff < $TMP; ret=$? ;;
 image/jpeg) jpg2ff < $TMP; ret=$? ;;
-*) xconvert $TMP png:- 2&>/dev/null | png2ff 2&>/dev/null; ret=$? ;;
+*) xconvert $TMP png:- 2>/dev/null | png2ff 2>/dev/null; ret=$? ;;
 esac
 
 rm $TMP;
 
 if [ $ret -ne 0 ]; then
-   printf "%s: failed to convert %s\n" "$0" "$FORMAT" 1>&2;
+   printf "%s: failed to convert %s\n" "$0" "$FORMAT" >&2;
 fi
 
 exit $ret;



[hackers] [farbfeld] Also be consistent in config.mk || FRIGN

2016-01-05 Thread git
commit 226d9136b89ac6f714ff5e9d67dea278f149bedd
Author: FRIGN 
AuthorDate: Tue Jan 5 17:47:16 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 17:47:16 2016 +0100

Also be consistent in config.mk

diff --git a/config.mk b/config.mk
index 9d01b31..f123dc1 100644
--- a/config.mk
+++ b/config.mk
@@ -2,7 +2,7 @@
 
 # paths
 PREFIX = /usr/local
-MANPREFIX = $(PREFIX)/share/man
+MANPREFIX = ${PREFIX}/share/man
 
 PNGLIB = /usr/local/lib
 PNGINC = /usr/local/include



[hackers] [farbfeld] Use consistent {} in Makefile || FRIGN

2016-01-05 Thread git
commit 4e84440473323aa72109162123ff062a198a2c44
Author: FRIGN 
AuthorDate: Tue Jan 5 17:31:43 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 17:31:43 2016 +0100

Use consistent {} in Makefile

diff --git a/Makefile b/Makefile
index 46dcefc..789f817 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,9 @@
-# farbfeld - tools to convert between png/jpg and ff
 # See LICENSE file for copyright and license details
-
 include config.mk
 
 BIN = png2ff ff2png jpg2ff
-SRC = $(BIN:=.c)
-MAN1 = 2ff.1 $(BIN:=.1)
+SRC = ${BIN:=.c}
+MAN1 = 2ff.1 ${BIN:=.1}
 MAN5 = farbfeld.5
 
 all: png2ff ff2png jpg2ff
@@ -22,18 +20,18 @@ install: all
@mkdir -p "${DESTDIR}${PREFIX}/bin"
@cp -f 2ff ${BIN} "${DESTDIR}${PREFIX}/bin"
@echo installing manpages into ${DESTDIR}${MANPREFIX}
-   @mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
-   @cp -f $(MAN1) "$(DESTDIR)$(MANPREFIX)/man1"
-   @cd "$(DESTDIR)$(MANPREFIX)/man1" && chmod 644 $(MAN1)
-   @mkdir -p "$(DESTDIR)$(MANPREFIX)/man5"
-   @cp -f $(MAN5) "$(DESTDIR)$(MANPREFIX)/man5"
-   @cd "$(DESTDIR)$(MANPREFIX)/man5" && chmod 644 $(MAN5)
+   @mkdir -p "${DESTDIR}${MANPREFIX}/man1"
+   @cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1"
+   @cd "${DESTDIR}${MANPREFIX}/man1" && chmod 644 ${MAN1}
+   @mkdir -p "${DESTDIR}${MANPREFIX}/man5"
+   @cp -f ${MAN5} "${DESTDIR}${MANPREFIX}/man5"
+   @cd "${DESTDIR}${MANPREFIX}/man5" && chmod 644 ${MAN5}
 
 uninstall:
@echo removing from ${DESTDIR}${PREFIX}/bin
@cd "${DESTDIR}${PREFIX}/bin" && rm -f 2ff ${BIN}
@echo removing manpages from ${DESTDIR}${MANPREFIX}
-   @cd "${DESTDIR}${MANPREFIX}/man1" && rm -f $(MAN1)
-   @cd "${DESTDIR}${MANPREFIX}/man5" && rm -f $(MAN5)
+   @cd "${DESTDIR}${MANPREFIX}/man1" && rm -f ${MAN1}
+   @cd "${DESTDIR}${MANPREFIX}/man5" && rm -f ${MAN5}
 
 .PHONY: all clean install uninstall



[hackers] [farbfeld] Quote paths in Makefile || FRIGN

2016-01-05 Thread git
commit 37279aea00503196cfb5e008b66ced8ec8043e1f
Author: FRIGN 
AuthorDate: Tue Jan 5 17:13:38 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 17:14:02 2016 +0100

Quote paths in Makefile

Thanks quinq for reporting this!

diff --git a/Makefile b/Makefile
index cfc4fe8..46dcefc 100644
--- a/Makefile
+++ b/Makefile
@@ -19,21 +19,21 @@ clean:
 
 install: all
@echo installing into ${DESTDIR}${PREFIX}/bin
-   @mkdir -p ${DESTDIR}${PREFIX}/bin
-   @cp -f 2ff ${BIN} ${DESTDIR}${PREFIX}/bin
-   @echo installing manpages into ${DESTDIR}${MANPREFIX}   
-   @mkdir -p $(DESTDIR)$(MANPREFIX)/man1
-   @cp -f $(MAN1) $(DESTDIR)$(MANPREFIX)/man1
-   @cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN1)
-   @mkdir -p $(DESTDIR)$(MANPREFIX)/man5
-   @cp -f $(MAN5) $(DESTDIR)$(MANPREFIX)/man5
-   @cd $(DESTDIR)$(MANPREFIX)/man5 && chmod 644 $(MAN5)
+   @mkdir -p "${DESTDIR}${PREFIX}/bin"
+   @cp -f 2ff ${BIN} "${DESTDIR}${PREFIX}/bin"
+   @echo installing manpages into ${DESTDIR}${MANPREFIX}
+   @mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
+   @cp -f $(MAN1) "$(DESTDIR)$(MANPREFIX)/man1"
+   @cd "$(DESTDIR)$(MANPREFIX)/man1" && chmod 644 $(MAN1)
+   @mkdir -p "$(DESTDIR)$(MANPREFIX)/man5"
+   @cp -f $(MAN5) "$(DESTDIR)$(MANPREFIX)/man5"
+   @cd "$(DESTDIR)$(MANPREFIX)/man5" && chmod 644 $(MAN5)
 
 uninstall:
@echo removing from ${DESTDIR}${PREFIX}/bin
-   @cd ${DESTDIR}${PREFIX}/bin && rm -f 2ff ${BIN}
+   @cd "${DESTDIR}${PREFIX}/bin" && rm -f 2ff ${BIN}
@echo removing manpages from ${DESTDIR}${MANPREFIX}
-   @cd ${DESTDIR}${MANPREFIX}/man1 && rm -f $(MAN1)
-   @cd ${DESTDIR}${MANPREFIX}/man5 && rm -f $(MAN5)
+   @cd "${DESTDIR}${MANPREFIX}/man1" && rm -f $(MAN1)
+   @cd "${DESTDIR}${MANPREFIX}/man5" && rm -f $(MAN5)
 
 .PHONY: all clean install uninstall



[hackers] [farbfeld] Fix Makefile+config.mk || FRIGN

2016-01-05 Thread git
commit a7dba356ecad56b84c06fc12f537682feff61232
Author: FRIGN 
AuthorDate: Tue Jan 5 16:56:47 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 16:56:47 2016 +0100

Fix Makefile+config.mk

I forgot that we can't just cd. It has to be a &&-statement.
Also, uncomplicate the output.

diff --git a/Makefile b/Makefile
index b93b472..cfc4fe8 100644
--- a/Makefile
+++ b/Makefile
@@ -17,26 +17,23 @@ all: png2ff ff2png jpg2ff
 clean:
rm -f ${BIN}
 
-install:
+install: all
@echo installing into ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
@cp -f 2ff ${BIN} ${DESTDIR}${PREFIX}/bin
-   mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+   @echo installing manpages into ${DESTDIR}${MANPREFIX}   
+   @mkdir -p $(DESTDIR)$(MANPREFIX)/man1
@cp -f $(MAN1) $(DESTDIR)$(MANPREFIX)/man1
-   cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN1)
-   mkdir -p $(DESTDIR)$(MANPREFIX)/man5
+   @cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN1)
+   @mkdir -p $(DESTDIR)$(MANPREFIX)/man5
@cp -f $(MAN5) $(DESTDIR)$(MANPREFIX)/man5
-   cd $(DESTDIR)$(MANPREFIX)/man5 && chmod 644 $(MAN5)
+   @cd $(DESTDIR)$(MANPREFIX)/man5 && chmod 644 $(MAN5)
 
 uninstall:
@echo removing from ${DESTDIR}${PREFIX}/bin
-   cd ${DESTDIR}${PREFIX}/bin
-   @rm -f 2ff ${BIN}
-   @echo removing from ${DESTDIR}${MANPREFIX}/man1
-   cd ${DESTDIR}${MANPREFIX}/man1
-   @rm -f $(MAN1)
-   @echo removing from ${DESTDIR}${MANPREFIX}/man5
-   cd ${DESTDIR}${MANPREFIX}/man5
-   @rm -f $(MAN5)
+   @cd ${DESTDIR}${PREFIX}/bin && rm -f 2ff ${BIN}
+   @echo removing manpages from ${DESTDIR}${MANPREFIX}
+   @cd ${DESTDIR}${MANPREFIX}/man1 && rm -f $(MAN1)
+   @cd ${DESTDIR}${MANPREFIX}/man5 && rm -f $(MAN5)
 
 .PHONY: all clean install uninstall
diff --git a/config.mk b/config.mk
index 6c04982..9d01b31 100644
--- a/config.mk
+++ b/config.mk
@@ -2,15 +2,16 @@
 
 # paths
 PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/share/man
 
 PNGLIB = /usr/local/lib
 PNGINC = /usr/local/include
 
-JPEGLIB = /usr/local/lib
-JPEGINC = /usr/local/include
+JPGLIB = /usr/local/lib
+JPGINC = /usr/local/include
 
-INCS = -I${PNGINC} -I${JPEGINC}
-LIBS = -L${PNGLIB} -L${JPEGLIB} -lpng -ljpeg
+INCS = -I${PNGINC} -I${JPGINC}
+LIBS = -L${PNGLIB} -L${JPGLIB} -lpng -ljpeg
 
 # flags
 CPPFLAGS = -D_DEFAULT_SOURCE



[hackers] [farbfeld] 2ff: Check return values and handle errors || FRIGN

2016-01-05 Thread git
commit ba154494ae239b9a79fc0947cad497e983c80653
Author: FRIGN 
AuthorDate: Tue Jan 5 16:03:43 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 16:03:43 2016 +0100

2ff: Check return values and handle errors

Also, in case convert(1) is not in the path, it will just return an
error-message giving the MIME-type of the problematic input data.
The return-value is given properly as well (0 on success, 1 on error).

diff --git a/2ff b/2ff
index 2b0cbd9..19946df 100755
--- a/2ff
+++ b/2ff
@@ -10,9 +10,15 @@ cat > $TMP;
 FORMAT=$(file -ib $TMP | cut -d ";" -f 1);
 
 case "$FORMAT" in
-image/png)  png2ff < $TMP ;;
-image/jpeg) jpg2ff < $TMP ;;
-*) convert $TMP png:- | png2ff ;;
+image/png)  png2ff < $TMP; ret=$? ;;
+image/jpeg) jpg2ff < $TMP; ret=$? ;;
+*) xconvert $TMP png:- 2&>/dev/null | png2ff 2&>/dev/null; ret=$? ;;
 esac
 
 rm $TMP;
+
+if [ $ret -ne 0 ]; then
+   printf "%s: failed to convert %s\n" "$0" "$FORMAT" 1>&2;
+fi
+
+exit $ret;



[hackers] [farbfeld] Add tool manpages and set up the Makefile to install the manuals || FRIGN

2016-01-05 Thread git
commit 24c4b045fc495becc9ba4239ba3d2963851c7634
Author: FRIGN 
AuthorDate: Tue Jan 5 16:38:12 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 16:38:12 2016 +0100

Add tool manpages and set up the Makefile to install the manuals

While at it, refactor the makefile a bit.

diff --git a/2ff.1 b/2ff.1
new file mode 100644
index 000..44eed4e
--- /dev/null
+++ b/2ff.1
@@ -0,0 +1,51 @@
+.Dd 2016-01-05
+.Dt 2FF 1
+.Os suckless.org
+.Sh NAME
+.Nm 2ff
+.Nd convert image to farbfeld
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+.Nm
+reads an image from stdin, converts it to
+.Xr farbfeld 5
+and writes the result to stdout.
+.Pp
+.Nm
+is a wrapper script around the *2ff-tools
+with a soft fallback to obtaining a PNG from imagemagick's
+.Xr convert 1
+and passing it through
+.Xr png2ff 1 .
+.Pp
+In case of an error
+.Nm
+writes a diagnostic message to stderr.
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It 0
+Image processed successfully.
+.It 1
+An error occurred or
+.Xr convert 1
+was not found in the fallback.
+.El
+.Sh EXAMPLES
+$
+.Nm
+< image.* > image.ff
+.Pp
+$
+.Nm
+< image.* | bzip2 > image.ff.bz2
+.Sh SEE ALSO
+.Xr bunzip2 1 ,
+.Xr bzip2 1 ,
+.Xr convert 1 ,
+.Xr ff2png 1 ,
+.Xr jpg2ff 1 ,
+.Xr png2ff 1 ,
+.Xr farbfeld 5
+.Sh AUTHORS
+.An Laslo Hunhold Aq Mt d...@frign.de
diff --git a/Makefile b/Makefile
index f54f7b4..b93b472 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,10 @@
 
 include config.mk
 
-SRC = png2ff.c ff2png.c jpg2ff.c
+BIN = png2ff ff2png jpg2ff
+SRC = $(BIN:=.c)
+MAN1 = 2ff.1 $(BIN:=.1)
+MAN5 = farbfeld.5
 
 all: png2ff ff2png jpg2ff
 
@@ -12,16 +15,28 @@ all: png2ff ff2png jpg2ff
@${CC} -o $@ ${CFLAGS} ${LIBS} ${LDFLAGS} $<
 
 clean:
-   rm -f png2ff ff2png jpg2ff
+   rm -f ${BIN}
 
 install:
@echo installing into ${DESTDIR}${PREFIX}/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin
-   @cp -f jpg2ff png2ff ff2png 2ff ${DESTDIR}${PREFIX}/bin
+   @cp -f 2ff ${BIN} ${DESTDIR}${PREFIX}/bin
+   mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+   @cp -f $(MAN1) $(DESTDIR)$(MANPREFIX)/man1
+   cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN1)
+   mkdir -p $(DESTDIR)$(MANPREFIX)/man5
+   @cp -f $(MAN5) $(DESTDIR)$(MANPREFIX)/man5
+   cd $(DESTDIR)$(MANPREFIX)/man5 && chmod 644 $(MAN5)
 
 uninstall:
@echo removing from ${DESTDIR}${PREFIX}/bin
-   @rm -f ${DESTDIR}${PREFIX}/bin/png2ff
-   @rm -f ${DESTDIR}${PREFIX}/bin/ff2png
+   cd ${DESTDIR}${PREFIX}/bin
+   @rm -f 2ff ${BIN}
+   @echo removing from ${DESTDIR}${MANPREFIX}/man1
+   cd ${DESTDIR}${MANPREFIX}/man1
+   @rm -f $(MAN1)
+   @echo removing from ${DESTDIR}${MANPREFIX}/man5
+   cd ${DESTDIR}${MANPREFIX}/man5
+   @rm -f $(MAN5)
 
 .PHONY: all clean install uninstall
diff --git a/ff2png.1 b/ff2png.1
new file mode 100644
index 000..3bf1d82
--- /dev/null
+++ b/ff2png.1
@@ -0,0 +1,42 @@
+.Dd 2016-01-05
+.Dt FF2PNG 1
+.Os suckless.org
+.Sh NAME
+.Nm ff2png
+.Nd convert farbfeld to PNG
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+.Nm
+reads a
+.Xr farbfeld 5
+image from stdin, converts it to a 16-Bit RGBA PNG and writes the result
+to stdout.
+.Pp
+In case of an error
+.Nm
+writes a diagnostic message to stderr.
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It 0
+Image processed successfully.
+.It 1
+An error occurred.
+.El
+.Sh EXAMPLES
+$
+.Nm
+< image.ff > image.png
+.Pp
+$ bunzip2 < image.ff.bz2 |
+.Nm
+> image.png
+.Sh SEE ALSO
+.Xr 2ff 1 ,
+.Xr bunzip2 1 ,
+.Xr bzip2 1 ,
+.Xr jpg2ff 1 ,
+.Xr png2ff 1 ,
+.Xr farbfeld 5
+.Sh AUTHORS
+.An Laslo Hunhold Aq Mt d...@frign.de
diff --git a/jpg2ff.1 b/jpg2ff.1
new file mode 100644
index 000..0e99062
--- /dev/null
+++ b/jpg2ff.1
@@ -0,0 +1,41 @@
+.Dd 2016-01-05
+.Dt JPG2FF 1
+.Os suckless.org
+.Sh NAME
+.Nm jpg2ff
+.Nd convert JPG to farbfeld
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+.Nm
+reads a JPG image from stdin, converts it to
+.Xr farbfeld 5
+and writes the result to stdout.
+.Pp
+In case of an error
+.Nm
+writes a diagnostic message to stderr.
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It 0
+Image processed successfully.
+.It 1
+An error occurred.
+.El
+.Sh EXAMPLES
+$
+.Nm
+< image.jpg > image.ff
+.Pp
+$
+.Nm
+< image.jpg | bzip2 > image.ff.bz2
+.Sh SEE ALSO
+.Xr 2ff 1 ,
+.Xr bunzip2 1 ,
+.Xr bzip2 1 ,
+.Xr ff2png 1 ,
+.Xr png2ff 1 ,
+.Xr farbfeld 5
+.Sh AUTHORS
+.An Laslo Hunhold Aq Mt d...@frign.de
diff --git a/png2ff.1 b/png2ff.1
new file mode 100644
index 000..f1c6083
--- /dev/null
+++ b/png2ff.1
@@ -0,0 +1,41 @@
+.Dd 2016-01-05
+.Dt PNG2FF 1
+.Os suckless.org
+.Sh NAME
+.Nm png2ff
+.Nd convert PNG to farbfeld
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+.Nm
+reads a PNG image from stdin, converts it to
+.Xr farbfeld 5
+and writes the result to stdout.
+.Pp
+In case of an error
+.Nm
+writes a diagnostic message to stderr.
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It 0
+Image processed successfully.
+.It 1
+An error occurred.
+.El
+.Sh EXAMPLES
+$
+.Nm
+< image.png > image.ff
+.Pp
+$
+.Nm
+< image.png | bzip2 > 

[hackers] [sbase] grep: make E and F flags mutually exclusive || Quentin Rameau

2016-01-05 Thread git
commit eeeb7a6e53ae54b795f47131bf36227d6fd3fe87
Author: Quentin Rameau 
AuthorDate: Tue Jan 5 14:52:46 2016 +0100
Commit: sin 
CommitDate: Tue Jan 5 13:54:17 2016 +

grep: make E and F flags mutually exclusive

Don't make F the priority flag when both E and F are given, instead use
the last one.

diff --git a/grep.c b/grep.c
index ca255ff..9f4093c 100644
--- a/grep.c
+++ b/grep.c
@@ -183,10 +183,13 @@ main(int argc, char *argv[])
ARGBEGIN {
case 'E':
Eflag = 1;
+   Fflag = 0;
flags |= REG_EXTENDED;
break;
case 'F':
Fflag = 1;
+   Eflag = 0;
+   flags &= ~REG_EXTENDED;
break;
case 'H':
Hflag = 1;



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

2016-01-05 Thread Dimitris Papastamos
On Tue, Jan 05, 2016 at 02:35:18PM +0100, Connor Lane Smith wrote:
> Hey,
> 
> On 5 January 2016 at 14:01, Roberto E. Vargas Caballero  
> wrote:
> > 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.
> 
> I do think egrep & fgrep are worth having, but I'm not sure if
> strcmp(argv[0], ...) is the way to go about it. For one thing it means
> (unless I'm mistaken) that executing /bin/egrep would actually call
> grep, not egrep. This could be fixed by comparing only the basename,
> but in my opinion a more reliable approach would be to add two short
> shell scripts to add the appropriate flag, e.g.
> 
> #!/bin/sh
> exec grep -E "$@"
> 
> There is the drawback here that the first grep in $PATH may not be
> sbase grep, but all in all I think a shell script is better than
> checking argv[0] within the binary itself. Alternatively anyone who
> wants egrep & fgrep could just add shell aliases... Still, it's up to
> the maintainers.

Yes, I like the shell script approach, however, what happens when someone
uses the sbase-box target?



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

2016-01-05 Thread Connor Lane Smith
Hey,

On 5 January 2016 at 14:01, Roberto E. Vargas Caballero  wrote:
> 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.

I do think egrep & fgrep are worth having, but I'm not sure if
strcmp(argv[0], ...) is the way to go about it. For one thing it means
(unless I'm mistaken) that executing /bin/egrep would actually call
grep, not egrep. This could be fixed by comparing only the basename,
but in my opinion a more reliable approach would be to add two short
shell scripts to add the appropriate flag, e.g.

#!/bin/sh
exec grep -E "$@"

There is the drawback here that the first grep in $PATH may not be
sbase grep, but all in all I think a shell script is better than
checking argv[0] within the binary itself. Alternatively anyone who
wants egrep & fgrep could just add shell aliases... Still, it's up to
the maintainers.

cls



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

2016-01-05 Thread Pickfire

I am sorry for that, I had removed that malicious word in another patch.

--
_
< Do what you like, like what you do. >
-
   \   ^__^
\  (oo)\___
   (__)\   )\/\
   ||w |
   || ||



Re: [hackers] [st][PATCH] I don't like yellow, it arouses me too much

2016-01-05 Thread Christoph Lohmann
Greetings.

On Tue, 05 Jan 2016 14:11:11 +0100 Ivan Tham  wrote:
> Let's put there the default foreground color.
> http://www.nickkolenda.com/wp-content/uploads/2015/10/color-arousal.png
> Thanks to voidead for the idea.

As  said  in  my  answer before: »I don’t like yellow, it arouses me too
much« is a personal taste and no reason for an inclusion into  the  main
tree  of st. Find a rationale for why every user should have this change
included or add some »arousal scale theme« to the  wiki  as  a  personal
patch.


Sincerely,

Christoph Lohmann

💻 http://r-36.net
💻 gopher://r-36.net
☺ http://r-36.net/about
🔐 1C3B 7E6F 9805 E5C8 C0BD  1F7F EA21 7AAC 09A9 CB55
🔐 http://r-36.net/about/20h.asc
📧 2...@r-36.net




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

2016-01-05 Thread Christoph Lohmann
Greetings.

On Tue, 05 Jan 2016 14:09:04 +0100 Ivan Tham  wrote:
> Thanks to voidead: god of destroying faggot asscunts

What’s the rationale of this patch? He complained without any manners on
IRC that st is completely buggy and it’s showing  in  his  misconfigured
system italics as yellow.

I won’t apply the patch with such a commit message.


Sincerely,

Christoph Lohmann

💻 http://r-36.net
💻 gopher://r-36.net
☺ http://r-36.net/about
🔐 1C3B 7E6F 9805 E5C8 C0BD  1F7F EA21 7AAC 09A9 CB55
🔐 http://r-36.net/about/20h.asc
📧 2...@r-36.net




[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 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1c09cac..f6f8dc8 100644
--- a/Makefile
+++ b/Makefile
@@ -196,7 +196,9 @@ confstr_l.h limits_l.h sysconf_l.h pathconf_l.h: getconf.sh
 install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
-   cd $(DESTDIR)$(PREFIX)/bin && ln -f test [ && chmod 755 $(BIN)
+   ln $(DESTDIR)$(PREFIX)/bin/grep $(DESTDIR)$(PREFIX)/bin/egrep
+   ln $(DESTDIR)$(PREFIX)/bin/grep $(DESTDIR)$(PREFIX)/bin/fgrep
+   cd $(DESTDIR)$(PREFIX)/bin && ln -f test [ && chmod 755 $(BIN) egrep 
fgrep
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
for m in $(MAN); do sed "s/^\.Os sbase/.Os sbase $(VERSION)/g" < "$$m" 
> $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
diff --git a/grep.c b/grep.c
index ca255ff..c01d151 100644
--- a/grep.c
+++ b/grep.c
@@ -180,6 +180,11 @@ main(int argc, char *argv[])
 
SLIST_INIT(&phead);
 
+   if (!strcmp(argv[0], "egrep"))
+   Eflag =1, flags |= REG_EXTENDED;
+   else if (!strcmp(argv[0], "fgrep"))
+   Fflag = 1;
+
ARGBEGIN {
case 'E':
Eflag = 1;
-- 
2.1.4




[hackers] [st][PATCH] I don't like yellow, it arouses me too much

2016-01-05 Thread Ivan Tham
Let's put there the default foreground color.
http://www.nickkolenda.com/wp-content/uploads/2015/10/color-arousal.png
Thanks to voidead for the idea.
---
 config.def.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index fd09d72..c11ed2f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -127,7 +127,7 @@ static unsigned int mousebg = 0;
  * will reverse too. Another logic would only make the simple feature too
  * complex.
  */
-static unsigned int defaultitalic = 11;
+static unsigned int defaultitalic = 7;
 static unsigned int defaultunderline = 7;
 
 /*
-- 
2.6.4




[hackers] [st][PATCH] yellow italics everywhere is for colorblind people

2016-01-05 Thread Ivan Tham
Thanks to voidead: god of destroying ""
---
 config.def.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index fd09d72..c11ed2f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -127,7 +127,7 @@ static unsigned int mousebg = 0;
  * will reverse too. Another logic would only make the simple feature too
  * complex.
  */
-static unsigned int defaultitalic = 11;
+static unsigned int defaultitalic = 7;
 static unsigned int defaultunderline = 7;
 
 /*
-- 
2.6.4




[hackers] [farbfeld] farbfeld.5: exit() -> return || FRIGN

2016-01-05 Thread git
commit b669c8642e21850ea561931633ae06e6ba5bf354
Author: FRIGN 
AuthorDate: Tue Jan 5 11:16:11 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 11:16:43 2016 +0100

farbfeld.5: exit() -> return

Now that we're in main, we don't need to exit().
Also, we should return 0 at the end, thanks Hiltjo!

diff --git a/farbfeld.5 b/farbfeld.5
index 2ed3354..62e327a 100644
--- a/farbfeld.5
+++ b/farbfeld.5
@@ -64,23 +64,23 @@ main(int argc, char *argv[])
 
if (argc > 1) {
fprintf(stderr, "usage: %s\\n", argv[0]);
-   exit(1);
+   return 1;
}
 
if (fread(hdr, 1, sizeof(hdr), stdin) != sizeof(hdr)) {
fprintf(stderr, "incomplete header\\n");
-   exit(1);
+   return 1;
}
if (memcmp("farbfeld", hdr, strlen("farbfeld"))) {
fprintf(stderr, "invalid magic\\n");
-   exit(1);
+   return 1;
}
width = ntohl(*((uint32_t *)(hdr + 8)));
height = ntohl(*((uint32_t *)(hdr + 12)));
 
if (fwrite(hdr, 1, sizeof(hdr), stdout) != sizeof(hdr)) {
fprintf(stderr, "write error\\n");
-   exit(1);
+   return 1;
}
 
for (i = 0; i < height; i++) {
@@ -88,7 +88,7 @@ main(int argc, char *argv[])
if (fread(rgba, sizeof(uint16_t), 4,
  stdin) != 4) {
fprintf(stderr, "unexpected EOF\\n");
-   exit(1);
+   return 1;
}
for (k = 0; k < 4; k++) {
rgba[k] = ntohs(rgba[k]);
@@ -105,10 +105,12 @@ main(int argc, char *argv[])
if (fwrite(rgba, sizeof(uint16_t), 4,
   stdout) != 4) {
fprintf(stderr, "write error\\n");
-   exit(1);
+   return 1;
}
}
}
+
+   return 0;
 }
 .Ed
 .Sh SEE ALSO



[hackers] [farbfeld] Update example in farbfeld.5 || FRIGN

2016-01-05 Thread git
commit b52f376a0f18db0dc8b2c8707cf3f41d32fd9a10
Author: FRIGN 
AuthorDate: Tue Jan 5 11:10:39 2016 +0100
Commit: FRIGN 
CommitDate: Tue Jan 5 11:10:39 2016 +0100

Update example in farbfeld.5

We were close to a full program anyway, so I just completed the code so
you can study and run it easily.

diff --git a/farbfeld.5 b/farbfeld.5
index 74bd02c..2ed3354 100644
--- a/farbfeld.5
+++ b/farbfeld.5
@@ -45,8 +45,8 @@ and inherent complexity involved in handling common image 
formats
 (PNG, JPEG, GIF,...), having to rely on bloated libraries not being able
 to focus on the task at hand for a given problem.
 .Sh EXAMPLES
-Below is an example for a color inverter. No external libraries other
-than libc are needed to read the image data:
+Below is an example for a color inverter usable in a pipeline. No external
+libraries other than libc are needed to handle the image data:
 .Bd -literal -offset left
 #include 
 
@@ -55,49 +55,58 @@ than libc are needed to read the image data:
 #include 
 #include 
 
-(...)
+int
+main(int argc, char *argv[])
+{
+   uint32_t width, height, i, j, k;
+   uint16_t rgba[4];
+   uint8_t hdr[strlen("farbfeld") + 2 * sizeof(uint32_t)];
 
-uint32_t width, height, i, j, k;
-uint16_t rgba[4];
-uint8_t hdr[strlen("farbfeld") + 2 * sizeof(uint32_t)];
+   if (argc > 1) {
+   fprintf(stderr, "usage: %s\\n", argv[0]);
+   exit(1);
+   }
 
-if (fread(hdr, 1, sizeof(hdr), infile) != sizeof(hdr)) {
-   fprintf(stderr, "incomplete header\\n");
-   exit(1);
-}
-if (memcmp("farbfeld", hdr, strlen("farbfeld"))) {
-   fprintf(stderr, "invalid magic\\n");
-   exit(1);
-}
-width = ntohl(*((uint32_t *)(hdr + 8)));
-height = ntohl(*((uint32_t *)(hdr + 12)));
+   if (fread(hdr, 1, sizeof(hdr), stdin) != sizeof(hdr)) {
+   fprintf(stderr, "incomplete header\\n");
+   exit(1);
+   }
+   if (memcmp("farbfeld", hdr, strlen("farbfeld"))) {
+   fprintf(stderr, "invalid magic\\n");
+   exit(1);
+   }
+   width = ntohl(*((uint32_t *)(hdr + 8)));
+   height = ntohl(*((uint32_t *)(hdr + 12)));
 
-if (fwrite(hdr, 1, sizeof(hdr), outfile) != sizeof(hdr)) {
-   fprintf(stderr, "write error\\n");
-   exit(1);
-}
+   if (fwrite(hdr, 1, sizeof(hdr), stdout) != sizeof(hdr)) {
+   fprintf(stderr, "write error\\n");
+   exit(1);
+   }
 
-for (i = 0; i < height; i++) {
-   for (j = 0; j < width; j++) {
-   if (fread(rgba, sizeof(uint16_t), 4, infile) != 4) {
-   fprintf(stderr, "unexpected EOF\\n");
-   exit(1);
-   }
-   for (k = 0; k < 4; k++) {
-   rgba[k] = ntohs(rgba[k]);
-   }
+   for (i = 0; i < height; i++) {
+   for (j = 0; j < width; j++) {
+   if (fread(rgba, sizeof(uint16_t), 4,
+ stdin) != 4) {
+   fprintf(stderr, "unexpected EOF\\n");
+   exit(1);
+   }
+   for (k = 0; k < 4; k++) {
+   rgba[k] = ntohs(rgba[k]);
+   }
 
-   /* invert colors */
-   rgba[0] = 65535 - rgba[0];
-   rgba[1] = 65535 - rgba[1];
-   rgba[2] = 65535 - rgba[2];
+   /* invert colors */
+   rgba[0] = 65535 - rgba[0];
+   rgba[1] = 65535 - rgba[1];
+   rgba[2] = 65535 - rgba[2];
 
-   for (k = 0; k < 4; k++) {
-   rgba[k] = htons(rgba[k]);
-   }
-   if (fwrite(rgba, sizeof(uint16_t), 4, outfile) != 4) {
-   fprintf(stderr, "write error\\n");
-   exit(1);
+   for (k = 0; k < 4; k++) {
+   rgba[k] = htons(rgba[k]);
+   }
+   if (fwrite(rgba, sizeof(uint16_t), 4,
+  stdout) != 4) {
+   fprintf(stderr, "write error\\n");
+   exit(1);
+   }
}
}
 }



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

2016-01-05 Thread Pickfire


On Tue, Jan 05, 2016 at 10:49:36AM +0100, Roberto E. Vargas Caballero wrote:

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'


Thanks a lot.

--
_
< Do what you like, like what you do. >
-
   \   ^__^
\  (oo)\___
   (__)\   )\/\
   ||w |
   || ||



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'




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

2016-01-05 Thread Dimitris Papastamos
On Tue, Jan 05, 2016 at 05:38:16PM +0800, Pickfire wrote:
> Hi, I use `git send-email`, it won't be mentioned by default.

See the git-send-email manpage.  There is a way to modify the
subject.



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

2016-01-05 Thread FRIGN
On Tue, 5 Jan 2016 17:44:12 +0800
Pickfire  wrote:

> I doesn't know there is an ml etiquette, I will add it to the wiki.
> It isn't mentioned.

Not everything is written in the wiki man, and it's not the first time
you sent in a patch.
You know how patch-mails are formatted, so that's how you can deduce a
ml-etiquette easily.

But feel free to send in a patch, so the newcomers know what it's about.

Cheers

FRIGN

-- 
FRIGN 



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

2016-01-05 Thread Pickfire

On Tue, Jan 05, 2016 at 10:42:52AM +0100, FRIGN wrote:

On Tue, 5 Jan 2016 17:38:16 +0800
Pickfire  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.


I don't care what you use. Just stay with the ml etiquette and
mention the project name in the title of your bloody mail.


I doesn't know there is an ml etiquette, I will add it to the wiki.
It isn't mentioned.

--
_
< Do what you like, like what you do. >
-
   \   ^__^
\  (oo)\___
   (__)\   )\/\
   ||w |
   || ||



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

2016-01-05 Thread FRIGN
On Tue, 5 Jan 2016 17:38:16 +0800
Pickfire  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.

I don't care what you use. Just stay with the ml etiquette and
mention the project name in the title of your bloody mail.

-- 
FRIGN 



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

2016-01-05 Thread Pickfire

Hi, I use `git send-email`, it won't be mentioned by default.

It is for st. As you can see in the patch.

--
_
< Do what you like, like what you do. >
-
   \   ^__^
\  (oo)\___
   (__)\   )\/\
   ||w |
   || ||



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

2016-01-05 Thread Dimitris Papastamos
You didn't mention what project this should apply to.