History log of /openbsd-current/usr.bin/rcs/rcs.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.89 28-Nov-2021 deraadt

Stop using MAXBSIZE to eliminate sys/param.h including (which injects a
ton of namespace intrusion). Create local sizes, and refactor some code
along the way.
ok millert


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.88 09-Jan-2019 joris

When expanding $Log$ make sure a newline is added if rd_log has none.
This can happen on new RCS files.

Fixes $Log$ keyword expansion.


# 1.87 09-Jan-2019 joris

Make sure rcs_lock_add() and rcs_lock_remove() properly update the
rd_lock member of the matching delta.

Other keyword substitution will not properly work in cases where the
RCS file did not have a lock for the revision yet or if the lock is
being removed.


# 1.86 30-Dec-2018 guenther

Delete unnecessary <libgen.h> #includes

ok deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.85 09-May-2016 schwarze

Implement Mdocdate keyword substitution.
In particular, this stops rcsdiff(1) and CVSweb from showing
wrong Mdocdate lines in diffs.
Problem originally reported by tj@.
OK tobias@ otto@ millert@


Revision tags: OPENBSD_5_9_BASE
# 1.84 02-Nov-2015 nicm

Allow rcsnum_free and buf_free to accept NULL and remove various NULL
checks that are now unnecessary, from Michael W Bombardieri. ok millert


Revision tags: OPENBSD_5_8_BASE
# 1.83 13-Jun-2015 nicm

Convert xfree to free. From Fritjof Bornebusch. ok deraadt


Revision tags: OPENBSD_5_7_BASE
# 1.82 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.81 10-Oct-2014 otto

Zap some stored values never read; From Fritjof Bornebusch; ok nicm@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.80 07-Jan-2014 deraadt

ctype cleanups; ok okan


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.79 03-Mar-2012 nicm

Remove unused variable, from Michael W Bombardieri who also got an ok
from tobias@.


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.78 14-Jul-2011 sobrado

spacing, no binary change.


# 1.77 06-Jul-2011 nicm

Replace the keyword expansion code with a faster, more readable version
which additionally also supports $Log$ and $Locker. Written by Joerg
Sonnenberger and tweaked by me.

ok ray


# 1.76 20-May-2011 nicm

Remove a bunch of unused functions, from Michael W Bombardieri.

ok ray


# 1.75 20-Apr-2011 nicm

Remove some unneeded includes and dead code, from Michael W Bombardieri.

ok jasper xsa


# 1.74 04-Apr-2011 djm

previous commit introduced a crash: the removed strtol was being used to
skip past a value and it couldn't just be nuked


# 1.73 27-Mar-2011 jasper

- remove unused variables

from Michael W. Bombardieri
ok chl@ nicm@


Revision tags: OPENBSD_4_9_BASE
# 1.72 10-Dec-2010 jasper

- plug an fd leak

help/ok chl@ nicm@


# 1.71 27-Oct-2010 tobias

Merge -k and expand @@ parsing code between OpenCVS and OpenRCS, resulting
in a performance gain in OpenCVS in some "cvs update" scenarios.

ok zinovik


# 1.70 20-Oct-2010 tobias

Merge OpenCVS' rcs_deltatext_set into OpenRCS, fixing a memory leak.

ok nicm zinovik


# 1.69 20-Oct-2010 tobias

Remove the need for rp_file in parser structure, instead keep only one
FILE pointer in RCSFILE. This fixes some ugliness in closing an
fdopen()ed FILE and its underlying file descriptor.

Notified by Joerg Sonnenberger <joerg at britannica dot bec to de>

discussed with and ok nicm


# 1.68 15-Oct-2010 tobias

Replaced RCS parser code with new rcsparse.{c,h}:
- be very strict about things we parse
- print more information about errors if they occur
- do not fatal() directly in parser, give caller a chance to react
- fix an rcs design issue when it comes to login names

tested by many on tech@

ok xsa


# 1.67 05-Oct-2010 tobias

Zapped unused function rcs_tag_resolve.

ok xsa


# 1.66 05-Oct-2010 tobias

rcs_state_check must check for more invalid characters than just space.

ok nicm


# 1.65 29-Sep-2010 tobias

Ensure that we always parse all deltas before expecting "desc" keyword.

ok nicm, zinovik


# 1.64 23-Sep-2010 nicm

Plug memory leak in rcs_getrev, from zinovik.

ok me stsp


# 1.63 11-Sep-2010 tobias

Fixed typo.

ok ray, zinovik


# 1.62 02-Sep-2010 tobias

rcsnum_parse() allocates already an RCSNUM struct, so it's not needed to
copy it into a newly allocated one (which is even a memory leak).

ok zinovik


# 1.61 31-Aug-2010 tobias

style


Revision tags: OPENBSD_4_8_BASE
# 1.60 28-Jul-2010 ray

Make BUFs autoextend by default. This was already done in OpenCVS
a while ago.

OK zinovik nicm


# 1.59 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


# 1.58 23-Jul-2010 ray

Rename a bunch of variables and functions, removing the cvs_/rcs_
prefixes to reduce differences between cvs and rcs files.

"yes!" nicm


# 1.57 21-Jul-2010 ray

Only use username if author is NULL. Fixes "ci -wusername" when run
as root.

OK nicm


# 1.56 13-Jul-2010 nicm

Don't read before the beginning of the log message if it is zero-length
(possible when it comes from stdin).

Tweaked version of a fix from Peter Hendrickson in PR 6423.

ok deraadt


# 1.55 09-Jul-2010 naddy

Make cvs and rcs consistent in what characters they'll accept in
symbol/tag names: require the first character to be a letter and
allow any printable character (except the RCS specials $,.:;@)
afterwards. This matches GNU cvs.

ok xsa@ zinovik@ stsp@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.54 14-Apr-2009 jj

tried to fix a the-the in the comment, ended up rewriting it. with/from joris@


Revision tags: OPENBSD_4_5_BASE
# 1.53 25-Feb-2009 ray

Checking if a file is ASCII should only be done when diffing, because
the non-ASCII characters could be printed to the screen. For
checking in files, checking out files, merging files, and removing
revisions of files, we do so regardless of whether the files are
ASCII or binary.

Fixes PR6031.

OK joris and deraadt.


# 1.52 15-Feb-2009 joris

add our temporary RCS file to our temp_files worklist in case
for some reason we get interrupted before calling rename().

we hate leaving behind temporary files.


# 1.51 09-Nov-2008 tobias

Removed unneeded conversion from RCSNUM to string in rcs_rev_setlog.

oki joris@


# 1.50 08-Nov-2008 tobias

Support for retrieving revisions from branches in branches was missing.

Reported by chl@, ok joris@


# 1.49 09-Oct-2008 deraadt

