[rosapps]

- Avoid old crt names usage, by Caemyr/kjk_hyperion.

svn path=/trunk/; revision=44107
This commit is contained in:
Aleksey Bragin 2009-11-11 18:19:42 +00:00
parent 94d60cdacc
commit effa38586c
10 changed files with 25 additions and 25 deletions

View file

@ -146,9 +146,9 @@ main(int argc, char *argv[])
if (stat(*argv, &sb)) {
if (!cflag) {
/* Create the file. */
fd = open(*argv,
fd = _open(*argv,
O_WRONLY | O_CREAT, DEFFILEMODE);
if (fd == -1 || fstat(fd, &sb) || close(fd)) {
if (fd == -1 || fstat(fd, &sb) || _close(fd)) {
rval = 1;
warn("%s", *argv);
continue;
@ -300,37 +300,37 @@ rw(char *fname, struct stat *sbp, int force)
}
needed_chmod = rval = 0;
if ((fd = open(fname, O_RDWR, 0)) == -1) {
if (!force || chmod(fname, DEFFILEMODE))
if ((fd = _open(fname, O_RDWR, 0)) == -1) {
if (!force || _chmod(fname, DEFFILEMODE))
goto err;
if ((fd = open(fname, O_RDWR, 0)) == -1)
if ((fd = _open(fname, O_RDWR, 0)) == -1)
goto err;
needed_chmod = 1;
}
if (sbp->st_size != 0) {
if (read(fd, &byte, sizeof(byte)) != sizeof(byte))
if (_read(fd, &byte, sizeof(byte)) != sizeof(byte))
goto err;
if (lseek(fd, (off_t)0, SEEK_SET) == -1)
if (_lseek(fd, (off_t)0, SEEK_SET) == -1)
goto err;
if (write(fd, &byte, sizeof(byte)) != sizeof(byte))
if (_write(fd, &byte, sizeof(byte)) != sizeof(byte))
goto err;
} else {
if (write(fd, &byte, sizeof(byte)) != sizeof(byte)) {
if (_write(fd, &byte, sizeof(byte)) != sizeof(byte)) {
err: rval = 1;
warn("%s", fname);
/* } else if (ftruncate(fd, (off_t)0)) {*/
} else if (chsize(fd, (off_t)0)) {
} else if (_chsize(fd, (off_t)0)) {
rval = 1;
warn("%s: file modified", fname);
}
}
if (close(fd) && rval != 1) {
if (_close(fd) && rval != 1) {
rval = 1;
warn("%s", fname);
}
if (needed_chmod && chmod(fname, sbp->st_mode) && rval != 1) {
if (needed_chmod && _chmod(fname, sbp->st_mode) && rval != 1) {
rval = 1;
warn("%s: permissions modified", fname);
}

View file

@ -1075,14 +1075,14 @@ FTPRebuildConnectionInfo(const FTPLIPtr lip, const FTPCIPtr cip)
/* Reattach the FILE pointers for use with the Std I/O library
* routines.
*/
if ((cip->cin = fdopen(cip->ctrlSocketR, "r")) == NULL) {
if ((cip->cin = _fdopen(cip->ctrlSocketR, "r")) == NULL) {
cip->errNo = kErrFdopenR;
cip->ctrlSocketR = kClosedFileDescriptor;
cip->ctrlSocketW = kClosedFileDescriptor;
return (kErrFdopenR);
}
if ((cip->cout = fdopen(cip->ctrlSocketW, "w")) == NULL) {
if ((cip->cout = _fdopen(cip->ctrlSocketW, "w")) == NULL) {
CloseFile(&cip->cin);
cip->errNo = kErrFdopenW;
cip->ctrlSocketR = kClosedFileDescriptor;

View file

@ -297,7 +297,7 @@ OpenBookmarkFile(int *numBookmarks0)
return NULL; /* Okay to not have one yet. */
}
(void) chmod(pathName, 00600);
(void) _chmod(pathName, 00600);
if (FGets(line, sizeof(line), fp) == NULL) {
(void) fprintf(stderr, "%s: invalid format.\n", pathName);
(void) fclose(fp);
@ -683,7 +683,7 @@ OpenTmpBookmarkFile(int nb)
perror(pathName);
return (NULL);
}
(void) chmod(pathName, 00600);
(void) _chmod(pathName, 00600);
if (nb > 0) {
if (fprintf(outfp, "NcFTP bookmark-file version: %d\nNumber of bookmarks: %d\n", kBookmarkVersion, nb) < 0) {
(void) fprintf(stderr, "Could not save bookmark.\n");

View file

@ -2540,7 +2540,7 @@ PageCmd(const int argc, const char **const argv, const CommandPtr cmdp, const Ar
#endif
for (i=1; i<argc; i++) {
result = FTPGetOneFile2(&gConn, argv[i], NULL, kTypeAscii, fileno(stream), kResumeNo, kAppendNo);
result = FTPGetOneFile2(&gConn, argv[i], NULL, kTypeAscii, _fileno(stream), kResumeNo, kAppendNo);
if (result < 0) {
if (errno != EPIPE) {
ClosePager(stream);

View file

@ -506,7 +506,7 @@ gl_init(void)
}
hist_init();
}
if (isatty(0) == 0 || isatty(1) == 0)
if (_isatty(0) == 0 || _isatty(1) == 0)
gl_error("\n*** Error: getline(): not interactive, use stdio.\n");
gl_char_init();
gl_init_done = 1;
@ -2398,7 +2398,7 @@ gl_local_filename_completion_proc(const char *start, int idx)
if ((name[0] == '.') && ((name[1] == '\0') || ((name[1] == '.') && (name[2] == '\0'))))
goto next; /* Skip . and .. */
if ((filepfxlen == 0) || (strnicmp(name, filepfx, filepfxlen) == 0)) {
if ((filepfxlen == 0) || (_strnicmp(name, filepfx, filepfxlen) == 0)) {
/* match */
len = strlen(name);
cp = (char *) malloc(filepfxoffset + len + 4 /* spare */ + 1 /* NUL */);

View file

@ -321,7 +321,7 @@ LoadFirewallPrefs(int forceReload)
if (fp != NULL) {
WriteDefaultFirewallPrefs(fp);
(void) fclose(fp);
(void) chmod(pathName, 00600);
(void) _chmod(pathName, 00600);
gNumProgramRuns = 1;
}
}

View file

@ -649,7 +649,7 @@ SaveHistory(void)
gl_strlen = Vt100VisibleStrlen;
gl_histsavefile(pathName);
(void) chmod(pathName, 00600);
(void) _chmod(pathName, 00600);
} /* SaveHistory */

View file

@ -113,7 +113,7 @@ HaveSpool(void)
gHaveSpool = 0;
if (gOurInstallationPath[0] != '\0') {
OurInstallationPath(ncftpbatch, sizeof(ncftpbatch), "ncftpbatch.exe");
gHaveSpool = (access(ncftpbatch, F_OK) == 0) ? 1 : 0;
gHaveSpool = (_access(ncftpbatch, F_OK) == 0) ? 1 : 0;
}
}
#elif defined(BINDIR)

View file

@ -125,7 +125,7 @@ OpenTrace(void)
fp = fopen(pathName, FOPEN_WRITE_TEXT);
if (fp != NULL) {
(void) chmod(pathName, 00600);
(void) _chmod(pathName, 00600);
#ifdef HAVE_SETVBUF
(void) setvbuf(fp, gTraceLBuf, _IOLBF, sizeof(gTraceLBuf));
#endif /* HAVE_SETVBUF */

View file

@ -69,7 +69,7 @@ loadFile(const char *fileName, int *fileSize_)
}
/* Get file size */
if (fstat(fileno(f), &sb) < 0)
if (fstat(_fileno(f), &sb) < 0)
{
fclose(f);
printf("Couldn't get size of file %s!\n", fileName);
@ -506,7 +506,7 @@ applyPatch_file_open_error:
_snprintf(buffer, MAX_PATH, "%s.bak", fileName);
buffer[MAX_PATH-1] = '\0';
makeBackup = 1;
if (access(buffer, 0) >= 0) /* file exists */
if (_access(buffer, 0) >= 0) /* file exists */
{
printf("File %s already exists, overwrite? (Y)es, (N)o, (A)bort", buffer);
do