added comments to functions; removed obsolete function; Not part of build at all.

This commit is contained in:
ssu%netscape.com 2000-02-06 23:41:00 +00:00
Родитель 5bb9378150
Коммит 881dd2390c
2 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -34,11 +34,7 @@
#define APP_NAME "nsz.exe" #define APP_NAME "nsz.exe"
char *GetSubString(char *Strings) /* Function to show the usage for this application */
{
return(strchr(Strings,0)+1);
}
void ShowUsage(char *name) void ShowUsage(char *name)
{ {
char szBuf[MAX_BUF]; char szBuf[MAX_BUF];
@ -50,6 +46,7 @@ void ShowUsage(char *name)
MessageBox(NULL, szBuf, "Usage", MB_OK); MessageBox(NULL, szBuf, "Usage", MB_OK);
} }
/* Function to print error message with/without error code */
void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH) void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH)
{ {
DWORD dwErr; DWORD dwErr;
@ -66,6 +63,7 @@ void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH)
MessageBox(NULL, szErrorString, NULL, MB_ICONEXCLAMATION); MessageBox(NULL, szErrorString, NULL, MB_ICONEXCLAMATION);
} }
/* Function to remove quotes from a string */
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize) void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
{ {
char *lpszBegin; char *lpszBegin;
@ -84,6 +82,7 @@ void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
lpszDest[lstrlen(lpszDest) - 1] = '\0'; lpszDest[lstrlen(lpszDest) - 1] = '\0';
} }
/* Function to remove the last backslash from a path string */
void RemoveBackSlash(LPSTR szInput) void RemoveBackSlash(LPSTR szInput)
{ {
int iCounter; int iCounter;
@ -103,6 +102,7 @@ void RemoveBackSlash(LPSTR szInput)
} }
} }
/* Function to append a backslash to a path string */
void AppendBackSlash(LPSTR szInput, DWORD dwInputSize) void AppendBackSlash(LPSTR szInput, DWORD dwInputSize)
{ {
if(szInput != NULL) if(szInput != NULL)
@ -117,6 +117,10 @@ void AppendBackSlash(LPSTR szInput, DWORD dwInputSize)
} }
} }
/* Function to parse a path string for one of three parts of a path:
* Filename only
* Path only
* drive only */
void ParsePath(LPSTR szInput, LPSTR szOutput, DWORD dwOutputSize, DWORD dwType) void ParsePath(LPSTR szInput, LPSTR szOutput, DWORD dwOutputSize, DWORD dwType)
{ {
int iCounter; int iCounter;
@ -196,6 +200,8 @@ void ParsePath(LPSTR szInput, LPSTR szOutput, DWORD dwOutputSize, DWORD dwType)
} }
} }
/* Function to check to see if a file exists.
* If it does, return it's attributes */
long FileExists(LPSTR szFile) long FileExists(LPSTR szFile)
{ {
DWORD rv; DWORD rv;
@ -210,6 +216,8 @@ long FileExists(LPSTR szFile)
} }
} }
/* Function to locate the first non space character in a string,
* and return a pointer to it. */
LPSTR GetFirstNonSpace(LPSTR lpszString) LPSTR GetFirstNonSpace(LPSTR lpszString)
{ {
int i; int i;
@ -226,6 +234,8 @@ LPSTR GetFirstNonSpace(LPSTR lpszString)
return(NULL); return(NULL);
} }
/* Function to return the argument count given a command line input
* format string */
int GetArgC(LPSTR lpszCommandLine) int GetArgC(LPSTR lpszCommandLine)
{ {
int i; int i;
@ -276,6 +286,8 @@ int GetArgC(LPSTR lpszCommandLine)
return(iArgCount); return(iArgCount);
} }
/* Function to return a specific argument parameter from a given command line input
* format string. */
LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize) LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize)
{ {
int i; int i;
@ -354,6 +366,8 @@ LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize)
return(lpszDest); return(lpszDest);
} }
/* Function to add a file to a self-extracting .exe file.
* It compresses the file, then adds it as a resource type "FILE". */
void AddFile(LPSTR lpszSeaExe, LPSTR lpszFile) void AddFile(LPSTR lpszSeaExe, LPSTR lpszFile)
{ {
char szBuf[MAX_BUF]; char szBuf[MAX_BUF];
@ -427,6 +441,8 @@ void AddFile(LPSTR lpszSeaExe, LPSTR lpszFile)
} }
} }
/* Function to extract a resourced file from a .exe file.
* It also uncompresss the file after extracting it. */
BOOL APIENTRY ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam) BOOL APIENTRY ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
{ {
char szBuf[MAX_BUF]; char szBuf[MAX_BUF];
@ -567,7 +583,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmd
} }
if(!FileExists(szAppName)) if(!FileExists(szAppName))
{ {
wsprintf(szBuf, "file not found: %s", szAppName); wsprintf(szBuf, "File not found: %s", szAppName);
PrintError(szBuf, ERROR_CODE_HIDE); PrintError(szBuf, ERROR_CODE_HIDE);
exit(1); exit(1);
} }

Просмотреть файл

@ -35,7 +35,6 @@
#define PP_PATH_ONLY 2 #define PP_PATH_ONLY 2
#define PP_ROOT_ONLY 3 #define PP_ROOT_ONLY 3
char *GetSubString(char *Strings);
void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH); void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH);
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int dwDestSize); void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int dwDestSize);
void RemoveBackSlash(LPSTR szInput); void RemoveBackSlash(LPSTR szInput);