cvs(1) uses a config file to know about the $OpenBSD$ expansion keyword,
but unfortunately rcs is not so lucky, and it will have to encoded inside.
A bit gross, but what can we do? PR 5953, ok tobias


# 1.48 17-Sep-2008 reyk

try getlogin() to get the real username when comitting files as root.
this gives better information in log messages when the user logged in
with a different uid and used sudo or su to become root. matches the
behaviour of gcvs except that we don't fallback to LOGNAME or USER
since getlogin() should not lie.

ok tobias@


Revision tags: OPENBSD_4_4_BASE
# 1.47 11-May-2008 tobias

Memory leak in rcs_delta_stats plugged.

ok joris


Revision tags: OPENBSD_4_3_BASE
# 1.46 02-Feb-2008 xsa

From src/usr.bin/cvs:

> add changed lines support to log and rlog (the + and - stuff)
> from Pierre Riteau;


# 1.45 31-Jan-2008 tobias

Revert last patch and add this magic branch number only during
output, this way we don't have to hassle in our internal brach handling.

OK joris@


# 1.44 06-Jan-2008 tobias

Branches are separated with \n\t in GNU rcs/cvs.
This makes regress tests easier to check with OpenCVS and GNU cvs.

OK xsa@


# 1.43 06-Jan-2008 sturm

gnu cvs added a new keyword 'commitid', this diff adds just enough code
to parse the commitid so that cvsweb (using rcs) continues to work on
those files

ok niallo@, xsa@


# 1.42 27-Aug-2007 xsa

typo in error msg; from Igor Zinovik.


Revision tags: OPENBSD_4_2_BASE
# 1.41 03-Jul-2007 ray

Rename rcs_diffreg() to diffreg().

OK joris@


# 1.40 30-Jun-2007 xsa

Sync revisions and time buffers size to be consistent with each others.
Simplifies further size tweaks if needed.
OK ray@.


# 1.39 13-Jun-2007 niallo

value of 'author' in an rcs file is effectively a system username.
therefore, we should allow it to contain the same characters as a username.

pointed out by jcs@
ok ray@ xsa@


# 1.38 29-May-2007 ray

Since xrealloc dies on failure it is safe to directly assign to the
original pointer. Theo agrees, and so does the rest of the tree
(ssh, etc. all do this already).

Saves a bunch of variables and assignments.

OK niallo@


# 1.37 17-May-2007 ray

Don't free unused variable, from tbert.

OK niallo && xsa


Revision tags: OPENBSD_4_1_BASE
# 1.36 27-Feb-2007 xsa

As done in OpenCVS, general includes cleanup sweep. OK otto@.


# 1.35 02-Jan-2007 niallo

- fix support for checking out binary files.

testing from xsa@ and Igor Sobrado <igor at string1.ciencias.uniovi.es>
ok xsa@


# 1.34 21-Dec-2006 niallo

- plug memleak in rcs_parse_delta()

same as opencvs diff, ok xsa@


# 1.33 21-Sep-2006 millert

Add support to rcsdiff for all the other diff flags that
are pertinent to files (not directories) and that do not
conflict with rcsdiff-specific flags. OK xsa@


Revision tags: OPENBSD_4_0_BASE
# 1.32 23-Aug-2006 millert

Add missing checks for EOF when parsing rcs file sections.
OK xsa@ joris@ niallo@


# 1.31 07-Aug-2006 ray

More strlcpy/strlcat -> snprintf/xasprintf cleanup.

OK joris@


# 1.30 04-Aug-2006 ray

Remove unnecessary strlcpy/strlcat.

``Oh man!'' xsa@


# 1.29 28-Jul-2006 ray

Recalculate buffer length after each expansion.

OK niallo@


# 1.28 27-Jul-2006 ray

Second try at adding binary file support to rcs_expand_keywords(),
using BUFs instead of C strings. Also remove initial keyword search,
which is a premature optimization, slower, and apparently too hard for
me to get right.

OK niallo@


# 1.27 27-Jul-2006 deraadt

unused variable


# 1.26 27-Jul-2006 deraadt

spacing


# 1.25 21-Jul-2006 ray

Revert; keywords did not expand.


# 1.24 21-Jul-2006 ray

Add binary file support to rcs_expand_keywords(), using BUFs instead
of C strings.

OK niallo@


# 1.23 11-Jul-2006 markus

fix out of bound read in rcs_expand_keywords(); ok niallo


# 1.22 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.21 08-Jul-2006 niallo

- plug an old memory leak in patching code.

ok joris@


# 1.20 11-Jun-2006 niallo

- clean up rcs_expand_keywords() a little more.


# 1.19 11-Jun-2006 niallo

- zap unused variable


# 1.18 09-Jun-2006 niallo

- fix rcs_expand_keywords().

reported by Andreas Kahari <andreas.kahari at gmail>, input from joris@


# 1.17 04-Jun-2006 niallo

- explicitly set some pointers to NULL since they are tested on error.


# 1.16 04-Jun-2006 niallo

- we can just use the 'sizdiff' variable instead of calling strlen(expbuf);
simplifies things a little.


# 1.15 04-Jun-2006 niallo

- ensure fin pointer is not invalidated after realloc


# 1.14 04-Jun-2006 niallo

- don't forget to free data in rcs_expand_keywords()


# 1.13 04-Jun-2006 niallo

- fix off-by-one in rcs_expand_keywords()


# 1.12 03-Jun-2006 niallo

- correctly handle binary files; say bye bye to using c strings for deltatexts.

"slap it in" joris@


# 1.11 28-May-2006 ray

Don't fill in the rd_locker if we are creating a new RCS file.

OK joris@


# 1.10 27-May-2006 ray

Rename RCSFILE.fd to RCSFILE.rf_fd, plus minor spacing nits. No
binary change.

OK xsa@


# 1.9 11-May-2006 xsa

first round of rcs_write() cleanup; prodded by joris@; input/OK ray@.


# 1.8 08-May-2006 xsa

check for rcs_diffreg() return value; OK ray@.


# 1.7 04-May-2006 xsa

finish work wrt TMPDIR; use xasprintf() to simplify code while in there;
"looks fine" ray@.


# 1.6 01-May-2006 niallo

- fix a case in rcs_getrev() handling of branches where variant was not being
increased and thus no progress could be made in the loop.

bug noticed in rcsdiff(1) by sturm@

ok joris@


# 1.5 29-Apr-2006 ray

Check return values for all strlcpy, and strlcat calls.

OK xsa@ and probably others.


# 1.4 27-Apr-2006 xsa

zap util.[ch] and move the content into rcsutil.[ch].
discussed with joris@.


# 1.3 26-Apr-2006 joris

prevent file races by obtaining an fd for the RCS file and
do our operations on that, this is safe and guarantees we
can operate on the file until we close(2) it.

a fix is coming for the remaining races in our diff code.
okay niallo@ and ray@


