1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

Import a slightly newer version of 1.9.9 (as at 970523) that has fixed a

few more memory leaks and cleaned up getopt usage.  These were done shortly
after the last one I imported.  Very little has changed other than that.
(except for some doc updates)

Obtained from: cyclic.com
This commit is contained in:
Peter Wemm 1997-05-23 14:48:05 +00:00
parent 4a59246031
commit aa134866ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/cvs/dist/; revision=26065
33 changed files with 427 additions and 75 deletions

View File

@ -15,6 +15,16 @@ similar file for the unix-like operating systems (not yet, at least).
This file also might contain some platform-specific bugs.
* Exporting binary files on non-unix clients with "cvs export" does
not work. The workaround is to use "cvs checkout" instead. If you
are thinking of fixing this, check out the comment "For cvs export,
assume it is a text file." in client.c.
* Wrappers do not work client/server, and there are a variety of other
bugs and annoyances with wrappers.
* Some people have reported seeing the message "dying gasps from %s
unexpected" (where %s is the name of your server) when using
client/server CVS. One person reported that this had to do with using

View File

@ -1,3 +1,11 @@
Wed May 21 17:02:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* BUGS: Add item about wrappers.
Fri May 16 13:43:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* BUGS: Add item about "cvs export" and binary files.
Sun May 11 11:38:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* README.VMS: Remove information about "direct TCP". Noone has

View File

@ -1,3 +1,10 @@
17 May 1997 Jim Kingdon
* listen2.c: Failed attempt at making this do what it was
intended to do. Will need to rethink the approach.
* listen2.mak: The usual involuntary tweaks.
* .cvsignore: Add listen2.ncb listen2.mdp.
Mon May 12 11:59:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* listener.c: Removed; see ../ChangeLog for rationale.

View File

