(install_service, info, apro) [_WIN32]: Convert to standard snprintf()
from _snprintf(). [_WIN32]: Add #define snprintf to convert to _snprintf for WIN32 Visual Studio.
This commit is contained in:
parent
591b8d4862
commit
0e4eb6bf0a
3 changed files with 7 additions and 6 deletions
|
@ -60,6 +60,7 @@ typedef long ssize_t;
|
||||||
|
|
||||||
typedef int pid_t;
|
typedef int pid_t;
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
|
#define snprintf _snprintf
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ info(void)
|
||||||
if (!name || !*name)
|
if (!name || !*name)
|
||||||
name = "TOP";
|
name = "TOP";
|
||||||
|
|
||||||
_snprintf(filename, sizeof(filename) - 1, "%s\\%s", infodir, name);
|
snprintf(filename, sizeof(filename) - 1, "%s\\%s", infodir, name);
|
||||||
fp = fopen(filename, "rb");
|
fp = fopen(filename, "rb");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
/* may be a "partial" request. */
|
/* may be a "partial" request. */
|
||||||
|
@ -337,7 +337,7 @@ info(void)
|
||||||
(strncasecmp(name, fData.cFileName, strlen(name)) == 0)) {
|
(strncasecmp(name, fData.cFileName, strlen(name)) == 0)) {
|
||||||
nmatch++;
|
nmatch++;
|
||||||
if (nmatch == 1) {
|
if (nmatch == 1) {
|
||||||
_snprintf(last, sizeof(last), "%s", fData.cFileName);
|
snprintf(last, sizeof(last), "%s", fData.cFileName);
|
||||||
} else {
|
} else {
|
||||||
if (nmatch == 2) {
|
if (nmatch == 2) {
|
||||||
pr("`%s' is ambiguous. The following topics match:\n%s",
|
pr("`%s' is ambiguous. The following topics match:\n%s",
|
||||||
|
@ -362,7 +362,7 @@ info(void)
|
||||||
pr(".\n");
|
pr(".\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
_snprintf(filename, sizeof(filename), "%s/%s",
|
snprintf(filename, sizeof(filename), "%s/%s",
|
||||||
infodir, last);
|
infodir, last);
|
||||||
fp = fopen(filename, "rb");
|
fp = fopen(filename, "rb");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
|
@ -419,7 +419,7 @@ apro(void)
|
||||||
lhitlim = 100;
|
lhitlim = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
_snprintf(filename, sizeof(filename), "%s\\*",infodir);
|
snprintf(filename, sizeof(filename), "%s\\*",infodir);
|
||||||
hDir = FindFirstFile(filename, &fData);
|
hDir = FindFirstFile(filename, &fData);
|
||||||
if (hDir == INVALID_HANDLE_VALUE) {
|
if (hDir == INVALID_HANDLE_VALUE) {
|
||||||
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
|
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
|
||||||
|
@ -452,7 +452,7 @@ apro(void)
|
||||||
((fData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) ||
|
((fData.dwFileAttributes == FILE_ATTRIBUTE_NORMAL) ||
|
||||||
(fData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE) ||
|
(fData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE) ||
|
||||||
(fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY))) {
|
(fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY))) {
|
||||||
_snprintf(filename, sizeof(filename), "%s\\%s", infodir,
|
snprintf(filename, sizeof(filename), "%s\\%s", infodir,
|
||||||
fData.cFileName);
|
fData.cFileName);
|
||||||
fp = fopen(filename, "rb");
|
fp = fopen(filename, "rb");
|
||||||
alreadyhit = 0;
|
alreadyhit = 0;
|
||||||
|
|
|
@ -47,7 +47,7 @@ install_service(char *program_name, char *service_name, char *config_file)
|
||||||
SERVICE_DESCRIPTION sdBuf;
|
SERVICE_DESCRIPTION sdBuf;
|
||||||
|
|
||||||
if (config_file != NULL)
|
if (config_file != NULL)
|
||||||
_snprintf(&program_name[strlen(program_name)], _MAX_PATH-strlen(program_name), " -e %s",
|
snprintf(&program_name[strlen(program_name)], _MAX_PATH-strlen(program_name), " -e %s",
|
||||||
config_file);
|
config_file);
|
||||||
|
|
||||||
if (service_name == NULL)
|
if (service_name == NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue