aboutsummaryrefslogtreecommitdiff
path: root/center.c
Commit message (Collapse)AuthorAgeFilesLines
* Add centering by longest line (#3)Casper Andersson 2022-10-041-3/+73
| | | | | | | | | | Centering by longest line requires inputting all lines before starting output, to determine which is longest. Use a tail queue for this to insert at end and then iterate from start. The lines are freed after being output. Unlike the static read buffer, we can't reuse the list buffers in an easy way if we are iterating over multiple input files. So they need to be freed to avoid memory leaks.
* Remove unused flags from call to getopt()Thomas Voss 2022-10-031-1/+1
|
* Make buffer and size static to avoid memory leakCasper Andersson 2022-10-011-2/+2
| | | | | | | getline() allocates/reallocates memory dynamically. When center() is called repeatedly it would leak memory. Make them static so the same memory is reallocated all the time, and none is lost. No need to free manually, let the OS take care of that.
* Fix centering with ANSI escapesThomas Voss 2022-09-231-1/+1
| | | | | | This was broken with the logic change in #68f7fb9 I think. At the very least it’s that commit after which I noticed this bug. Doesn’t matter though, it’s fixed now.
* Fix text centering of multibyte charactersThomas Voss 2022-09-231-2/+7
|
* Add license textThomas Voss 2022-09-201-0/+17
|
* Fix usage stringThomas Voss 2022-08-091-1/+1
|
* Don't exit when fopen(3) returns NULLThomas Voss 2022-02-081-4/+7
| | | | | | | | On failure to open a file the program should print a diagnostic message to the standard error and move on to the next file as opposed to exiting immediately. This allows for consistent behavior compared to other common implementations of utilities such as cat(1) which reduces potential confusion for the user.
* Initial commitThomas Voss 2022-02-081-0/+163
This initial commit includes the following: - A gitignore file - A license (0-Clause BSD) - A Makefile supporting installation - A manual page written in mdoc(7) - A fully working initial implementation