| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
If the length of a line is longer than the width of the display we want
to center on, `width - len` becomes negative which causes an infinite
loop of printing spaces. This fixes that bug.
|
|
|
|
|
| |
cas — Today at 07:18
Use <casper.casan@gmail.com>
|
|
|
|
| |
Casper completed that TODO in commit 7aed855.
|
|
|
|
|
|
|
| |
My older commits on this repo were under the email <thomasvoss@live.com>
instead of my newer <mail@thomasvoss.com>. Casper also has commits as
both <casper@casan.se> and <casper.casan@gmail.com> with the names
Casper and Casper Andersson, so this should fix those issues.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
With Hacktoberfest coming up, a TODO will allow potential new people to
find issues to work on. GitHub issues could be used, but the main repo
is not on GitHub so no thanks.
|
| |
|
|
|
|
|
|
| |
The example is supposed to center the input as if the output device is a
terminal with a width of 80 characters. The example doesn't use the `-w'
flag though, so we set that up.
|
|
|
|
|
|
|
|
| |
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.
|
|
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
|