# 1.2 26-Apr-2006 xsa

err() cleanup;


# 1.1 26-Apr-2006 joris

fork our code we shared between openrcs/cvs into the openrcs dir.

this was starting to become inhuman to maintain without
ugly ugly hacks in the shared code, and it will be easier
to make specific changes for openrcs without touching the
soon-to-be-replaced opencvs code.


# 1.88 09-Jan-2019 joris

When expanding $Log$ make sure a newline is added if rd_log has none.
This can happen on new RCS files.

Fixes $Log$ keyword expansion.


# 1.87 09-Jan-2019 joris

Make sure rcs_lock_add() and rcs_lock_remove() properly update the
rd_lock member of the matching delta.

Other keyword substitution will not properly work in cases where the
RCS file did not have a lock for the revision yet or if the lock is
being removed.


# 1.86 30-Dec-2018 guenther

Delete unnecessary <libgen.h> #includes

ok deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.85 09-May-2016 schwarze

Implement Mdocdate keyword substitution.
In particular, this stops rcsdiff(1) and CVSweb from showing
wrong Mdocdate lines in diffs.
Problem originally reported by tj@.
OK tobias@ otto@ millert@


Revision tags: OPENBSD_5_9_BASE
# 1.84 02-Nov-2015 nicm

Allow rcsnum_free and buf_free to accept NULL and remove various NULL
checks that are now unnecessary, from Michael W Bombardieri. ok millert


Revision tags: OPENBSD_5_8_BASE
# 1.83 13-Jun-2015 nicm

Convert xfree to free. From Fritjof Bornebusch. ok deraadt


Revision tags: OPENBSD_5_7_BASE
# 1.82 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.81 10-Oct-2014 otto

Zap some stored values never read; From Fritjof Bornebusch; ok nicm@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.80 07-Jan-2014 deraadt

ctype cleanups; ok okan


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.79 03-Mar-2012 nicm

Remove unused variable, from Michael W Bombardieri who also got an ok
from tobias@.


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.78 14-Jul-2011 sobrado

spacing, no binary change.


# 1.77 06-Jul-2011 nicm

Replace the keyword expansion code with a faster, more readable version
which additionally also supports $Log$ and $Locker. Written by Joerg
Sonnenberger and tweaked by me.

ok ray


# 1.76 20-May-2011 nicm

Remove a bunch of unused functions, from Michael W Bombardieri.

ok ray


# 1.75 20-Apr-2011 nicm

Remove some unneeded includes and dead code, from Michael W Bombardieri.

ok jasper xsa


# 1.74 04-Apr-2011 djm

previous commit introduced a crash: the removed strtol was being used to
skip past a value and it couldn't just be nuked


# 1.73 27-Mar-2011 jasper

- remove unused variables

from Michael W. Bombardieri
ok chl@ nicm@


Revision tags: OPENBSD_4_9_BASE
# 1.72 10-Dec-2010 jasper

- plug an fd leak

help/ok chl@ nicm@


# 1.71 27-Oct-2010 tobias

Merge -k and expand @@ parsing code between OpenCVS and OpenRCS, resulting
in a performance gain in OpenCVS in some "cvs update" scenarios.

ok zinovik


# 1.70 20-Oct-2010 tobias

Merge OpenCVS' rcs_deltatext_set into OpenRCS, fixing a memory leak.

ok nicm zinovik


# 1.69 20-Oct-2010 tobias

Remove the need for rp_file in parser structure, instead keep only one
FILE pointer in RCSFILE. This fixes some ugliness in closing an
fdopen()ed FILE and its underlying file descriptor.

Notified by Joerg Sonnenberger <joerg at britannica dot bec to de>

discussed with and ok nicm


# 1.68 15-Oct-2010 tobias

Replaced RCS parser code with new rcsparse.{c,h}:
- be very strict about things we parse
- print more information about errors if they occur
- do not fatal() directly in parser, give caller a chance to react
- fix an rcs design issue when it comes to login names

tested by many on tech@

ok xsa


# 1.67 05-Oct-2010 tobias

Zapped unused function rcs_tag_resolve.

ok xsa


# 1.66 05-Oct-2010 tobias

rcs_state_check must check for more invalid characters than just space.

ok nicm


# 1.65 29-Sep-2010 tobias

Ensure that we always parse all deltas before expecting "desc" keyword.

ok nicm, zinovik


# 1.64 23-Sep-2010 nicm

Plug memory leak in rcs_getrev, from zinovik.

ok me stsp


# 1.63 11-Sep-2010 tobias

Fixed typo.

ok ray, zinovik


# 1.62 02-Sep-2010 tobias

rcsnum_parse() allocates already an RCSNUM struct, so it's not needed to
copy it into a newly allocated one (which is even a memory leak).

ok zinovik


# 1.61 31-Aug-2010 tobias

style


Revision tags: OPENBSD_4_8_BASE
# 1.60 28-Jul-2010 ray

Make BUFs autoextend by default. This was already done in OpenCVS
a while ago.

OK zinovik nicm


# 1.59 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


# 1.58 23-Jul-2010 ray

Rename a bunch of variables and functions, removing the cvs_/rcs_
prefixes to reduce differences between cvs and rcs files.

"yes!" nicm


# 1.57 21-Jul-2010 ray

Only use username if author is NULL. Fixes "ci -wusername" when run
as root.

OK nicm


# 1.56 13-Jul-2010 nicm

Don't read before the beginning of the log message if it is zero-length
(possible when it comes from stdin).

Tweaked version of a fix from Peter Hendrickson in PR 6423.

ok deraadt


# 1.55 09-Jul-2010 naddy

Make cvs and rcs consistent in what characters they'll accept in
symbol/tag names: require the first character to be a letter and
allow any printable character (except the RCS specials $,.:;@)
afterwards. This matches GNU cvs.

ok xsa@ zinovik@ stsp@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.54 14-Apr-2009 jj

tried to fix a the-the in the comment, ended up rewriting it. with/from joris@


Revision tags: OPENBSD_4_5_BASE
# 1.53 25-Feb-2009 ray

Checking if a file is ASCII should only be done when diffing, because
the non-ASCII characters could be printed to the screen. For
checking in files, checking out files, merging files, and removing
revisions of files, we do so regardless of whether the files are
ASCII or binary.

Fixes PR6031.

OK joris and deraadt.


# 1.52 15-Feb-2009 joris

add our temporary RCS file to our temp_files worklist in case
for some reason we get interrupted before calling rename().

we hate leaving behind temporary files.


# 1.51 09-Nov-2008 tobias

Removed unneeded conversion from RCSNUM to string in rcs_rev_setlog.

oki joris@


# 1.50 08-Nov-2008 tobias

Support for retrieving revisions from branches in branches was missing.

Reported by chl@, ok joris@


# 1.49 09-Oct-2008 deraadt

