This is an automated email from the git hooks/post-receive script. rubund-guest pushed a commit to branch master in repository fyba.
commit d652cd73fe9c00db9bd170b0275c7324da89e21f Author: Thomas Hirsch <thomas.hir...@statkart.no> Date: Mon Oct 14 09:08:50 2013 +0200 delete copyrighted legacy routines --- src/UT/FULLPATH.cpp | 309 ---------------------------------------------------- src/UT/Makefile.am | 2 +- src/UT/SPLITPTH.cpp | 226 -------------------------------------- 3 files changed, 1 insertion(+), 536 deletions(-) diff --git a/src/UT/FULLPATH.cpp b/src/UT/FULLPATH.cpp deleted file mode 100644 index 5ad422f..0000000 --- a/src/UT/FULLPATH.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/* ------------------------------ - * Fil: FullPath.c - * ------------------------------ */ - -#include "stdafx.h" -#include <stdlib.h> -#include <string.h> - -#ifdef LINUX -# include <unistd.h> -#endif - -#ifdef UNIX -# include <ctype.h> -#endif - -#ifdef OS2 -# define INCL_DOSFILEMGR -# define INCL_DOSERRORS -# include <os2.h> -#endif - -#ifdef BORLAND -# include <windows.h> -#endif - -#ifdef WIN32 -# include <windows.h> -#endif - -#include "fyut.h" - - -#ifdef UNIX - -/*-----------------------------------------------------------------------* - * filename - fullpath.c - * - * function(s) - * isSlash - check for directory separator character - * _fullpath - make an absolute path name from a relative path name - *-----------------------------------------------------------------------*/ - -/* - * C/C++ Run Time Library - Version 5.0 - * - * Copyright (c) 1987, 1992 by Borland International - * All Rights Reserved. - * - */ - - -/*---------------------------------------------------------------------* - -Name isSlash - check for directory separator character - -Usage int isSlash(int c); - -Prototype in local - -Description isSlash returns true if the character c is a valid - directory separator character (\ or / on DOS, / on UNIX). - It returns false otherwise. - -Return value Describe above. - -*---------------------------------------------------------------------*/ -static int isSlash (int c) -{ - return (c == '\\' || c == '/'); -} - -/*---------------------------------------------------------------------* - -Name _fullpath - makes new file name - -Usage #include <dir.h> - char *_fullpath(char *buffer, const char * pathname, - size_t maxlen); - -Prototype in stdlib.h - -Description _fullpath converts the relative path name name 'pathname' - to a fully qualified pathname, stored in 'buffer'. The - relative path can contain ".\" and "..". - - The maximum size of the supplied buffer is 'maxlen'. - If the fully qualified path is longer than 'maxlen', - NULL is returned. The buffer should be at least _MAX_PATH - bytes long (this constant is defined in stdlib.h). - - If 'buffer' is NULL, a buffer to store the fully qualified - path is allocated and is returned. The calling program - must free this buffer with GlobalFree(() when it is no longer needed. - - If the pathname does not specify a disk drive, the current - drive is used. - -Return value A pointer to the buffer containing the fully qualified - path is returned. If there is an error, NULL is returned. - -Note This function is a rewrite of the FExpand procedure - in the Turbo Pascal RTL, with modifications for MSC - compatibility. - -*---------------------------------------------------------------------*/ -char * _fullpath(char *buffer, - const char *pathname, - size_t maxlen - ) -{ - char *tempbuf; - char *dst, *src; - int c, driveletter; - size_t len; - - - /* Allocate a temporary buffer to hold the fully qualified path. - */ - if ((tempbuf = (char*)UT_MALLOC(_MAX_PATH*2+1)) == NULL) - return (NULL); - - - driveletter = 7; - src = (char *)pathname; - - - /* If supplied path is relative, append it to the drivename - * and its current directory. Otherwise append it to the - * drivename only. - */ - if (!isSlash(src[0])) { /* path is relative? */ - /* Get drivename and its current directory. - */ - if (getcwd(tempbuf,_MAX_PATH*2+1) == NULL) { - UT_FREE(tempbuf); - return (NULL); - } - dst = &tempbuf[strlen(tempbuf)]; - if (!isSlash(*(dst-1))) /* if directory doesn't end in slash */ - *dst++ = UT_SLASH; /* append one */ - - } else { - /* Path is absolute. Store the drivename only.*/ - dst = tempbuf; - } - strcpy(dst,src); /* concatenate supplied path */ - - /* Scan the path, squeezing out "../" and "./", and - * squeezing out the previous directory when "../" is found. - */ - src = dst = tempbuf; - - for (;;) { - /* If this the end of the path, or end of a directory, - * we must check for "." or ".." - */ - if ((c = *src++) == '\0' || isSlash(c)) { - /* If last directory copied was "/.", back up over it. - * Skip test if we are still at the beginning of tempbuf. - */ - if (src != (tempbuf+1)) { - if (*(dst-1) == '.' && isSlash(*(dst-2))) { - dst -= 2; - - /* If last directory copied was "/..", back up over it - * AND the previous directory. - */ - } else if (*(dst-1) == '.' && *(dst-2) == '.' && isSlash(*(dst-3))) { - dst -= 3; /* back up over "/.." */ - if (*(dst-1) == ':') { /* can't back up over drivename */ - UT_FREE(tempbuf); - return(NULL); - } - while (!isSlash(*--dst)) - ; /* back up to start of prev. dir. */ - } - - if (c == '\0') { /* end of path? */ - if (isSlash(*(dst-1))) /* if last char is slash */ - dst--; /* back up over it */ - if (*(dst-1) == ':') /* if path is just a drivename */ - *dst++ = '/'; /* append a slash */ - *dst = '\0'; /* append null terminator */ - break; - - } else { - *dst++ = c; /* copy the slash */ - } - } - - } else { - *dst++ = c; /* copy the character */ - } - } - - /* Copy the temp buffer to the user's buffer, if present. - * Otherwise shrink the temp buffer and return a pointer to it. - */ - len = strlen(tempbuf) + 1; /* length of path and null */ - if (buffer != NULL) { - if (len > maxlen) { /* user buffer too small? */ - UT_FREE(tempbuf); - return (NULL); - - } else { - strcpy(buffer,tempbuf); - UT_FREE(tempbuf); - return (buffer); - } - - } else { - return (char*)(realloc(tempbuf,len)); /* shrink the buffer */ - } -} -#endif - - -/* -AR-930423 -CH UT_FullPath Finn fullstendig filnavn -CD ================================================================== -CD Form�l: -CD Lag absolutt path navn fra relativt path navn. -CD I tilleg tolker denne environment-variabler inn i filnavnet. -CD Environment-varialen skrives i parantes. -CD -CD Eks: -CD SET FKB=D:\DATA\SOSI\FKB -CD -CD Filnavnet (FKB)\CV03851V.SOS -CD pakkes ut til D:\DATA\SOSI\FKB\CV03851V.SOS -CD -CD PARAMETERLISTE: -CD Type Navn I/U Merknad -CD ------------------------------------------------------------------ -CD char *pszBuffer u Komplett filnavn -CD const char *pszPath i Forkortet filnavn -CD size_t maxlen i Max lengde av pszBuffer -CD short sStatus r Status; 0=OK, annen verdi er feil. -CD -CD Bruk: sStatus = UT_FullPath(szBuffer,szPath,maxlen); - ================================================================== -*/ -SK_EntPnt_UT short UT_FullPath(char *pszBuffer, const char *pszPath, size_t maxlen) -{ - char szFilnavn[_MAX_PATH]; - char *pszStart,*pszSlutt; - char *env; -#ifdef BORLAND - char *pszOrgPath; -#endif - - /* S�k start- og sluttparantes */ - UT_StrCopy(szFilnavn,pszPath,_MAX_PATH); - pszStart = strchr(szFilnavn,'('); - pszSlutt = strchr(szFilnavn,')'); - - /* B�de start- og sluttparantes er funnet, - og starten er f�rst i strengen */ - if (pszStart != NULL && pszSlutt != NULL && pszStart < pszSlutt) { - *pszStart++ = '\0'; - *pszSlutt++ = '\0'; -#ifdef LINUX - env = getenv( UT_StrUpper(pszStart)); -#else - size_t len; - _dupenv_s(&env, &len, UT_StrUpper(pszStart)); -#endif - - /* Navnet er ikke funnet */ - if (env == NULL) { - UT_StrCopy(szFilnavn,pszPath,_MAX_PATH); - - } else { - UT_StrCat(szFilnavn,env,_MAX_PATH); - UT_ClrTrailsp(szFilnavn); - UT_StrCat(szFilnavn,pszPath+(pszSlutt-szFilnavn),_MAX_PATH); - } - } - - /* Hent filopplysninger */ -#ifdef UNIX - return (short)(_fullpath(pszBuffer,szFilnavn,maxlen) != NULL)? 0 : 1; -#endif - -#ifdef OS232 - return (short) DosQueryPathInfo(szFilnavn,FIL_QUERYFULLNAME,pszBuffer,maxlen); -#endif - -#ifdef OS216 - return (short) DosQPathInfo(szFilnavn,FIL_QUERYFULLNAME,(PBYTE)pszBuffer,(USHORT)maxlen,0); -#endif - -#ifdef WIN32 - return (short)(_fullpath(pszBuffer,szFilnavn,maxlen) != NULL)? 0 : 1; -#endif - -#ifdef BORLAND - pszOrgPath = _fullpath(pszBuffer,szFilnavn,maxlen); - - if (pszOrgPath != NULL) - return((short)0); - else - return ((short)1); -#endif - -} - diff --git a/src/UT/Makefile.am b/src/UT/Makefile.am index d356ae5..66cd768 100644 --- a/src/UT/Makefile.am +++ b/src/UT/Makefile.am @@ -2,7 +2,7 @@ AM_CPPFLAGS = --pedantic -Wno-long-long -Wall -O2 -D_FILE_OFFSET_BITS=64 -DUNIX ACLOCAL_AMFLAGS = -I m5 lib_LTLIBRARIES = libfyut.la -libfyut_la_SOURCES = ANFORSEL.cpp DELDIR.cpp FILNACMP.cpp INQTID.cpp SPLITPTH.cpp UT1.cpp UT4.cpp CopyFile.cpp DELFILE.cpp FULLPATH.cpp MAKEPATH.cpp stdafx.cpp UT2.cpp CREDIR.cpp DISKINFO.cpp INQSIZE.cpp SETSIZE.cpp StrtPros.cpp UT3.cpp fyut.h stdafx.h +libfyut_la_SOURCES = ANFORSEL.cpp DELDIR.cpp FILNACMP.cpp INQTID.cpp UT1.cpp UT4.cpp CopyFile.cpp DELFILE.cpp MAKEPATH.cpp stdafx.cpp UT2.cpp CREDIR.cpp DISKINFO.cpp INQSIZE.cpp SETSIZE.cpp StrtPros.cpp UT3.cpp fyut.h stdafx.h libfyut_la_LDFLAGS = -version-info 0:0:0 library_includedir=$(includedir)/fyba diff --git a/src/UT/SPLITPTH.cpp b/src/UT/SPLITPTH.cpp deleted file mode 100644 index eb0a38e..0000000 --- a/src/UT/SPLITPTH.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/*------------------------------------------------------------------------ - * filename - spltpath.c - * - * function(s) - * DotFound - checks for special directory names - * UT_splitpath - split a full path name (MSC compatible) - *-----------------------------------------------------------------------*/ - -/* - * C/C++ Run Time Library - Version 5.0 - * - * Copyright (c) 1987, 1992 by Borland International - * All Rights Reserved. - * - */ - -#include "stdafx.h" -#include <string.h> - -#ifdef BORLAND -#include <windows.h> -#endif - -#ifdef WIN32 -#include <windows.h> -#endif - - -#include "fyut.h" - - -/*---------------------------------------------------------------------* - -Name DotFound - checks for special dir name cases - -Usage int DotFound(char *pB); - -Prototype in local to this module - -Description checks for special directory names - -*---------------------------------------------------------------------*/ -static size_t DotFound(char *pB) -{ - if (*(pB-1) == '.') - pB--; - switch (*--pB) { - case ':' : - if (*(pB-2) != '\0') { - break; - } else { - return UT_TRUE; - } - case '/' : - case '\\' : - case '\0' : - return UT_TRUE; - } - return UT_FALSE; -} - -/*---------------------------------------------------------------------* - -Name UT_splitpath - splits a full path name into its components - -Usage #include <fyut.h> - void UT_splitpath(const char *path, char * drive, char * dir, - char * name, char * ext); - -Related -functions usage void UT_makepath(char *path, const char *drive, const char *dir, - const char *name, const char *ext); - -Prototype in fyut.h - -Description UT_splitpath takes a file's full path name (path) as a string - in the form - - X:\DIR\SUBDIR\NAME.EXT - - and splits path into its four components. It then stores - those components in the strings pointed to by drive, dir, - name and ext. (Each component is required but can be a - NULL, which means the corresponding component will be - parsed but not stored.) - - The maximum sizes for these strings are given by the - constants _MAX_DRIVE, _MAX_DIR, _MAX_PATH, _MAX_NAME and _MAX_EXT, - (defined in fyut.h) and each size includes space for the - null-terminator. - - UT_splitpath assumes that there is enough space to store each - non-NULL component. fnmerge assumes that there is enough - space for the constructed path name. The maximum constructed - length is _MAX_PATH. - - When UT_splitpath splits path, it treats the punctuation as - follows: - - * drive keeps the colon attached (C:, A:, etc.) - - * dir keeps the leading and trailing backslashes - (\turboc\include\,\source\, etc.) - - * ext keeps the dot preceding the extension (.c, .exe, etc.) - - UT_splitpath and _makepath are invertible; if you - split a given path with UT_splitpath, then - merge the resultant components with UT_makepath, you end up - with path. - -Return value UT_splitpath does not return a value. - -*---------------------------------------------------------------------*/ - - -/* -AR-930423 -CH UT_splitpath Splitt filnavn -CD ================================================================== -CD Form�l: -CD UT_splitpath splitter et fullstendig filnavn i enkelte komponenter. -CD Filnavnet: X:\DIR\SUBDIR\NAME.EXT -CD blir til: X er drive -CD \DIR\SUBDIR\ er gitt av dir -CD NAME.EXT er gitt av name og ext -CD -CD PARAMETERLISTE: -CD Type Navn I/U Merknad -CD -------------------------------------------------------------- -CD char *pszPath i Komplett filnavn -CD const char *pszDrive u Disk -CD const char *pszDir u Katalog -CD const char *pszNavn u Navn -CD const char *pszExt u Extension -CD -CD Bruk: UT_splitpath(szPath,szDrive,szDir,szNavn,szExt); - ================================================================== -*/ -SK_EntPnt_UT void UT_splitpath(const char *pathP, char *driveP, char *dirP, - char *nameP, char *extP) -{ - char *pB; - size_t Wrk; - int ExtFunnet; - - char buf[ _MAX_PATH+2 ]; - - /* - * Set all string to default value zero - */ - ExtFunnet = UT_FALSE; - if (driveP) - *driveP = 0; - if (dirP) - *dirP = 0; - if (nameP) - *nameP = 0; - if (extP) - *extP = 0; - - /* - * Copy filename into template up to _MAX_PATH characters - */ - pB = buf; - while (*pathP == ' ') - pathP++; - - if ((Wrk = strlen(pathP)) >= _MAX_PATH) - Wrk = _MAX_PATH - 1; - *pB++ = 0; - UT_StrCopy(pB, pathP, Wrk+1); - - *(pB += Wrk) = 0; - - /* - * Split the filename and fill corresponding nonzero pointers - */ - Wrk = 0; - for (; ; ) { - switch (*--pB) { - case '.' : - if (!Wrk && (*(pB+1) == '\0')) - Wrk = DotFound(pB); - if ((!Wrk) && (!ExtFunnet)) { - ExtFunnet = UT_TRUE; - UT_StrCopy(extP, pB, _MAX_EXT); - *pB = 0; - } - continue; - case ':' : - if (pB != &buf[2]) - continue; - case '\0' : - if (Wrk) { - pB++; - UT_StrCopy(dirP, pB, _MAX_DIR); - *pB-- = 0; - break; - } - case '/' : - case '\\' : - if (!Wrk) { - Wrk++; - pB++; - UT_StrCopy(nameP, pB, _MAX_FNAME); - *pB-- = 0; - if (*pB == 0 || (*pB == ':' && pB == &buf[2])) - break; - } - continue; - - case '*' : - case '?' : - continue; - - default : - continue; - } - break; - } - - if (*pB == ':') { - UT_StrCopy(driveP, &buf[1], _MAX_DRIVE); - } -} -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/fyba.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel