From 6045cae71a438a752980a395f03717a13cc22179 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 15 Apr 2004 01:01:56 +0000 Subject: Import cvs-1.11.15 --- contrib/cvs/src/repos.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'contrib/cvs/src/repos.c') diff --git a/contrib/cvs/src/repos.c b/contrib/cvs/src/repos.c index 8cdcb45..2c7a3bc 100644 --- a/contrib/cvs/src/repos.c +++ b/contrib/cvs/src/repos.c @@ -21,11 +21,11 @@ char * Name_Repository (dir, update_dir) - char *dir; - char *update_dir; + const char *dir; + const char *update_dir; { FILE *fpin; - char *xupdate_dir; + const char *xupdate_dir; char *repos = NULL; size_t repos_allocated = 0; char *tmp; @@ -123,8 +123,9 @@ Name_Repository (dir, update_dir) error (0, 0, "`..'-relative repositories are not supported."); error (1, 0, "illegal source repository"); } - newrepos = xmalloc (strlen (current_parsed_root->directory) + strlen (repos) + 2); - (void) sprintf (newrepos, "%s/%s", current_parsed_root->directory, repos); + newrepos = xmalloc (strlen (current_parsed_root->directory) + + strlen (repos) + 2); + sprintf (newrepos, "%s/%s", current_parsed_root->directory, repos); free (repos); repos = newrepos; } @@ -134,29 +135,33 @@ Name_Repository (dir, update_dir) return repos; } + + /* * Return a pointer to the repository name relative to CVSROOT from a * possibly fully qualified repository */ -char * +const char * Short_Repository (repository) - char *repository; + const char *repository; { if (repository == NULL) - return (NULL); + return NULL; /* If repository matches CVSroot at the beginning, strip off CVSroot */ /* And skip leading '/' in rep, in case CVSroot ended with '/'. */ if (strncmp (current_parsed_root->directory, repository, strlen (current_parsed_root->directory)) == 0) { - char *rep = repository + strlen (current_parsed_root->directory); + const char *rep = repository + strlen (current_parsed_root->directory); return (*rep == '/') ? rep+1 : rep; } else - return (repository); + return repository; } + + /* Sanitize the repository name (in place) by removing trailing * slashes and a trailing "." if present. It should be safe for * callers to use strcat and friends to create repository names. @@ -179,12 +184,7 @@ Short_Repository (repository) * back further someday, so that the trailing "/." doesn't get into * repository in the first place, but we haven't taken things that * far yet.'' --Jim Kingdon (recurse.c, 07-Sep-97) - * - * Ahh, all too true. The major consideration is RELATIVE_REPOS. If - * the "/." doesn't end up in the repository while RELATIVE_REPOS is - * defined, there will be nothing in the CVS/Repository file. I - * haven't verified that the remote protocol will handle that - * correctly yet, so I've not made that change. */ + */ void Sanitize_Repository_Name (repository) -- cgit v1.1