cvs(1) uses a config file to know about the $OpenBSD$ expansion keyword,
but unfortunately rcs is not so lucky, and it will have to encoded inside.
A bit gross, but what can we do? PR 5953, ok tobias


# 1.48 17-Sep-2008 reyk

try getlogin() to get the real username when comitting files as root.
this gives better information in log messages when the user logged in
with a different uid and used sudo or su to become root. matches the
behaviour of gcvs except that we don't fallback to LOGNAME or USER
since getlogin() should not lie.

ok tobias@


Revision tags: OPENBSD_4_4_BASE
# 1.47 11-May-2008 tobias

Memory leak in rcs_delta_stats plugged.

ok joris


Revision tags: OPENBSD_4_3_BASE
# 1.46 02-Feb-2008 xsa

From src/usr.bin/cvs:

> add changed lines support to log and rlog (the + and - stuff)
> from Pierre Riteau;


# 1.45 31-Jan-2008 tobias

Revert last patch and add this magic branch number only during
output, this way we don't have to hassle in our internal brach handling.

OK joris@


# 1.44 06-Jan-2008 tobias

Branches are separated with \n\t in GNU rcs/cvs.
This makes regress tests easier to check with OpenCVS and GNU cvs.

OK xsa@


# 1.43 06-Jan-2008 sturm

gnu cvs added a new keyword 'commitid', this diff adds just enough code
to parse the commitid so that cvsweb (using rcs) continues to work on
those files

ok niallo@, xsa@


# 1.42 27-Aug-2007 xsa

typo in error msg; from Igor Zinovik.


Revision tags: OPENBSD_4_2_BASE
# 1.41 03-Jul-2007 ray

Rename rcs_diffreg() to diffreg().

OK joris@


# 1.40 30-Jun-2007 xsa

Sync revisions and time buffers size to be consistent with each others.
Simplifies further size tweaks if needed.
OK ray@.


# 1.39 13-Jun-2007 niallo

value of 'author' in an rcs file is effectively a system username.
therefore, we should allow it to contain the same characters as a username.

pointed out by jcs@
ok ray@ xsa@


# 1.38 29-May-2007 ray

Since xrealloc dies on failure it is safe to directly assign to the
original pointer. Theo agrees, and so does the rest of the tree
(ssh, etc. all do this already).

Saves a bunch of variables and assignments.

OK niallo@


# 1.37 17-May-2007 ray

Don't free unused variable, from tbert.

OK niallo && xsa


Revision tags: OPENBSD_4_1_BASE
# 1.36 27-Feb-2007 xsa

As done in OpenCVS, general includes cleanup sweep. OK otto@.


# 1.35 02-Jan-2007 niallo

- fix support for checking out binary files.

testing from xsa@ and Igor Sobrado <igor at string1.ciencias.uniovi.es>
ok xsa@


# 1.34 21-Dec-2006 niallo

- plug memleak in rcs_parse_delta()

same as opencvs diff, ok xsa@


# 1.33 21-Sep-2006 millert

Add support to rcsdiff for all the other diff flags that
are pertinent to files (not directories) and that do not
conflict with rcsdiff-specific flags. OK xsa@


Revision tags: OPENBSD_4_0_BASE
# 1.32 23-Aug-2006 millert

Add missing checks for EOF when parsing rcs file sections.
OK xsa@ joris@ niallo@


# 1.31 07-Aug-2006 ray

More strlcpy/strlcat -> snprintf/xasprintf cleanup.

OK joris@


# 1.30 04-Aug-2006 ray

Remove unnecessary strlcpy/strlcat.

``Oh man!'' xsa@


# 1.29 28-Jul-2006 ray

Recalculate buffer length after each expansion.

OK niallo@


# 1.28 27-Jul-2006 ray

Second try at adding binary file support to rcs_expand_keywords(),
using BUFs instead of C strings. Also remove initial keyword search,
which is a premature optimization, slower, and apparently too hard for
me to get right.

OK niallo@


# 1.27 27-Jul-2006 deraadt

unused variable


# 1.26 27-Jul-2006 deraadt

spacing


# 1.25 21-Jul-2006 ray

Revert; keywords did not expand.


# 1.24 21-Jul-2006 ray

Add binary file support to rcs_expand_keywords(), using BUFs instead
of C strings.

OK niallo@


# 1.23 11-Jul-2006 markus

fix out of bound read in rcs_expand_keywords(); ok niallo


# 1.22 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.21 08-Jul-2006 niallo

- plug an old memory leak in patching code.

ok joris@


# 1.20 11-Jun-2006 niallo

- clean up rcs_expand_keywords() a little more.


# 1.19 11-Jun-2006 niallo

- zap unused variable


# 1.18 09-Jun-2006 niallo

- fix rcs_expand_keywords().

reported by Andreas Kahari <andreas.kahari at gmail>, input from joris@


# 1.17 04-Jun-2006 niallo

- explicitly set some pointers to NULL since they are tested on error.


# 1.16 04-Jun-2006 niallo

- we can just use the 'sizdiff' variable instead of calling strlen(expbuf);
simplifies things a little.


# 1.15 04-Jun-2006 niallo

- ensure fin pointer is not invalidated after realloc


# 1.14 04-Jun-2006 niallo

- don't forget to free data in rcs_expand_keywords()


# 1.13 04-Jun-2006 niallo

- fix off-by-one in rcs_expand_keywords()


# 1.12 03-Jun-2006 niallo

- correctly handle binary files; say bye bye to using c strings for deltatexts.

"slap it in" joris@


# 1.11 28-May-2006 ray

Don't fill in the rd_locker if we are creating a new RCS file.

OK joris@


# 1.10 27-May-2006 ray

Rename RCSFILE.fd to RCSFILE.rf_fd, plus minor spacing nits. No
binary change.

OK xsa@


# 1.9 11-May-2006 xsa

first round of rcs_write() cleanup; prodded by joris@; input/OK ray@.


# 1.8 08-May-2006 xsa

check for rcs_diffreg() return value; OK ray@.


# 1.7 04-May-2006 xsa

finish work wrt TMPDIR; use xasprintf() to simplify code while in there;
"looks fine" ray@.


# 1.6 01-May-2006 niallo

- fix a case in rcs_getrev() handling of branches where variant was not being
increased and thus no progress could be made in the loop.

bug noticed in rcsdiff(1) by sturm@

ok joris@


# 1.5 29-Apr-2006 ray

Check return values for all strlcpy, and strlcat calls.

OK xsa@ and probably others.


# 1.4 27-Apr-2006 xsa

zap util.[ch] and move the content into rcsutil.[ch].
discussed with joris@.


# 1.3 26-Apr-2006 joris

prevent file races by obtaining an fd for the RCS file and
do our operations on that, this is safe and guarantees we
can operate on the file until we close(2) it.

