History log of /openbsd-current/usr.bin/cvs/cvs.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.160 27-Jan-2021 deraadt

fix -fno-common issues; ok mortimer


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.159 01-Jun-2017 joris

Stop looking at current_cvsroot->cr_method to figure out if we're remote or not.

Instead use cvsroot_is_local() and cvsroot_is_remote().


Revision tags: OPENBSD_6_1_BASE
# 1.158 04-Sep-2016 tb

Add missing getpw pledge

ok deraadt


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.157 19-Nov-2015 deraadt

opencvs can use pledge "stdio rpath wpath cpath fattr proc exec".
I have not looked into adding stricter pledges later in the code.


# 1.156 05-Nov-2015 nicm

Remove xfree(), like already done for RCS. From Michael W Bombardieri,
ok mmcc


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.155 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.154 01-Dec-2014 deraadt

An internal function called xrealloc() is actually a fail-hard
reallocarray()... so rename it.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.153 08-Jan-2014 okan

unsigned char for ctype. ok deraadt


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.152 20-Sep-2011 nicm

Lose unused variable cvs_msg, from Michael W Bombardieri.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.151 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


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.150 21-Jun-2008 joris

add a hash table mechanism based upon hcreate(3) but one that allows
us to maintain multiple hash tables concurrently.

immediatly start using it to keep track of what directories
we have already created and what CVS dirs we already created so
we do not recreate them when we do not need to.

we will be switching more internals to use this soon.
rejoice for cheaper lookups.

ok tobias@


# 1.149 17-Jun-2008 joris

unused vars


# 1.148 14-Jun-2008 joris

don't always re-open the same CVS/Entries file, instead keep the
last opened CVS/Entries around to operate on and close it whenever
we switch directory. gives us a small performance boost, obviously.

while doing this, switch the way we write revisions to disk by
using fwrite(3) so stuff can get written to disk in chunks
instead of writing everything line by line, another win.

with help from otto@
ok tobias@


# 1.147 10-Jun-2008 joris

make opencvs behave exactly like GNU cvs does when it comes to
verbosity, it's verbose by default and you can shut it up using -Q.

ok tobias@


# 1.146 30-May-2008 tobias

Set up cmdp before first possible call of fatal to avoid NULL pointer
dereference in logging code. Spotted by Igor Zinovik.

ok joris


# 1.145 28-May-2008 tobias

Don't limit ourselfs when it comes to arguments on command line or
arguments sent by client.

ok joris


# 1.144 08-Mar-2008 tobias

Set umask (and cvs_umask) to system's umask in local and client mode.
Also zap umask(0);umask(mask); calls, we have cvs_umask for this.

ok joris


Revision tags: OPENBSD_4_3_BASE
# 1.143 26-Feb-2008 joris

spacing


# 1.142 02-Feb-2008 joris

initial CVSROOT/modules support, only does aliases at the moment (-a).
"modules.c, hurray!" xsa@, ok tobias@


# 1.141 28-Jan-2008 tobias

Zapped some variables which made the source harder to read (and to verify).

> Diff from Igor Zinovik


# 1.140 10-Jan-2008 tobias

Simply the use of cmdp and cvs_command by zapping cvs_command and working
solely with cmdp. This remedies some reliability issues with invalid
commands supplied and also fixes a GNU cvs style incompatibility with
release command.

> Based on patch from Igor Zinovik


# 1.139 07-Oct-2007 chl

break after exit() is useless

ok ray@


# 1.138 19-Sep-2007 tobias

Allow lines which do not specify any arguments for command (or cvs).
Sticks at GNU cvs behaviour.

OK joris@


# 1.137 19-Sep-2007 tobias

parse global arguments (cvs) and command arguments only once, i.e. first
line of occurence. Nice side-effect: only parse arguments for current
command, not for all.

OK joris@


# 1.136 19-Sep-2007 tobias

Print warning about invalid command in .cvsrc only if -V is in use.
OpenCVS defaults to -q, so man page should say "with -V", not "without -q
or -Q".

OK joris@


# 1.135 19-Sep-2007 tobias

Next to ' ', '\t' is valid between command and arguments.

OK joris@


# 1.134 19-Sep-2007 tobias

Weird, but our goal is compatibility: treat '\t' in front of keyword as '#'.

OK joris@


# 1.133 19-Sep-2007 tobias

Usage of fgetln() instead of fgets() in .cvsrc parsing handles line
numbers better and allows longer command arguments.

OK joris@


# 1.132 10-Sep-2007 tobias

Fixed segmentation fault that occured during .cvsrc parsing if an invalid
cvs command has been specified.

Spotted by Mathias De Belder <mathias at woei dot be> who also supplied a
patch, although I took his second suggestion.

OK joris@


# 1.131 07-Sep-2007 tobias

Do not fatal if getpwuid() fails, instead ignore user configuration files.

OK joris@


# 1.130 02-Sep-2007 tobias

Stick at GNU cvs behaviour with Root directive handling: it does not need
to be sent first, can occure multiple times (although this is ignored) but
should be supplied before Directory.

OK joris@


Revision tags: OPENBSD_4_2_BASE
# 1.129 06-Aug-2007 sobrado

the ellipsis is not an optional argument; while here, sync the usage
and synopsis of commands

lots of good ideas by jmc@

ok jmc@


# 1.128 27-May-2007 ray

Add bounds check for cvs command arguments. Initial diff by Tobias
Stoeckmann, rearranged to "if (num_items >= BUFSIZ)" format for
readability.

