<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-openbsd/bin/cat, branch master</title>
<subtitle>WireGuard implementation for the OpenBSD kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-openbsd/atom/bin/cat?h=master</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-openbsd/atom/bin/cat?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/'/>
<updated>2020-12-11T05:48:22Z</updated>
<entry>
<title>cat(1): -n flag: correctly enumerate files with more than INT_MAX lines</title>
<updated>2020-12-11T05:48:22Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2020-12-11T05:48:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=8d576c92c5d93d1e61ef1d918cae5fa9a9421c10'/>
<id>urn:sha1:8d576c92c5d93d1e61ef1d918cae5fa9a9421c10</id>
<content type='text'>
If we bump 'lines' from an int to an unsigned long long we can
trivially support files with more than INT_MAX lines.

ok millert@
</content>
</entry>
<entry>
<title>cat(1): misc. style(9)</title>
<updated>2020-12-04T02:25:56Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2020-12-04T02:25:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=2112a9335ac99e5fab9cf094ba46d5b0af68fa4c'/>
<id>urn:sha1:2112a9335ac99e5fab9cf094ba46d5b0af68fa4c</id>
<content type='text'>
- Use getprogname(3) instead of __progname.
- Sprinkle in some missing braces.
- Prefer err(..., NULL) when malloc(3) fails.
- Remove an unnecessary cast to from ssize_t to size_t.
</content>
</entry>
<entry>
<title>cat(1): simplify argv processing loops</title>
<updated>2020-12-04T01:42:05Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2020-12-04T01:42:05Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=2d7eb85656337cac88f09f1628b941f37e8f7b4a'/>
<id>urn:sha1:2d7eb85656337cac88f09f1628b941f37e8f7b4a</id>
<content type='text'>
cook_args() and raw_args() do some peculiar things in order to avoid
calling cook_buf() and raw_cat(), respectively, in more than one
place.  The result is a convoluted.  If we isolate the special cases
from the normal case and just call these functions in multiple places
the loops will be easier to read.

Three things:

1. Pull the no-args case out of the loop.  If *argv is NULL when we
   get into the argv processing function we just want to operate on
   the standard input and return early.  It makes no sense to handle
   this case *in* the loop.

2. Isolate the "-" case from the filename case.  If *argv is "-" we want
   to operate on the standard input.  We can then do any stdin-specific
   cleanup within the same branch, which makes it easier to understand
   both the "-" case and the normal filename case.  This also allows us
   to remove the 'filename' intermediate variable from both argv processing
   functions.

3. While we're here, use a for-loop and iterate argv in the loop header.
   Now argv is incremented in one place.

ok martijn@
</content>
</entry>
<entry>
<title>cat(1): remove global 'filename' variable</title>
<updated>2020-12-03T22:37:12Z</updated>
<author>
<name>cheloha</name>
<email>cheloha@openbsd.org</email>
</author>
<published>2020-12-03T22:37:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=2724571b5981d3ed7e944ac1b3ebcd0530089ac7'/>
<id>urn:sha1:2724571b5981d3ed7e944ac1b3ebcd0530089ac7</id>
<content type='text'>
There is no need for the global filename variable.  Both cook_buf()
and raw_cat() can accept a filename variable from the caller to use
for printing warnings.

ok martijn@
</content>
</entry>
<entry>
<title>When system calls indicate an error they return -1, not some arbitrary</title>
<updated>2019-06-28T13:34:58Z</updated>
<author>
<name>deraadt</name>
<email>deraadt@openbsd.org</email>
</author>
<published>2019-06-28T13:34:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=3aaa63eb46949490a39db9c6d82aacc8ee5d8551'/>
<id>urn:sha1:3aaa63eb46949490a39db9c6d82aacc8ee5d8551</id>
<content type='text'>
value &lt; 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
</content>
</entry>
<entry>
<title>More whitespace, helps reading</title>
<updated>2017-02-19T00:46:57Z</updated>
<author>
<name>jca</name>
<email>jca@openbsd.org</email>
</author>
<published>2017-02-19T00:46:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=d2d156320132dfc938ad5ddcc6e5ab8d2c1679ad'/>
<id>urn:sha1:d2d156320132dfc938ad5ddcc6e5ab8d2c1679ad</id>
<content type='text'>
ok ajacoutot@
</content>
</entry>
<entry>
<title>Delete useless setlocale(3) in src/bin/.</title>
<updated>2016-10-19T18:20:25Z</updated>
<author>
<name>schwarze</name>
<email>schwarze@openbsd.org</email>
</author>
<published>2016-10-19T18:20:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=8351f622847848213a64cbaeb04b6f3bf1b79ae5'/>
<id>urn:sha1:8351f622847848213a64cbaeb04b6f3bf1b79ae5</id>
<content type='text'>
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary &lt;hans at stare dot cz&gt;.
Feedback and OK tb@, OK millert@.
</content>
</entry>
<entry>
<title>attempt to improve clarity by reducing forward references and more</title>
<updated>2016-07-10T00:15:39Z</updated>
<author>
<name>tedu</name>
<email>tedu@openbsd.org</email>
</author>
<published>2016-07-10T00:15:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=ddfba94c91b7e28489d9eedf50e213622828033d'/>
<id>urn:sha1:ddfba94c91b7e28489d9eedf50e213622828033d</id>
<content type='text'>
directly documenting each option's effect.
</content>
</entry>
<entry>
<title>For -be, indent the $ on blank lines.</title>
<updated>2016-07-01T22:40:44Z</updated>
<author>
<name>schwarze</name>
<email>schwarze@openbsd.org</email>
</author>
<published>2016-07-01T22:40:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=55e223d9636347827cb9454b49f1833faec09861'/>
<id>urn:sha1:55e223d9636347827cb9454b49f1833faec09861</id>
<content type='text'>
Patch from Giles Lean (NetBSD PR bin/4841), tweaked by kleink at
NetBSD (rev. 1.17 1998-01-27), version for OpenBSD sent in by Sevan
Janiyan &lt;venture37 at geeklan dot co dot uk&gt;.
OK deraadt@
</content>
</entry>
<entry>
<title>replace setbuf with setvbuf, from Frederic Nowak</title>
<updated>2015-11-04T21:28:01Z</updated>
<author>
<name>tedu</name>
<email>tedu@openbsd.org</email>
</author>
<published>2015-11-04T21:28:01Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-openbsd/commit/?id=6a6a5705673115d2aa7d0fdcc3d47a27a1b562b2'/>
<id>urn:sha1:6a6a5705673115d2aa7d0fdcc3d47a27a1b562b2</id>
<content type='text'>
</content>
</entry>
</feed>