a fix is coming for the remaining races in our diff code.
okay niallo@ and ray@


# 1.2 26-Apr-2006 xsa

err() cleanup;


# 1.1 26-Apr-2006 joris

fork our code we shared between openrcs/cvs into the openrcs dir.

this was starting to become inhuman to maintain without
ugly ugly hacks in the shared code, and it will be easier
to make specific changes for openrcs without touching the
soon-to-be-replaced opencvs code.


# 1.86 30-Dec-2018 guenther

Delete unnecessary <libgen.h> #includes

ok deraadt@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.85 09-May-2016 schwarze

Implement Mdocdate keyword substitution.
In particular, this stops rcsdiff(1) and CVSweb from showing
wrong Mdocdate lines in diffs.
Problem originally reported by tj@.
OK tobias@ otto@ millert@


Revision tags: OPENBSD_5_9_BASE
# 1.84 02-Nov-2015 nicm

Allow rcsnum_free and buf_free to accept NULL and remove various NULL
checks that are now unnecessary, from Michael W Bombardieri. ok millert


Revision tags: OPENBSD_5_8_BASE
# 1.83 13-Jun-2015 nicm

Convert xfree to free. From Fritjof Bornebusch. ok deraadt


Revision tags: OPENBSD_5_7_BASE
# 1.82 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.81 10-Oct-2014 otto

Zap some stored values never read; From Fritjof Bornebusch; ok nicm@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.80 07-Jan-2014 deraadt

ctype cleanups; ok okan


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.79 03-Mar-2012 nicm

Remove unused variable, from Michael W Bombardieri who also got an ok
from tobias@.


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.78 14-Jul-2011 sobrado

spacing, no binary change.


# 1.77 06-Jul-2011 nicm

Replace the keyword expansion code with a faster, more readable version
which additionally also supports $Log$ and $Locker. Written by Joerg
Sonnenberger and tweaked by me.

ok ray


# 1.76 20-May-2011 nicm

Remove a bunch of unused functions, from Michael W Bombardieri.

ok ray


# 1.75 20-Apr-2011 nicm

Remove some unneeded includes and dead code, from Michael W Bombardieri.

ok jasper xsa


# 1.74 04-Apr-2011 djm

previous commit introduced a crash: the removed strtol was being used to
skip past a value and it couldn't just be nuked


# 1.73 27-Mar-2011 jasper

- remove unused variables

from Michael W. Bombardieri
ok chl@ nicm@


Revision tags: OPENBSD_4_9_BASE
# 1.72 10-Dec-2010 jasper

- plug an fd leak

help/ok chl@ nicm@


# 1.71 27-Oct-2010 tobias

Merge -k and expand @@ parsing code between OpenCVS and OpenRCS, resulting
in a performance gain in OpenCVS in some "cvs update" scenarios.

ok zinovik


# 1.70 20-Oct-2010 tobias

Merge OpenCVS' rcs_deltatext_set into OpenRCS, fixing a memory leak.

ok nicm zinovik


# 1.69 20-Oct-2010 tobias

Remove the need for rp_file in parser structure, instead keep only one
FILE pointer in RCSFILE. This fixes some ugliness in closing an
fdopen()ed FILE and its underlying file descriptor.

Notified by Joerg Sonnenberger <joerg at britannica dot bec to de>

discussed with and ok nicm


# 1.68 15-Oct-2010 tobias

Replaced RCS parser code with new rcsparse.{c,h}:
- be very strict about things we parse
- print more information about errors if they occur
- do not fatal() directly in parser, give caller a chance to react
- fix an rcs design issue when it comes to login names

tested by many on tech@

ok xsa


# 1.67 05-Oct-2010 tobias

Zapped unused function rcs_tag_resolve.

ok xsa


# 1.66 05-Oct-2010 tobias

rcs_state_check must check for more invalid characters than just space.

ok nicm


# 1.65 29-Sep-2010 tobias

Ensure that we always parse all deltas before expecting "desc" keyword.

ok nicm, zinovik


# 1.64 23-Sep-2010 nicm

Plug memory leak in rcs_getrev, from zinovik.

ok me stsp


# 1.63 11-Sep-2010 tobias

Fixed typo.

ok ray, zinovik


# 1.62 02-Sep-2010 tobias

rcsnum_parse() allocates already an RCSNUM struct, so it's not needed to
copy it into a newly allocated one (which is even a memory leak).

ok zinovik


# 1.61 31-Aug-2010 tobias

style


Revision tags: OPENBSD_4_8_BASE
# 1.60 28-Jul-2010 ray

Make BUFs autoextend by default. This was already done in OpenCVS
a while ago.

OK zinovik nicm


# 1.59 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


# 1.58 23-Jul-2010 ray

Rename a bunch of variables and functions, removing the cvs_/rcs_
prefixes to reduce differences between cvs and rcs files.

"yes!" nicm


# 1.57 21-Jul-2010 ray

Only use username if author is NULL. Fixes "ci -wusername" when run
as root.

OK nicm


# 1.56 13-Jul-2010 nicm

Don't read before the beginning of the log message if it is zero-length
(possible when it comes from stdin).

Tweaked version of a fix from Peter Hendrickson in PR 6423.

ok deraadt


# 1.55 09-Jul-2010 naddy

Make cvs and rcs consistent in what characters they'll accept in
symbol/tag names: require the first character to be a letter and
allow any printable character (except the RCS specials $,.:;@)
afterwards. This matches GNU cvs.

ok xsa@ zinovik@ stsp@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.54 14-Apr-2009 jj

tried to fix a the-the in the comment, ended up rewriting it. with/from joris@


Revision tags: OPENBSD_4_5_BASE
# 1.53 25-Feb-2009 ray

Checking if a file is ASCII should only be done when diffing, because
the non-ASCII characters could be printed to the screen. For
checking in files, checking out files, merging files, and removing
revisions of files, we do so regardless of whether the files are
ASCII or binary.

Fixes PR6031.

OK joris and deraadt.


# 1.52 15-Feb-2009 joris

add our temporary RCS file to our temp_files worklist in case
for some reason we get interrupted before calling rename().

we hate leaving behind temporary files.


# 1.51 09-Nov-2008 tobias

Removed unneeded conversion from RCSNUM to string in rcs_rev_setlog.

oki joris@


# 1.50 08-Nov-2008 tobias

Support for retrieving revisions from branches in branches was missing.

Reported by chl@, ok joris@


# 1.49 09-Oct-2008 deraadt

cvs(1) uses a config file to know about the $OpenBSD$ expansion keyword,
but unfortunately rcs is not so lucky, and it will have to encoded inside.
A bit gross, but what can we do? PR 5953, ok tobias


# 1.48 17-Sep-2008 reyk