I would have liked to allow our cvs client to accept as many arguments
as the system would allow, but the argument parsing code is surprising
hairy.

OK niallo@.


# 1.127 27-May-2007 ray

Revert, we dealt with the -x flag in the past. jmc suddenly
remembered we had created a separate section for compatibility
flags. Oh well, two free commits.

OK jmc@


# 1.126 27-May-2007 ray

Mention -x flag (for compatibility only). From Tobias Stoeckmann.

Input and OK jmc@


# 1.125 27-May-2007 ray

Call fatal() if extra arguments are given to "opencvs server". From
Tobias Stoeckmann.

OK niallo@


# 1.124 26-May-2007 ray

cvs_server_path is more appropriate to check than cvs_server_active.

From Tobias Stoeckmann.

OK niallo@


# 1.123 22-May-2007 xsa

Note that the global -x option is kept for compatibility (for now) and has
no effect.


# 1.122 09-May-2007 xsa

- we do not have -H, zap it.
- add missing `x' flag in getopt() and sort flags.
- sync usage().

Based on initial diff from Tobias Stoeckmann.


# 1.121 30-Apr-2007 xsa

make usage() __dead; from Tobias Stoeckmann.


# 1.120 30-Apr-2007 xsa

missing header; from Tobias Stoeckmann.


# 1.119 24-Apr-2007 sobrado

changes "Usage" to "usage"; sorts options list in cvs history;
the argument to -z is tz, not timezone; argument names to flags
should use lowercase letters; cvs's usage() output should fit
on a 80-column display

ok by jmc@, niallo@ and xsa@


Revision tags: OPENBSD_4_1_BASE
# 1.118 24-Feb-2007 otto

fix comment; from jared r r spiegel


# 1.117 22-Feb-2007 otto

general includes cleanup sweep. ok joris@ niallo@


# 1.116 17-Feb-2007 xsa

cvs_path_cat() removal since we can now easily handle that
functionality w/ xsnprintf(); Initial diff started by thib@.
OK thib@ joris@.


# 1.115 09-Feb-2007 joris

strtol(3) -> strtonum(3)


# 1.114 06-Feb-2007 jmc

sort options;


# 1.113 11-Jan-2007 joris

in a remote setup:
do not connect to the remote server until we are sure all the options
passed to the commands are valid.

noticed by xsa@


# 1.112 11-Dec-2006 xsa

global option -n implies -l


# 1.111 11-Dec-2006 xsa

Permit checkout from a read-only repository using the -R global option
or using the CVSREADONLYFS environment variable.
Request/test/ok todd@. Man page bits courtesy of jmc@.


# 1.110 28-Nov-2006 xsa

snprintf() -> cvs_path_cat()


# 1.109 14-Nov-2006 xsa

Add support for the "Set" request.


# 1.108 14-Nov-2006 xsa

Simplify in cvs_read_rcfile() by using cvs_path_cat();


Revision tags: OPENBSD_4_0_BASE
# 1.107 09-Jul-2006 joris

handle SIGPIPE correctly.


# 1.106 07-Jul-2006 joris

first part of opencvs remote, fairly useable on existing trees
although i advise against using it on real development trees for now.

only a few commands work right so far:
- commit
- diff
- status
- log
- update (partially working)

if you feel like testing remote and run into bugs feel free to
contact me, and please include a full trace (-t).


# 1.105 28-Jun-2006 reyk

use quiet mode (-q) by default and add a flag -V for the old "verbose"
mode. if you really need to know all the details (the old GNU'ish
behaviour), use -V or even -t for tracing.

ok joris@


# 1.104 13-Jun-2006 joris

be more accurate in describing what happened
when we cannot see the repository the user wants to work with.


# 1.103 12-Jun-2006 xsa

bring back a working version of the `cvs init' command. OK joris@.


# 1.102 02-Jun-2006 david

various spelling fixes


# 1.101 30-May-2006 joris

nuke cvs_repo_base variable


# 1.100 27-May-2006 joris

lets be nice and abort cvs when we find out there is
no CVSROOT directory where there is suppose to be one.


# 1.99 27-May-2006 joris

basic support for CVSROOT/config - only supporting the 'tag' and
'umask' keyword right now.


# 1.98 27-May-2006 joris

commit the new opencvs code, i have been hacking on
this for the past 2 weeks now and it should go in at
the start of the hackathon so others can help out.

this code is a lot safer, smarter, faster and best of
all it is actually doing what it is suppose to do!

basic checkout, update, status, diff and commit are
working in local mode only.
there is no support for any remote setups now.


# 1.97 14-Apr-2006 deraadt

remove a metric buttload of excessive ()
no binary change; ok ray


# 1.96 05-Apr-2006 ray

Use variable names for sizeof, remove casts in front of xmalloc,
use xcalloc and xstrdup where appropriate, and other stuff.

OK joris@


# 1.95 15-Mar-2006 deraadt

bogus idiom


Revision tags: OPENBSD_3_9_BASE
# 1.94 29-Jan-2006 xsa

spread some fatal() here too;


# 1.93 26-Jan-2006 xsa

strings cleanup; OK niallo@.


# 1.92 23-Jan-2006 xsa

print complete command name in usage, not aliases.


# 1.91 02-Jan-2006 xsa

- nuke remaining err(), errx() and warnx() instances.
- make cvs_log_init() return type void.
ok joris@.


# 1.90 02-Jan-2006 xsa

#include's cleanup; ok joris@ niallo@.


# 1.89 19-Dec-2005 xsa

use fatal() if getpwuid() fails; OK joris@.


