summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* arg.h: Fortify ARGC()Laslo Hunhold2017-08-04
| | | | You never know...
* arg.h: Refactor ARGF_()Laslo Hunhold2017-08-04
|
* arg.h: Do not modify the array elements of argv[]Laslo Hunhold2017-08-04
| | | | | | | | | | | The C99 standard explicitly allows to modify argc, argv, but leaves it open what happens if you modify the content of argv. Under OpenBSD, this actually has an effect on how the program is listed (e.g. in ps). To prevent this, we just add a counter variable and use that for iteration. While at it, this commit also includes a few style changes. Thanks Hiltjo for reporting this!
* arg.h: Rename argparsed to argusedLaslo Hunhold2017-08-04
| | | | We do not really parse anything, we just use/devour something.
* Remove dangling newlines in LICENSELaslo Hunhold2017-08-02
|
* Combine all license matters in LICENSELaslo Hunhold2017-08-02
| | | | | | | | | | We use some OpenBSD code in util.c (namely by Ted Unangst, Todd C. Miller and Otto Moerbeek), which is licensed under the ISC license. To make it clearer and make it easier to see what farbfeld really is licensed under, we include these authors in the LICENSE file and remove the explicit headers from util.c. While at it, we also remove superfluous includes and shove them to the top.
* FORMAT: make it a proper table with Unicode-boundary-glyphsLaslo Hunhold2017-08-02
|
* config.mk: small style changeLaslo Hunhold2017-08-02
|
* arg.h: Handle { NULL } argv[] properlyLaslo Hunhold2017-08-02
| | | | | | | | Previously, we would return argc as -1, which could cause some problems. This was not an issue introduced in the rewrite and is a bug present in the "old" arg.h as well. Thanks Isabella Parakiss for reporting this!
* Minor style change in arg.hLaslo Hunhold2017-08-02
| | | | | We decrement argc first before incrementing argv, so we never have a state where we potentially point to uncharted territory.
* Rewrite arg.hLaslo Hunhold2017-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was something I wanted to do for quite a while now. The problem with the old arg.h is that it does not allow you to call ARGF() and EARGF() multiple times without messing the argument up. This is an unnecessary limitation and can lead to unexpected results for people not aware of this problem. ARGBEGIN { case 'a': printf("1st call: %s\n", ARGF()); printf("2nd call: %s\n", ARGF()); break; default: break; } $ prog -a ARG 1st call: ARG 2nd call: RG This is fixed now to properly print $ prog -a ARG 1st call: ARG 2nd call: ARG The old version also used more local variables than necessary, as the problem can be reduced to one single local variable within the second loop, which expresses if the argument has been consumed or not. The use of abort() within EARGF() was a bit drastic. exit(1) should suffice here and align with what you expect from an e*-type function. Additionally, the formatting I used should make readability easier and the code deduplication in the *ARGF()-macros helps with maintainability. The license used is ISC, which is compatible with MIT/X, GPL and so forth in case you want to use it in your project. I explicitly added the license header to the file making it easy to just drop it in. There are no plans to support the obsolete ARGNUM, ARGNUMF, LNGARG syntaxes.
* Makefile - expand targets for portabilityLaslo Hunhold2017-05-30
| | | | | | Reading the standard thoroughly revealed that the only way to really get a portable Makefile is to list each target explicitly, so that's what we'll do now here.
* Makefile-workaround for OpenBSDLaslo Hunhold2017-05-29
| | | | | | | | | | | | | Thanks Hiltjo for reporting this! For some reason, OpenBSD make does not add $(BIN).o to the dependency list when it sees the $(BIN) target rule. It does so however when it does the conversion from .c to .o. This behaviour is unique for OpenBSD make as far as I've seen, and for the time being, this workaround will manually add the object to the dependency list. This is not POSIX compliant and in GNU make it just evaluates to an empty string, but it works until this has been investigated further.
* Rename TOOL-LDFLAGS to TOOL-LDLIBS, fix order and add explicit .c.oLaslo Hunhold2017-05-01
| | | | | | | | | | | The tool-specific flags were LDLIBS and not LDFLAGS, because we specify the libraries we want to link in, not flags to the linker itself. The order was broken as it didn't allow -Wl,--as-needed or other things highly dependent on the order of arguments. I also wanted to add an explicit .c.o suffix rule. This way, it is clearer what is happening in the Makefile and the form of compilation output is controllable.
* Add Alexander and Mattias to LICENSELaslo Hunhold2017-04-16
|
* Bring cc-command-line in orderLaslo Hunhold2017-04-16
| | | | | | | | | Of course, you want the libraries to come last in order of execution. Additionally, in case the libraries provided with $($*-LDFLAGS) contain unresolved symbols, we want to give the opportunity for the user to provide the necessary general symbols, whatever they may be, last. Thanks Duncaen for reporting this!
* Bump version to 3Laslo Hunhold2017-04-14
| | | | | | | | | | | | | | This is more or less a refactoring release, but with deep changes in the tools that I was hoping to look into for a long time. The codebase is in a very consistent state now, also thanks to the introduction of a set of common utility-functions. What really makes me think is the fact that it takes so many iterations and a high level of detail to get the library handling and I/O right. It just makes you wonder how much software is out there that is full of little subtle bugs that might blow up in your face some day. Thanks for all the feedback!
* Improve the wording on alpha-blendingLaslo Hunhold2017-04-14
|
* Remove the need of '#' for alpha masksLaslo Hunhold2017-04-14
| | | | | | To be honest, it can happen too easily that the user forgets to put the colour in quotation marks, yielding in the rest of the pipeline to be discarded as a comment.
* Improve readability of alpha-blending sectionsLaslo Hunhold2017-04-14
|
* Move the logo a bit to the left so it is centeredLaslo Hunhold2017-04-14
|
* Fix the R in the logoLaslo Hunhold2017-04-14
|
* Update usage of ff2jpg(1) and ff2ppm(1)Laslo Hunhold2017-04-14
| | | | so they align with the manpages.
* Refactor invert.c in farbfeld.5Laslo Hunhold2017-04-14
| | | | | | | | | | | | | I noticed that it would be beneficial to release the invert.c code listing under a very permissive license. I like the style of the "Copy me if you can"-License, but thought that 0BSD would make it even clearer that everyone can do whatever he wants with this code. The code itself was not bad beforehand, but lacked some elementary features like checked flushing at the end and proper error messages. I also reworked the data structures a bit to make it more appealing and clearer where the "guts" of the code are (i.e. in invert()).
* Update the Makefile to reflect TODO has been removedLaslo Hunhold2017-04-14
|
* Update and refactor the manpagesLaslo Hunhold2017-04-14
| | | | | | Make them more consistent, and only maintain a list of the conversion tools in farbfeld.5. Refine the wording on the jpg-manpages.
* Update the READMELaslo Hunhold2017-04-14
| | | | | Rework the introductory paragraph and show examples directly afterwards. If people are interested in the tl;dr-sections, they can then read on.
* Don't suppress imagemagick and png2ff(1) warningsLaslo Hunhold2017-04-14
| | | | | | Else the user might be left wondering what happened. The output from imagemagick might not be the nicest in the world, but it's bearable for some given edge-cases.
* Make comment in ff2jpg(1) more consistentLaslo Hunhold2017-04-14
|
* Refactor 2ff(1)Laslo Hunhold2017-04-14
| | | | | | | | | | | | | | | | | | The Unix philosophy teaches us that tools should strive to output only necessary diagnostic information and also reflect errors properly with the return value. There were three subtle problems with 2ff: 1) If the farbfeld-passthrough failed, it would return 1 instead of 1. 2) If the first 8 bytes contained a NUL byte, bash would print an ugly warning message. Passing it through tr -d '\0' fixes that. 3) Lack of comments. I added some to make the structure even clearer, also including using an if-else-structure. I removed the 2ff error message; the tools themselves print proper messages already.
* Staticize functions in png2ff(1)Laslo Hunhold2017-04-14
|
* Remove TODOLaslo Hunhold2017-04-14
| | | | It's not very useful for the reader any more.
* Add PNG-LDFLAGS and JPG-LDFLAGS in config.mkLaslo Hunhold2017-04-14
| | | | instead of per-tool-settings.
* Use fshut() to properly flush the output streamLaslo Hunhold2017-04-13
| | | | | | | | For small images, it could happen that the output stream would not be flushed before exit(), resulting in a lack of error-reporting on a full device. Using fflush(), a function I first introduced in sbase, we do the flushing before returning manually and report errors if they occurred.
* Update LICENSELaslo Hunhold2017-04-12
|
* Update TODOLaslo Hunhold2017-04-12
| | | | | | | | | | The truncation issue is solved now by checking the return values. Maybe for small images where the FILE-buffer is not flushed early enough we can rethink that. The utility functions were written to the extent it was desired. I added a note not to forget to take a look at the part in the jpg-code which does the color mixing.
* Refactor ff2ppm(1)Laslo Hunhold2017-04-12
| | | | | We make use of the utility functions for parsing the color mask and other things and generally align the code with the general coding style.
* Refactor png-conversion-utilitiesLaslo Hunhold2017-04-12
| | | | | | | We split out the libpng-setup into a separate function, it is very very ugly. The code also received a general cleanup and aligns itself much better with the general coding style and structure.
* Refactor ff2pam(1)Laslo Hunhold2017-04-12
| | | | | I chose to go with a row-based-approach here, which is a bit easier to read and is somewhat "closer" to the input data.
* Refactor jpg-conversion-utilitiesLaslo Hunhold2017-04-12
| | | | | | | | | | | | First of all, there was lots of libjpeg-specific cruft that just didn't have any right to exist (METHODDEF(), strange typedefs, use of the internal memory pool for no reason). This is gone now. Additionally, we make use of the save and proven utility functions and in general the code should be more well-separated now. What is left to do is clear up the part where we mix the colors with the mask.
* Also print extra warningsLaslo Hunhold2017-04-12
|
* Rename header-functions and add more util functionsLaslo Hunhold2017-04-12
| | | | | | | | parse_mask() -> parse a mask-color #xxxxxx ereallocarray() estrtonum() These will come in handy in the respective tools.
* config.mk: C89 -> C99Laslo Hunhold2017-04-02
| | | | | We are using stdint.h, which is a C99 feature. Syntactically, the code is C89 though.
* Remove prerequisite from single-suffix inference ruleLaslo Hunhold2017-04-02
| | | | | | | | | | | | | | This is against the standard: "The application shall ensure that the makefile does not specify prerequisites for inference rules;"[0] We are still fine though as we explicitly state the dependency on the requisite-objects in the $(BIN)-target. Thanks Lucas for pointing this out! [0]:http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
* Add util.{c|h} to deduplicate codeLaslo Hunhold2017-03-30
|
* Mark explicit dependency on requisites for BINLaslo Hunhold2017-03-30
|
* Pass LDFLAGS instead of CFLAGS in the linking stageLaslo Hunhold2017-03-30
|
* No need to keep the implicit build ruleLaslo Hunhold2017-03-30
|
* Make Makefile strictly POSIX compliantLaslo Hunhold2017-03-30
| | | | | | | | | | | | | | | Thanks Hiltjo for the feedback! GNUisms need to be avoided like a plague, even if it means having to be a little more creative. Strict POSIX compliance means that I just worked within the bounds of the POSIX specification, hopefully without using any GNU or BSD extensions. If I did, please let me know. Tip to all Linux users: Test your Makefiles with pmake(1) instead of make(1) (= GNU make) and refer to the newest POSIX 2016 make specification[0]. [0]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
* Rename PREREQ to REQLaslo Hunhold2017-03-29
|