try getlogin() to get the real username when comitting files as root.
this gives better information in log messages when the user logged in
with a different uid and used sudo or su to become root. matches the
behaviour of gcvs except that we don't fallback to LOGNAME or USER
since getlogin() should not lie.

ok tobias@


Revision tags: OPENBSD_4_4_BASE
# 1.47 11-May-2008 tobias

Memory leak in rcs_delta_stats plugged.

ok joris


Revision tags: OPENBSD_4_3_BASE
# 1.46 02-Feb-2008 xsa

From src/usr.bin/cvs:

> add changed lines support to log and rlog (the + and - stuff)
> from Pierre Riteau;


# 1.45 31-Jan-2008 tobias

Revert last patch and add this magic branch number only during
output, this way we don't have to hassle in our internal brach handling.

OK joris@


# 1.44 06-Jan-2008 tobias

Branches are separated with \n\t in GNU rcs/cvs.
This makes regress tests easier to check with OpenCVS and GNU cvs.

OK xsa@


# 1.43 06-Jan-2008 sturm

gnu cvs added a new keyword 'commitid', this diff adds just enough code
to parse the commitid so that cvsweb (using rcs) continues to work on
those files

ok niallo@, xsa@


# 1.42 27-Aug-2007 xsa

typo in error msg; from Igor Zinovik.


Revision tags: OPENBSD_4_2_BASE
# 1.41 03-Jul-2007 ray

Rename rcs_diffreg() to diffreg().

OK joris@


# 1.40 30-Jun-2007 xsa

Sync revisions and time buffers size to be consistent with each others.
Simplifies further size tweaks if needed.
OK ray@.


# 1.39 13-Jun-2007 niallo

value of 'author' in an rcs file is effectively a system username.
therefore, we should allow it to contain the same characters as a username.

pointed out by jcs@
ok ray@ xsa@


# 1.38 29-May-2007 ray

Since xrealloc dies on failure it is safe to directly assign to the
original pointer. Theo agrees, and so does the rest of the tree
(ssh, etc. all do this already).

Saves a bunch of variables and assignments.

OK niallo@


# 1.37 17-May-2007 ray

Don't free unused variable, from tbert.

OK niallo && xsa


Revision tags: OPENBSD_4_1_BASE
# 1.36 27-Feb-2007 xsa

As done in OpenCVS, general includes cleanup sweep. OK otto@.


# 1.35 02-Jan-2007 niallo

- fix support for checking out binary files.

testing from xsa@ and Igor Sobrado <igor at string1.ciencias.uniovi.es>
ok xsa@


# 1.34 21-Dec-2006 niallo

- plug memleak in rcs_parse_delta()

same as opencvs diff, ok xsa@


# 1.33 21-Sep-2006 millert

Add support to rcsdiff for all the other diff flags that
are pertinent to files (not directories) and that do not
conflict with rcsdiff-specific flags. OK xsa@


Revision tags: OPENBSD_4_0_BASE
# 1.32 23-Aug-2006 millert

Add missing checks for EOF when parsing rcs file sections.
OK xsa@ joris@ niallo@


# 1.31 07-Aug-2006 ray

More strlcpy/strlcat -> snprintf/xasprintf cleanup.

OK joris@


# 1.30 04-Aug-2006 ray

Remove unnecessary strlcpy/strlcat.

``Oh man!'' xsa@


# 1.29 28-Jul-2006 ray

Recalculate buffer length after each expansion.

OK niallo@


# 1.28 27-Jul-2006 ray

Second try at adding binary file support to rcs_expand_keywords(),
using BUFs instead of C strings. Also remove initial keyword search,
which is a premature optimization, slower, and apparently too hard for
me to get right.

OK niallo@


# 1.27 27-Jul-2006 deraadt

unused variable


# 1.26 27-Jul-2006 deraadt

spacing


# 1.25 21-Jul-2006 ray

Revert; keywords did not expand.


# 1.24 21-Jul-2006 ray

Add binary file support to rcs_expand_keywords(), using BUFs instead
of C strings.

OK niallo@


# 1.23 11-Jul-2006 markus

fix out of bound read in rcs_expand_keywords(); ok niallo


# 1.22 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.21 08-Jul-2006 niallo

- plug an old memory leak in patching code.

ok joris@


# 1.20 11-Jun-2006 niallo

- clean up rcs_expand_keywords() a little more.


# 1.19 11-Jun-2006 niallo

- zap unused variable


# 1.18 09-Jun-2006 niallo

- fix rcs_expand_keywords().

reported by Andreas Kahari <andreas.kahari at gmail>, input from joris@


# 1.17 04-Jun-2006 niallo

- explicitly set some pointers to NULL since they are tested on error.


# 1.16 04-Jun-2006 niallo

- we can just use the 'sizdiff' variable instead of calling strlen(expbuf);
simplifies things a little.


# 1.15 04-Jun-2006 niallo

- ensure fin pointer is not invalidated after realloc


# 1.14 04-Jun-2006 niallo

- don't forget to free data in rcs_expand_keywords()


# 1.13 04-Jun-2006 niallo

- fix off-by-one in rcs_expand_keywords()


# 1.12 03-Jun-2006 niallo

- correctly handle binary files; say bye bye to using c strings for deltatexts.

"slap it in" joris@


# 1.11 28-May-2006 ray

Don't fill in the rd_locker if we are creating a new RCS file.

OK joris@


# 1.10 27-May-2006 ray

Rename RCSFILE.fd to RCSFILE.rf_fd, plus minor spacing nits. No
binary change.

OK xsa@


# 1.9 11-May-2006 xsa

first round of rcs_write() cleanup; prodded by joris@; input/OK ray@.


# 1.8 08-May-2006 xsa

check for rcs_diffreg() return value; OK ray@.


# 1.7 04-May-2006 xsa

finish work wrt TMPDIR; use xasprintf() to simplify code while in there;
"looks fine" ray@.


# 1.6 01-May-2006 niallo

- fix a case in rcs_getrev() handling of branches where variant was not being
increased and thus no progress could be made in the loop.

bug noticed in rcsdiff(1) by sturm@

ok joris@


# 1.5 29-Apr-2006 ray

Check return values for all strlcpy, and strlcat calls.

OK xsa@ and probably others.


# 1.4 27-Apr-2006 xsa

zap util.[ch] and move the content into rcsutil.[ch].
discussed with joris@.


# 1.3 26-Apr-2006 joris

prevent file races by obtaining an fd for the RCS file and
do our operations on that, this is safe and guarantees we
can operate on the file until we close(2) it.

a fix is coming for the remaining races in our diff code.
okay niallo@ and ray@


# 1.2 26-Apr-2006 xsa

err() cleanup;


# 1.1 26-Apr-2006 joris

fork our code we shared between openrcs/cvs into the openrcs dir.

