General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
This commit is contained in:
parent
af7a299930
commit
51295a4d3e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17141
@ -126,7 +126,7 @@ TclGetTimeZone (currentTime)
|
||||
#if defined(HAVE_TM_GMTOFF) && !defined (TCL_GOT_TIMEZONE)
|
||||
# define TCL_GOT_TIMEZONE
|
||||
time_t curTime = (time_t) currentTime;
|
||||
struct tm *timeDataPtr = localtime(¤tTime);
|
||||
struct tm *timeDataPtr = localtime(&curTime);
|
||||
int timeZone;
|
||||
|
||||
timeZone = -(timeDataPtr->tm_gmtoff / 60);
|
||||
|
@ -12,7 +12,5 @@ int abort_(void)
|
||||
#endif
|
||||
{
|
||||
sig_die("Fortran abort routine called", 1);
|
||||
#ifdef __cplusplus
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -8,14 +8,12 @@
|
||||
|
||||
#ifdef KR_headers
|
||||
extern VOID s_copy();
|
||||
ef1asc_(a, la, b, lb) ftnint *a, *b; ftnlen *la, *lb;
|
||||
int ef1asc_(a, la, b, lb) ftnint *a, *b; ftnlen *la, *lb;
|
||||
#else
|
||||
extern void s_copy(char*,char*,ftnlen,ftnlen);
|
||||
int ef1asc_(ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb)
|
||||
#endif
|
||||
{
|
||||
s_copy( (char *)a, (char *)b, EVEN(*la), *lb );
|
||||
#ifdef __cplusplus
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ for(fp = fname ; fp < flast ; ++fp)
|
||||
break;
|
||||
}
|
||||
|
||||
while (ep = *env++)
|
||||
while ( (ep = *env++) )
|
||||
{
|
||||
for(fp = fname; fp<flast ; )
|
||||
if(*fp++ != *ep++)
|
||||
|
@ -90,6 +90,7 @@ sig_die("Trace trap", 1);
|
||||
int xargc;
|
||||
char **xargv;
|
||||
|
||||
int
|
||||
#ifdef KR_headers
|
||||
main(argc, argv) int argc; char **argv;
|
||||
#else
|
||||
|
@ -20,7 +20,5 @@ fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ", offset+1
|
||||
while((i = *varn) && i != ' ')
|
||||
putc(*varn++, stderr);
|
||||
sig_die(".", 1);
|
||||
#ifdef __cplusplus
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "fio.h"
|
||||
#include "fmt.h"
|
||||
|
||||
int
|
||||
y_rsk(Void)
|
||||
{
|
||||
if(f__curunit->uend || f__curunit->url <= f__recpos
|
||||
@ -11,6 +12,8 @@ y_rsk(Void)
|
||||
} while(++f__recpos < f__curunit->url);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
y_getc(Void)
|
||||
{
|
||||
int ch;
|
||||
@ -30,10 +33,10 @@ y_getc(Void)
|
||||
return(-1);
|
||||
}
|
||||
err(f__elist->cierr,errno,"readingd");
|
||||
#ifdef __cplusplus
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
#ifdef KR_headers
|
||||
y_putc(c)
|
||||
#else
|
||||
@ -47,6 +50,8 @@ y_putc(int c)
|
||||
err(f__elist->cierr,110,"dout");
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
y_rev(Void)
|
||||
{ /*what about work done?*/
|
||||
if(f__curunit->url==1 || f__recpos==f__curunit->url)
|
||||
@ -56,6 +61,8 @@ y_rev(Void)
|
||||
f__recpos=0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
y_err(Void)
|
||||
{
|
||||
err(f__elist->cierr, 110, "dfe");
|
||||
@ -64,6 +71,7 @@ y_err(Void)
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
y_newrec(Void)
|
||||
{
|
||||
if(f__curunit->url == 1 || f__recpos == f__curunit->url) {
|
||||
@ -77,6 +85,7 @@ y_newrec(Void)
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
#ifdef KR_headers
|
||||
c_dfe(a) cilist *a;
|
||||
#else
|
||||
@ -108,7 +117,7 @@ integer s_rdfe(cilist *a)
|
||||
{
|
||||
int n;
|
||||
if(!f__init) f_init();
|
||||
if(n=c_dfe(a))return(n);
|
||||
if( (n=c_dfe(a)) )return(n);
|
||||
f__reading=1;
|
||||
if(f__curunit->uwrt && f__nowreading(f__curunit))
|
||||
err(a->cierr,errno,"read start");
|
||||
@ -130,7 +139,7 @@ integer s_wdfe(cilist *a)
|
||||
{
|
||||
int n;
|
||||
if(!f__init) f_init();
|
||||
if(n=c_dfe(a)) return(n);
|
||||
if( (n=c_dfe(a)) ) return(n);
|
||||
f__reading=0;
|
||||
if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
|
||||
err(a->cierr,errno,"startwrt");
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "f2c.h"
|
||||
#include "fio.h"
|
||||
|
||||
int
|
||||
#ifdef KR_headers
|
||||
c_due(a) cilist *a;
|
||||
#else
|
||||
@ -30,7 +31,7 @@ integer s_rdue(cilist *a)
|
||||
#endif
|
||||
{
|
||||
int n;
|
||||
if(n=c_due(a)) return(n);
|
||||
if( (n=c_due(a)) ) return(n);
|
||||
f__reading=1;
|
||||
if(f__curunit->uwrt && f__nowreading(f__curunit))
|
||||
err(a->cierr,errno,"read start");
|
||||
@ -43,7 +44,7 @@ integer s_wdue(cilist *a)
|
||||
#endif
|
||||
{
|
||||
int n;
|
||||
if(n=c_due(a)) return(n);
|
||||
if( (n=c_due(a)) ) return(n);
|
||||
f__reading=0;
|
||||
if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
|
||||
err(a->cierr,errno,"write start");
|
||||
|
@ -43,7 +43,7 @@ integer f_end(alist *a)
|
||||
(void) sprintf(nbuf,"fort.%ld",a->aunit);
|
||||
#ifdef NON_UNIX_STDIO
|
||||
{ FILE *tf;
|
||||
if (tf = fopen(nbuf, f__w_mode[0]))
|
||||
if ( (tf = fopen(nbuf, f__w_mode[0])) )
|
||||
fclose(tf);
|
||||
}
|
||||
#else
|
||||
@ -63,7 +63,7 @@ copy(from, len, to) char *from, *to; register long len;
|
||||
copy(FILE *from, register long len, FILE *to)
|
||||
#endif
|
||||
{
|
||||
int k, len1;
|
||||
int len1;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
while(fread(buf, len1 = len > BUFSIZ ? BUFSIZ : (int)len, 1, from)) {
|
||||
|
@ -78,9 +78,9 @@ char *F_err[] =
|
||||
#define MAXERR (sizeof(F_err)/sizeof(char *)+100)
|
||||
|
||||
#ifdef KR_headers
|
||||
f__canseek(f) FILE *f; /*SYSDEP*/
|
||||
int f__canseek(f) FILE *f; /*SYSDEP*/
|
||||
#else
|
||||
f__canseek(FILE *f) /*SYSDEP*/
|
||||
int f__canseek(FILE *f) /*SYSDEP*/
|
||||
#endif
|
||||
{
|
||||
#ifdef NON_UNIX_STDIO
|
||||
@ -187,9 +187,9 @@ f_init(Void)
|
||||
p->uwrt=1;
|
||||
}
|
||||
#ifdef KR_headers
|
||||
f__nowreading(x) unit *x;
|
||||
int f__nowreading(x) unit *x;
|
||||
#else
|
||||
f__nowreading(unit *x)
|
||||
int f__nowreading(unit *x)
|
||||
#endif
|
||||
{
|
||||
long loc;
|
||||
@ -210,9 +210,9 @@ f__nowreading(unit *x)
|
||||
return(0);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
f__nowwriting(x) unit *x;
|
||||
int f__nowwriting(x) unit *x;
|
||||
#else
|
||||
f__nowwriting(unit *x)
|
||||
int f__nowwriting(unit *x)
|
||||
#endif
|
||||
{
|
||||
long loc;
|
||||
|
@ -80,8 +80,8 @@ extern int (*f__doend)(Void);
|
||||
extern FILE *f__cf; /*current file*/
|
||||
extern unit *f__curunit; /*current unit*/
|
||||
extern unit f__units[];
|
||||
#define err(f,m,s) {if(f) errno= m; else f__fatal(m,s); return(m);}
|
||||
#define errfl(f,m,s) return err__fl((int)f,m,s)
|
||||
#define err(f,m,s) {if( (f) ) errno=(m); else f__fatal((m),(s)); return((m));}
|
||||
#define errfl(f,m,s) return err__fl((int)(f),(m),(s))
|
||||
|
||||
/*Table sizes*/
|
||||
#define MXUNIT 100
|
||||
@ -99,4 +99,4 @@ extern int f__hiwater; /* so TL doesn't confuse us */
|
||||
#define EXT 7
|
||||
#define INT 8
|
||||
|
||||
#define buf_end(x) (x->_flag & _IONBF ? x->_ptr : x->_base + BUFSIZ)
|
||||
#define buf_end(x) ((x)->_flag & _IONBF ? (x)->_ptr : (x)->_base + BUFSIZ)
|
||||
|
@ -40,9 +40,9 @@ char *ap_end(char *s)
|
||||
/*NOTREACHED*/ return 0;
|
||||
}
|
||||
#ifdef KR_headers
|
||||
op_gen(a,b,c,d)
|
||||
int op_gen(a,b,c,d)
|
||||
#else
|
||||
op_gen(int a, int b, int c, int d)
|
||||
int op_gen(int a, int b, int c, int d)
|
||||
#endif
|
||||
{ struct syl *p= &f__syl[f__pc];
|
||||
if(f__pc>=SYLMX)
|
||||
@ -99,9 +99,9 @@ char *f_s(char *s, int curloc)
|
||||
return(s);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
ne_d(s,p) char *s,**p;
|
||||
int ne_d(s,p) char *s,**p;
|
||||
#else
|
||||
ne_d(char *s, char **p)
|
||||
int ne_d(char *s, char **p)
|
||||
#endif
|
||||
{ int n,x,sign=0;
|
||||
struct syl *sp;
|
||||
@ -185,9 +185,9 @@ ne_d(char *s, char **p)
|
||||
return(1);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
e_d(s,p) char *s,**p;
|
||||
int e_d(s,p) char *s,**p;
|
||||
#else
|
||||
e_d(char *s, char **p)
|
||||
int e_d(char *s, char **p)
|
||||
#endif
|
||||
{ int i,im,n,w,d,e,found=0,x=0;
|
||||
char *sv=s;
|
||||
@ -333,9 +333,9 @@ char *f_list(char *s)
|
||||
}
|
||||
|
||||
#ifdef KR_headers
|
||||
pars_f(s) char *s;
|
||||
int pars_f(s) char *s;
|
||||
#else
|
||||
pars_f(char *s)
|
||||
int pars_f(char *s)
|
||||
#endif
|
||||
{
|
||||
f__parenlvl=f__revloc=f__pc=0;
|
||||
@ -350,9 +350,9 @@ int f__cnt[STKSZ],f__ret[STKSZ],f__cp,f__rp;
|
||||
flag f__workdone, f__nonl;
|
||||
|
||||
#ifdef KR_headers
|
||||
type_f(n)
|
||||
int type_f(n)
|
||||
#else
|
||||
type_f(int n)
|
||||
int type_f(int n)
|
||||
#endif
|
||||
{
|
||||
switch(n)
|
||||
@ -476,6 +476,8 @@ loop: switch(type_f((p= &f__syl[f__pc])->op))
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
en_fio(Void)
|
||||
{ ftnint one=1;
|
||||
return(do_fio(&one,(char *)NULL,(ftnint)0));
|
||||
|
@ -6,6 +6,8 @@ char *f__icend;
|
||||
extern icilist *f__svic;
|
||||
int f__icnum;
|
||||
extern int f__hiwater;
|
||||
|
||||
int
|
||||
z_getc(Void)
|
||||
{
|
||||
if(f__recpos++ < f__svic->icirlen) {
|
||||
@ -15,9 +17,9 @@ z_getc(Void)
|
||||
return '\n';
|
||||
}
|
||||
#ifdef KR_headers
|
||||
z_putc(c)
|
||||
int z_putc(c)
|
||||
#else
|
||||
z_putc(int c)
|
||||
int z_putc(int c)
|
||||
#endif
|
||||
{
|
||||
if(f__icptr >= f__icend) err(f__svic->icierr,110,"inwrite");
|
||||
@ -26,6 +28,8 @@ z_putc(int c)
|
||||
else err(f__svic->icierr,110,"recend");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
z_rnew(Void)
|
||||
{
|
||||
f__icptr = f__svic->iciunit + (++f__icnum)*f__svic->icirlen;
|
||||
@ -43,9 +47,9 @@ z_endp(Void)
|
||||
}
|
||||
|
||||
#ifdef KR_headers
|
||||
c_si(a) icilist *a;
|
||||
int c_si(a) icilist *a;
|
||||
#else
|
||||
c_si(icilist *a)
|
||||
int c_si(icilist *a)
|
||||
#endif
|
||||
{
|
||||
f__elist = (cilist *)a;
|
||||
@ -82,7 +86,7 @@ integer s_rsfi(a) icilist *a;
|
||||
integer s_rsfi(icilist *a)
|
||||
#endif
|
||||
{ int n;
|
||||
if(n=c_si(a)) return(n);
|
||||
if( (n=c_si(a)) ) return(n);
|
||||
f__reading=1;
|
||||
f__doed=rd_ed;
|
||||
f__doned=rd_ned;
|
||||
@ -93,6 +97,7 @@ integer s_rsfi(icilist *a)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
z_wnew(Void)
|
||||
{
|
||||
if (f__recpos < f__hiwater) {
|
||||
@ -113,7 +118,7 @@ integer s_wsfi(a) icilist *a;
|
||||
integer s_wsfi(icilist *a)
|
||||
#endif
|
||||
{ int n;
|
||||
if(n=c_si(a)) return(n);
|
||||
if( (n=c_si(a)) ) return(n);
|
||||
f__reading=0;
|
||||
f__doed=w_ed;
|
||||
f__doned=w_ned;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <unistd.h>
|
||||
#include "f2c.h"
|
||||
#include "fio.h"
|
||||
#ifdef KR_headers
|
||||
@ -53,7 +54,7 @@ integer f_inqu(inlist *a)
|
||||
}
|
||||
}
|
||||
if(a->inex!=NULL)
|
||||
if(byfile && x != -1 || !byfile && p!=NULL)
|
||||
if((byfile && x != -1) || (!byfile && p!=NULL))
|
||||
*a->inex=1;
|
||||
else *a->inex=0;
|
||||
if(a->inopen!=NULL)
|
||||
@ -61,7 +62,7 @@ integer f_inqu(inlist *a)
|
||||
else *a->inopen=(p!=NULL && p->ufd!=NULL);
|
||||
if(a->innum!=NULL) *a->innum= p-f__units;
|
||||
if(a->innamed!=NULL)
|
||||
if(byfile || p!=NULL && p->ufnm!=NULL)
|
||||
if(byfile || (p!=NULL && p->ufnm!=NULL))
|
||||
*a->innamed=1;
|
||||
else *a->innamed=0;
|
||||
if(a->inname!=NULL)
|
||||
|
@ -67,6 +67,7 @@ extern int ungetc(int, FILE*); /* for systems with a buggy stdio.h */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
t_getc(Void)
|
||||
{ int ch;
|
||||
if(f__curunit->uend) return(EOF);
|
||||
@ -87,14 +88,14 @@ flag f__lquit;
|
||||
int f__lcount,f__ltype,nml_read;
|
||||
char *f__lchar;
|
||||
double f__lx,f__ly;
|
||||
#define ERR(x) if(n=(x)) return(n)
|
||||
#define ERR(x) if( (n=(x)) ) return(n)
|
||||
#define GETC(x) (x=(*l_getc)())
|
||||
#define Ungetc(x,y) (*l_ungetc)(x,y)
|
||||
|
||||
#ifdef KR_headers
|
||||
l_R(poststar) int poststar;
|
||||
int l_R(poststar) int poststar;
|
||||
#else
|
||||
l_R(int poststar)
|
||||
int l_R(int poststar)
|
||||
#endif
|
||||
{
|
||||
char s[FMAX+EXPMAXDIGS+4];
|
||||
@ -249,6 +250,7 @@ rd_count(register int ch)
|
||||
return f__lcount <= 0;
|
||||
}
|
||||
|
||||
int
|
||||
l_C(Void)
|
||||
{ int ch, nml_save;
|
||||
double lz;
|
||||
@ -285,7 +287,7 @@ l_C(Void)
|
||||
Ungetc(ch,f__cf);
|
||||
nml_save = nml_read;
|
||||
nml_read = 0;
|
||||
if (ch = l_R(1))
|
||||
if ( (ch = l_R(1)) )
|
||||
return ch;
|
||||
if (!f__ltype)
|
||||
errfl(f__elist->cierr,112,"no real part");
|
||||
@ -297,7 +299,7 @@ l_C(Void)
|
||||
}
|
||||
while(iswhit(GETC(ch)));
|
||||
(void) Ungetc(ch,f__cf);
|
||||
if (ch = l_R(1))
|
||||
if ( (ch = l_R(1)) )
|
||||
return ch;
|
||||
if (!f__ltype)
|
||||
errfl(f__elist->cierr,112,"no imaginary part");
|
||||
@ -311,6 +313,8 @@ l_C(Void)
|
||||
nml_read = nml_save;
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
l_L(Void)
|
||||
{
|
||||
int ch;
|
||||
@ -357,6 +361,8 @@ l_L(Void)
|
||||
return(0);
|
||||
}
|
||||
#define BUFSIZE 128
|
||||
|
||||
int
|
||||
l_CHAR(Void)
|
||||
{ int ch,size,i;
|
||||
static char rafail[] = "realloc failure";
|
||||
@ -479,9 +485,9 @@ l_CHAR(Void)
|
||||
}
|
||||
}
|
||||
#ifdef KR_headers
|
||||
c_le(a) cilist *a;
|
||||
int c_le(a) cilist *a;
|
||||
#else
|
||||
c_le(cilist *a)
|
||||
int c_le(cilist *a)
|
||||
#endif
|
||||
{
|
||||
if(!f__init)
|
||||
@ -499,9 +505,9 @@ c_le(cilist *a)
|
||||
return(0);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
l_read(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
|
||||
int l_read(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
|
||||
#else
|
||||
l_read(ftnint *number, char *ptr, ftnlen len, ftnint type)
|
||||
int l_read(ftnint *number, char *ptr, ftnlen len, ftnint type)
|
||||
#endif
|
||||
{
|
||||
#define Ptr ((flex *)ptr)
|
||||
@ -639,7 +645,7 @@ integer s_rsle(cilist *a)
|
||||
{
|
||||
int n;
|
||||
|
||||
if(n=c_le(a)) return(n);
|
||||
if( (n=c_le(a)) ) return(n);
|
||||
f__reading=1;
|
||||
f__external=1;
|
||||
f__formatted=1;
|
||||
|
@ -14,9 +14,9 @@ donewrec(Void)
|
||||
}
|
||||
|
||||
#ifdef KR_headers
|
||||
t_putc(c)
|
||||
int t_putc(c)
|
||||
#else
|
||||
t_putc(int c)
|
||||
int t_putc(int c)
|
||||
#endif
|
||||
{
|
||||
f__recpos++;
|
||||
@ -141,7 +141,7 @@ l_g(char *buf, double n)
|
||||
switch(*b) {
|
||||
#ifndef WANT_LEAD_0
|
||||
case '0':
|
||||
while(b[0] = b[1])
|
||||
while( (b[0] = b[1]) )
|
||||
b++;
|
||||
break;
|
||||
#endif
|
||||
@ -166,7 +166,7 @@ l_g(char *buf, double n)
|
||||
while(*++b);
|
||||
goto f__ret;
|
||||
case 'E':
|
||||
for(c1 = '.', c = 'E'; *b = c1;
|
||||
for(c1 = '.', c = 'E'; (*b = c1);
|
||||
c1 = c, c = *++b);
|
||||
goto f__ret;
|
||||
}
|
||||
@ -188,7 +188,7 @@ l_put(register char *s)
|
||||
#else
|
||||
register int c, (*pn)(int) = f__putn;
|
||||
#endif
|
||||
while(c = *s++)
|
||||
while( (c = *s++) )
|
||||
(*pn)(c);
|
||||
}
|
||||
|
||||
@ -240,9 +240,9 @@ lwrt_C(double a, double b)
|
||||
PUT(')');
|
||||
}
|
||||
#ifdef KR_headers
|
||||
l_write(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
|
||||
int l_write(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
|
||||
#else
|
||||
l_write(ftnint *number, char *ptr, ftnlen len, ftnint type)
|
||||
int l_write(ftnint *number, char *ptr, ftnlen len, ftnint type)
|
||||
#endif
|
||||
{
|
||||
#define Ptr ((flex *)ptr)
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <unistd.h>
|
||||
#ifndef NON_UNIX_STDIO
|
||||
#include "sys/types.h"
|
||||
#include "sys/stat.h"
|
||||
@ -28,9 +29,9 @@ char *f__w_mode[4] = {"wb", "w", "r+b", "r+"};
|
||||
#endif
|
||||
|
||||
#ifdef KR_headers
|
||||
f__isdev(s) char *s;
|
||||
int f__isdev(s) char *s;
|
||||
#else
|
||||
f__isdev(char *s)
|
||||
int f__isdev(char *s)
|
||||
#endif
|
||||
{
|
||||
#ifdef NON_UNIX_STDIO
|
||||
@ -164,7 +165,7 @@ integer f_open(olist *a)
|
||||
case 'R':
|
||||
replace:
|
||||
#ifdef NON_UNIX_STDIO
|
||||
if (tf = fopen(buf,f__w_mode[0]))
|
||||
if ( (tf = fopen(buf,f__w_mode[0])) )
|
||||
fclose(tf);
|
||||
#else
|
||||
(void) close(creat(buf, 0666));
|
||||
@ -187,9 +188,9 @@ integer f_open(olist *a)
|
||||
else {
|
||||
if(!(b->ufd = fopen(buf, f__r_mode[ufmt]))) {
|
||||
#ifdef NON_UNIX_STDIO
|
||||
if (b->ufd = fopen(buf, f__w_mode[ufmt|2]))
|
||||
if ( (b->ufd = fopen(buf, f__w_mode[ufmt|2])) )
|
||||
b->uwrt = 2;
|
||||
else if (b->ufd = fopen(buf, f__w_mode[ufmt]))
|
||||
else if ( (b->ufd = fopen(buf, f__w_mode[ufmt])) )
|
||||
b->uwrt = 1;
|
||||
else
|
||||
#else
|
||||
@ -219,9 +220,9 @@ integer f_open(olist *a)
|
||||
return(0);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
fk_open(seq,fmt,n) ftnint n;
|
||||
int fk_open(seq,fmt,n) ftnint n;
|
||||
#else
|
||||
fk_open(int seq, int fmt, ftnint n)
|
||||
int fk_open(int seq, int fmt, ftnint n)
|
||||
#endif
|
||||
{ char nbuf[10];
|
||||
olist a;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#ifdef KR_headers
|
||||
#ifndef __FreeBSD__
|
||||
extern FILE *fdopen();
|
||||
#endif
|
||||
#else
|
||||
#ifdef MSDOS
|
||||
#include "io.h"
|
||||
@ -14,17 +16,23 @@ extern "C" {
|
||||
#endif
|
||||
#ifndef MSDOS
|
||||
#ifdef OPEN_DECL
|
||||
#ifndef __FreeBSD__
|
||||
extern int creat(const char*,int), open(const char*,int);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef __FreeBSD__
|
||||
extern int close(int);
|
||||
extern int read(int,void*,size_t), write(int,void*,size_t);
|
||||
extern int unlink(const char*);
|
||||
#endif
|
||||
#ifndef _POSIX_SOURCE
|
||||
#ifndef NON_UNIX_STDIO
|
||||
#ifndef __FreeBSD__
|
||||
extern FILE *fdopen(int, const char*);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern char *mktemp(char*);
|
||||
|
||||
|
@ -29,10 +29,10 @@ rd_Z(Uint *n, int w, ftnlen len)
|
||||
|
||||
if (!hex['0']) {
|
||||
s = "0123456789";
|
||||
while(ch = *s++)
|
||||
while( (ch = *s++) )
|
||||
hex[ch] = ch - '0' + 1;
|
||||
s = "ABCDEF";
|
||||
while(ch = *s++)
|
||||
while( (ch = *s++) )
|
||||
hex[ch] = hex[ch + 'a' - 'A'] = ch - 'A' + 11;
|
||||
}
|
||||
s = s0 = (char *)x;
|
||||
@ -61,7 +61,7 @@ rd_Z(Uint *n, int w, ftnlen len)
|
||||
return errno = 115;
|
||||
w = (int)len;
|
||||
w1 = s - s0;
|
||||
w2 = w1+1 >> 1;
|
||||
w2 = (w1+1) >> 1;
|
||||
t = (char *)n;
|
||||
if (*(char *)&one) {
|
||||
/* little endian */
|
||||
@ -83,7 +83,7 @@ rd_Z(Uint *n, int w, ftnlen len)
|
||||
t += i;
|
||||
}
|
||||
do {
|
||||
*t = hex[*s0 & 0xff]-1 << 4 | hex[s0[1] & 0xff]-1;
|
||||
*t = ((hex[*s0 & 0xff]-1) << 4) | (hex[s0[1] & 0xff]-1);
|
||||
t += i;
|
||||
s0 += 2;
|
||||
}
|
||||
@ -387,9 +387,9 @@ rd_POS(char *s)
|
||||
return(1);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
rd_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
|
||||
int rd_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
|
||||
#else
|
||||
rd_ed(struct syl *p, char *ptr, ftnlen len)
|
||||
int rd_ed(struct syl *p, char *ptr, ftnlen len)
|
||||
#endif
|
||||
{ int ch;
|
||||
for(;f__cursor>0;f__cursor--) if((ch=(*f__getn)())<0) return(ch);
|
||||
@ -450,9 +450,9 @@ rd_ed(struct syl *p, char *ptr, ftnlen len)
|
||||
return(errno);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
rd_ned(p) struct syl *p;
|
||||
int rd_ned(p) struct syl *p;
|
||||
#else
|
||||
rd_ned(struct syl *p)
|
||||
int rd_ned(struct syl *p)
|
||||
#endif
|
||||
{
|
||||
switch(p->op)
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "fio.h"
|
||||
#include "fmt.h"
|
||||
|
||||
int
|
||||
xrd_SL(Void)
|
||||
{ int ch;
|
||||
if(!f__curunit->uend)
|
||||
@ -14,6 +15,8 @@ xrd_SL(Void)
|
||||
f__cursor=f__recpos=0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
x_getc(Void)
|
||||
{ int ch;
|
||||
if(f__curunit->uend) return(EOF);
|
||||
@ -33,11 +36,15 @@ x_getc(Void)
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
x_endp(Void)
|
||||
{
|
||||
(void) xrd_SL();
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
x_rev(Void)
|
||||
{
|
||||
(void) xrd_SL();
|
||||
@ -50,7 +57,7 @@ integer s_rsfe(cilist *a) /* start */
|
||||
#endif
|
||||
{ int n;
|
||||
if(!f__init) f_init();
|
||||
if(n=c_sfe(a)) return(n);
|
||||
if( (n=c_sfe(a)) ) return(n);
|
||||
f__reading=1;
|
||||
f__sequential=1;
|
||||
f__formatted=1;
|
||||
|
@ -78,7 +78,7 @@ hash(hashtab *ht, register char *s)
|
||||
register hashentry *h;
|
||||
char *s0 = s;
|
||||
|
||||
for(x = 0; c = *s++; x = x & 0x4000 ? ((x << 1) & 0x7fff) + 1 : x << 1)
|
||||
for(x = 0; (c = *s++); x = x & 0x4000 ? ((x << 1) & 0x7fff) + 1 : x << 1)
|
||||
x += c;
|
||||
for(h = *(zot = ht->tab + x % ht->htsize); h; h = h->next)
|
||||
if (!strcmp(s0, h->name))
|
||||
@ -99,7 +99,7 @@ mk_hashtab(Namelist *nl)
|
||||
hashentry *he;
|
||||
|
||||
hashtab **x, **x0, *y;
|
||||
for(x = &nl_cache; y = *x; x0 = x, x = &y->next)
|
||||
for(x = &nl_cache; (y = *x); x0 = x, x = &y->next)
|
||||
if (nl == y->nl)
|
||||
return y;
|
||||
if (n_nlcache >= MAX_NL_CACHE) {
|
||||
@ -151,13 +151,13 @@ nl_init(Void) {
|
||||
|
||||
if(!f__init)
|
||||
f_init();
|
||||
for(s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; c = *s++; )
|
||||
for(s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; (c = *s++); )
|
||||
Alpha[c]
|
||||
= Alphanum[c]
|
||||
= Alpha[c + 'a' - 'A']
|
||||
= Alphanum[c + 'a' - 'A']
|
||||
= c;
|
||||
for(s = "0123456789_"; c = *s++; )
|
||||
for(s = "0123456789_"; (c = *s++); )
|
||||
Alphanum[c] = c;
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ getname(register char *s, int slen)
|
||||
ch = 115;
|
||||
errfl(f__elist->cierr, ch, "namelist read");
|
||||
}
|
||||
while(*s = Alphanum[GETC(ch) & 0xff])
|
||||
while( (*s = Alphanum[GETC(ch) & 0xff]) )
|
||||
if (s < se)
|
||||
s++;
|
||||
if (ch == EOF)
|
||||
@ -235,15 +235,15 @@ getdimen(int *chp, dimen *d, ftnlen delta, ftnlen extent, ftnlen *x1)
|
||||
register int k;
|
||||
ftnlen x2, x3;
|
||||
|
||||
if (k = getnum(chp, x1))
|
||||
if ( (k = getnum(chp, x1)) )
|
||||
return k;
|
||||
x3 = 1;
|
||||
if (*chp == ':') {
|
||||
if (k = getnum(chp, &x2))
|
||||
if ( (k = getnum(chp, &x2)) )
|
||||
return k;
|
||||
x2 -= *x1;
|
||||
if (*chp == ':') {
|
||||
if (k = getnum(chp, &x3))
|
||||
if ( (k = getnum(chp, &x3)) )
|
||||
return k;
|
||||
if (!x3)
|
||||
return 123;
|
||||
@ -291,9 +291,9 @@ print_ne(cilist *a)
|
||||
static char where0[] = "namelist read start ";
|
||||
|
||||
#ifdef KR_headers
|
||||
x_rsne(a) cilist *a;
|
||||
int x_rsne(a) cilist *a;
|
||||
#else
|
||||
x_rsne(cilist *a)
|
||||
int x_rsne(cilist *a)
|
||||
#endif
|
||||
{
|
||||
int ch, got1, k, n, nd, quote, readall;
|
||||
@ -340,7 +340,7 @@ x_rsne(cilist *a)
|
||||
#endif
|
||||
}
|
||||
have_amp:
|
||||
if (ch = getname(buf,sizeof(buf)))
|
||||
if ( (ch = getname(buf,sizeof(buf))) )
|
||||
return ch;
|
||||
nl = (Namelist *)a->cifmt;
|
||||
if (strcmp(buf, nl->name))
|
||||
@ -392,10 +392,10 @@ x_rsne(cilist *a)
|
||||
case '&':
|
||||
return 0;
|
||||
default:
|
||||
if (ch <= ' ' && ch >= 0 || ch == ',')
|
||||
if ((ch <= ' ' && ch >= 0) || (ch == ','))
|
||||
continue;
|
||||
Ungetc(ch,f__cf);
|
||||
if (ch = getname(buf,sizeof(buf)))
|
||||
if ( (ch = getname(buf,sizeof(buf))) )
|
||||
return ch;
|
||||
goto havename;
|
||||
}
|
||||
@ -419,8 +419,8 @@ x_rsne(cilist *a)
|
||||
if (!(dims = v->dims)) {
|
||||
if (type != TYCHAR)
|
||||
errfl(a->cierr, 122, where);
|
||||
if (k = getdimen(&ch, dn, (ftnlen)size,
|
||||
(ftnlen)size, &b))
|
||||
if ( (k = getdimen(&ch, dn, (ftnlen)size,
|
||||
(ftnlen)size, &b)) )
|
||||
errfl(a->cierr, k, where);
|
||||
if (ch != ')')
|
||||
errfl(a->cierr, 115, where);
|
||||
@ -436,7 +436,7 @@ x_rsne(cilist *a)
|
||||
nomax = span = dims[1];
|
||||
ivae = iva + size*nomax;
|
||||
colonseen = 0;
|
||||
if (k = getdimen(&ch, dn, size, nomax, &b))
|
||||
if ( (k = getdimen(&ch, dn, size, nomax, &b)) )
|
||||
errfl(a->cierr, k, where);
|
||||
no = dn->extent;
|
||||
b0 = dims[2];
|
||||
@ -447,8 +447,8 @@ x_rsne(cilist *a)
|
||||
errfl(a->cierr, 115, where);
|
||||
dn1 = dn + 1;
|
||||
span /= *dims;
|
||||
if (k = getdimen(&ch, dn1, dn->delta**dims,
|
||||
span, &b1))
|
||||
if ( (k = getdimen(&ch, dn1, dn->delta**dims,
|
||||
span, &b1)) )
|
||||
errfl(a->cierr, k, where);
|
||||
ex *= *dims;
|
||||
b += b1*ex;
|
||||
@ -467,7 +467,7 @@ x_rsne(cilist *a)
|
||||
no1 = 1;
|
||||
dn0 = dimens;
|
||||
if (type == TYCHAR && ch == '(' /*)*/) {
|
||||
if (k = getdimen(&ch, &substr, size, size, &b))
|
||||
if ( (k = getdimen(&ch, &substr, size, size, &b)) )
|
||||
errfl(a->cierr, k, where);
|
||||
if (ch != ')')
|
||||
errfl(a->cierr, 115, where);
|
||||
@ -502,7 +502,7 @@ x_rsne(cilist *a)
|
||||
dn1->delta -= ex;
|
||||
}
|
||||
}
|
||||
else if (dims = v->dims) {
|
||||
else if ( (dims = v->dims) ) {
|
||||
no = no1 = dims[1];
|
||||
ivae = iva + no*size;
|
||||
}
|
||||
@ -522,7 +522,7 @@ x_rsne(cilist *a)
|
||||
else if (iva + no1*size > ivae)
|
||||
no1 = (ivae - iva)/size;
|
||||
f__lquit = 0;
|
||||
if (k = l_read(&no1, vaddr + iva, size, type))
|
||||
if ( (k = l_read(&no1, vaddr + iva, size, type)) )
|
||||
return k;
|
||||
if (f__lquit == 1)
|
||||
return 0;
|
||||
@ -533,8 +533,8 @@ x_rsne(cilist *a)
|
||||
if (no1 > f__lcount)
|
||||
no1 = f__lcount;
|
||||
iva += no1 * dn0->delta;
|
||||
if (k = l_read(&no1, vaddr + iva,
|
||||
size, type))
|
||||
if ( (k = l_read(&no1, vaddr + iva,
|
||||
size, type)) )
|
||||
return k;
|
||||
}
|
||||
}
|
||||
@ -594,7 +594,7 @@ s_rsne(cilist *a)
|
||||
|
||||
f__external=1;
|
||||
l_eof = 0;
|
||||
if(n = c_le(a))
|
||||
if( (n = c_le(a)) )
|
||||
return n;
|
||||
if(f__curunit->uwrt && f__nowreading(f__curunit))
|
||||
err(a->cierr,errno,where0);
|
||||
|
@ -15,9 +15,9 @@ integer e_rsfe(Void)
|
||||
return(n);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
c_sfe(a) cilist *a; /* check */
|
||||
int c_sfe(a) cilist *a; /* check */
|
||||
#else
|
||||
c_sfe(cilist *a) /* check */
|
||||
int c_sfe(cilist *a) /* check */
|
||||
#endif
|
||||
{ unit *p;
|
||||
if(a->ciunit >= MXUNIT || a->ciunit<0)
|
||||
|
@ -4,9 +4,9 @@ extern uiolen f__reclen;
|
||||
long f__recloc;
|
||||
|
||||
#ifdef KR_headers
|
||||
c_sue(a) cilist *a;
|
||||
int c_sue(a) cilist *a;
|
||||
#else
|
||||
c_sue(cilist *a)
|
||||
int c_sue(cilist *a)
|
||||
#endif
|
||||
{
|
||||
if(a->ciunit >= MXUNIT || a->ciunit < 0)
|
||||
@ -31,7 +31,7 @@ integer s_rsue(cilist *a)
|
||||
int n;
|
||||
if(!f__init) f_init();
|
||||
f__reading=1;
|
||||
if(n=c_sue(a)) return(n);
|
||||
if( (n=c_sue(a)) ) return(n);
|
||||
f__recpos=0;
|
||||
if(f__curunit->uwrt && f__nowreading(f__curunit))
|
||||
err(a->cierr, errno, "read start");
|
||||
@ -54,7 +54,7 @@ integer s_wsue(cilist *a)
|
||||
{
|
||||
int n;
|
||||
if(!f__init) f_init();
|
||||
if(n=c_sue(a)) return(n);
|
||||
if( (n=c_sue(a)) ) return(n);
|
||||
f__reading=0;
|
||||
f__reclen=0;
|
||||
if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
|
||||
|
@ -3,9 +3,9 @@
|
||||
uiolen f__reclen;
|
||||
|
||||
#ifdef KR_headers
|
||||
do_us(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
|
||||
int do_us(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
|
||||
#else
|
||||
do_us(ftnint *number, char *ptr, ftnlen len)
|
||||
int do_us(ftnint *number, char *ptr, ftnlen len)
|
||||
#endif
|
||||
{
|
||||
if(f__reading)
|
||||
@ -23,6 +23,7 @@ do_us(ftnint *number, char *ptr, ftnlen len)
|
||||
(void) fwrite(ptr,(int)len,(int)(*number),f__cf);
|
||||
return(0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
integer do_ud(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
|
||||
|
@ -15,9 +15,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef KR_headers
|
||||
wrt_E(p,w,d,e,len) ufloat *p; ftnlen len;
|
||||
int wrt_E(p,w,d,e,len) ufloat *p; ftnlen len;
|
||||
#else
|
||||
wrt_E(ufloat *p, int w, int d, int e, ftnlen len)
|
||||
int wrt_E(ufloat *p, int w, int d, int e, ftnlen len)
|
||||
#endif
|
||||
{
|
||||
char buf[FMAX+EXPMAXDIGS+4], *s, *se;
|
||||
@ -127,7 +127,7 @@ wrt_E(ufloat *p, int w, int d, int e, ftnlen len)
|
||||
/* exponent field if it fits. */
|
||||
#else
|
||||
if (!e0) {
|
||||
for(s -= 2, e1 = 2; s[0] = s[1]; s++)
|
||||
for(s -= 2, e1 = 2; (s[0] = s[1]); s++)
|
||||
#ifdef CRAY
|
||||
delta--;
|
||||
if ((delta += 4) < 0)
|
||||
@ -191,9 +191,9 @@ wrt_E(ufloat *p, int w, int d, int e, ftnlen len)
|
||||
}
|
||||
|
||||
#ifdef KR_headers
|
||||
wrt_F(p,w,d,len) ufloat *p; ftnlen len;
|
||||
int wrt_F(p,w,d,len) ufloat *p; ftnlen len;
|
||||
#else
|
||||
wrt_F(ufloat *p, int w, int d, ftnlen len)
|
||||
int wrt_F(ufloat *p, int w, int d, ftnlen len)
|
||||
#endif
|
||||
{
|
||||
int d1, sign, n;
|
||||
@ -217,7 +217,7 @@ wrt_F(ufloat *p, int w, int d, ftnlen len)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (n = f__scale)
|
||||
if ( (n = f__scale) )
|
||||
if (n > 0)
|
||||
do x *= 10.; while(--n > 0);
|
||||
else
|
||||
@ -267,7 +267,7 @@ wrt_F(ufloat *p, int w, int d, ftnlen len)
|
||||
PUT('-');
|
||||
else if (f__cplus)
|
||||
PUT('+');
|
||||
while(n = *b++)
|
||||
while( (n = *b++) )
|
||||
PUT(n);
|
||||
while(--d1 >= 0)
|
||||
PUT('0');
|
||||
|
@ -6,6 +6,8 @@ extern int f__cursor;
|
||||
int f__hiwater;
|
||||
icilist *f__svic;
|
||||
char *f__icptr;
|
||||
|
||||
int
|
||||
mv_cur(Void) /* shouldn't use fseek because it insists on calling fflush */
|
||||
/* instead we know too much about stdio */
|
||||
{
|
||||
@ -233,9 +235,9 @@ wrt_H(int a, char *s)
|
||||
return(1);
|
||||
}
|
||||
#ifdef KR_headers
|
||||
wrt_L(n,len, sz) Uint *n; ftnlen sz;
|
||||
int wrt_L(n,len, sz) Uint *n; ftnlen sz;
|
||||
#else
|
||||
wrt_L(Uint *n, int len, ftnlen sz)
|
||||
int wrt_L(Uint *n, int len, ftnlen sz)
|
||||
#endif
|
||||
{ int i;
|
||||
long x;
|
||||
@ -307,9 +309,9 @@ wrt_G(ufloat *p, int w, int d, int e, ftnlen len)
|
||||
return(wrt_E(p,w,d,e,len));
|
||||
}
|
||||
#ifdef KR_headers
|
||||
w_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
|
||||
int w_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
|
||||
#else
|
||||
w_ed(struct syl *p, char *ptr, ftnlen len)
|
||||
int w_ed(struct syl *p, char *ptr, ftnlen len)
|
||||
#endif
|
||||
{
|
||||
if(f__cursor && mv_cur()) return(mv_cur());
|
||||
@ -350,9 +352,9 @@ w_ed(struct syl *p, char *ptr, ftnlen len)
|
||||
}
|
||||
}
|
||||
#ifdef KR_headers
|
||||
w_ned(p) struct syl *p;
|
||||
int w_ned(p) struct syl *p;
|
||||
#else
|
||||
w_ned(struct syl *p)
|
||||
int w_ned(struct syl *p)
|
||||
#endif
|
||||
{
|
||||
switch(p->op)
|
||||
|
@ -5,9 +5,9 @@
|
||||
extern int f__hiwater;
|
||||
|
||||
#ifdef KR_headers
|
||||
x_putc(c)
|
||||
int x_putc(c)
|
||||
#else
|
||||
x_putc(int c)
|
||||
int x_putc(int c)
|
||||
#endif
|
||||
{
|
||||
/* this uses \n as an indicator of record-end */
|
||||
@ -27,6 +27,8 @@ x_putc(int c)
|
||||
#endif
|
||||
return putc(c,f__cf);
|
||||
}
|
||||
|
||||
int
|
||||
x_wSL(Void)
|
||||
{
|
||||
(*f__putn)('\n');
|
||||
@ -35,6 +37,8 @@ x_wSL(Void)
|
||||
f__hiwater = 0;
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
xw_end(Void)
|
||||
{
|
||||
if(f__nonl == 0)
|
||||
@ -42,6 +46,8 @@ xw_end(Void)
|
||||
f__hiwater = f__recpos = f__cursor = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
xw_rev(Void)
|
||||
{
|
||||
if(f__workdone) (*f__putn)('\n');
|
||||
@ -56,7 +62,7 @@ integer s_wsfe(cilist *a) /*start*/
|
||||
#endif
|
||||
{ int n;
|
||||
if(!f__init) f_init();
|
||||
if(n=c_sfe(a)) return(n);
|
||||
if( (n=c_sfe(a)) ) return(n);
|
||||
f__reading=0;
|
||||
f__sequential=1;
|
||||
f__formatted=1;
|
||||
|
@ -10,7 +10,7 @@ integer s_wsle(cilist *a)
|
||||
#endif
|
||||
{
|
||||
int n;
|
||||
if(n=c_le(a)) return(n);
|
||||
if( (n=c_le(a)) ) return(n);
|
||||
f__reading=0;
|
||||
f__external=1;
|
||||
f__formatted=1;
|
||||
|
@ -11,7 +11,7 @@ s_wsne(cilist *a)
|
||||
{
|
||||
int n;
|
||||
|
||||
if(n=c_le(a))
|
||||
if( (n=c_le(a)) )
|
||||
return(n);
|
||||
f__reading=0;
|
||||
f__external=1;
|
||||
|
@ -30,15 +30,16 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: isinf.c,v 1.2 1995/01/23 01:27:00 davidg Exp $
|
||||
*/
|
||||
|
||||
#if defined(LIBC_RCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id$";
|
||||
static const char rcsid[] = "$Id: isinf.c,v 1.2 1995/01/23 01:27:00 davidg Exp $";
|
||||
#endif /* LIBC_RCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
@ -52,6 +53,7 @@ isnan(d)
|
||||
return(p->exp == 2047 && (p->manh || p->manl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ static char sccsid[] = "@(#)creat.c 8.1 (Berkeley) 6/2/93";
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
int
|
||||
#if __STDC__
|
||||
creat(const char *path, mode_t mode)
|
||||
#else
|
||||
|
@ -47,7 +47,7 @@ getwd(buf)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (p = getcwd(buf, MAXPATHLEN))
|
||||
if ( (p = getcwd(buf, MAXPATHLEN)) )
|
||||
return(p);
|
||||
(void)strcpy(buf, strerror(errno));
|
||||
return((char *)NULL);
|
||||
|
@ -42,6 +42,7 @@ static char sccsid[] = "@(#)killpg.c 8.1 (Berkeley) 6/2/93";
|
||||
/*
|
||||
* Backwards-compatible killpg().
|
||||
*/
|
||||
int
|
||||
#if __STDC__
|
||||
killpg(pid_t pgid, int sig)
|
||||
#else
|
||||
|
@ -38,6 +38,7 @@ static char sccsid[] = "@(#)setpgrp.c 8.1 (Berkeley) 6/2/93";
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
#if __STDC__
|
||||
setpgrp(pid_t pid, pid_t pgid)
|
||||
#else
|
||||
|
@ -38,6 +38,7 @@ static char sccsid[] = "@(#)sigcompat.c 8.1 (Berkeley) 6/2/93";
|
||||
#include <sys/param.h>
|
||||
#include <signal.h>
|
||||
|
||||
int
|
||||
sigvec(signo, sv, osv)
|
||||
int signo;
|
||||
struct sigvec *sv, *osv;
|
||||
@ -52,6 +53,7 @@ sigvec(signo, sv, osv)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
sigsetmask(mask)
|
||||
int mask;
|
||||
{
|
||||
@ -63,6 +65,7 @@ sigsetmask(mask)
|
||||
return (omask);
|
||||
}
|
||||
|
||||
int
|
||||
sigblock(mask)
|
||||
int mask;
|
||||
{
|
||||
@ -74,6 +77,7 @@ sigblock(mask)
|
||||
return (omask);
|
||||
}
|
||||
|
||||
int
|
||||
sigpause(mask)
|
||||
int mask;
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
|
||||
*/
|
||||
if (b.psize &&
|
||||
(b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
|
||||
b.psize & sizeof(indx_t) - 1))
|
||||
b.psize & (sizeof(indx_t) - 1) ))
|
||||
goto einval;
|
||||
|
||||
/* Minimum number of keys per page; absolute minimum is 2. */
|
||||
@ -245,7 +245,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
|
||||
if (m.magic != BTREEMAGIC || m.version != BTREEVERSION)
|
||||
goto eftype;
|
||||
if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 ||
|
||||
m.psize & sizeof(indx_t) - 1)
|
||||
m.psize & (sizeof(indx_t) - 1) )
|
||||
goto eftype;
|
||||
if (m.flags & ~SAVEMETA)
|
||||
goto eftype;
|
||||
@ -278,8 +278,8 @@ __bt_open(fname, flags, mode, openinfo, dflags)
|
||||
t->bt_psize = b.psize;
|
||||
|
||||
/* Set the cache size; must be a multiple of the page size. */
|
||||
if (b.cachesize && b.cachesize & b.psize - 1)
|
||||
b.cachesize += (~b.cachesize & b.psize - 1) + 1;
|
||||
if (b.cachesize && b.cachesize & (b.psize - 1) )
|
||||
b.cachesize += (~b.cachesize & (b.psize - 1) ) + 1;
|
||||
if (b.cachesize < b.psize * MINCACHE)
|
||||
b.cachesize = b.psize * MINCACHE;
|
||||
|
||||
|
@ -875,7 +875,7 @@ hash_realloc(p_ptr, oldsize, newsize)
|
||||
{
|
||||
register void *p;
|
||||
|
||||
if (p = malloc(newsize)) {
|
||||
if ( (p = malloc(newsize)) ) {
|
||||
memmove(p, *p_ptr, oldsize);
|
||||
memset((char *)p + oldsize, 0, newsize - oldsize);
|
||||
free(*p_ptr);
|
||||
|
@ -590,7 +590,7 @@ __big_split(hashp, op, np, big_keyp, addr, obucket, ret)
|
||||
return (-1);
|
||||
change = (__call_hash(hashp, key.data, key.size) != obucket);
|
||||
|
||||
if (ret->next_addr = __find_last_page(hashp, &big_keyp)) {
|
||||
if ( (ret->next_addr = __find_last_page(hashp, &big_keyp)) ) {
|
||||
if (!(ret->nextp =
|
||||
__get_buf(hashp, ret->next_addr, big_keyp, 0)))
|
||||
return (-1);;
|
||||
|
@ -40,6 +40,8 @@ static char sccsid[] = "@(#)closedir.c 8.1 (Berkeley) 6/10/93";
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern void _reclaim_telldir __P(( const DIR * ));
|
||||
|
||||
/*
|
||||
* close a directory.
|
||||
*/
|
||||
|
@ -105,7 +105,7 @@ execl(name, arg, va_alist)
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (argv = buildargv(ap, arg, NULL))
|
||||
if ( (argv = buildargv(ap, arg, NULL)) )
|
||||
(void)execve(name, argv, environ);
|
||||
va_end(ap);
|
||||
sverrno = errno;
|
||||
@ -133,7 +133,7 @@ execle(name, arg, va_alist)
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (argv = buildargv(ap, arg, &envp))
|
||||
if ( (argv = buildargv(ap, arg, &envp)) )
|
||||
(void)execve(name, argv, envp);
|
||||
va_end(ap);
|
||||
sverrno = errno;
|
||||
@ -161,7 +161,7 @@ execlp(name, arg, va_alist)
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
if (argv = buildargv(ap, arg, NULL))
|
||||
if ( (argv = buildargv(ap, arg, NULL)) )
|
||||
(void)execvp(name, argv);
|
||||
va_end(ap);
|
||||
sverrno = errno;
|
||||
@ -204,7 +204,7 @@ execvp(name, argv)
|
||||
cur = path = strdup(path);
|
||||
|
||||
eacces = etxtbsy = 0;
|
||||
while (p = strsep(&cur, ":")) {
|
||||
while ( (p = strsep(&cur, ":")) ) {
|
||||
/*
|
||||
* It's a SHELL path -- double, leading and trailing colons
|
||||
* mean the current directory.
|
||||
|
@ -147,7 +147,7 @@ rangematch(pattern, test, flags)
|
||||
* consistency with the regular expression syntax.
|
||||
* J.T. Conklin (conklin@ngai.kaleida.com)
|
||||
*/
|
||||
if (negate = (*pattern == '!' || *pattern == '^'))
|
||||
if ( (negate = (*pattern == '!' || *pattern == '^')) )
|
||||
++pattern;
|
||||
|
||||
for (ok = 0; (c = *pattern++) != ']';) {
|
||||
|
@ -56,7 +56,7 @@ static int fts_palloc __P((FTS *, size_t));
|
||||
static FTSENT *fts_sort __P((FTS *, FTSENT *, int));
|
||||
static u_short fts_stat __P((FTS *, FTSENT *, int));
|
||||
|
||||
#define ISDOT(a) (a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
|
||||
#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])) )
|
||||
|
||||
#define ISSET(opt) (sp->fts_options & opt)
|
||||
#define SET(opt) (sp->fts_options |= opt)
|
||||
@ -304,7 +304,7 @@ fts_read(sp)
|
||||
if (p->fts_info == FTS_D) {
|
||||
/* If skipped or crossed mount point, do post-order visit. */
|
||||
if (instr == FTS_SKIP ||
|
||||
ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
|
||||
(ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) ) {
|
||||
if (p->fts_flags & FTS_SYMFOLLOW)
|
||||
(void)close(p->fts_symfd);
|
||||
if (sp->fts_child) {
|
||||
@ -354,7 +354,7 @@ fts_read(sp)
|
||||
|
||||
/* Move to the next node on this level. */
|
||||
next: tmp = p;
|
||||
if (p = p->fts_link) {
|
||||
if ( (p = p->fts_link) ) {
|
||||
free(tmp);
|
||||
|
||||
/*
|
||||
@ -640,7 +640,7 @@ fts_build(sp, type)
|
||||
|
||||
/* Read the directory, attaching each entry to the `link' pointer. */
|
||||
adjaddr = NULL;
|
||||
for (head = tail = NULL, nitems = 0; dp = readdir(dirp);) {
|
||||
for (head = tail = NULL, nitems = 0; (dp = readdir(dirp)); ) {
|
||||
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
|
||||
continue;
|
||||
|
||||
@ -680,8 +680,8 @@ mem1: saved_errno = errno;
|
||||
p->fts_accpath = cur->fts_accpath;
|
||||
} else if (nlinks == 0
|
||||
#ifdef DT_DIR
|
||||
|| nlinks > 0 &&
|
||||
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
|
||||
|| (nlinks > 0 &&
|
||||
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
|
||||
#endif
|
||||
) {
|
||||
p->fts_accpath =
|
||||
@ -909,7 +909,7 @@ fts_lfree(head)
|
||||
register FTSENT *p;
|
||||
|
||||
/* Free a linked list of structures. */
|
||||
while (p = head) {
|
||||
while ( (p = head) ) {
|
||||
head = head->fts_link;
|
||||
free(p);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static int fts_palloc __P((FTS *, size_t));
|
||||
static FTSENT *fts_sort __P((FTS *, FTSENT *, int));
|
||||
static u_short fts_stat __P((FTS *, FTSENT *, int));
|
||||
|
||||
#define ISDOT(a) (a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
|
||||
#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])) )
|
||||
|
||||
#define ISSET(opt) (sp->fts_options & opt)
|
||||
#define SET(opt) (sp->fts_options |= opt)
|
||||
@ -304,7 +304,7 @@ fts_read(sp)
|
||||
if (p->fts_info == FTS_D) {
|
||||
/* If skipped or crossed mount point, do post-order visit. */
|
||||
if (instr == FTS_SKIP ||
|
||||
ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
|
||||
(ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) ) {
|
||||
if (p->fts_flags & FTS_SYMFOLLOW)
|
||||
(void)close(p->fts_symfd);
|
||||
if (sp->fts_child) {
|
||||
@ -354,7 +354,7 @@ fts_read(sp)
|
||||
|
||||
/* Move to the next node on this level. */
|
||||
next: tmp = p;
|
||||
if (p = p->fts_link) {
|
||||
if ( (p = p->fts_link) ) {
|
||||
free(tmp);
|
||||
|
||||
/*
|
||||
@ -640,7 +640,7 @@ fts_build(sp, type)
|
||||
|
||||
/* Read the directory, attaching each entry to the `link' pointer. */
|
||||
adjaddr = NULL;
|
||||
for (head = tail = NULL, nitems = 0; dp = readdir(dirp);) {
|
||||
for (head = tail = NULL, nitems = 0; (dp = readdir(dirp)); ) {
|
||||
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
|
||||
continue;
|
||||
|
||||
@ -680,8 +680,8 @@ mem1: saved_errno = errno;
|
||||
p->fts_accpath = cur->fts_accpath;
|
||||
} else if (nlinks == 0
|
||||
#ifdef DT_DIR
|
||||
|| nlinks > 0 &&
|
||||
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
|
||||
|| (nlinks > 0 &&
|
||||
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
|
||||
#endif
|
||||
) {
|
||||
p->fts_accpath =
|
||||
@ -909,7 +909,7 @@ fts_lfree(head)
|
||||
register FTSENT *p;
|
||||
|
||||
/* Free a linked list of structures. */
|
||||
while (p = head) {
|
||||
while ( (p = head) ) {
|
||||
head = head->fts_link;
|
||||
free(p);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ static char sccsid[] = "@(#)getcwd.c 8.1 (Berkeley) 6/4/93";
|
||||
|
||||
#define ISDOT(dp) \
|
||||
(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
|
||||
dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
|
||||
(dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
|
||||
|
||||
char *
|
||||
getcwd(pt, size)
|
||||
|
@ -68,7 +68,7 @@ getgrouplist(uname, agroup, groups, grpcnt)
|
||||
* Scan the group file to find additional groups.
|
||||
*/
|
||||
setgrent();
|
||||
while (grp = getgrent()) {
|
||||
while ( (grp = getgrent()) ) {
|
||||
for (i = 0; i < ngroups; i++) {
|
||||
if (grp->gr_gid == groups[i])
|
||||
goto skip;
|
||||
|
@ -280,7 +280,7 @@ int len;
|
||||
{
|
||||
char *ptr = list;
|
||||
|
||||
while (ptr = strstr(ptr, group)) {
|
||||
while ( (ptr = strstr(ptr, group)) ) {
|
||||
|
||||
ptr += strlen(group);
|
||||
|
||||
@ -317,7 +317,7 @@ int *rotation;
|
||||
*/
|
||||
int
|
||||
innetgr(group, host, user, dom)
|
||||
char *group, *host, *user, *dom;
|
||||
const char *group, *host, *user, *dom;
|
||||
{
|
||||
char *hst, *usr, *dm;
|
||||
#ifdef YP
|
||||
|
@ -83,7 +83,6 @@ getpass(prompt)
|
||||
register int ch;
|
||||
register char *p;
|
||||
FILE *outfp;
|
||||
long omask;
|
||||
static char buf[_PASSWORD_LEN + 1];
|
||||
|
||||
/*
|
||||
|
@ -49,6 +49,10 @@ static char sccsid[] = "@(#)getpwent.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <limits.h>
|
||||
#include <grp.h>
|
||||
|
||||
extern void setnetgrent __P(( char * ));
|
||||
extern int getnetgrent __P(( char **, char **, char ** ));
|
||||
extern int innetgr __P(( const char *, const char *, const char *, const char * ));
|
||||
|
||||
static struct passwd _pw_passwd; /* password structure */
|
||||
static DB *_pw_db; /* password database */
|
||||
static int _pw_keynum; /* key counter */
|
||||
@ -237,7 +241,7 @@ endpwent()
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
static int
|
||||
__initdb()
|
||||
{
|
||||
static int warned;
|
||||
@ -273,7 +277,7 @@ __initdb()
|
||||
return(0);
|
||||
}
|
||||
|
||||
static
|
||||
static int
|
||||
__hashpw(key)
|
||||
DBT *key;
|
||||
{
|
||||
@ -289,7 +293,7 @@ __hashpw(key)
|
||||
return(0);
|
||||
|
||||
t = line;
|
||||
#define EXPAND(e) e = t; while (*t++ = *p++);
|
||||
#define EXPAND(e) e = t; while ( (*t++ = *p++) );
|
||||
EXPAND(_pw_passwd.pw_name);
|
||||
EXPAND(_pw_passwd.pw_passwd);
|
||||
bcopy(p, (char *)&_pw_passwd.pw_uid, sizeof(int));
|
||||
|
@ -50,7 +50,7 @@ getttynam(tty)
|
||||
register struct ttyent *t;
|
||||
|
||||
setttyent();
|
||||
while (t = getttyent())
|
||||
while ( (t = getttyent()) )
|
||||
if (!strcmp(tty, t->ty_name))
|
||||
break;
|
||||
endttyent();
|
||||
@ -120,7 +120,7 @@ getttyent()
|
||||
tty.ty_comment = p;
|
||||
if (*p == 0)
|
||||
tty.ty_comment = 0;
|
||||
if (p = index(p, '\n'))
|
||||
if ( (p = index(p, '\n')) )
|
||||
*p = '\0';
|
||||
return (&tty);
|
||||
}
|
||||
@ -180,7 +180,7 @@ setttyent()
|
||||
if (tf) {
|
||||
rewind(tf);
|
||||
return (1);
|
||||
} else if (tf = fopen(_PATH_TTYS, "r"))
|
||||
} else if ( (tf = fopen(_PATH_TTYS, "r")) )
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
initgroups(uname, agroup)
|
||||
|
@ -46,6 +46,8 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int __fdnlist __P(( int, struct nlist * ));
|
||||
|
||||
int
|
||||
nlist(name, list)
|
||||
const char *name;
|
||||
|
@ -64,7 +64,7 @@ popen(program, type)
|
||||
FILE *iop;
|
||||
int pdes[2], pid;
|
||||
|
||||
if (*type != 'r' && *type != 'w' || type[1])
|
||||
if ( (*type != 'r' && *type != 'w') || type[1])
|
||||
return (NULL);
|
||||
|
||||
if ((cur = malloc(sizeof(struct pid))) == NULL)
|
||||
|
@ -44,7 +44,7 @@ static char sccsid[] = "@(#)pwcache.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <utmp.h>
|
||||
|
||||
#define NCACHE 64 /* power of 2 */
|
||||
#define MASK NCACHE - 1 /* bits to store with */
|
||||
#define MASK (NCACHE - 1) /* bits to store with */
|
||||
|
||||
char *
|
||||
user_from_uid(uid, nouser)
|
||||
|
@ -38,6 +38,7 @@ static char sccsid[] = "@(#)raise.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
raise(s)
|
||||
int s;
|
||||
{
|
||||
|
@ -38,6 +38,8 @@ static char sccsid[] = "@(#)rewinddir.c 8.1 (Berkeley) 6/8/93";
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
extern void _seekdir __P(( DIR *, long ));
|
||||
|
||||
void
|
||||
rewinddir(dirp)
|
||||
DIR *dirp;
|
||||
|
@ -38,6 +38,8 @@ static char sccsid[] = "@(#)seekdir.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <sys/param.h>
|
||||
#include <dirent.h>
|
||||
|
||||
extern void _seekdir __P(( DIR *, long ));
|
||||
|
||||
/*
|
||||
* Seek to an entry in a directory.
|
||||
* _seekdir is in telldir.c so that it can share opaque data structures.
|
||||
|
@ -14,7 +14,7 @@
|
||||
* 3. Absolutely no warranty of function or purpose is made by the author
|
||||
* Peter Wemm.
|
||||
*
|
||||
* $Id: setproctitle.c,v 1.1 1995/12/26 22:50:08 peter Exp $
|
||||
* $Id: setproctitle.c,v 1.2 1996/02/24 14:37:29 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -67,7 +67,6 @@ setproctitle(fmt, va_alist)
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
char *p;
|
||||
static char buf[SPT_BUFSIZE];
|
||||
static char *ps_argv[2];
|
||||
va_list ap;
|
||||
|
@ -41,6 +41,7 @@ static char sccsid[] = "@(#)siginterrupt.c 8.1 (Berkeley) 6/4/93";
|
||||
* Set signal state to prevent restart of system calls
|
||||
* after an instance of the indicated signal.
|
||||
*/
|
||||
int
|
||||
siginterrupt(sig, flag)
|
||||
int sig, flag;
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ static char sccsid[] = "@(#)sigsetops.c 8.1 (Berkeley) 6/4/93";
|
||||
#undef sigdelset
|
||||
#undef sigismember
|
||||
|
||||
int
|
||||
sigemptyset(set)
|
||||
sigset_t *set;
|
||||
{
|
||||
@ -52,6 +53,7 @@ sigemptyset(set)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
sigfillset(set)
|
||||
sigset_t *set;
|
||||
{
|
||||
@ -59,6 +61,7 @@ sigfillset(set)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
sigaddset(set, signo)
|
||||
sigset_t *set;
|
||||
int signo;
|
||||
@ -67,6 +70,7 @@ sigaddset(set, signo)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
sigdelset(set, signo)
|
||||
sigset_t *set;
|
||||
int signo;
|
||||
@ -75,6 +79,7 @@ sigdelset(set, signo)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
sigismember(set, signo)
|
||||
const sigset_t *set;
|
||||
int signo;
|
||||
|
@ -36,7 +36,7 @@
|
||||
static char sccsid[] = "From: @(#)syslog.c 8.4 (Berkeley) 3/18/94";
|
||||
*/
|
||||
static const char rcsid[] =
|
||||
"$Id: syslog.c,v 1.7 1995/10/22 14:37:08 phk Exp $";
|
||||
"$Id: syslog.c,v 1.8 1996/03/02 19:56:16 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -202,7 +202,7 @@ vsyslog(pri, fmt, ap)
|
||||
}
|
||||
|
||||
/* Substitute error message for %m. */
|
||||
for ( ; ch = *fmt; ++fmt)
|
||||
for ( ; (ch = *fmt); ++fmt)
|
||||
if (ch == '%' && fmt[1] == 'm') {
|
||||
++fmt;
|
||||
fputs(strerror(saved_errno), fmt_fp);
|
||||
|
@ -62,8 +62,8 @@ timezone(zone, dst)
|
||||
register char *beg,
|
||||
*end;
|
||||
|
||||
if (beg = getenv("TZNAME")) { /* set in environment */
|
||||
if (end = index(beg, ',')) { /* "PST,PDT" */
|
||||
if ( (beg = getenv("TZNAME")) ) { /* set in environment */
|
||||
if ( (end = index(beg, ',')) ) {/* "PST,PDT" */
|
||||
if (dst)
|
||||
return(++end);
|
||||
*end = '\0';
|
||||
@ -82,22 +82,22 @@ static struct zone {
|
||||
char *stdzone;
|
||||
char *dlzone;
|
||||
} zonetab[] = {
|
||||
-1*60, "MET", "MET DST", /* Middle European */
|
||||
-2*60, "EET", "EET DST", /* Eastern European */
|
||||
4*60, "AST", "ADT", /* Atlantic */
|
||||
5*60, "EST", "EDT", /* Eastern */
|
||||
6*60, "CST", "CDT", /* Central */
|
||||
7*60, "MST", "MDT", /* Mountain */
|
||||
8*60, "PST", "PDT", /* Pacific */
|
||||
{-1*60, "MET", "MET DST"}, /* Middle European */
|
||||
{-2*60, "EET", "EET DST"}, /* Eastern European */
|
||||
{4*60, "AST", "ADT"}, /* Atlantic */
|
||||
{5*60, "EST", "EDT"}, /* Eastern */
|
||||
{6*60, "CST", "CDT"}, /* Central */
|
||||
{7*60, "MST", "MDT"}, /* Mountain */
|
||||
{8*60, "PST", "PDT"}, /* Pacific */
|
||||
#ifdef notdef
|
||||
/* there's no way to distinguish this from WET */
|
||||
0, "GMT", 0, /* Greenwich */
|
||||
{0, "GMT", 0}, /* Greenwich */
|
||||
#endif
|
||||
0*60, "WET", "WET DST", /* Western European */
|
||||
-10*60, "EST", "EST", /* Aust: Eastern */
|
||||
-10*60+30, "CST", "CST", /* Aust: Central */
|
||||
-8*60, "WST", 0, /* Aust: Western */
|
||||
-1
|
||||
{0*60, "WET", "WET DST"}, /* Western European */
|
||||
{-10*60,"EST", "EST"}, /* Aust: Eastern */
|
||||
{-10*60+30,"CST", "CST"}, /* Aust: Central */
|
||||
{-8*60, "WST", 0}, /* Aust: Western */
|
||||
{-1}
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -177,7 +177,7 @@ ttyname(fd)
|
||||
if (fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
|
||||
return (NULL);
|
||||
|
||||
if (db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL)) {
|
||||
if ( (db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL)) ) {
|
||||
memset(&bkey, 0, sizeof(bkey));
|
||||
bkey.type = S_IFCHR;
|
||||
bkey.dev = sb.st_rdev;
|
||||
@ -206,7 +206,7 @@ oldttyname(fd, sb)
|
||||
if ((dp = opendir(_PATH_DEV)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
while (dirp = readdir(dp)) {
|
||||
while ( (dirp = readdir(dp)) ) {
|
||||
if (dirp->d_fileno != sb->st_ino)
|
||||
continue;
|
||||
bcopy(dirp->d_name, buf + sizeof(_PATH_DEV) - 1,
|
||||
|
@ -51,12 +51,12 @@ ttyslot()
|
||||
|
||||
setttyent();
|
||||
for (cnt = 0; cnt < 3; ++cnt)
|
||||
if (name = ttyname(cnt)) {
|
||||
if (p = rindex(name, '/'))
|
||||
if ( (name = ttyname(cnt)) ) {
|
||||
if ( (p = rindex(name, '/')) )
|
||||
++p;
|
||||
else
|
||||
p = name;
|
||||
for (slot = 1; ttyp = getttyent(); ++slot)
|
||||
for (slot = 1; (ttyp = getttyent()); ++slot)
|
||||
if (!strcmp(ttyp->ty_name, p)) {
|
||||
endttyent();
|
||||
return(slot);
|
||||
|
@ -224,7 +224,7 @@ strunvis(dst, src)
|
||||
char *start = dst;
|
||||
int state = 0;
|
||||
|
||||
while (c = *src++) {
|
||||
while ( (c = *src++) ) {
|
||||
again:
|
||||
switch (unvis(dst, c, &state, 0)) {
|
||||
case UNVIS_VALID:
|
||||
|
@ -159,7 +159,7 @@ strvis(dst, src, flag)
|
||||
register char c;
|
||||
char *start;
|
||||
|
||||
for (start = dst; c = *src;)
|
||||
for (start = dst; (c = *src); )
|
||||
dst = vis(dst, c, flag, *++src);
|
||||
*dst = '\0';
|
||||
return (dst - start);
|
||||
|
@ -30,15 +30,16 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: isinf.c,v 1.2 1995/01/23 01:27:00 davidg Exp $
|
||||
*/
|
||||
|
||||
#if defined(LIBC_RCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id$";
|
||||
static const char rcsid[] = "$Id: isinf.c,v 1.2 1995/01/23 01:27:00 davidg Exp $";
|
||||
#endif /* LIBC_RCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
@ -52,6 +53,7 @@ isnan(d)
|
||||
return(p->exp == 2047 && (p->manh || p->manl));
|
||||
}
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
|
@ -35,7 +35,7 @@
|
||||
* Center for Telecommunications Research
|
||||
* Columbia University, New York City
|
||||
*
|
||||
* $Id: ether_addr.c,v 1.2 1995/08/07 03:42:14 wpaul Exp $
|
||||
* $Id: ether_addr.c,v 1.3 1996/03/16 21:25:59 wpaul Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -90,11 +90,20 @@ struct ether_addr *ether_aton(a)
|
||||
{
|
||||
int i;
|
||||
static struct ether_addr o;
|
||||
unsigned int o0, o1, o2, o3, o4, o5;
|
||||
|
||||
i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5);
|
||||
|
||||
i = sscanf(a, "%x:%x:%x:%x:%x:%x", o.octet[0], o.octet[1], o.octet[2],
|
||||
o.octet[3], o.octet[4], o.octet[5]);
|
||||
if (i != 6)
|
||||
return (NULL);
|
||||
|
||||
o.octet[0]=o0;
|
||||
o.octet[1]=o1;
|
||||
o.octet[2]=o2;
|
||||
o.octet[3]=o3;
|
||||
o.octet[4]=o4;
|
||||
o.octet[5]=o5;
|
||||
|
||||
return ((struct ether_addr *)&o);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: gethostbydns.c,v 1.7 1995/10/22 14:39:02 phk Exp $";
|
||||
static char rcsid[] = "$Id: gethostbydns.c,v 1.8 1996/01/13 09:03:40 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -73,6 +73,8 @@ static char rcsid[] = "$Id: gethostbydns.c,v 1.7 1995/10/22 14:39:02 phk Exp $";
|
||||
|
||||
#include "res_config.h"
|
||||
|
||||
extern void _res_close __P((void));
|
||||
|
||||
#define MAXALIASES 35
|
||||
#define MAXADDRS 35
|
||||
|
||||
@ -85,8 +87,6 @@ static struct hostent host;
|
||||
static char *host_aliases[MAXALIASES];
|
||||
static char hostbuf[8*1024];
|
||||
static struct in_addr host_addr;
|
||||
static FILE *hostf = NULL;
|
||||
static int stayopen = 0;
|
||||
|
||||
#ifdef RESOLVSORT
|
||||
static void addrsort __P((char **, int));
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: gethostbyht.c,v 1.2 1995/05/30 05:40:44 rgrimes Exp $";
|
||||
static char rcsid[] = "$Id: gethostbyht.c,v 1.3 1996/01/13 09:03:45 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -135,7 +135,7 @@ gethostent()
|
||||
cp++;
|
||||
host.h_name = cp;
|
||||
q = host.h_aliases = host_aliases;
|
||||
if (cp = strpbrk(cp, " \t"))
|
||||
if ( (cp = strpbrk(cp, " \t")) )
|
||||
*cp++ = '\0';
|
||||
while (cp && *cp) {
|
||||
if (*cp == ' ' || *cp == '\t') {
|
||||
@ -144,7 +144,7 @@ gethostent()
|
||||
}
|
||||
if (q < &host_aliases[MAXALIASES - 1])
|
||||
*q++ = cp;
|
||||
if (cp = strpbrk(cp, " \t"))
|
||||
if ( (cp = strpbrk(cp, " \t")) )
|
||||
*cp++ = '\0';
|
||||
}
|
||||
*q = NULL;
|
||||
@ -160,7 +160,7 @@ _gethostbyhtname(name)
|
||||
register char **cp;
|
||||
|
||||
sethostent(0);
|
||||
while (p = gethostent()) {
|
||||
while ( (p = gethostent()) ) {
|
||||
if (strcasecmp(p->h_name, name) == 0)
|
||||
break;
|
||||
for (cp = p->h_aliases; *cp != 0; cp++)
|
||||
@ -180,7 +180,7 @@ _gethostbyhtaddr(addr, len, type)
|
||||
register struct hostent *p;
|
||||
|
||||
sethostent(0);
|
||||
while (p = gethostent())
|
||||
while ( (p = gethostent()) )
|
||||
if (p->h_addrtype == type && !bcmp(p->h_addr, addr, len))
|
||||
break;
|
||||
endhostent();
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.1 1994/09/25 02:12:14 pst Exp $";
|
||||
static char rcsid[] = "$Id: gethostbynis.c,v 1.1 1994/09/25 02:12:14 pst Exp $";
|
||||
static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.2 1996/03/16 21:25:58 wpaul Exp $";
|
||||
static char rcsid[] = "$Id: gethostbynis.c,v 1.2 1996/03/16 21:25:58 wpaul Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,6 +34,7 @@ static char rcsid[] = "$Id: gethostbynis.c,v 1.1 1994/09/25 02:12:14 pst Exp $";
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)$Id: gethostnamadr.c,v 1.6 1995/03/24 15:38:54 ache Exp $";
|
||||
static char rcsid[] = "$Id: gethostnamadr.c,v 1.6 1995/03/24 15:38:54 ache Exp $";
|
||||
static char sccsid[] = "@(#)$Id: gethostnamadr.c,v 1.7 1995/05/30 05:40:45 rgrimes Exp $";
|
||||
static char rcsid[] = "$Id: gethostnamadr.c,v 1.7 1995/05/30 05:40:45 rgrimes Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -38,6 +38,11 @@ static char rcsid[] = "$Id: gethostnamadr.c,v 1.6 1995/03/24 15:38:54 ache Exp $
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void _sethosthtent __P(( int ));
|
||||
extern void _endhosthtent __P(( void ));
|
||||
extern void _sethostdnsent __P(( int ));
|
||||
extern void _endhostdnsent __P(( void ));
|
||||
|
||||
extern struct hostent * _gethostbyhtname __P((const char *));
|
||||
extern struct hostent * _gethostbydnsname __P((const char *));
|
||||
extern struct hostent * _gethostbynisname __P((const char *));
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: getnetbydns.c,v 1.4 1995/10/22 14:39:04 phk Exp $";
|
||||
static char rcsid[] = "$Id: getnetbydns.c,v 1.5 1996/01/13 09:03:51 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -80,6 +80,7 @@ static char rcsid[] = "$Id: getnetbydns.c,v 1.4 1995/10/22 14:39:04 phk Exp $";
|
||||
|
||||
#include "res_config.h"
|
||||
|
||||
extern void _res_close __P((void));
|
||||
extern int h_errno;
|
||||
|
||||
#define BYADDR 0
|
||||
|
@ -141,7 +141,7 @@ _getnetbyhtname(name)
|
||||
register char **cp;
|
||||
|
||||
setnetent(_net_stayopen);
|
||||
while (p = getnetent()) {
|
||||
while ( (p = getnetent()) ) {
|
||||
if (strcasecmp(p->n_name, name) == 0)
|
||||
break;
|
||||
for (cp = p->n_aliases; *cp != 0; cp++)
|
||||
@ -162,7 +162,7 @@ _getnetbyhtaddr(net, type)
|
||||
register struct netent *p;
|
||||
|
||||
setnetent(_net_stayopen);
|
||||
while (p = getnetent())
|
||||
while ( (p = getnetent()) )
|
||||
if (p->n_addrtype == type && p->n_net == net)
|
||||
break;
|
||||
if (!_net_stayopen)
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)$Id: getnetnamadr.c,v 1.3 1995/03/24 15:51:30 ache Exp $";
|
||||
static char rcsid[] = "$Id: getnetnamadr.c,v 1.3 1995/03/24 15:51:30 ache Exp $";
|
||||
static char sccsid[] = "@(#)$Id: getnetnamadr.c,v 1.4 1995/05/30 05:40:48 rgrimes Exp $";
|
||||
static char rcsid[] = "$Id: getnetnamadr.c,v 1.4 1995/05/30 05:40:48 rgrimes Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -38,6 +38,13 @@ static char rcsid[] = "$Id: getnetnamadr.c,v 1.3 1995/03/24 15:51:30 ache Exp $"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void _setnetent __P(( int ));
|
||||
extern void _endnetent __P(( void ));
|
||||
extern void _setnethtent __P(( int ));
|
||||
extern void _endnethtent __P(( void ));
|
||||
extern void _setnetdnsent __P(( int ));
|
||||
extern void _endnetdnsent __P(( void ));
|
||||
|
||||
extern struct netent * _getnetbyhtname __P((const char *));
|
||||
extern struct netent * _getnetbydnsname __P((const char *));
|
||||
extern struct netent * _getnetbynisname __P((const char *));
|
||||
|
@ -46,7 +46,7 @@ getprotobynumber(proto)
|
||||
register struct protoent *p;
|
||||
|
||||
setprotoent(_proto_stayopen);
|
||||
while (p = getprotoent())
|
||||
while ( (p = getprotoent()) )
|
||||
if (p->p_proto == proto)
|
||||
break;
|
||||
if (!_proto_stayopen)
|
||||
|
@ -48,7 +48,7 @@ getprotobyname(name)
|
||||
register char **cp;
|
||||
|
||||
setprotoent(_proto_stayopen);
|
||||
while (p = getprotoent()) {
|
||||
while ( (p = getprotoent()) ) {
|
||||
if (strcmp(p->p_name, name) == 0)
|
||||
break;
|
||||
for (cp = p->p_aliases; *cp != 0; cp++)
|
||||
|
@ -56,7 +56,7 @@ getservbyname(name, proto)
|
||||
#endif
|
||||
|
||||
setservent(_serv_stayopen);
|
||||
while (p = getservent()) {
|
||||
while ( (p = getservent()) ) {
|
||||
if (strcmp(name, p->s_name) == 0)
|
||||
goto gotname;
|
||||
for (cp = p->s_aliases; *cp; cp++)
|
||||
|
@ -56,7 +56,7 @@ getservbyport(port, proto)
|
||||
#endif
|
||||
|
||||
setservent(_serv_stayopen);
|
||||
while (p = getservent()) {
|
||||
while ( (p = getservent()) ) {
|
||||
if (p->s_port != port)
|
||||
continue;
|
||||
if (proto == 0 || strcmp(p->s_proto, proto) == 0)
|
||||
|
@ -48,6 +48,8 @@ static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
|
||||
static int serv_stepping_yp = 0;
|
||||
#endif
|
||||
|
||||
extern int _yp_check __P(( char ** ));
|
||||
|
||||
#define MAXALIASES 35
|
||||
|
||||
static FILE *servf = NULL;
|
||||
|
@ -60,7 +60,7 @@ inet_network(cp)
|
||||
base = 8, cp++;
|
||||
if (*cp == 'x' || *cp == 'X')
|
||||
base = 16, cp++;
|
||||
while (c = *cp) {
|
||||
while ( (c = *cp) ) {
|
||||
if (isdigit(c)) {
|
||||
val = (val * base) + (c - '0');
|
||||
cp++;
|
||||
|
@ -57,6 +57,8 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
|
||||
#include <rpcsvc/ypclnt.h>
|
||||
#endif
|
||||
|
||||
extern int innetgr __P(( const char *, const char *, const char *, const char * ));
|
||||
|
||||
#define max(a, b) ((a > b) ? a : b)
|
||||
|
||||
int __ivaliduser __P((FILE *, u_long, const char *, const char *));
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_comp.c,v 1.3 1995/05/30 05:40:54 rgrimes Exp $";
|
||||
static char rcsid[] = "$Id: res_comp.c,v 1.4 1996/01/07 09:14:54 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -95,7 +95,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
|
||||
/*
|
||||
* fetch next label in domain name
|
||||
*/
|
||||
while (n = *cp++) {
|
||||
while ( (n = *cp++) ) {
|
||||
/*
|
||||
* Check for indirection
|
||||
*/
|
||||
@ -298,7 +298,7 @@ dn_find(exp_dn, msg, dnptrs, lastdnptr)
|
||||
for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
|
||||
dn = exp_dn;
|
||||
sp = cp = *cpp;
|
||||
while (n = *cp++) {
|
||||
while ( (n = *cp++) ) {
|
||||
/*
|
||||
* check for indirection
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_debug.c,v 1.6 1996/01/07 09:14:55 peter Exp $";
|
||||
static char rcsid[] = "$Id: res_debug.c,v 1.7 1996/02/06 20:35:48 wollman Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -171,7 +171,7 @@ do_rrset(msg, len, cp, cnt, pflag, file, hs)
|
||||
* Print answer records.
|
||||
*/
|
||||
sflag = (_res.pfcode & pflag);
|
||||
if (n = ntohs(cnt)) {
|
||||
if ( (n = ntohs(cnt)) ) {
|
||||
if ((!_res.pfcode) ||
|
||||
((sflag) && (_res.pfcode & RES_PRF_HEAD1)))
|
||||
fprintf(file, hs);
|
||||
@ -286,7 +286,7 @@ __fp_nquery(msg, len, file)
|
||||
/*
|
||||
* Print question records.
|
||||
*/
|
||||
if (n = ntohs(hp->qdcount)) {
|
||||
if ( (n = ntohs(hp->qdcount)) ) {
|
||||
if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
|
||||
fprintf(file, ";; QUESTIONS:\n");
|
||||
while (--n >= 0) {
|
||||
@ -490,7 +490,7 @@ __p_rr(cp, msg, file)
|
||||
case T_HINFO:
|
||||
case T_ISDN:
|
||||
cp2 = cp + dlen;
|
||||
if (n = *cp++) {
|
||||
if ( (n = *cp++) ) {
|
||||
fprintf(file, "\t%.*s", n, cp);
|
||||
cp += n;
|
||||
}
|
||||
@ -549,7 +549,7 @@ __p_rr(cp, msg, file)
|
||||
(void) fputs("\t\"", file);
|
||||
cp2 = cp1 + dlen;
|
||||
while (cp < cp2) {
|
||||
if (n = (unsigned char) *cp++) {
|
||||
if ( (n = (unsigned char) *cp++) ) {
|
||||
for (c = n; c > 0 && cp < cp2; c--)
|
||||
if ((*cp == '\n') || (*cp == '"')) {
|
||||
(void) putc('\\', file);
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "$Id: res_send.c,v 1.6 1995/08/21 09:15:40 bde Exp $";
|
||||
static char rcsid[] = "$Id: res_send.c,v 1.7 1996/01/07 09:15:02 peter Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/* change this to "0"
|
||||
@ -716,7 +716,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
* This routine is not expected to be user visible.
|
||||
*/
|
||||
void
|
||||
_res_close()
|
||||
_res_close(void)
|
||||
{
|
||||
if (s >= 0) {
|
||||
(void) close(s);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: msgcat.c,v 1.3 1995/06/17 03:02:21 ache Exp $ */
|
||||
/* $Id: msgcat.c,v 1.4 1995/10/22 14:39:22 phk Exp $ */
|
||||
|
||||
/***********************************************************
|
||||
Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
|
||||
@ -312,13 +312,13 @@ int type;
|
||||
if (strncmp(header.magic, MCMagic, MCMagicLen) != 0) CORRUPT();
|
||||
|
||||
if (header.majorVer != MCMajorVer) {
|
||||
fprintf(stderr, "%s: %s is version %d, we need %d.\n", ERRNAME,
|
||||
fprintf(stderr, "%s: %s is version %ld, we need %ld.\n", ERRNAME,
|
||||
catpath, header.majorVer, MCMajorVer);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (header.numSets <= 0) {
|
||||
fprintf(stderr, "%s: %s has %d sets!\n", ERRNAME, catpath,
|
||||
fprintf(stderr, "%s: %s has %ld sets!\n", ERRNAME, catpath,
|
||||
header.numSets);
|
||||
return(0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: msgcat.h,v 1.1 1995/03/30 12:47:27 jkh Exp $ */
|
||||
/* $Id: msgcat.h,v 1.2 1995/05/30 05:41:00 rgrimes Exp $ */
|
||||
|
||||
/* -*-c++-*- */
|
||||
|
||||
@ -66,7 +66,7 @@ up-to-date. Many thanks.
|
||||
#define MCLastMsg 0
|
||||
#define MCLastSet 0
|
||||
|
||||
#define MCMajorVer 1
|
||||
#define MCMajorVer 1L
|
||||
#define MCMinorVer 0
|
||||
|
||||
/*
|
||||
|
@ -43,28 +43,28 @@ static struct cclass {
|
||||
char *chars;
|
||||
char *multis;
|
||||
} cclasses[] = {
|
||||
"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789", "",
|
||||
"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
"",
|
||||
"blank", " \t", "",
|
||||
"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
|
||||
\25\26\27\30\31\32\33\34\35\36\37\177", "",
|
||||
"digit", "0123456789", "",
|
||||
"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
{"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789", ""},
|
||||
{"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
""},
|
||||
{"blank", " \t", ""},
|
||||
{"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
|
||||
\25\26\27\30\31\32\33\34\35\36\37\177", ""},
|
||||
{"digit", "0123456789", ""},
|
||||
{"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
|
||||
"",
|
||||
"lower", "abcdefghijklmnopqrstuvwxyz",
|
||||
"",
|
||||
"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
""},
|
||||
{"lower", "abcdefghijklmnopqrstuvwxyz",
|
||||
""},
|
||||
{"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
|
||||
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
|
||||
"",
|
||||
"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
|
||||
"",
|
||||
"space", "\t\n\v\f\r ", "",
|
||||
"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
"",
|
||||
"xdigit", "0123456789ABCDEFabcdef",
|
||||
"",
|
||||
NULL, 0, ""
|
||||
""},
|
||||
{"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
|
||||
""},
|
||||
{"space", "\t\n\v\f\r ", ""},
|
||||
{"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
""},
|
||||
{"xdigit", "0123456789ABCDEFabcdef",
|
||||
""},
|
||||
{NULL, 0, ""}
|
||||
};
|
||||
|
@ -42,100 +42,100 @@ static struct cname {
|
||||
char *name;
|
||||
char code;
|
||||
} cnames[] = {
|
||||
"NUL", '\0',
|
||||
"SOH", '\001',
|
||||
"STX", '\002',
|
||||
"ETX", '\003',
|
||||
"EOT", '\004',
|
||||
"ENQ", '\005',
|
||||
"ACK", '\006',
|
||||
"BEL", '\007',
|
||||
"alert", '\007',
|
||||
"BS", '\010',
|
||||
"backspace", '\b',
|
||||
"HT", '\011',
|
||||
"tab", '\t',
|
||||
"LF", '\012',
|
||||
"newline", '\n',
|
||||
"VT", '\013',
|
||||
"vertical-tab", '\v',
|
||||
"FF", '\014',
|
||||
"form-feed", '\f',
|
||||
"CR", '\015',
|
||||
"carriage-return", '\r',
|
||||
"SO", '\016',
|
||||
"SI", '\017',
|
||||
"DLE", '\020',
|
||||
"DC1", '\021',
|
||||
"DC2", '\022',
|
||||
"DC3", '\023',
|
||||
"DC4", '\024',
|
||||
"NAK", '\025',
|
||||
"SYN", '\026',
|
||||
"ETB", '\027',
|
||||
"CAN", '\030',
|
||||
"EM", '\031',
|
||||
"SUB", '\032',
|
||||
"ESC", '\033',
|
||||
"IS4", '\034',
|
||||
"FS", '\034',
|
||||
"IS3", '\035',
|
||||
"GS", '\035',
|
||||
"IS2", '\036',
|
||||
"RS", '\036',
|
||||
"IS1", '\037',
|
||||
"US", '\037',
|
||||
"space", ' ',
|
||||
"exclamation-mark", '!',
|
||||
"quotation-mark", '"',
|
||||
"number-sign", '#',
|
||||
"dollar-sign", '$',
|
||||
"percent-sign", '%',
|
||||
"ampersand", '&',
|
||||
"apostrophe", '\'',
|
||||
"left-parenthesis", '(',
|
||||
"right-parenthesis", ')',
|
||||
"asterisk", '*',
|
||||
"plus-sign", '+',
|
||||
"comma", ',',
|
||||
"hyphen", '-',
|
||||
"hyphen-minus", '-',
|
||||
"period", '.',
|
||||
"full-stop", '.',
|
||||
"slash", '/',
|
||||
"solidus", '/',
|
||||
"zero", '0',
|
||||
"one", '1',
|
||||
"two", '2',
|
||||
"three", '3',
|
||||
"four", '4',
|
||||
"five", '5',
|
||||
"six", '6',
|
||||
"seven", '7',
|
||||
"eight", '8',
|
||||
"nine", '9',
|
||||
"colon", ':',
|
||||
"semicolon", ';',
|
||||
"less-than-sign", '<',
|
||||
"equals-sign", '=',
|
||||
"greater-than-sign", '>',
|
||||
"question-mark", '?',
|
||||
"commercial-at", '@',
|
||||
"left-square-bracket", '[',
|
||||
"backslash", '\\',
|
||||
"reverse-solidus", '\\',
|
||||
"right-square-bracket", ']',
|
||||
"circumflex", '^',
|
||||
"circumflex-accent", '^',
|
||||
"underscore", '_',
|
||||
"low-line", '_',
|
||||
"grave-accent", '`',
|
||||
"left-brace", '{',
|
||||
"left-curly-bracket", '{',
|
||||
"vertical-line", '|',
|
||||
"right-brace", '}',
|
||||
"right-curly-bracket", '}',
|
||||
"tilde", '~',
|
||||
"DEL", '\177',
|
||||
NULL, 0,
|
||||
{"NUL", '\0'},
|
||||
{"SOH", '\001'},
|
||||
{"STX", '\002'},
|
||||
{"ETX", '\003'},
|
||||
{"EOT", '\004'},
|
||||
{"ENQ", '\005'},
|
||||
{"ACK", '\006'},
|
||||
{"BEL", '\007'},
|
||||
{"alert", '\007'},
|
||||
{"BS", '\010'},
|
||||
{"backspace", '\b'},
|
||||
{"HT", '\011'},
|
||||
{"tab", '\t'},
|
||||
{"LF", '\012'},
|
||||
{"newline", '\n'},
|
||||
{"VT", '\013'},
|
||||
{"vertical-tab", '\v'},
|
||||
{"FF", '\014'},
|
||||
{"form-feed", '\f'},
|
||||
{"CR", '\015'},
|
||||
{"carriage-return", '\r'},
|
||||
{"SO", '\016'},
|
||||
{"SI", '\017'},
|
||||
{"DLE", '\020'},
|
||||
{"DC1", '\021'},
|
||||
{"DC2", '\022'},
|
||||
{"DC3", '\023'},
|
||||
{"DC4", '\024'},
|
||||
{"NAK", '\025'},
|
||||
{"SYN", '\026'},
|
||||
{"ETB", '\027'},
|
||||
{"CAN", '\030'},
|
||||
{"EM", '\031'},
|
||||
{"SUB", '\032'},
|
||||
{"ESC", '\033'},
|
||||
{"IS4", '\034'},
|
||||
{"FS", '\034'},
|
||||
{"IS3", '\035'},
|
||||
{"GS", '\035'},
|
||||
{"IS2", '\036'},
|
||||
{"RS", '\036'},
|
||||
{"IS1", '\037'},
|
||||
{"US", '\037'},
|
||||
{"space", ' '},
|
||||
{"exclamation-mark", '!'},
|
||||
{"quotation-mark", '"'},
|
||||
{"number-sign", '#'},
|
||||
{"dollar-sign", '$'},
|
||||
{"percent-sign", '%'},
|
||||
{"ampersand", '&'},
|
||||
{"apostrophe", '\''},
|
||||
{"left-parenthesis", '('},
|
||||
{"right-parenthesis", ')'},
|
||||
{"asterisk", '*'},
|
||||
{"plus-sign", '+'},
|
||||
{"comma", ','},
|
||||
{"hyphen", '-'},
|
||||
{"hyphen-minus", '-'},
|
||||
{"period", '.'},
|
||||
{"full-stop", '.'},
|
||||
{"slash", '/'},
|
||||
{"solidus", '/'},
|
||||
{"zero", '0'},
|
||||
{"one", '1'},
|
||||
{"two", '2'},
|
||||
{"three", '3'},
|
||||
{"four", '4'},
|
||||
{"five", '5'},
|
||||
{"six", '6'},
|
||||
{"seven", '7'},
|
||||
{"eight", '8'},
|
||||
{"nine", '9'},
|
||||
{"colon", ':'},
|
||||
{"semicolon", ';'},
|
||||
{"less-than-sign", '<'},
|
||||
{"equals-sign", '='},
|
||||
{"greater-than-sign", '>'},
|
||||
{"question-mark", '?'},
|
||||
{"commercial-at", '@'},
|
||||
{"left-square-bracket", '['},
|
||||
{"backslash", '\\'},
|
||||
{"reverse-solidus", '\\'},
|
||||
{"right-square-bracket",']'},
|
||||
{"circumflex", '^'},
|
||||
{"circumflex-accent", '^'},
|
||||
{"underscore", '_'},
|
||||
{"low-line", '_'},
|
||||
{"grave-accent", '`'},
|
||||
{"left-brace", '{'},
|
||||
{"left-curly-bracket", '{'},
|
||||
{"vertical-line", '|'},
|
||||
{"right-brace", '}'},
|
||||
{"right-curly-bracket", '}'},
|
||||
{"tilde", '~'},
|
||||
{"DEL", '\177'},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
@ -148,8 +148,8 @@ int eflags;
|
||||
struct match mv;
|
||||
register struct match *m = &mv;
|
||||
register char *dp;
|
||||
const register sopno gf = g->firststate+1; /* +1 for OEND */
|
||||
const register sopno gl = g->laststate;
|
||||
register const sopno gf = g->firststate+1; /* +1 for OEND */
|
||||
register const sopno gl = g->laststate;
|
||||
char *start;
|
||||
char *stop;
|
||||
|
||||
|
@ -103,9 +103,11 @@ static int freezeset __P((struct parse *p, cset *cs));
|
||||
static int firstch __P((struct parse *p, cset *cs));
|
||||
static int nch __P((struct parse *p, cset *cs));
|
||||
static void mcadd __P((struct parse *p, cset *cs, char *cp));
|
||||
#if used
|
||||
static void mcsub __P((cset *cs, char *cp));
|
||||
static int mcin __P((cset *cs, char *cp));
|
||||
static char *mcfind __P((cset *cs, char *cp));
|
||||
#endif
|
||||
static void mcinvert __P((struct parse *p, cset *cs));
|
||||
static void mccase __P((struct parse *p, cset *cs));
|
||||
static int isinsets __P((struct re_guts *g, int c));
|
||||
@ -295,7 +297,7 @@ int stop; /* character this ERE should end at */
|
||||
conc = HERE();
|
||||
while (MORE() && (c = PEEK()) != '|' && c != stop)
|
||||
p_ere_exp(p);
|
||||
REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
|
||||
(void)REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
|
||||
|
||||
if (!EAT('|'))
|
||||
break; /* NOTE BREAK OUT */
|
||||
@ -342,7 +344,7 @@ register struct parse *p;
|
||||
pos = HERE();
|
||||
switch (c) {
|
||||
case '(':
|
||||
REQUIRE(MORE(), REG_EPAREN);
|
||||
(void)REQUIRE(MORE(), REG_EPAREN);
|
||||
p->g->nsub++;
|
||||
subno = p->g->nsub;
|
||||
if (subno < NPAREN)
|
||||
@ -355,7 +357,7 @@ register struct parse *p;
|
||||
assert(p->pend[subno] != 0);
|
||||
}
|
||||
EMIT(ORPAREN, subno);
|
||||
MUSTEAT(')', REG_EPAREN);
|
||||
(void)MUSTEAT(')', REG_EPAREN);
|
||||
break;
|
||||
#ifndef POSIX_MISTAKE
|
||||
case ')': /* happens only if no current unmatched ( */
|
||||
@ -398,12 +400,12 @@ register struct parse *p;
|
||||
p_bracket(p);
|
||||
break;
|
||||
case '\\':
|
||||
REQUIRE(MORE(), REG_EESCAPE);
|
||||
(void)REQUIRE(MORE(), REG_EESCAPE);
|
||||
c = GETNEXT();
|
||||
ordinary(p, c);
|
||||
break;
|
||||
case '{': /* okay as ordinary except if digit follows */
|
||||
REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
|
||||
(void)REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
ordinary(p, c);
|
||||
@ -419,7 +421,7 @@ register struct parse *p;
|
||||
return; /* no repetition, we're done */
|
||||
NEXT();
|
||||
|
||||
REQUIRE(!wascaret, REG_BADRPT);
|
||||
(void)REQUIRE(!wascaret, REG_BADRPT);
|
||||
switch (c) {
|
||||
case '*': /* implemented as +? */
|
||||
/* this case does not require the (y|) trick, noKLUDGE */
|
||||
@ -446,7 +448,7 @@ register struct parse *p;
|
||||
if (EAT(',')) {
|
||||
if (isdigit(PEEK())) {
|
||||
count2 = p_count(p);
|
||||
REQUIRE(count <= count2, REG_BADBR);
|
||||
(void)REQUIRE(count <= count2, REG_BADBR);
|
||||
} else /* single number with comma */
|
||||
count2 = INFINITY;
|
||||
} else /* just a single number */
|
||||
@ -455,7 +457,7 @@ register struct parse *p;
|
||||
if (!EAT('}')) { /* error heuristics */
|
||||
while (MORE() && PEEK() != '}')
|
||||
NEXT();
|
||||
REQUIRE(MORE(), REG_EBRACE);
|
||||
(void)REQUIRE(MORE(), REG_EBRACE);
|
||||
SETERROR(REG_BADBR);
|
||||
}
|
||||
break;
|
||||
@ -478,7 +480,7 @@ static void
|
||||
p_str(p)
|
||||
register struct parse *p;
|
||||
{
|
||||
REQUIRE(MORE(), REG_EMPTY);
|
||||
(void)REQUIRE(MORE(), REG_EMPTY);
|
||||
while (MORE())
|
||||
ordinary(p, GETNEXT());
|
||||
}
|
||||
@ -521,7 +523,7 @@ register int end2; /* second terminating character */
|
||||
p->g->neol++;
|
||||
}
|
||||
|
||||
REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
|
||||
(void)REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -546,7 +548,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
assert(MORE()); /* caller should have ensured this */
|
||||
c = GETNEXT();
|
||||
if (c == '\\') {
|
||||
REQUIRE(MORE(), REG_EESCAPE);
|
||||
(void)REQUIRE(MORE(), REG_EESCAPE);
|
||||
c = BACKSL | (unsigned char)GETNEXT();
|
||||
}
|
||||
switch (c) {
|
||||
@ -576,7 +578,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
assert(p->pend[subno] != 0);
|
||||
}
|
||||
EMIT(ORPAREN, subno);
|
||||
REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
|
||||
(void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
|
||||
break;
|
||||
case BACKSL|')': /* should not get here -- must be user */
|
||||
case BACKSL|'}':
|
||||
@ -606,7 +608,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
p->g->backrefs = 1;
|
||||
break;
|
||||
case '*':
|
||||
REQUIRE(starordinary, REG_BADRPT);
|
||||
(void)REQUIRE(starordinary, REG_BADRPT);
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
ordinary(p, c &~ BACKSL);
|
||||
@ -624,7 +626,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
if (EAT(',')) {
|
||||
if (MORE() && isdigit(PEEK())) {
|
||||
count2 = p_count(p);
|
||||
REQUIRE(count <= count2, REG_BADBR);
|
||||
(void)REQUIRE(count <= count2, REG_BADBR);
|
||||
} else /* single number with comma */
|
||||
count2 = INFINITY;
|
||||
} else /* just a single number */
|
||||
@ -633,7 +635,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
||||
if (!EATTWO('\\', '}')) { /* error heuristics */
|
||||
while (MORE() && !SEETWO('\\', '}'))
|
||||
NEXT();
|
||||
REQUIRE(MORE(), REG_EBRACE);
|
||||
(void)REQUIRE(MORE(), REG_EBRACE);
|
||||
SETERROR(REG_BADBR);
|
||||
}
|
||||
} else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
|
||||
@ -658,7 +660,7 @@ register struct parse *p;
|
||||
ndigits++;
|
||||
}
|
||||
|
||||
REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
|
||||
(void)REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
|
||||
return(count);
|
||||
}
|
||||
|
||||
@ -698,7 +700,7 @@ register struct parse *p;
|
||||
p_b_term(p, cs);
|
||||
if (EAT('-'))
|
||||
CHadd(cs, '-');
|
||||
MUSTEAT(']', REG_EBRACK);
|
||||
(void)MUSTEAT(']', REG_EBRACK);
|
||||
|
||||
if (p->error != 0) /* don't mess things up further */
|
||||
return;
|
||||
@ -769,21 +771,21 @@ register cset *cs;
|
||||
switch (c) {
|
||||
case ':': /* character class */
|
||||
NEXT2();
|
||||
REQUIRE(MORE(), REG_EBRACK);
|
||||
(void)REQUIRE(MORE(), REG_EBRACK);
|
||||
c = PEEK();
|
||||
REQUIRE(c != '-' && c != ']', REG_ECTYPE);
|
||||
(void)REQUIRE(c != '-' && c != ']', REG_ECTYPE);
|
||||
p_b_cclass(p, cs);
|
||||
REQUIRE(MORE(), REG_EBRACK);
|
||||
REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
|
||||
(void)REQUIRE(MORE(), REG_EBRACK);
|
||||
(void)REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
|
||||
break;
|
||||
case '=': /* equivalence class */
|
||||
NEXT2();
|
||||
REQUIRE(MORE(), REG_EBRACK);
|
||||
(void)REQUIRE(MORE(), REG_EBRACK);
|
||||
c = PEEK();
|
||||
REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
|
||||
(void)REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
|
||||
p_b_eclass(p, cs);
|
||||
REQUIRE(MORE(), REG_EBRACK);
|
||||
REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
|
||||
(void)REQUIRE(MORE(), REG_EBRACK);
|
||||
(void)REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
|
||||
break;
|
||||
default: /* symbol, ordinary character, or range */
|
||||
/* xxx revision needed for multichar stuff */
|
||||
@ -798,7 +800,7 @@ register cset *cs;
|
||||
} else
|
||||
finish = start;
|
||||
/* xxx what about signed chars here... */
|
||||
REQUIRE(start <= finish, REG_ERANGE);
|
||||
(void)REQUIRE(start <= finish, REG_ERANGE);
|
||||
for (i = start; i <= finish; i++)
|
||||
CHadd(cs, i);
|
||||
break;
|
||||
@ -866,13 +868,13 @@ register struct parse *p;
|
||||
{
|
||||
register char value;
|
||||
|
||||
REQUIRE(MORE(), REG_EBRACK);
|
||||
(void)REQUIRE(MORE(), REG_EBRACK);
|
||||
if (!EATTWO('[', '.'))
|
||||
return(GETNEXT());
|
||||
|
||||
/* collating symbol */
|
||||
value = p_b_coll_elem(p, '.');
|
||||
REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
|
||||
(void)REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
|
||||
return(value);
|
||||
}
|
||||
|
||||
@ -1264,6 +1266,7 @@ register char *cp;
|
||||
cs->multis[cs->smultis - 1] = '\0';
|
||||
}
|
||||
|
||||
#if used
|
||||
/*
|
||||
- mcsub - subtract a collating element from a cset
|
||||
== static void mcsub(register cset *cs, register char *cp);
|
||||
@ -1321,6 +1324,7 @@ register char *cp;
|
||||
return(p);
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
- mcinvert - invert the list of collating elements in a cset
|
||||
|
@ -88,23 +88,23 @@ static struct rerr {
|
||||
char *name;
|
||||
char *explain;
|
||||
} rerrs[] = {
|
||||
REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match",
|
||||
REG_BADPAT, "REG_BADPAT", "invalid regular expression",
|
||||
REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element",
|
||||
REG_ECTYPE, "REG_ECTYPE", "invalid character class",
|
||||
REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)",
|
||||
REG_ESUBREG, "REG_ESUBREG", "invalid backreference number",
|
||||
REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced",
|
||||
REG_EPAREN, "REG_EPAREN", "parentheses not balanced",
|
||||
REG_EBRACE, "REG_EBRACE", "braces not balanced",
|
||||
REG_BADBR, "REG_BADBR", "invalid repetition count(s)",
|
||||
REG_ERANGE, "REG_ERANGE", "invalid character range",
|
||||
REG_ESPACE, "REG_ESPACE", "out of memory",
|
||||
REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid",
|
||||
REG_EMPTY, "REG_EMPTY", "empty (sub)expression",
|
||||
REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug",
|
||||
REG_INVARG, "REG_INVARG", "invalid argument to regex routine",
|
||||
0, "", "*** unknown regexp error code ***",
|
||||
{REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
|
||||
{REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
|
||||
{REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
|
||||
{REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
|
||||
{REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
|
||||
{REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
|
||||
{REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
|
||||
{REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
|
||||
{REG_EBRACE, "REG_EBRACE", "braces not balanced"},
|
||||
{REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
|
||||
{REG_ERANGE, "REG_ERANGE", "invalid character range"},
|
||||
{REG_ESPACE, "REG_ESPACE", "out of memory"},
|
||||
{REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
|
||||
{REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
|
||||
{REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
|
||||
{REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
|
||||
{0, "", "*** unknown regexp error code ***"}
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -38,6 +38,7 @@ static char sccsid[] = "@(#)atoi.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
|
||||
int
|
||||
atoi(str)
|
||||
const char *str;
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ calloc(num, size)
|
||||
register void *p;
|
||||
|
||||
size *= num;
|
||||
if (p = malloc(size))
|
||||
if ( (p = malloc(size)) )
|
||||
bzero(p, size);
|
||||
return(p);
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93";
|
||||
*/
|
||||
char *suboptarg;
|
||||
|
||||
int
|
||||
getsubopt(optionp, tokens, valuep)
|
||||
register char **optionp, **valuep;
|
||||
register char * const *tokens;
|
||||
|
@ -46,6 +46,7 @@ char *__findenv __P((const char *, int *));
|
||||
* Set the value of the environmental variable "name" to be
|
||||
* "value". If rewrite is set, replace any current value.
|
||||
*/
|
||||
int
|
||||
setenv(name, value, rewrite)
|
||||
register const char *name;
|
||||
register const char *value;
|
||||
@ -63,7 +64,7 @@ setenv(name, value, rewrite)
|
||||
if (!rewrite)
|
||||
return (0);
|
||||
if (strlen(c) >= l_value) { /* old larger; copy over */
|
||||
while (*c++ = *value++);
|
||||
while ( (*c++ = *value++) );
|
||||
return (0);
|
||||
}
|
||||
} else { /* create new slot */
|
||||
@ -93,7 +94,7 @@ setenv(name, value, rewrite)
|
||||
malloc((size_t)((int)(c - name) + l_value + 2))))
|
||||
return (-1);
|
||||
for (c = environ[offset]; (*c = *name++) && *c != '='; ++c);
|
||||
for (*c++ = '='; *c++ = *value++;);
|
||||
for (*c++ = '='; (*c++ = *value++); );
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ Balloc
|
||||
int x;
|
||||
Bigint *rv;
|
||||
|
||||
if (rv = freelist[k]) {
|
||||
if ( (rv = freelist[k]) ) {
|
||||
freelist[k] = rv->next;
|
||||
} else {
|
||||
x = 1 << k;
|
||||
@ -628,7 +628,7 @@ mult
|
||||
xc0 = c->x;
|
||||
#ifdef Pack_32
|
||||
for (; xb < xbe; xb++, xc0++) {
|
||||
if (y = *xb & 0xffff) {
|
||||
if ( (y = *xb & 0xffff) ) {
|
||||
x = xa;
|
||||
xc = xc0;
|
||||
carry = 0;
|
||||
@ -641,7 +641,7 @@ mult
|
||||
} while (x < xae);
|
||||
*xc = carry;
|
||||
}
|
||||
if (y = *xb >> 16) {
|
||||
if ( (y = *xb >> 16) ) {
|
||||
x = xa;
|
||||
xc = xc0;
|
||||
carry = 0;
|
||||
@ -690,7 +690,7 @@ pow5mult
|
||||
int i;
|
||||
static int p05[3] = { 5, 25, 125 };
|
||||
|
||||
if (i = k & 3)
|
||||
if ( (i = k & 3) )
|
||||
b = multadd(b, p05[i-1], 0);
|
||||
|
||||
if (!(k >>= 2))
|
||||
@ -752,7 +752,7 @@ lshift
|
||||
*x1++ = *x << k | z;
|
||||
z = *x++ >> k1;
|
||||
} while (x < xe);
|
||||
if (*x1 = z)
|
||||
if ( (*x1 = z) )
|
||||
++n1;
|
||||
}
|
||||
#else
|
||||
@ -918,7 +918,7 @@ ulp
|
||||
} else {
|
||||
word0(a) = 0;
|
||||
L -= Exp_shift;
|
||||
word1(a) = L >= 31 ? 1 : 1 << 31 - L;
|
||||
word1(a) = L >= 31 ? 1 : 1 << (31 - L);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -953,16 +953,16 @@ b2d
|
||||
*e = 32 - k;
|
||||
#ifdef Pack_32
|
||||
if (k < Ebits) {
|
||||
d0 = Exp_1 | y >> Ebits - k;
|
||||
d0 = Exp_1 | (y >> (Ebits - k));
|
||||
w = xa > xa0 ? *--xa : 0;
|
||||
d1 = y << (32-Ebits) + k | w >> Ebits - k;
|
||||
d1 = (y << ((32-Ebits) + k)) | (w >> (Ebits - k));
|
||||
goto ret_d;
|
||||
}
|
||||
z = xa > xa0 ? *--xa : 0;
|
||||
if (k -= Ebits) {
|
||||
d0 = Exp_1 | y << k | z >> 32 - k;
|
||||
d0 = Exp_1 | (y << k) | (z >> (32 - k));
|
||||
y = xa > xa0 ? *--xa : 0;
|
||||
d1 = z << k | y >> 32 - k;
|
||||
d1 = (z << k) | (y >> (32 - k));
|
||||
} else {
|
||||
d0 = Exp_1 | y;
|
||||
d1 = z;
|
||||
@ -1029,13 +1029,13 @@ d2b
|
||||
z |= Exp_msk11;
|
||||
#endif
|
||||
#else
|
||||
if (de = (int)(d0 >> Exp_shift))
|
||||
if ( (de = (int)(d0 >> Exp_shift)) )
|
||||
z |= Exp_msk1;
|
||||
#endif
|
||||
#ifdef Pack_32
|
||||
if (y = d1) {
|
||||
if (k = lo0bits(&y)) {
|
||||
x[0] = y | z << 32 - k;
|
||||
if ( (y = d1) ) {
|
||||
if ( (k = lo0bits(&y)) ) {
|
||||
x[0] = y | (z << (32 - k));
|
||||
z >>= k;
|
||||
}
|
||||
else
|
||||
@ -1371,9 +1371,9 @@ strtod
|
||||
/* Get starting approximation = rv * 10**e1 */
|
||||
|
||||
if (e1 > 0) {
|
||||
if (i = e1 & 15)
|
||||
if ( (i = e1 & 15) )
|
||||
rv *= tens[i];
|
||||
if (e1 &= ~15) {
|
||||
if ( (e1 &= ~15) ) {
|
||||
if (e1 > DBL_MAX_10_EXP) {
|
||||
ovfl:
|
||||
errno = ERANGE;
|
||||
@ -1413,9 +1413,9 @@ strtod
|
||||
}
|
||||
} else if (e1 < 0) {
|
||||
e1 = -e1;
|
||||
if (i = e1 & 15)
|
||||
if ( (i = e1 & 15) )
|
||||
rv /= tens[i];
|
||||
if (e1 &= ~15) {
|
||||
if ( (e1 &= ~15) ) {
|
||||
e1 >>= 4;
|
||||
for (j = 0; e1 > 1; j++, e1 >>= 1)
|
||||
if (e1 & 1)
|
||||
@ -1946,13 +1946,13 @@ __dtoa
|
||||
#ifdef Sudden_Underflow
|
||||
i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
|
||||
#else
|
||||
if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) {
|
||||
if ( (i = (int)((word0(d) >> Exp_shift1) & (Exp_mask>>Exp_shift1))) ) {
|
||||
#endif
|
||||
d2 = d;
|
||||
word0(d2) &= Frac_mask1;
|
||||
word0(d2) |= Exp_11;
|
||||
#ifdef IBM
|
||||
if (j = 11 - hi0bits(word0(d2) & Frac_mask))
|
||||
if ( (j = 11 - hi0bits(word0(d2) & Frac_mask)) )
|
||||
d2 /= 1 << j;
|
||||
#endif
|
||||
|
||||
@ -1989,8 +1989,8 @@ __dtoa
|
||||
/* d is denormalized */
|
||||
|
||||
i = bbits + be + (Bias + (P-1) - 1);
|
||||
x = i > 32 ? word0(d) << 64 - i | word1(d) >> i - 32
|
||||
: word1(d) << 32 - i;
|
||||
x = i > 32 ? ((word0(d) << (64 - i)) | (word1(d) >> (i - 32)))
|
||||
: (word1(d) << (32 - i));
|
||||
d2 = x;
|
||||
word0(d2) -= 31*Exp_msk1; /* adjust exponent */
|
||||
i -= (Bias + (P-1) - 1) + 1;
|
||||
@ -2087,7 +2087,7 @@ __dtoa
|
||||
ds *= bigtens[i];
|
||||
}
|
||||
d /= ds;
|
||||
} else if (j1 = -k) {
|
||||
} else if ( (j1 = -k) ) {
|
||||
d *= tens[j1 & 0xf];
|
||||
for (j = j1 >> 4; j; j >>= 1, i++)
|
||||
if (j & 1) {
|
||||
@ -2186,7 +2186,7 @@ __dtoa
|
||||
*s++ = '0' + (int)L;
|
||||
if (i == ilim) {
|
||||
d += d;
|
||||
if (d > ds || d == ds && L & 1) {
|
||||
if (d > ds || (d == ds && L & 1)) {
|
||||
bump_up:
|
||||
while (*--s == '9')
|
||||
if (s == s0) {
|
||||
@ -2250,7 +2250,7 @@ __dtoa
|
||||
Bfree(b);
|
||||
b = b1;
|
||||
}
|
||||
if (j = b5 - m5)
|
||||
if ( (j = b5 - m5) )
|
||||
b = pow5mult(b, j);
|
||||
} else
|
||||
b = pow5mult(b, b5);
|
||||
@ -2283,10 +2283,10 @@ __dtoa
|
||||
* can do shifts and ors to compute the numerator for q.
|
||||
*/
|
||||
#ifdef Pack_32
|
||||
if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)
|
||||
if ( (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) )
|
||||
i = 32 - i;
|
||||
#else
|
||||
if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
|
||||
if ( (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf) )
|
||||
i = 16 - i;
|
||||
#endif
|
||||
if (i > 4) {
|
||||
@ -2359,15 +2359,15 @@ __dtoa
|
||||
goto ret;
|
||||
}
|
||||
#endif
|
||||
if (j < 0 || j == 0 && !mode
|
||||
if (j < 0 || (j == 0 && !mode
|
||||
#ifndef ROUND_BIASED
|
||||
&& !(word1(d) & 1)
|
||||
#endif
|
||||
) {
|
||||
)) {
|
||||
if (j1 > 0) {
|
||||
b = lshift(b, 1);
|
||||
j1 = cmp(b, S);
|
||||
if ((j1 > 0 || j1 == 0 && dig & 1)
|
||||
if ((j1 > 0 || (j1 == 0 && dig & 1))
|
||||
&& dig++ == '9')
|
||||
goto round_9_up;
|
||||
}
|
||||
@ -2406,7 +2406,7 @@ __dtoa
|
||||
|
||||
b = lshift(b, 1);
|
||||
j = cmp(b, S);
|
||||
if (j > 0 || j == 0 && dig & 1) {
|
||||
if (j > 0 || (j == 0 && dig & 1)) {
|
||||
roundoff:
|
||||
while (*--s == '9')
|
||||
if (s == s0) {
|
||||
|
@ -112,7 +112,7 @@ strtol(nptr, endptr, base)
|
||||
break;
|
||||
if (c >= base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
any = 1;
|
||||
|
@ -119,7 +119,7 @@ strtoq(nptr, endptr, base)
|
||||
break;
|
||||
if (c >= base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
any = 1;
|
||||
|
@ -119,7 +119,7 @@ strtoq(nptr, endptr, base)
|
||||
break;
|
||||
if (c >= base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
any = 1;
|
||||
|
@ -90,7 +90,7 @@ strtoul(nptr, endptr, base)
|
||||
break;
|
||||
if (c >= base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
any = 1;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user