CVS는 많은 사람들이 사용하고 있고, 사용하지 않더라도 무엇인지 한번쯤은 들어봤을만한 도구이다. 윈도우즈에 특화하려는 의도로 시작된 CVSNT도 있지만, 나의 경우에는 실행파일 하나만 있으면 설치할 필요도 없이 간편하게 모든 CVS 기능을 사용할 수 있는 원조 CVS를 선호한다. 윈도우즈용 실행파일도 FSF의 FTP사이트에서 제공된다. 그런데, 이 실행파일을 사용하면, 로컬 저장소를 지정할때, 드라이브를 지정할 수 없는 경우가 있다. 예컨대,
cvs -d :local:c:\cvs init이 경우에는 드라이브를 적어주어도 제대로 작동하나, 이렇게 만든 저장소를 관리하기 위해 다음과 같이 하면,
cvs -d :local:c:\cvs co CVSROOT조금 전에 만든 저장소를 찾지 못한다.
이를 해결하려면, 소스코드를 받아서 약간 고쳐서 컴파일하면 된다. 패치는 다음과 같다. (아래에서 다운로드 받을 수 있다.)
--- lib/canonicalize.c.old Fri Jun 10 15:30:20 2005 +++ lib/canonicalize.c Sun Jan 06 09:34:40 2008 @@ -20,6 +20,12 @@ # include <config.h> #endif +#ifdef WIN32 +/* need the next to exclude winsock headers */ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif + #include "canonicalize.h" #ifdef STDC_HEADERS @@ -127,13 +133,44 @@ return resolved; # else +# ifdef WIN32 + /* Use GetFullPathName() with existence check. */ + char namebuf[_MAX_PATH+1]; + DWORD n; + char *p, *resolved; + + n = GetFullPathName(name, sizeof(namebuf), namebuf, &p); + if (n == 0) + return NULL; + /* n is strlen() or required size, so, we have malloc() size. */ + if ((resolved = xmalloc(n + 1)) == NULL) + return NULL; + /* if name buf was not enough, GetFullPathName() again. */ + if (n > sizeof(namebuf)) { /* get it directly to `resolved' */ + if ((n = GetFullPathName(name, n + 1, resolved, &p)) == 0) { + free(resolved); + return NULL; + } + } + else { + memcpy(resolved, namebuf, n + 1); /* copy including NUL */ + } + /* check if it exists. */ + if (GetFileAttributes(resolved) == -1) { + free(resolved); + return NULL; + } + return resolved; +# else return canonicalize_filename_mode (name, CAN_EXISTING); +# endif # endif /* !HAVE_RESOLVEPATH */ } #endif /* !HAVE_CANONICALIZE_FILE_NAME */ +#ifndef WIN32 /* Return the canonical absolute name of file NAME. A canonical name does not contain any `.', `..' components nor any repeated file name separators ('/') or symlinks. Whether components must exist @@ -316,3 +353,4 @@ free (rname); return NULL; } +#endif
필요한 도구들
- C 컴파일러 - 없으면 Visual C++ Express를 받아서 설치하면 된다.
- patch - 없으면 여기에서 배포하는 것을 설치하면 된다.
명령행 요약
unzip cvs-1.12.13a.zip cd cvs-1.12.13a patch -p0 < cvs.patch nmake -f cvsnt.mak