this was starting to become inhuman to maintain without
ugly ugly hacks in the shared code, and it will be easier
to make specific changes for openrcs without touching the
soon-to-be-replaced opencvs code.


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.85 09-May-2016 schwarze

Implement Mdocdate keyword substitution.
In particular, this stops rcsdiff(1) and CVSweb from showing
wrong Mdocdate lines in diffs.
Problem originally reported by tj@.
OK tobias@ otto@ millert@


Revision tags: OPENBSD_5_9_BASE
# 1.84 02-Nov-2015 nicm

Allow rcsnum_free and buf_free to accept NULL and remove various NULL
checks that are now unnecessary, from Michael W Bombardieri. ok millert


Revision tags: OPENBSD_5_8_BASE
# 1.83 13-Jun-2015 nicm

Convert xfree to free. From Fritjof Bornebusch. ok deraadt


Revision tags: OPENBSD_5_7_BASE
# 1.82 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


# 1.81 10-Oct-2014 otto

Zap some stored values never read; From Fritjof Bornebusch; ok nicm@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.80 07-Jan-2014 deraadt

ctype cleanups; ok okan


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.79 03-Mar-2012 nicm

Remove unused variable, from Michael W Bombardieri who also got an ok
from tobias@.


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.78 14-Jul-2011 sobrado

spacing, no binary change.


# 1.77 06-Jul-2011 nicm

Replace the keyword expansion code with a faster, more readable version
which additionally also supports $Log$ and $Locker. Written by Joerg
Sonnenberger and tweaked by me.

ok ray


# 1.76 20-May-2011 nicm

Remove a bunch of unused functions, from Michael W Bombardieri.

ok ray


# 1.75 20-Apr-2011 nicm

Remove some unneeded includes and dead code, from Michael W Bombardieri.

ok jasper xsa


# 1.74 04-Apr-2011 djm

previous commit introduced a crash: the removed strtol was being used to
skip past a value and it couldn't just be nuked


# 1.73 27-Mar-2011 jasper

- remove unused variables

from Michael W. Bombardieri
ok chl@ nicm@


Revision tags: OPENBSD_4_9_BASE
# 1.72 10-Dec-2010 jasper

- plug an fd leak

help/ok chl@ nicm@


# 1.71 27-Oct-2010 tobias

Merge -k and expand @@ parsing code between OpenCVS and OpenRCS, resulting
in a performance gain in OpenCVS in some "cvs update" scenarios.

ok zinovik


# 1.70 20-Oct-2010 tobias

Merge OpenCVS' rcs_deltatext_set into OpenRCS, fixing a memory leak.

ok nicm zinovik


# 1.69 20-Oct-2010 tobias

Remove the need for rp_file in parser structure, instead keep only one
FILE pointer in RCSFILE. This fixes some ugliness in closing an
fdopen()ed FILE and its underlying file descriptor.

Notified by Joerg Sonnenberger <joerg at britannica dot bec to de>

discussed with and ok nicm


# 1.68 15-Oct-2010 tobias

Replaced RCS parser code with new rcsparse.{c,h}:
- be very strict about things we parse
- print more information about errors if they occur
- do not fatal() directly in parser, give caller a chance to react
- fix an rcs design issue when it comes to login names

tested by many on tech@

ok xsa


# 1.67 05-Oct-2010 tobias

Zapped unused function rcs_tag_resolve.

ok xsa


# 1.66 05-Oct-2010 tobias

rcs_state_check must check for more invalid characters than just space.

ok nicm


# 1.65 29-Sep-2010 tobias

Ensure that we always parse all deltas before expecting "desc" keyword.

ok nicm, zinovik


# 1.64 23-Sep-2010 nicm

Plug memory leak in rcs_getrev, from zinovik.

ok me stsp


# 1.63 11-Sep-2010 tobias

Fixed typo.

ok ray, zinovik


# 1.62 02-Sep-2010 tobias

rcsnum_parse() allocates already an RCSNUM struct, so it's not needed to
copy it into a newly allocated one (which is even a memory leak).

ok zinovik


# 1.61 31-Aug-2010 tobias

style


Revision tags: OPENBSD_4_8_BASE
# 1.60 28-Jul-2010 ray

Make BUFs autoextend by default. This was already done in OpenCVS
a while ago.

OK zinovik nicm


# 1.59 23-Jul-2010 ray

Reduce variable/function name and whitespace differences between
cvs/rcs.

OK xsa zinovik


# 1.58 23-Jul-2010 ray

Rename a bunch of variables and functions, removing the cvs_/rcs_
prefixes to reduce differences between cvs and rcs files.

"yes!" nicm


# 1.57 21-Jul-2010 ray

Only use username if author is NULL. Fixes "ci -wusername" when run
as root.

OK nicm


# 1.56 13-Jul-2010 nicm

Don't read before the beginning of the log message if it is zero-length
(possible when it comes from stdin).

Tweaked version of a fix from Peter Hendrickson in PR 6423.

ok deraadt


# 1.55 09-Jul-2010 naddy

Make cvs and rcs consistent in what characters they'll accept in
symbol/tag names: require the first character to be a letter and
allow any printable character (except the RCS specials $,.:;@)
afterwards. This matches GNU cvs.

ok xsa@ zinovik@ stsp@


Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.54 14-Apr-2009 jj

tried to fix a the-the in the comment, ended up rewriting it. with/from joris@


Revision tags: OPENBSD_4_5_BASE
# 1.53 25-Feb-2009 ray

Checking if a file is ASCII should only be done when diffing, because
the non-ASCII characters could be printed to the screen. For
checking in files, checking out files, merging files, and removing
revisions of files, we do so regardless of whether the files are
ASCII or binary.

Fixes PR6031.

OK joris and deraadt.


# 1.52 15-Feb-2009 joris

add our temporary RCS file to our temp_files worklist in case
for some reason we get interrupted before calling rename().

we hate leaving behind temporary files.


# 1.51 09-Nov-2008 tobias

Removed unneeded conversion from RCSNUM to string in rcs_rev_setlog.

oki joris@


# 1.50 08-Nov-2008 tobias

Support for retrieving revisions from branches in branches was missing.

Reported by chl@, ok joris@


# 1.49 09-Oct-2008 deraadt

cvs(1) uses a config file to know about the $OpenBSD$ expansion keyword,
but unfortunately rcs is not so lucky, and it will have to encoded inside.
A bit gross, but what can we do? PR 5953, ok tobias


# 1.48 17-Sep-2008 reyk

try getlogin() to get the real username when comitting files as root.
this gives better information in log messages when the user logged in
with a different uid and used sudo or su to become root. matches the
behaviour of gcvs except that we don't fallback to LOGNAME or USER
since getlogin() should not lie.

ok tobias@


Revision tags: OPENBSD_4_4_BASE
# 1.47 11-May-2008 tobias

Memory leak in rcs_delta_stats plugged.