# 1.88 10-Dec-2005 joris

switch to xmalloc stuff, me and xsa@ agreed on this a long
time ago, but we were being held back by jfb. too bad for him.

next step is to use fatal() through out the code for unrecoverable
errors instead of trying to be all nice and fluffy and reach main() again.

ok niallo@ and xsa@


# 1.87 03-Dec-2005 joris

fix date handling in opencvs, this was broken since the very start.
now, when you checkout a tree with gnu cvs, opencvs no longer sees all
the files as modified, and visa versa.

this actually makes gnu cvs and opencvs dance together in working copies.


# 1.86 12-Nov-2005 niallo

- remove strtab stuff. serves no useful purpose.

diff is from joris@, committing on his behalf because his net connection
is very dodgy right now.


# 1.85 07-Oct-2005 reyk

knf and spacing, ok joris@


Revision tags: OPENBSD_3_8_BASE
# 1.84 10-Aug-2005 xsa

fgets() expects the 2nd arg to be an int. OK jfb@ joris@.


# 1.83 10-Aug-2005 xsa

add global -w option and document it; ok jmc joris


# 1.82 10-Aug-2005 xsa

use correct return codes when we exit(); ok joris


# 1.81 09-Aug-2005 xsa

add missing [-T tmpdir] in usage(), spotted by jmc@.


# 1.80 04-Aug-2005 xsa

handle TMPDIR environment variable as well as -T <tmpdir> global option;
Ok jfb@ joris@.


# 1.79 03-Aug-2005 xsa

check only once for the HOME environment variable and reuse
its value (if any) to check for the .cvsrc and .cvsignore files;
ok jfb@ joris@.


# 1.78 01-Aug-2005 xsa

respect $HOME when checking for .cvsrc; ok jfb@ joris@.


# 1.77 30-Jul-2005 xsa

add missing -r in usage();


# 1.76 28-Jul-2005 xsa

respect CVSREAD env. variable; ok jfb@.


# 1.75 25-Jul-2005 xsa

KNF;


# 1.74 24-Jul-2005 xsa

some more `if (!var)' cleanup;


# 1.73 23-Jul-2005 joris

rewrite of the file code. the previous one was just
a mess and not clean.
this code is much cleaner, faster, and uses less memory overall.

tested by xsa@, brad@, Michael Knudsen, and myself.
okay xsa@


# 1.72 07-Jul-2005 joris

remove trailing whitespaces

from deraadt@


# 1.71 16-Jun-2005 xsa

match gnu/usr.bin/cvs error msg output on bad CVSROOT error; ok joris


# 1.70 10-Jun-2005 joris

allow comments in the cvsrc file.
reported by david@


# 1.69 01-Jun-2005 joris

missed these in previous commits.


# 1.68 31-May-2005 xsa

headers ordering (alphabetically) and cleanup, from mbalmer@ and myself;


# 1.67 24-May-2005 jfb

Merge the cvs_cmd and cvs_cmd_info structures and add the necessary
fields to hook local versions of the commands. This needs to go in
before it gets any bigger

ok joris


# 1.66 23-May-2005 joris

add -n flag to cvs usage

ok jfb@


# 1.65 20-May-2005 xsa

first bits of the `cvs -n' option; ok jfb joris


# 1.64 19-May-2005 xsa

- add missing flags for the log command
- enable the -h -N -R -t options
ok joris


# 1.63 18-May-2005 xsa

add `dir' arg in release cmd synopsis;


# 1.62 17-May-2005 xsa

enable `release' command; tested & ok joris@.


# 1.61 25-Apr-2005 jfb

resurrect missing parts to generate rcsdiff(1)-style diffs with the -n
flag

ok xsa


# 1.60 25-Apr-2005 jfb

* add missing 'R' flag in diff synopsis
* add the CVS_EX_BADROOT return code to indicate that there was no
CVSROOT given or it was invalid

ok joris, xsa


# 1.59 22-Apr-2005 xsa

sync add command usage w/ man page; joris ok


# 1.58 22-Apr-2005 joris

missing '-R' (force recursion) option for diff.

noticed by brad@


# 1.57 21-Apr-2005 xsa

let the `cvs remove' command work with no file(s) specified as args;
joris ok


# 1.56 21-Apr-2005 jfb

* fix the tag command's synopsis
* prepend __progname and the command string when displaying command
usage


# 1.55 20-Apr-2005 jfb

check the validity of tag names passed to the tag command, and print
an abort message if the tag is invalid. also, match gnu cvs behaviour
with regards to command usage output on usage errors.

ok joris


# 1.54 16-Apr-2005 xsa

snprintf return value check; joris ok


# 1.53 12-Apr-2005 joris

don't show unneeded error messages.


# 1.52 12-Apr-2005 xsa

tell about the CVS_EX_* error codes, as we do not use sysexits.h anymore;
ok joris@.


# 1.51 12-Apr-2005 joris

introduce our own set of error codes used by the commands to report
what exactly went wrong in case of an error.

ok jfb@


# 1.50 11-Apr-2005 joris

don't include sysexits.h now we don't use those error codes
anymore.


# 1.49 11-Apr-2005 joris

remove EX_USAGE error codes

ok jfb@


# 1.48 06-Apr-2005 jfb

make cvs_findcmd() available to the rest of the program

ok joris@


# 1.47 03-Apr-2005 xsa

first round of EX_* exit codes removal; ok joris@.


# 1.46 31-Mar-2005 joris

make sure the server command can still be reached with the
new framework.

ok xsa@


# 1.45 30-Mar-2005 joris

move all the client commands to the new command framework.
eliminates a lot of duplicate code.

ok jfb@


# 1.44 24-Mar-2005 jfb

add the string table code and enable it on startup


# 1.43 24-Mar-2005 joris

add the first pieces of our new command framework.

ok jfb@


Revision tags: OPENBSD_3_7_BASE
# 1.42 08-Mar-2005 joris

make cvs_findcmd() and cvs_read_rcfile() static.

ok xsa@, jfb@


# 1.41 06-Mar-2005 joris

initial support for the admin command. Not all options are working yet.

ok xsa@ jfb@


# 1.40 25-Feb-2005 jfb

exit with an error message if cvs_file_init() fails


# 1.39 03-Feb-2005 xsa

be more consistent everywhere with `-k mode' option;
ok jfb@ jmc@ Joris Vink;