@ -5,6 +5,8 @@
#include <winsock.h>
#include <stdio.h>
#include <io.h>
#include <process.h>
int
main ()
@ -42,12 +44,51 @@ main ()
while (1)
{
int sasize = sizeof (sa);
#if 0
int save_stdin, save_stdout;
#endif
s = accept (t, (struct sockaddr *) &sa, &sasize);
if (s == INVALID_SOCKET)
{
printf ("Cannot accept(): %d\n", WSAGetLastError ());
exit (1);
}
#if 0
/* This, of course, does not work because sockets are
not file descriptors and file descriptors are not
sockets. Duh! */
save_stdin = _dup (0);
if (save_stdin < 0)
{
printf ("Cannot save stdin: %s\n", strerror (errno));
exit (1);
}
save_stdout = _dup (1);
if (save_stdout < 0)
{
printf ("Cannot save stdout: %s\n", strerror (errno));
exit (1);
}
if (_dup2 (s, 0) < 0)
{
printf ("Cannot dup stdin: %s\n", strerror (errno));
exit (1);
}
if (_dup2 (s, 1) < 0)
{
printf ("Cannot dup stdout: %s\n", strerror (errno));
exit (1);
}
/* Of course this will be "cvs" eventually, but "netstat"
is for testing. */
if (_spawnl (_P_DETACH, "netstat", "netstat", NULL) < 0)
{
printf ("Cannot spawn subprocess: %s\n", strerror (errno));
exit (1);
}
#else
if (send (s, "hello, world\n", 13, 0) == SOCKET_ERROR)
{
/* Note that we do not detect the case in which we sent
@ -55,6 +96,7 @@ main ()
printf ("Cannot send(): %d\n", WSAGetLastError ());
exit (1);
}
#endif
if (closesocket (s) != 0)
{
printf ("Cannot closesocket(): %d\n", WSAGetLastError ());

View File

@ -49,10 +49,11 @@ CPP=cl.exe
OUTDIR=.\Release
INTDIR=.\Release
ALL :
ALL : "$(OUTDIR)\listen2.exe"
CLEAN :
-@erase
-@erase ".\Release\listen2.exe"
-@erase ".\Release\listen2.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
@ -72,12 +73,18 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)/listen2.bsc"
BSC32_SBRS=
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /subsystem:console /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo\
/subsystem:console /incremental:no /pdb:"$(OUTDIR)/listen2.pdb" /machine:I386\
/out:"$(OUTDIR)/listen2.exe"
LINK32_OBJS=
LINK32_OBJS= \
"$(INTDIR)/listen2.obj"
"$(OUTDIR)\listen2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "listen2 - Win32 Debug"
@ -94,10 +101,15 @@ LINK32_OBJS=
OUTDIR=.\Debug
INTDIR=.\Debug
ALL :
ALL : "$(OUTDIR)\listen2.exe"
CLEAN :
-@erase
-@erase ".\Debug\listen2.exe"
-@erase ".\Debug\listen2.obj"
-@erase ".\Debug\listen2.ilk"
-@erase ".\Debug\listen2.pdb"
-@erase ".\Debug\vc40.pdb"
-@erase ".\Debug\vc40.idb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
@ -117,12 +129,18 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)/listen2.bsc"
BSC32_SBRS=
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib /nologo\
/subsystem:console /incremental:yes /pdb:"$(OUTDIR)/listen2.pdb" /debug\
/machine:I386 /out:"$(OUTDIR)/listen2.exe"
LINK32_OBJS=
LINK32_OBJS= \
"$(INTDIR)/listen2.obj"
"$(OUTDIR)\listen2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
@ -156,6 +174,15 @@ LINK32_OBJS=
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\listen2.c
"$(INTDIR)\listen2.obj" : $(SOURCE) "$(INTDIR)"
# End Source File
# End Target
# End Project
################################################################################

View File

@ -1,3 +1,45 @@
Thu May 22 09:25:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* cvs.texinfo (Error messages): Add comment about yet another way
to produce a "cannot open CVS/Entries for reading" error.
Tue May 20 17:54:55 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* cvs.texinfo (Error messages): Add item about EINVAL in rename.
Mon May 19 00:21:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* cvs.texinfo (Keywords in imports): New node.
(Tracking sources): Add comment about what a "vendor" is.
* cvs.texinfo (Keyword substitution): Where it refers to RCS
having a certain behavior, rewrite to not pass the buck like
that. Saying "RCS file" is still OK; that is a legit CVS
concept. A few other minor edits.
Sun May 18 10:24:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* RCSFILES: Add list of known newphrase extensions.
* cvs.texinfo (From other version control systems): Fix typo
("systesm" -> "systems").
* cvs.texinfo (Exit status): New node.
(diff): Replace text on exit status with an xref to that node.
The previous text documented a behavior which CVS no longer
implements.
(user-defined logging, commitinfo, verifymsg, Error messages):
Add index entries for "exit status, of <something which CVS invokes>".
* cvs.texinfo (Administrative files): Add comment concerning
writing triggers and particularly performance issues.
* cvs.texinfo (rtag options, tag options): Don't discuss what old
versions did with respect to the behavior now controlled by -F; we
don't try to document old versions here. Add comments concerning
how -F should be documented. Add index entries for "renaming
tags" and such pointing to "tag -F".
Wed May 14 12:16:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* cvs.texinfo (Binary files): Add text and comment about

View File

@ -37,6 +37,23 @@ for more information on them. CVS also sets the RCS state to "dead"
to indicate that a file does not exist in a given revision (this is
stored just as any other RCS state is).
The RCS file format allows quite a variety of extensions to be added
in a compatible manner by use of the "newphrase" feature documented in
rcsfile.5. We won't try to document extensions not used by CVS in any
detail, but we will briefly list them. Each occurrence of a newphrase
begins with an identifier, which is what we list here. Future
designers of extensions are strongly encouraged to pick
non-conflicting identifiers. Note that newphrase occurs several
places in the RCS grammar, and a given extension may not be legal in
all locations. However, it seems better to reserve a particular
identifier for all locations, to avoid confusion and complicated
rules.
Identifier Used by
---------- -------
namespace RCS library done at Silicon Graphics Inc. (SGI) in 1996
(a modified RCS 5.7--not sure it has any other name).
The rules regarding keyword expansion are not documented along with
the rest of the RCS file format; they are documented in the co(1)
manpage in the RCS 5.7 distribution. See also the "Keyword

View File

@ -2494,7 +2494,7 @@ files are binary and which are not. @xref{Wrappers}.
@c thinking of something more concise.
@node From other version control systems
@subsection Creating Files From Other Version Control Systems
@cindex Importing files, from other version control systesm
@cindex Importing files, from other version control systems
If you have a project which you are maintaining with
another version control system, such as @sc{rcs}, you
@ -4896,6 +4896,15 @@ are checking out contains any files in that directory.
@cindex Tracking sources
@c FIXME: Need discussion of added and removed files.
@c FIXME: This doesn't really adequately introduce the
@c concepts of "vendor" and "you". They don't *have*
@c to be separate organizations or separate people.
@c We want a description which is somewhat more based on
@c the technical issues of which sources go where, but
@c also with enough examples of how this relates to
@c relationships like customer-supplier, developer-QA,
@c maintainer-contributor, or whatever, to make it
@c seem concrete.
If you modify a program to better fit your site, you
probably want to include your modifications when the next
release of the program arrives. @sc{cvs} can help you with
@ -4928,6 +4937,7 @@ revision.
* Update imports:: Updating a module with the import command
* Reverting local changes:: Reverting a module to the latest vendor release
* Binary files in imports:: Binary files require special handling
* Keywords in imports:: Keyword substitution might be undesirable
@end menu
@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -5048,6 +5058,33 @@ after the @samp{-b}. @xref{admin options}.
Use the @samp{-k} wrapper option to tell import which
files are binary. @xref{Wrappers}.
@node Keywords in imports
@section How to handle keyword substitution with cvs import
The sources which you are importing may contain
keywords (@pxref{Keyword substitution}). For example,
the vendor may use @sc{cvs} or some other system
which uses similar keyword expansion syntax. If you
just import the files in the default fashion, then
the keyword expansions supplied by the vendor will
be replaced by keyword expansions supplied by your
own copy of @sc{cvs}. It may be more convenient to
maintain the expansions supplied by the vendor, so
that this information can supply information about
the sources that you imported from the vendor.
To maintain the keyword expansions supplied by the
vendor, supply the @samp{-ko} option to @code{cvs
import} the first time you import the file.
This will turn off keyword expansion
for that file entirely, so if you want to be more
selective you'll have to think about what you want
and use the @samp{-k} option to @code{cvs update} or
@code{cvs admin} as appropriate.
@c Supplying -ko to import if the file already existed
@c has no effect. Not clear to me whether it should
@c or not.
@c ---------------------------------------------------------------------
@node Moving files
@chapter Moving and renaming files
@ -5468,6 +5505,7 @@ Notified}); this command is useful even if you are not
using @code{cvs watch on}.
@cindex taginfo
@cindex exit status, of taginfo
The @file{taginfo} file defines programs to execute
when someone executes a @code{tag} or @code{rtag}
command. The @file{taginfo} file has the standard form
@ -5540,7 +5578,7 @@ But as soon as you export the files from your
development environment it becomes harder to identify
which revisions they are.
@sc{Rcs} uses a mechanism known as @dfn{keyword
CVS can use a mechanism known as @dfn{keyword
substitution} (or @dfn{keyword expansion}) to help
identifying the files. Embedded strings of the form
@code{$@var{keyword}$} and
@ -5550,7 +5588,7 @@ with strings of the form
a new revision of the file.
@menu
* Keyword list:: RCS Keywords
* Keyword list:: Keywords
* Using keywords:: Using keywords
* Avoiding substitution:: Avoiding substitution
* Substitution modes:: Substitution modes
@ -5562,8 +5600,13 @@ a new revision of the file.
@section RCS Keywords
@cindex RCS keywords
This is a list of the keywords that @sc{rcs} currently
(in release 5.6.0.1) supports:
@c FIXME: need some kind of example here I think,
@c perhaps in a
@c "Keyword intro" node. The intro in the "Keyword
@c substitution" node itself seems OK, but to launch
@c into a list of the keywords somehow seems too abrupt.
This is a list of the keywords:
@table @code
@cindex Author keyword
@ -5711,7 +5754,7 @@ keyword substitution. You can use @samp{-ko}
(@pxref{Substitution modes}) to turn off keyword
substitution entirely.
In many cases you can avoid using @sc{rcs} keywords in
In many cases you can avoid using keywords in
the source, even though they appear in the final
product. For example, the source for this manual
contains @samp{$@@asis@{@}Author$} whenever the text
@ -5722,7 +5765,7 @@ and @code{troff} you can embed the null-character
@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@node Substitution modes
@section Substitution modes
@cindex -k (RCS kflags)
@cindex -k (keyword substitution)
@cindex Kflag
@c FIXME: This could be made more coherent, by expanding it
@ -5805,10 +5848,14 @@ keyword---just do a @code{cvs log}. Once you export
the file the history information might be useless
anyhow.
A more serious concern is that @sc{rcs} is not good at
A more serious concern is that @sc{cvs} is not good at
handling @code{$@asis{}Log$} entries when a branch is
merged onto the main trunk. Conflicts often result
from the merging operation.
@c We say "cvs" even though it is done via rcsmerge;
@c this is an implementation detail. If the merging is
@c done in CVS instead, should check if this problem
@c still persists.
People also tend to "fix" the log entries in the file
(correcting spelling mistakes and maybe even factual
@ -6160,6 +6207,7 @@ reference to @sc{cvs} commands, @pxref{Invoking CVS}).
@menu
* Structure:: Overall structure of CVS commands
* Exit status:: Indicating CVS's success or failure
* ~/.cvsrc:: Default options with the ~/.csvrc file
* Global options:: Options you give to the left of cvs_command
* Common options:: Options you give to the right of cvs_command
@ -6224,6 +6272,40 @@ is accepted by more commands. In other words, do not
take the above categorization too seriously. Look at
the documentation instead.
@node Exit status
@appendixsec CVS's exit status
@cindex exit status, of CVS
CVS can indicate to the calling environment whether it
succeeded or failed by setting its @dfn{exit status}.
The exact way of testing the exit status will vary from
one operating system to another. For example in a unix
shell script the @samp{$?} variable will be 0 if the
last command returned a successful exit status, or
greater than 0 if the exit status indicated failure.
If CVS is successful, it returns a successful status;
if there is an error, it prints an error message and
returns a failure status. The one exception to this is
the @code{cvs diff} command. It will return a
successful status if it found no differences, or a
failure status if there were differences or if there
was an error. Because this behavior provides no good
way to detect errors, in the future it is possible that
@code{cvs diff} will be changed to behave like the
other @sc{cvs} commands.
@c It might seem like checking whether cvs -q diff
@c produces empty or non-empty output can tell whether
@c there were differences or not. But it seems like
@c there are cases with output but no differences
@c (testsuite basica-8b). It is not clear to me how
@c useful it is for a script to be able to check
@c whether there were differences.
@c FIXCVS? In previous versions of CVS, cvs diff
@c returned 0 for no differences, 1 for differences, or
@c 2 for errors. Is this behavior worth trying to
@c bring back (but what does it mean for VMS?)?
@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@node ~/.cvsrc
@appendixsec Default options and the ~/.cvsrc file
@ -7482,9 +7564,8 @@ If any file names are given, only those files are
compared. If any directories are given, all files
under them will be compared.
The exit status will be 0 if no differences were found,
1 if some differences were found, and 2 if any error
occurred.
The exit status for diff is different than for other
@sc{cvs} commands; for details @ref{Exit status}.
@menu
* diff options:: diff options
@ -8555,8 +8636,15 @@ recent revision (instead of ignoring the file).
@item -F
Overwrite an existing tag of the same name on a
different revision. This option is new in @sc{cvs}
1.4. The old behavior is matched by @samp{cvs tag -F}.
different revision.
@c FIXME: Needs an example, and/or more explanation.
@c Also needs to contrast this with the behavior if -F
@c is not specified, and the description needs to be
@c moved somewhere where it is shared between "tag" and
@c "rtag" (probably some sub-node of Revisions and
@c branches). Also should be clear about whether this
@c applies to branch tags, non-branch tags, or both.
@c Also this is *not* a common option.
@item -l
Local; run only in current working directory.
@ -8673,10 +8761,13 @@ These standard options are supported by @code{tag}
them):
@table @code
@cindex renaming tags
@cindex tags, renaming
@cindex moving tags
@item -F
Overwrite an existing tag of the same name on a
different revision. This option is new in @sc{cvs}
1.4. The old behavior is matched by @samp{cvs tag -F}.
different revision.
@c FIXME: See "rtag -F" for comments on this.
@item -l
Local; run only in current working directory.
@ -9651,6 +9742,13 @@ behavior}.
@cindex Reference manual (files)
@cindex CVSROOT (file)
@c FIXME? Somewhere there needs to be a more "how-to"
@c guide to writing these. I think the triggers
@c (commitinfo, loginfo, taginfo, &c) are perhaps a
@c different case than files like modules. One
@c particular issue that people sometimes are
@c (unnecessarily?) worried about is performance, and
@c the impact of writing in perl or sh or ____.
Inside the repository, in the directory
@file{$CVSROOT/CVSROOT}, there are a number of
supportive files for @sc{cvs}. You can use @sc{cvs} in a limited
@ -10114,6 +10212,7 @@ repository is appended to the template, followed by the
file names of any files involved in the commit (added,
removed, and modified files).
@cindex exit status, of commitinfo
The first line with a regular expression matching the
relative path to the module will be used. If the
command returns a non-zero exit status the commit will
@ -10184,6 +10283,7 @@ If the repository name does not match any of the
regular expressions in this file, the @samp{DEFAULT}
line is used, if it is specified.
@cindex exit status, of verifymsg
If the verification script exits with a non-zero exit status,
the commit is aborted.
@ -11015,6 +11115,7 @@ produced it should work fine.
@c For one example see basica-1a10 in the testsuite
@c For another example, "cvs co ." on NT; see comment
@c at windows-NT/filesubr.c (expand_wild).
@c For another example, "cvs co foo/bar" where foo exists.
@item cannot open CVS/Entries for reading: No such file or directory
This generally indicates a @sc{cvs} internal error, and
can be handled as with other @sc{cvs} bugs
@ -11022,6 +11123,12 @@ can be handled as with other @sc{cvs} bugs
exact nature of which would depend on the situation but
which hopefully could be figured out.
@item cvs [checkout aborted]: cannot rename file @var{file} to CVS/,,@var{file}: Invalid argument
This message has been reported as intermittently
happening with CVS 1.9 on Solaris 2.5. The cause is
unknown; if you know more about what causes it, let us
know as described in @ref{BUGS}.
@item cvs [update aborted]: could not patch @var{file}: No such file or directory
This means that there was a problem finding the
@code{patch} program. Make sure that it is in your
@ -11119,6 +11226,7 @@ it might be sufficient to place GNU diff3 in your
@c Should we mention the cvsaux binaries here?
@item cvs commit: warning: editor session failed
@cindex exit status, of editor
This means that the editor which @sc{cvs} is using exits with a nonzero
exit status. Some versions of vi will do this even when there was not
a problem editing the file. If so, point the

View File

@ -1,5 +1,41 @@
Fri May 16 13:14:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
* subr.c (free_names): Update documentation to reflect fact that
free_names is now called to free vectors allocated by expand_wild
as well as by line2argv.
* main.c (main): Use "xstrdup (foo)" not "xstrdup(foo)" as
specified in HACKING.
Fri May 16 15:10:37 1997 Norbert Kiesel <nk@cosa.de>
* modules.c (do_module): initialize optind to 0. use local copies
of optarg's (because they might me freed within free_names).
Thu May 15 11:50:15 1997 Norbert Kiesel <nk@cosa.de>
* main.c (main): initialize optind to 0. use local copies of
optarg's (because they might me freed within read_cvsrc).
* cvsrc.c (read_cvsrc): free old argv after constructing a new
one. This fixes a memory leak.
* recurse.c (start_recursion): use free_names() instead of
reimplementing it
* rcs.c (RCS_deltas): free branchversion (memory leak).
* parseinfo.c (Parse_Info): free some vars (3 memory leaks).
* logmsg.c (logfile_write): free str_list_format (memory leak).
* watch.c (watch_addremove), (watchers), update.c (update), tag.c
(cvstag), status.c (status), rtag.c (rtag), remove.c (cvsremove),
release.c (release), patch.c (patch), log.c (cvslog), import.c
(import), history.c (history), edit.c (watch_onoff), (edit),
(unedit), (editors), diff.c (diff), commit.c (commit), checkout.c
(checkout), add.c (add): initialize optind to 0
* diff.c (diff_fileproc): cosmetic change (whitespace added).
* checkout.c (checkout): move local variable definition into the

View File

@ -102,7 +102,7 @@ add (argc, argv)
wrap_setup ();
/* parse args */
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+k:m:")) != -1)
{
switch (c)

View File

@ -135,7 +135,7 @@ checkout (argc, argv)
ign_setup ();
wrap_setup ();
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, valid_options)) != -1)
{
switch (c)

View File

@ -332,7 +332,7 @@ commit (argc, argv)
}
#endif /* CVS_BADROOT */
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+nlRm:fF:r:")) != -1)
{
switch (c)

View File

@ -51,6 +51,13 @@ read_cvsrc (argc, argv, cmdname)
int max_new_argv;
char **new_argv;
/* old_argc and old_argv hold the values returned from the
previous invocation of read_cvsrc and are used to free the
allocated memory. The first invocation of read_cvsrc gets argv
from the system, this memory must not be free'd. */
static int old_argc = 0;
static char **old_argv = NULL;
/* don't do anything if argc is -1, since that implies "help" mode */
if (*argc == -1)
return;
@ -134,11 +141,18 @@ read_cvsrc (argc, argv, cmdname)
}
for (i=1; i < *argc; i++)
{
new_argv [new_argc++] = (*argv)[i];
new_argv [new_argc++] = xstrdup ((*argv)[i]);
}
*argc = new_argc;
*argv = new_argv;
if (old_argv != NULL)
{
/* Free the memory which was allocated in the previous
read_cvsrc call. */
free_names (&old_argc, old_argv);
}
old_argc = *argc = new_argc;
old_argv = *argv = new_argv;
free (homeinit);
return;