ok joris


Revision tags: OPENBSD_4_3_BASE
# 1.46 02-Feb-2008 xsa

From src/usr.bin/cvs:

> add changed lines support to log and rlog (the + and - stuff)
> from Pierre Riteau;


# 1.45 31-Jan-2008 tobias

Revert last patch and add this magic branch number only during
output, this way we don't have to hassle in our internal brach handling.

OK joris@


# 1.44 06-Jan-2008 tobias

Branches are separated with \n\t in GNU rcs/cvs.
This makes regress tests easier to check with OpenCVS and GNU cvs.

OK xsa@


# 1.43 06-Jan-2008 sturm

gnu cvs added a new keyword 'commitid', this diff adds just enough code
to parse the commitid so that cvsweb (using rcs) continues to work on
those files

ok niallo@, xsa@


# 1.42 27-Aug-2007 xsa

typo in error msg; from Igor Zinovik.


Revision tags: OPENBSD_4_2_BASE
# 1.41 03-Jul-2007 ray

Rename rcs_diffreg() to diffreg().

OK joris@


# 1.40 30-Jun-2007 xsa

Sync revisions and time buffers size to be consistent with each others.
Simplifies further size tweaks if needed.
OK ray@.


# 1.39 13-Jun-2007 niallo

value of 'author' in an rcs file is effectively a system username.
therefore, we should allow it to contain the same characters as a username.

pointed out by jcs@
ok ray@ xsa@


# 1.38 29-May-2007 ray

Since xrealloc dies on failure it is safe to directly assign to the
original pointer. Theo agrees, and so does the rest of the tree
(ssh, etc. all do this already).

Saves a bunch of variables and assignments.

OK niallo@


# 1.37 17-May-2007 ray

Don't free unused variable, from tbert.

OK niallo && xsa


Revision tags: OPENBSD_4_1_BASE
# 1.36 27-Feb-2007 xsa

As done in OpenCVS, general includes cleanup sweep. OK otto@.


# 1.35 02-Jan-2007 niallo

- fix support for checking out binary files.

testing from xsa@ and Igor Sobrado <igor at string1.ciencias.uniovi.es>
ok xsa@


# 1.34 21-Dec-2006 niallo

- plug memleak in rcs_parse_delta()

same as opencvs diff, ok xsa@


# 1.33 21-Sep-2006 millert

Add support to rcsdiff for all the other diff flags that
are pertinent to files (not directories) and that do not
conflict with rcsdiff-specific flags. OK xsa@


Revision tags: OPENBSD_4_0_BASE
# 1.32 23-Aug-2006 millert

Add missing checks for EOF when parsing rcs file sections.
OK xsa@ joris@ niallo@


# 1.31 07-Aug-2006 ray

More strlcpy/strlcat -> snprintf/xasprintf cleanup.

OK joris@


# 1.30 04-Aug-2006 ray

Remove unnecessary strlcpy/strlcat.

``Oh man!'' xsa@


# 1.29 28-Jul-2006 ray

Recalculate buffer length after each expansion.

OK niallo@


# 1.28 27-Jul-2006 ray

Second try at adding binary file support to rcs_expand_keywords(),
using BUFs instead of C strings. Also remove initial keyword search,
which is a premature optimization, slower, and apparently too hard for
me to get right.

OK niallo@


# 1.27 27-Jul-2006 deraadt

unused variable


# 1.26 27-Jul-2006 deraadt

spacing


# 1.25 21-Jul-2006 ray

Revert; keywords did not expand.


# 1.24 21-Jul-2006 ray

Add binary file support to rcs_expand_keywords(), using BUFs instead
of C strings.

OK niallo@


# 1.23 11-Jul-2006 markus

fix out of bound read in rcs_expand_keywords(); ok niallo


# 1.22 08-Jul-2006 ray

Remove file mode argument from {cvs|rcs}_buf_write_stmp(). We
always set the temporary file to mode 600, which is already done
by mkstemp().

OK joris@ and xsa@ over a month ago.


# 1.21 08-Jul-2006 niallo

- plug an old memory leak in patching code.

ok joris@


# 1.20 11-Jun-2006 niallo

- clean up rcs_expand_keywords() a little more.


# 1.19 11-Jun-2006 niallo

- zap unused variable


# 1.18 09-Jun-2006 niallo

- fix rcs_expand_keywords().

reported by Andreas Kahari <andreas.kahari at gmail>, input from joris@


# 1.17 04-Jun-2006 niallo

- explicitly set some pointers to NULL since they are tested on error.


# 1.16 04-Jun-2006 niallo

- we can just use the 'sizdiff' variable instead of calling strlen(expbuf);
simplifies things a little.


# 1.15 04-Jun-2006 niallo

- ensure fin pointer is not invalidated after realloc


# 1.14 04-Jun-2006 niallo

- don't forget to free data in rcs_expand_keywords()


# 1.13 04-Jun-2006 niallo

- fix off-by-one in rcs_expand_keywords()


# 1.12 03-Jun-2006 niallo

- correctly handle binary files; say bye bye to using c strings for deltatexts.

"slap it in" joris@


# 1.11 28-May-2006 ray

Don't fill in the rd_locker if we are creating a new RCS file.

OK joris@


# 1.10 27-May-2006 ray

Rename RCSFILE.fd to RCSFILE.rf_fd, plus minor spacing nits. No
binary change.

OK xsa@


# 1.9 11-May-2006 xsa

first round of rcs_write() cleanup; prodded by joris@; input/OK ray@.


# 1.8 08-May-2006 xsa

check for rcs_diffreg() return value; OK ray@.


# 1.7 04-May-2006 xsa

finish work wrt TMPDIR; use xasprintf() to simplify code while in there;
"looks fine" ray@.


# 1.6 01-May-2006 niallo

- fix a case in rcs_getrev() handling of branches where variant was not being
increased and thus no progress could be made in the loop.

bug noticed in rcsdiff(1) by sturm@

ok joris@


# 1.5 29-Apr-2006 ray

Check return values for all strlcpy, and strlcat calls.

OK xsa@ and probably others.


# 1.4 27-Apr-2006 xsa

zap util.[ch] and move the content into rcsutil.[ch].
discussed with joris@.


# 1.3 26-Apr-2006 joris

prevent file races by obtaining an fd for the RCS file and
do our operations on that, this is safe and guarantees we
can operate on the file until we close(2) it.

a fix is coming for the remaining races in our diff code.
okay niallo@ and ray@


# 1.2 26-Apr-2006 xsa

err() cleanup;


# 1.1 26-Apr-2006 joris

fork our code we shared between openrcs/cvs into the openrcs dir.

this was starting to become inhuman to maintain without
ugly ugly hacks in the shared code, and it will be easier
to make specific changes for openrcs without touching the
soon-to-be-replaced opencvs code.