# 1.38 24-Jan-2005 jfb

sync usage of some of the commands, and start filling the cmd_opts
field, which will later be used as the argument to getopt() instead
of hardcoding the option strings. This will allow us to use the
same handler for commands which have a local and remote version
(i.e. rdiff, rlog, rtag)


# 1.37 24-Jan-2005 jfb

* use the global cvs_msg instead of our own
* support the use of RCS keyword expansion flags in client mode


# 1.36 24-Jan-2005 jfb

add missing command IDs

reviewed by xsa@ and Joris Vink


# 1.35 14-Jan-2005 jfb

support the -D option to the tag command and sync usage for the tag
command

from Joris Vink, with modifications by me


# 1.34 13-Jan-2005 jfb

resurrect the -N and -p options to the diff command

requested and tested by brad@, thanks!


# 1.33 13-Jan-2005 jfb

more widespread use of cvs_msg, and free it when we are done

diff by Joris Vink and me


# 1.32 13-Jan-2005 jfb

fix the annotate usage (there is no -F flag) and add the missing bits
so the -r and -f arguments are supported, and complain if both -D
and -r are given. GNU CVS silently accepts to have both specified,
but does not produce output as a result.


# 1.31 06-Jan-2005 jfb

the status command now supports the same arguments as its gnu cvs
counterpart (-lRv)


# 1.30 06-Jan-2005 jfb

Improved and working import code from Joris Vink with modifications
from me (client mode only for the moment)


# 1.29 22-Dec-2004 david

spelling corrections; ok jmc@


# 1.28 21-Dec-2004 xsa

s/files/file/ in `cvs remove' usage, like in the other commands;


# 1.27 21-Dec-2004 jfb

gnu CVS has an undocumented -s command-line option to set a variable,
so let's support it too. This will also be required to implement the
`Set' request handler.


# 1.26 21-Dec-2004 xsa

on the way to `cvs remove'; ok jfb


# 1.25 15-Dec-2004 xsa

print line number of warnings in .cvsrc; ok jfb@.


# 1.24 15-Dec-2004 jfb

Permit the client to generate trace output when the -t option is given
by using the LP_TRACE level to cvs_log(). Traces are filtered by
default.


# 1.23 14-Dec-2004 xsa

be more verbose for .cvsrc errors/warnings; ok jfb@.


# 1.22 14-Dec-2004 jfb

support the tag command

from Joris Vink


# 1.21 13-Dec-2004 xsa

print full path of .cvsrc in log messages; jfb@ ok.


# 1.20 13-Dec-2004 jmc

sync SYNOPSIS and usage();
ok jfb@


# 1.19 09-Dec-2004 jfb

support the 'annotate' command, will need some polishing


# 1.18 07-Dec-2004 tedu

less whitespace, more pretty. ok jfb


# 1.17 07-Dec-2004 jfb

add missing parts for support of .cvsrc

tested, tweaked by and ok djm@


# 1.16 06-Dec-2004 jfb

add missing aliases for the status, tag, update and version commands

original patch from Peter Hessler, with additions by me


# 1.15 06-Dec-2004 deraadt

tighten vertical spacing for else; jfb ok


# 1.14 09-Nov-2004 krapht

* don't use the import code just yet, it uses new functions that aren't
tested enough yet


# 1.13 09-Nov-2004 krapht

* don't setup a signal handler for SIGCHLD yet
* ignore SIGPIPE
* add the getopt() argument format to the command structure


# 1.12 12-Aug-2004 jfb

After the command is done executing, if cvs_files isn't NULL, free the
file structure


# 1.11 06-Aug-2004 jfb

Handle the '-b' and '-x' global options even if we don't support them,
and add support for case insensitivity


# 1.10 06-Aug-2004 jfb

Have one global hierarchy of files that are being affected. This will
allow us to build the tree in memory as well as on disk for operations
such as checkout and update. It will also allow us to write all Entries
in a single disk write and to avoid creating empty directories on updates
when pruning is requested


# 1.9 30-Jul-2004 jfb

No more global cvs_root


# 1.8 30-Jul-2004 jfb

missing include


# 1.7 30-Jul-2004 jfb

Plug in the handler for `cvs status'


# 1.6 30-Jul-2004 jfb

Move to the new API for the client-server protocol. All functions now
take a cvs root structure as parameter. This will allow for much easier
management of CVS trees that make use of multiple roots.


# 1.5 29-Jul-2004 jfb

undefine DEBUG


# 1.4 26-Jul-2004 jfb

Add the handler for the checkout command


# 1.3 14-Jul-2004 jfb

add a usage string for cvs diff options


# 1.2 14-Jul-2004 jfb

cvsignore support and simpler API for file access


