Fixes for MSVC warnings C4273 and C4996

C4273 - (inconsistent dll linkage) generated by multiple declarations of isatty
C4996 - deprecated POSIX function names need to be prefixed with "_"
This commit is contained in:
Ray Speth 2012-01-17 04:12:15 +00:00
parent bc9ec48516
commit 9c2ec3862b
7 changed files with 25 additions and 13 deletions

View file

@ -98,11 +98,11 @@ f__canseek(FILE *f) /*SYSDEP*/
#endif
{
#ifdef NON_UNIX_STDIO
return !isatty(fileno(f));
return !ISATTY(FILENO(f));
#else
struct STAT_ST x;
if (FSTAT(fileno(f),&x) < 0)
if (FSTAT(FILENO(f),&x) < 0)
return(0);
#ifdef S_IFMT
switch(x.st_mode & S_IFMT) {
@ -113,7 +113,7 @@ f__canseek(FILE *f) /*SYSDEP*/
else
return(0);
case S_IFCHR:
if(isatty(fileno(f)))
if(ISATTY(FILENO(f)))
return(0);
return(1);
#ifdef S_IFBLK
@ -131,7 +131,7 @@ f__canseek(FILE *f) /*SYSDEP*/
return(0);
}
if (S_ISCHR(x.st_mode)) {
if(isatty(fileno(f)))
if(ISATTY(FILENO(f)))
return(0);
return(1);
}

View file

@ -108,8 +108,15 @@ extern void f_init(void);
extern int (*f__donewrec)(void), t_putc(int), x_wSL(void);
extern void b_char(char*,char*,ftnlen), g_char(char*,ftnlen,char*);
extern int c_sfe(cilist*), z_rnew(void);
#ifndef WIN32
#ifdef _MSC_VER
#define ISATTY _isatty
#define FILENO _fileno
#define ACCESS _access
#else
extern int isatty(int);
#define ISATTY isatty
#define FILENO fileno
#define ACCESS access
#endif
extern int err__fl(int,int,char*);
extern int xrd_SL(void);

View file

@ -32,7 +32,7 @@ integer f_inqu(inlist *a)
{ byfile=1;
g_char(a->infile,a->infilen,buf);
#ifdef NON_UNIX_STDIO
x = access(buf,0) ? -1 : 0;
x = ACCESS(buf,0) ? -1 : 0;
for(i=0,p=NULL;i<MXUNIT;i++)
if(f__units[i].ufd != NULL
&& f__units[i].ufnm != NULL

View file

@ -75,7 +75,7 @@ un_getc(int x, FILE *f__cf)
#ifdef KR_headers
extern int ungetc();
#else
#ifndef WIN32
#ifndef _MSC_VER
extern int ungetc(int, FILE*); /* for systems with a buggy stdio.h */
#endif
#endif

View file

@ -202,7 +202,7 @@ integer f_open(olist *a)
opnerr(a->oerr,errno,"open")
fclose(tf);
#else
if (access(buf,0))
if (ACCESS(buf,0))
opnerr(a->oerr,errno,"open")
#endif
break;
@ -232,7 +232,7 @@ integer f_open(olist *a)
opnerr(a->oerr,128,"open")
}
#else
if (!access(buf,0))
if (!ACCESS(buf,0))
opnerr(a->oerr,128,"open")
#endif
/* no break */

View file

@ -66,7 +66,7 @@ un_getc(int x, FILE *f__cf)
{ return ungetc(x,f__cf); }
#else
#define un_getc ungetc
#ifndef WIN32
#ifndef _MSC_VER
extern int ungetc(int, FILE*); /* for systems with a buggy stdio.h */
#endif
#endif

View file

@ -20,8 +20,13 @@ extern "C" {
extern "C" {
#endif
extern int getpid(void);
#ifndef WIN32
extern int isatty(int);
#ifdef _MSC_VER
#define ISATTY _isatty
#define FILENO _fileno
#else
extern int isatty(int);
#define ISATTY isatty
#define FILENO fileno
#endif
extern int pause(void);
#endif
@ -66,7 +71,7 @@ s_paus(char *s, ftnlen n)
if(n > 0)
fprintf(stderr, " %.*s", (int)n, s);
fprintf(stderr, " statement executed\n");
if( isatty(fileno(stdin)) )
if( ISATTY(FILENO(stdin)) )
s_1paus(stdin);
else {
#ifdef MSDOS