View File

@ -199,7 +199,7 @@ diff (argc, argv)
}
opts[0] = '\0';
optind = 1;
optind = 0;
while ((c = getopt_long (argc, argv,
"+abcdefhilnpstuwy0123456789BHNRTC:D:F:I:L:U:V:W:k:r:",
longopts, &option_index)) != -1)

View File

@ -60,7 +60,7 @@ watch_onoff (argc, argv)
int local = 0;
int err;
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)
@ -356,7 +356,7 @@ edit (argc, argv)
setting_tedit = 0;
setting_tunedit = 0;
setting_tcommit = 0;
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+lRa:")) != -1)
{
switch (c)
@ -491,7 +491,7 @@ unedit (argc, argv)
if (argc == -1)
usage (edit_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)
@ -983,7 +983,7 @@ editors (argc, argv)
if (argc == -1)
usage (editors_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)

View File

@ -395,7 +395,7 @@ history (argc, argv)
since_tag = xstrdup ("");
backto = xstrdup ("");
rec_types = xstrdup ("");
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:")) != -1)
{
switch (c)

View File

@ -80,7 +80,7 @@ import (argc, argv)
wrap_setup ();
vbranch = xstrdup (CVSBRANCH);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+Qqdb:m:I:k:W:")) != -1)
{
switch (c)

View File

@ -167,7 +167,7 @@ cvslog (argc, argv)
memset (&log_data, 0, sizeof log_data);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+bd:hlNRr::s:tw::")) != -1)
{
switch (c)

View File

@ -771,6 +771,8 @@ logfile_write (repository, filter, message, logfp, changes)
(void) walklist (changes, title_proc, NULL);
}
free (str_list_format);
/* Construct the final string. */
srepos = Short_Repository (repository);

View File

@ -329,6 +329,11 @@ main (argc, argv)
const struct cmd *cm;
int c, err = 0;
int rcsbin_update_env, tmpdir_update_env, cvs_update_env;
int free_CVSroot = 0;
int free_Editor = 0;
int free_Tmpdir = 0;
int free_Rcsbin = 0;
int help = 0; /* Has the user asked for help? This
lets us support the `cvs -H cmd'
convention to give help for cmd. */
@ -400,11 +405,9 @@ main (argc, argv)
if (getenv (CVSREAD_ENV) != NULL)
cvswrite = FALSE;
/* I'm not sure whether this needs to be 1 instead of 0 anymore. Using
1 used to accomplish what passing "+" as the first character to
the option string does, but that reason doesn't exist anymore. */
optind = 1;
/* Set this to 0 to force getopt initialization. getopt() sets
this to 1 internally. */
optind = 0;
/* We have to parse the options twice because else there is no
chance to avoid reading the global options from ".cvsrc". Set
@ -426,7 +429,7 @@ main (argc, argv)
if (use_cvsrc)
read_cvsrc (&argc, &argv, "cvs");
optind = 1;
optind = 0;
opterr = 1;
while ((c = getopt_long
@ -477,18 +480,22 @@ main (argc, argv)
exit (0);
break;
case 'b':
Rcsbin = optarg;
Rcsbin = xstrdup (optarg);
free_Rcsbin = 1;
rcsbin_update_env = 1; /* need to update environment */
break;
case 'T':
Tmpdir = optarg;
Tmpdir = xstrdup (optarg);
free_Tmpdir = 1;
tmpdir_update_env = 1; /* need to update environment */
break;
case 'e':
Editor = optarg;
Editor = xstrdup (optarg);
free_Editor = 1;
break;
case 'd':
CVSroot = optarg;
CVSroot = xstrdup (optarg);
free_CVSroot = 1;
cvs_update_env = 1; /* need to update environment */
break;
case 'H':
@ -862,6 +869,16 @@ main (argc, argv)
Lock_Cleanup ();
free (program_path);
if (free_CVSroot)
free (CVSroot);
if (free_Editor)
free (Editor);
if (free_Tmpdir)
free (Tmpdir);
if (free_Rcsbin)
free (Rcsbin);
#ifdef SYSTEM_CLEANUP
/* Hook for OS-specific behavior, for example socket subsystems on
NT and OS2 or dealing with windows and arguments on Mac. */

View File

@ -445,7 +445,7 @@ do_module (db, mname, m_type, msg, callback_proc, where,
modargv = xmodargv;
/* parse the args */
optind = 1;
optind = 0;
while ((c = getopt (modargc, modargv, CVSMODULE_OPTS)) != -1)
{
switch (c)
@ -461,7 +461,9 @@ do_module (db, mname, m_type, msg, callback_proc, where,
break;
case 'i':
nonalias_opt = 1;
checkin_prog = optarg;
if (checkin_prog)
free (checkin_prog);
checkin_prog = xstrdup (optarg);
break;
case 'l':
nonalias_opt = 1;
@ -469,19 +471,27 @@ do_module (db, mname, m_type, msg, callback_proc, where,
break;
case 'o':
nonalias_opt = 1;
checkout_prog = optarg;
if (checkout_prog)
free (checkout_prog);
checkout_prog = xstrdup (optarg);
break;
case 'e':
nonalias_opt = 1;
export_prog = optarg;
if (export_prog)
free (export_prog);
export_prog = xstrdup (optarg);
break;
case 't':
nonalias_opt = 1;
tag_prog = optarg;
if (tag_prog)
free (tag_prog);
tag_prog = xstrdup (optarg);
break;
case 'u':
nonalias_opt = 1;
update_prog = optarg;
if (update_prog)
free (update_prog);
update_prog = xstrdup (optarg);
break;
case '?':
error (0, 0,
@ -535,12 +545,7 @@ do_module (db, mname, m_type, msg, callback_proc, where,
err += callback_proc (&modargc, modargv, where, mwhere, mfile, shorten,
local_specified, mname, msg);
#if 0
/* FIXME: I've fixed this so that the correct arguments are called,
but now this fails because there is code below this point that
uses optarg values extracted from the arg vector. */
free_names (&xmodargc, xmodargv);
#endif
/* if there were special include args, process them now */
@ -718,6 +723,16 @@ do_module (db, mname, m_type, msg, callback_proc, where,
/* clean up */
if (mwhere)
free (mwhere);
if (checkin_prog)
free (checkin_prog);
if (checkout_prog)
free (checkout_prog);
if (export_prog)
free (export_prog);
if (tag_prog)
free (tag_prog);
if (update_prog)
free (update_prog);
if (cwd_saved)
free_cwd (&cwd);
if (zvalue != NULL)

View File

@ -54,6 +54,7 @@ Parse_Info (infofile, repository, callproc, all)
/* If no file, don't do anything special. */
if (!existence_error (errno))
error (0, errno, "cannot open %s", infopath);
free (infopath);
return 0;
}
@ -105,6 +106,8 @@ Parse_Info (infofile, repository, callproc, all)
if ((cp = strrchr (value, '\n')) != NULL)
*cp = '\0';
if (expanded_value != NULL)
free (expanded_value);
expanded_value = expand_path (value, infofile, line_number);
if (!expanded_value)
{
@ -121,6 +124,10 @@ Parse_Info (infofile, repository, callproc, all)
/* save the default value so we have it later if we need it */
if (strcmp (exp, "DEFAULT") == 0)
{
/* Is it OK to silently ignore all but the last DEFAULT
expression? */
if (default_value != NULL)
free (default_value);
default_value = xstrdup (expanded_value);
continue;
}

View File

@ -70,7 +70,7 @@ patch (argc, argv)
if (argc == -1)
usage (patch_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+V:k:cuftsQqlRD:r:")) != -1)
{
switch (c)

View File

@ -4039,6 +4039,8 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
break;
} while (next != NULL);
free (branchversion);
if (fclose (fp) < 0)
error (0, errno, "cannot close %s", rcs->path);

View File

@ -286,9 +286,7 @@ start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
err += do_recursion (&frame);
/* Free the data which expand_wild allocated. */
for (i = 0; i < argc; ++i)
free (argv[i]);
free (argv);
free_names (&argc, argv);
out:
free (update_dir);

View File

@ -81,7 +81,7 @@ release (argc, argv)
/* Everything from here on is client or local. */
if (argc == -1)
usage (release_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+Qdq")) != -1)
{
switch (c)

View File

@ -50,7 +50,7 @@ cvsremove (argc, argv)
if (argc == -1)
usage (remove_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+flR")) != -1)
{
switch (c)

View File

@ -91,7 +91,7 @@ rtag (argc, argv)
if (argc == -1)
usage (rtag_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+FanfQqlRdbr:D:")) != -1)
{
switch (c)

View File

@ -40,7 +40,7 @@ status (argc, argv)
if (argc == -1)
usage (status_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+vlR")) != -1)
{
switch (c)

View File

@ -163,9 +163,9 @@ pathname_levels (path)
}
/*
* Recover the space allocated by line2argv()
*/
/* Free a vector, where (*ARGV)[0], (*ARGV)[1], ... (*ARGV)[*PARGC - 1]
are malloc'd and so is *ARGV itself. Such a vector is allocated by
line2argv or expand_wild, for example. */
void
free_names (pargc, argv)
int *pargc;

View File

@ -82,7 +82,7 @@ cvstag (argc, argv)
if (argc == -1)
usage (tag_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+FQqlRcdr:D:bf")) != -1)
{
switch (c)

View File

@ -135,7 +135,7 @@ update (argc, argv)
wrap_setup ();
/* parse the args */
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+ApPflRQqduk:r:D:j:I:W:")) != -1)
{
switch (c)

View File

@ -256,7 +256,7 @@ watch_addremove (argc, argv)
the_args.commit = 0;
the_args.edit = 0;
the_args.unedit = 0;
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+lRa:")) != -1)
{
switch (c)
@ -485,7 +485,7 @@ watchers (argc, argv)
if (argc == -1)
usage (watchers_usage);
optind = 1;
optind = 0;
while ((c = getopt (argc, argv, "+lR")) != -1)
{
switch (c)