# 1.1 13-Jul-2004 jfb

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.159 01-Jun-2017 joris

Stop looking at current_cvsroot->cr_method to figure out if we're remote or not.

Instead use cvsroot_is_local() and cvsroot_is_remote().


Revision tags: OPENBSD_6_1_BASE
# 1.158 04-Sep-2016 tb

Add missing getpw pledge

ok deraadt


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.157 19-Nov-2015 deraadt

opencvs can use pledge "stdio rpath wpath cpath fattr proc exec".
I have not looked into adding stricter pledges later in the code.


# 1.156 05-Nov-2015 nicm

Remove xfree(), like already done for RCS. From Michael W Bombardieri,
ok mmcc


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.155 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.154 01-Dec-2014 deraadt

An internal function called xrealloc() is actually a fail-hard
reallocarray()... so rename it.


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.153 08-Jan-2014 okan

unsigned char for ctype. ok deraadt


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.152 20-Sep-2011 nicm

Lose unused variable cvs_msg, from Michael W Bombardieri.


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.151 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


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.150 21-Jun-2008 joris

add a hash table mechanism based upon hcreate(3) but one that allows
us to maintain multiple hash tables concurrently.

immediatly start using it to keep track of what directories
we have already created and what CVS dirs we already created so
we do not recreate them when we do not need to.

we will be switching more internals to use this soon.
rejoice for cheaper lookups.

ok tobias@


# 1.149 17-Jun-2008 joris

unused vars


# 1.148 14-Jun-2008 joris

don't always re-open the same CVS/Entries file, instead keep the
last opened CVS/Entries around to operate on and close it whenever
we switch directory. gives us a small performance boost, obviously.

while doing this, switch the way we write revisions to disk by
using fwrite(3) so stuff can get written to disk in chunks
instead of writing everything line by line, another win.

with help from otto@
ok tobias@


# 1.147 10-Jun-2008 joris

make opencvs behave exactly like GNU cvs does when it comes to
verbosity, it's verbose by default and you can shut it up using -Q.

ok tobias@


# 1.146 30-May-2008 tobias

Set up cmdp before first possible call of fatal to avoid NULL pointer
dereference in logging code. Spotted by Igor Zinovik.

ok joris


# 1.145 28-May-2008 tobias

Don't limit ourselfs when it comes to arguments on command line or
arguments sent by client.

ok joris


# 1.144 08-Mar-2008 tobias

Set umask (and cvs_umask) to system's umask in local and client mode.
Also zap umask(0);umask(mask); calls, we have cvs_umask for this.

ok joris


Revision tags: OPENBSD_4_3_BASE
# 1.143 26-Feb-2008 joris

spacing


# 1.142 02-Feb-2008 joris

initial CVSROOT/modules support, only does aliases at the moment (-a).
"modules.c, hurray!" xsa@, ok tobias@


# 1.141 28-Jan-2008 tobias

Zapped some variables which made the source harder to read (and to verify).

> Diff from Igor Zinovik


# 1.140 10-Jan-2008 tobias

Simply the use of cmdp and cvs_command by zapping cvs_command and working
solely with cmdp. This remedies some reliability issues with invalid
commands supplied and also fixes a GNU cvs style incompatibility with
release command.

> Based on patch from Igor Zinovik


# 1.139 07-Oct-2007 chl

break after exit() is useless

ok ray@


# 1.138 19-Sep-2007 tobias

Allow lines which do not specify any arguments for command (or cvs).
Sticks at GNU cvs behaviour.

OK joris@


# 1.137 19-Sep-2007 tobias

parse global arguments (cvs) and command arguments only once, i.e. first
line of occurence. Nice side-effect: only parse arguments for current
command, not for all.

OK joris@


# 1.136 19-Sep-2007 tobias

Print warning about invalid command in .cvsrc only if -V is in use.
OpenCVS defaults to -q, so man page should say "with -V", not "without -q
or -Q".

OK joris@


# 1.135 19-Sep-2007 tobias

Next to ' ', '\t' is valid between command and arguments.

OK joris@


# 1.134 19-Sep-2007 tobias

Weird, but our goal is compatibility: treat '\t' in front of keyword as '#'.

OK joris@


# 1.133 19-Sep-2007 tobias

Usage of fgetln() instead of fgets() in .cvsrc parsing handles line
numbers better and allows longer command arguments.

OK joris@


# 1.132 10-Sep-2007 tobias

Fixed segmentation fault that occured during .cvsrc parsing if an invalid
cvs command has been specified.

Spotted by Mathias De Belder <mathias at woei dot be> who also supplied a
patch, although I took his second suggestion.

OK joris@


# 1.131 07-Sep-2007 tobias

Do not fatal if getpwuid() fails, instead ignore user configuration files.

OK joris@


# 1.130 02-Sep-2007 tobias

Stick at GNU cvs behaviour with Root directive handling: it does not need
to be sent first, can occure multiple times (although this is ignored) but
should be supplied before Directory.

OK joris@


Revision tags: OPENBSD_4_2_BASE
# 1.129 06-Aug-2007 sobrado

the ellipsis is not an optional argument; while here, sync the usage
and synopsis of commands

lots of good ideas by jmc@

ok jmc@


# 1.128 27-May-2007 ray

Add bounds check for cvs command arguments. Initial diff by Tobias
Stoeckmann, rearranged to "if (num_items >= BUFSIZ)" format for
readability.

I would have liked to allow our cvs client to accept as many arguments
as the system would allow, but the argument parsing code is surprising
hairy.

OK niallo@.


# 1.127 27-May-2007 ray

Revert, we dealt with the -x flag in the past. jmc suddenly
remembered we had created a separate section for compatibility
flags. Oh well, two free commits.

OK jmc@


# 1.126 27-May-2007 ray

Mention -x flag (for compatibility only). From Tobias Stoeckmann.

Input and OK jmc@


# 1.125 27-May-2007 ray

Call fatal() if extra arguments are given to "opencvs server". From
Tobias Stoeckmann.

OK niallo@


# 1.124 26-May-2007 ray

cvs_server_path is more appropriate to check than cvs_server_active.

From Tobias Stoeckmann.

OK niallo@


# 1.123 22-May-2007 xsa

Note that the global -x option is kept for compatibility (for now) and has
no effect.


# 1.122 09-May-2007 xsa

- we do not have -H, zap it.
- add missing `x' flag in getopt() and sort flags.
- sync usage().

Based on initial diff from Tobias Stoeckmann.


# 1.121 30-Apr-2007 xsa

make usage() __dead; from Tobias Stoeckmann.


# 1.120 30-Apr-2007 xsa

missing header; from Tobias Stoeckmann.


# 1.119 24-Apr-2007 sobrado

changes "Usage" to "usage"; sorts options list in cvs history;
the argument to -z is tz, not timezone; argument names to flags
should use lowercase letters; cvs's usage() output should fit
on a 80-column display

ok by jmc@, niallo@ and xsa@


Revision tags: OPENBSD_4_1_BASE
# 1.118 24-Feb-2007 otto

fix comment; from jared r r spiegel


# 1.117 22-Feb-2007 otto

general includes cleanup sweep. ok joris@ niallo@


# 1.116 17-Feb-2007 xsa

cvs_path_cat() removal since we can now easily handle that
functionality w/ xsnprintf(); Initial diff started by thib@.
OK thib@ joris@.


# 1.115 09-Feb-2007 joris

strtol(3) -> strtonum(3)


# 1.114 06-Feb-2007 jmc

sort options;


# 1.113 11-Jan-2007 joris

in a remote setup:
do not connect to the remote server until we are sure all the options
passed to the commands are valid.

noticed by xsa@


# 1.112 11-Dec-2006 xsa

global option -n implies -l


# 1.111 11-Dec-2006 xsa

Permit checkout from a read-only repository using the -R global option
or using the CVSREADONLYFS environment variable.
Request/test/ok todd@. Man page bits courtesy of jmc@.


# 1.110 28-Nov-2006 xsa

snprintf() -> cvs_path_cat()


# 1.109 14-Nov-2006 xsa

Add support for the "Set" request.


# 1.108 14-Nov-2006 xsa

Simplify in cvs_read_rcfile() by using cvs_path_cat();


Revision tags: OPENBSD_4_0_BASE
# 1.107 09-Jul-2006 joris

handle SIGPIPE correctly.


# 1.106 07-Jul-2006 joris

first part of opencvs remote, fairly useable on existing trees
although i advise against using it on real development trees for now.

only a few commands work right so far:
- commit
- diff
- status
- log
- update (partially working)

if you feel like testing remote and run into bugs feel free to
contact me, and please include a full trace (-t).


# 1.105 28-Jun-2006 reyk

use quiet mode (-q) by default and add a flag -V for the old "verbose"
mode. if you really need to know all the details (the old GNU'ish
behaviour), use -V or even -t for tracing.

ok joris@


# 1.104 13-Jun-2006 joris

be more accurate in describing what happened
when we cannot see the repository the user wants to work with.


# 1.103 12-Jun-2006 xsa

bring back a working version of the `cvs init' command. OK joris@.


# 1.102 02-Jun-2006 david

various spelling fixes


# 1.101 30-May-2006 joris

nuke cvs_repo_base variable


# 1.100 27-May-2006 joris

lets be nice and abort cvs when we find out there is
no CVSROOT directory where there is suppose to be one.


# 1.99 27-May-2006 joris

basic support for CVSROOT/config - only supporting the 'tag' and
'umask' keyword right now.


# 1.98 27-May-2006 joris

commit the new opencvs code, i have been hacking on
this for the past 2 weeks now and it should go in at
the start of the hackathon so others can help out.

this code is a lot safer, smarter, faster and best of
all it is actually doing what it is suppose to do!

basic checkout, update, status, diff and commit are
working in local mode only.
there is no support for any remote setups now.


# 1.97 14-Apr-2006 deraadt

remove a metric buttload of excessive ()
no binary change; ok ray


# 1.96 05-Apr-2006 ray

Use variable names for sizeof, remove casts in front of xmalloc,
use xcalloc and xstrdup where appropriate, and other stuff.

OK joris@


# 1.95 15-Mar-2006 deraadt

bogus idiom


Revision tags: OPENBSD_3_9_BASE
# 1.94 29-Jan-2006 xsa

spread some fatal() here too;


# 1.93 26-Jan-2006 xsa

strings cleanup; OK niallo@.


# 1.92 23-Jan-2006 xsa

print complete command name in usage, not aliases.


# 1.91 02-Jan-2006 xsa

- nuke remaining err(), errx() and warnx() instances.
- make cvs_log_init() return type void.
ok joris@.


# 1.90 02-Jan-2006 xsa

#include's cleanup; ok joris@ niallo@.


# 1.89 19-Dec-2005 xsa

use fatal() if getpwuid() fails; OK joris@.


# 1.88 10-Dec-2005 joris

switch to xmalloc stuff, me and xsa@ agreed on this a long
time ago, but we were being held back by jfb. too bad for him.

next step is to use fatal() through out the code for unrecoverable
errors instead of trying to be all nice and fluffy and reach main() again.

ok niallo@ and xsa@


# 1.87 03-Dec-2005 joris

fix date handling in opencvs, this was broken since the very start.
now, when you checkout a tree with gnu cvs, opencvs no longer sees all
the files as modified, and visa versa.

this actually makes gnu cvs and opencvs dance together in working copies.


# 1.86 12-Nov-2005 niallo

- remove strtab stuff. serves no useful purpose.

diff is from joris@, committing on his behalf because his net connection
is very dodgy right now.


# 1.85 07-Oct-2005 reyk

knf and spacing, ok joris@


Revision tags: OPENBSD_3_8_BASE
# 1.84 10-Aug-2005 xsa

fgets() expects the 2nd arg to be an int. OK jfb@ joris@.


# 1.83 10-Aug-2005 xsa

add global -w option and document it; ok jmc joris


# 1.82 10-Aug-2005 xsa

use correct return codes when we exit(); ok joris


# 1.81 09-Aug-2005 xsa

add missing [-T tmpdir] in usage(), spotted by jmc@.


# 1.80 04-Aug-2005 xsa

handle TMPDIR environment variable as well as -T <tmpdir> global option;
Ok jfb@ joris@.


# 1.79 03-Aug-2005 xsa

check only once for the HOME environment variable and reuse
its value (if any) to check for the .cvsrc and .cvsignore files;
ok jfb@ joris@.


# 1.78 01-Aug-2005 xsa

respect $HOME when checking for .cvsrc; ok jfb@ joris@.


# 1.77 30-Jul-2005 xsa

add missing -r in usage();


# 1.76 28-Jul-2005 xsa

respect CVSREAD env. variable; ok jfb@.


# 1.75 25-Jul-2005 xsa

KNF;


# 1.74 24-Jul-2005 xsa

some more `if (!var)' cleanup;


# 1.73 23-Jul-2005 joris

rewrite of the file code. the previous one was just
a mess and not clean.
this code is much cleaner, faster, and uses less memory overall.

tested by xsa@, brad@, Michael Knudsen, and myself.
okay xsa@


# 1.72 07-Jul-2005 joris

remove trailing whitespaces

from deraadt@


# 1.71 16-Jun-2005 xsa

match gnu/usr.bin/cvs error msg output on bad CVSROOT error; ok joris


# 1.70 10-Jun-2005 joris

allow comments in the cvsrc file.
reported by david@


# 1.69 01-Jun-2005 joris

missed these in previous commits.


# 1.68 31-May-2005 xsa

headers ordering (alphabetically) and cleanup, from mbalmer@ and myself;


# 1.67 24-May-2005 jfb

Merge the cvs_cmd and cvs_cmd_info structures and add the necessary
fields to hook local versions of the commands. This needs to go in
before it gets any bigger

ok joris


# 1.66 23-May-2005 joris

add -n flag to cvs usage

ok jfb@


# 1.65 20-May-2005 xsa

first bits of the `cvs -n' option; ok jfb joris


# 1.64 19-May-2005 xsa

- add missing flags for the log command
- enable the -h -N -R -t options
ok joris


# 1.63 18-May-2005 xsa

add `dir' arg in release cmd synopsis;


# 1.62 17-May-2005 xsa

enable `release' command; tested & ok joris@.


# 1.61 25-Apr-2005 jfb

resurrect missing parts to generate rcsdiff(1)-style diffs with the -n
flag

ok xsa


# 1.60 25-Apr-2005 jfb

* add missing 'R' flag in diff synopsis
* add the CVS_EX_BADROOT return code to indicate that there was no
CVSROOT given or it was invalid

ok joris, xsa


# 1.59 22-Apr-2005 xsa

sync add command usage w/ man page; joris ok


# 1.58 22-Apr-2005 joris

missing '-R' (force recursion) option for diff.

noticed by brad@


# 1.57 21-Apr-2005 xsa

let the `cvs remove' command work with no file(s) specified as args;
joris ok


# 1.56 21-Apr-2005 jfb

* fix the tag command's synopsis
* prepend __progname and the command string when displaying command
usage


# 1.55 20-Apr-2005 jfb

check the validity of tag names passed to the tag command, and print
an abort message if the tag is invalid. also, match gnu cvs behaviour
with regards to command usage output on usage errors.

ok joris


# 1.54 16-Apr-2005 xsa

snprintf return value check; joris ok


# 1.53 12-Apr-2005 joris

don't show unneeded error messages.


# 1.52 12-Apr-2005 xsa

tell about the CVS_EX_* error codes, as we do not use sysexits.h anymore;
ok joris@.


# 1.51 12-Apr-2005 joris

introduce our own set of error codes used by the commands to report
what exactly went wrong in case of an error.

ok jfb@


# 1.50 11-Apr-2005 joris

don't include sysexits.h now we don't use those error codes
anymore.


# 1.49 11-Apr-2005 joris

remove EX_USAGE error codes

ok jfb@


# 1.48 06-Apr-2005 jfb

make cvs_findcmd() available to the rest of the program

ok joris@


# 1.47 03-Apr-2005 xsa

first round of EX_* exit codes removal; ok joris@.


# 1.46 31-Mar-2005 joris

make sure the server command can still be reached with the
new framework.

ok xsa@


# 1.45 30-Mar-2005 joris

move all the client commands to the new command framework.
eliminates a lot of duplicate code.

ok jfb@


# 1.44 24-Mar-2005 jfb

add the string table code and enable it on startup


# 1.43 24-Mar-2005 joris

add the first pieces of our new command framework.

ok jfb@


Revision tags: OPENBSD_3_7_BASE
# 1.42 08-Mar-2005 joris

make cvs_findcmd() and cvs_read_rcfile() static.

ok xsa@, jfb@


# 1.41 06-Mar-2005 joris

initial support for the admin command. Not all options are working yet.

ok xsa@ jfb@


# 1.40 25-Feb-2005 jfb

exit with an error message if cvs_file_init() fails


# 1.39 03-Feb-2005 xsa

be more consistent everywhere with `-k mode' option;
ok jfb@ jmc@ Joris Vink;


# 1.38 24-Jan-2005 jfb

sync usage of some of the commands, and start filling the cmd_opts
field, which will later be used as the argument to getopt() instead
of hardcoding the option strings. This will allow us to use the
same handler for commands which have a local and remote version
(i.e. rdiff, rlog, rtag)


# 1.37 24-Jan-2005 jfb

* use the global cvs_msg instead of our own
* support the use of RCS keyword expansion flags in client mode


# 1.36 24-Jan-2005 jfb

add missing command IDs

reviewed by xsa@ and Joris Vink


# 1.35 14-Jan-2005 jfb

support the -D option to the tag command and sync usage for the tag
command

from Joris Vink, with modifications by me


# 1.34 13-Jan-2005 jfb

resurrect the -N and -p options to the diff command

requested and tested by brad@, thanks!


# 1.33 13-Jan-2005 jfb

more widespread use of cvs_msg, and free it when we are done

diff by Joris Vink and me


# 1.32 13-Jan-2005 jfb

fix the annotate usage (there is no -F flag) and add the missing bits
so the -r and -f arguments are supported, and complain if both -D
and -r are given. GNU CVS silently accepts to have both specified,
but does not produce output as a result.


# 1.31 06-Jan-2005 jfb

the status command now supports the same arguments as its gnu cvs
counterpart (-lRv)


# 1.30 06-Jan-2005 jfb

Improved and working import code from Joris Vink with modifications
from me (client mode only for the moment)


# 1.29 22-Dec-2004 david

spelling corrections; ok jmc@


# 1.28 21-Dec-2004 xsa

s/files/file/ in `cvs remove' usage, like in the other commands;


# 1.27 21-Dec-2004 jfb

gnu CVS has an undocumented -s command-line option to set a variable,
so let's support it too. This will also be required to implement the
`Set' request handler.


# 1.26 21-Dec-2004 xsa

on the way to `cvs remove'; ok jfb


# 1.25 15-Dec-2004 xsa

print line number of warnings in .cvsrc; ok jfb@.


# 1.24 15-Dec-2004 jfb

Permit the client to generate trace output when the -t option is given
by using the LP_TRACE level to cvs_log(). Traces are filtered by
default.


# 1.23 14-Dec-2004 xsa

be more verbose for .cvsrc errors/warnings; ok jfb@.


# 1.22 14-Dec-2004 jfb

support the tag command

from Joris Vink


# 1.21 13-Dec-2004 xsa

print full path of .cvsrc in log messages; jfb@ ok.


# 1.20 13-Dec-2004 jmc

sync SYNOPSIS and usage();
ok jfb@


# 1.19 09-Dec-2004 jfb

support the 'annotate' command, will need some polishing


# 1.18 07-Dec-2004 tedu

less whitespace, more pretty. ok jfb


# 1.17 07-Dec-2004 jfb

add missing parts for support of .cvsrc

tested, tweaked by and ok djm@


# 1.16 06-Dec-2004 jfb

add missing aliases for the status, tag, update and version commands

original patch from Peter Hessler, with additions by me


# 1.15 06-Dec-2004 deraadt

tighten vertical spacing for else; jfb ok


# 1.14 09-Nov-2004 krapht

* don't use the import code just yet, it uses new functions that aren't
tested enough yet


# 1.13 09-Nov-2004 krapht

* don't setup a signal handler for SIGCHLD yet
* ignore SIGPIPE
* add the getopt() argument format to the command structure


# 1.12 12-Aug-2004 jfb

After the command is done executing, if cvs_files isn't NULL, free the
file structure


# 1.11 06-Aug-2004 jfb

Handle the '-b' and '-x' global options even if we don't support them,
and add support for case insensitivity


# 1.10 06-Aug-2004 jfb

Have one global hierarchy of files that are being affected. This will
allow us to build the tree in memory as well as on disk for operations
such as checkout and update. It will also allow us to write all Entries
in a single disk write and to avoid creating empty directories on updates
when pruning is requested


# 1.9 30-Jul-2004 jfb

No more global cvs_root


# 1.8 30-Jul-2004 jfb

missing include


# 1.7 30-Jul-2004 jfb

Plug in the handler for `cvs status'


# 1.6 30-Jul-2004 jfb

Move to the new API for the client-server protocol. All functions now
take a cvs root structure as parameter. This will allow for much easier
management of CVS trees that make use of multiple roots.


# 1.5 29-Jul-2004 jfb

undefine DEBUG


# 1.4 26-Jul-2004 jfb

Add the handler for the checkout command


# 1.3 14-Jul-2004 jfb

add a usage string for cvs diff options


# 1.2 14-Jul-2004 jfb

cvsignore support and simpler API for file access


# 1.1 13-Jul-2004 jfb

branches: 1.1.1;
Initial revision