swatt (05/14/82)
From freb Wed Jan 27 11:26:15 1982 To: swatt Subject: lint i have discovered several bugs in the library definitions lint uses. A corrected library is in ~freb/lib/lint/llib-lc . In addition, there is a bug in the documentation -- printf(3) says that sprintf is an int function, when in fact it is char * . The <stdio.h> file does not have function declarations for things like sprinf; it would be nice (otherwise you have to declare them everywhere to get lint to shut up). - karl The fixes to the lint library are: ====================================================================== cp /usr/lib/lint/llib-lc /tmp/upd.$$.tmp ; chmod +w /tmp/upd.$$.tmp echo -n "/usr/lib/lint/llib-lc: " ed - /tmp/upd.$$.tmp <<\!xxFUNNYxx 92a char *timezone(z,d) int z, d; { return(""); } . 89,91c char *ctime(c) long *c;{ return(""); } struct tm *localtime(c) long *c; { return localtime(c); } struct tm *gmtime(c) long *c; { return gmtime(c); } . 54c long time(t) long *t; { return( 0 );} . 49c int strncmp(a, b, n) char *a, *b; int n; { return(1); } char *strcpy(a, b) char *a, *b; { return(a); } char *strncpy(a, b, n) char *a, *b; int n; { return(a); } . 47c char *index(s, c) char *s, c; { return(s); } char *rindex(s, c) char *s, c; { return(s); } char *strcat(a, b) char *a, *b; { return(a); } char *strncat(a, b, n) char *a, *b; int n; { return(a); } . w q !xxFUNNYxx eval "diff -c /usr/lib/lint/llib-lc /tmp/upd.$$.tmp | sed '1,2d' >/tmp/upd.$$.dif" if cmp - /tmp/upd.$$.dif <<\!xxFUNNYxx *************** *** 44,50 int setuid(u) { return(0); } int (*signal(c, f))() int (*f)(); { return(f); } int stat(s, b) char *s; struct stat *b; { return(0); } ! char *strcat(a, b) char *a, *b; { ; } int strcmp(a, b) char *a, *b; { return(1); } char *strcpy(a, b) char *a, *b; { ; } int strlen(s) char *s; { return(1); } --- 44,53 ----- int setuid(u) { return(0); } int (*signal(c, f))() int (*f)(); { return(f); } int stat(s, b) char *s; struct stat *b; { return(0); } ! char *index(s, c) char *s, c; { return(s); } ! char *rindex(s, c) char *s, c; { return(s); } ! char *strcat(a, b) char *a, *b; { return(a); } ! char *strncat(a, b, n) char *a, *b; int n; { return(a); } int strcmp(a, b) char *a, *b; { return(1); } int strncmp(a, b, n) char *a, *b; int n; { return(1); } char *strcpy(a, b) char *a, *b; { return(a); } *************** *** 46,52 int stat(s, b) char *s; struct stat *b; { return(0); } char *strcat(a, b) char *a, *b; { ; } int strcmp(a, b) char *a, *b; { return(1); } ! char *strcpy(a, b) char *a, *b; { ; } int strlen(s) char *s; { return(1); } int stty(f, b) struct sgttyb *b; { return(0); } long tell(f) { return((long)0); } --- 49,57 ----- char *strcat(a, b) char *a, *b; { return(a); } char *strncat(a, b, n) char *a, *b; int n; { return(a); } int strcmp(a, b) char *a, *b; { return(1); } ! int strncmp(a, b, n) char *a, *b; int n; { return(1); } ! char *strcpy(a, b) char *a, *b; { return(a); } ! char *strncpy(a, b, n) char *a, *b; int n; { return(a); } int strlen(s) char *s; { return(1); } int stty(f, b) struct sgttyb *b; { return(0); } long tell(f) { return((long)0); } *************** *** 51,57 int stty(f, b) struct sgttyb *b; { return(0); } long tell(f) { return((long)0); } int system(s) char *s; { return(0); } ! time_t time(t) time_t *t; { return( 0 );} int unlink(s) char *s; { return(0); } int wait(s) int *s; { return(1); } int write(f, b, l) char *b; { return(l); } --- 56,62 ----- int stty(f, b) struct sgttyb *b; { return(0); } long tell(f) { return((long)0); } int system(s) char *s; { return(0); } ! long time(t) long *t; { return( 0 );} int unlink(s) char *s; { return(0); } int wait(s) int *s; { return(1); } int write(f, b, l) char *b; { return(l); } *************** *** 86,94 /* VARARGS */ sscanf( s, f ) char *s, *f; { return(1); } ungetc( c, f ) FILE *f; { return(c); } ! char *ctime(c) time_t *c;{ return(""); } ! struct tm *localtime(c) time_t *c; { return localtime(c); } ! struct tm *gmtime(c) time_t *c; { return gmtime(c); } char *asctime(t) struct tm *t; { return(""); } abort() {} int abs(i) int i; { return(i); } --- 91,99 ----- /* VARARGS */ sscanf( s, f ) char *s, *f; { return(1); } ungetc( c, f ) FILE *f; { return(c); } ! char *ctime(c) long *c;{ return(""); } ! struct tm *localtime(c) long *c; { return localtime(c); } ! struct tm *gmtime(c) long *c; { return gmtime(c); } char *asctime(t) struct tm *t; { return(""); } char *timezone(z,d) int z, d; { return(""); } abort() {} *************** *** 90,95 struct tm *localtime(c) time_t *c; { return localtime(c); } struct tm *gmtime(c) time_t *c; { return gmtime(c); } char *asctime(t) struct tm *t; { return(""); } abort() {} int abs(i) int i; { return(i); } double atof(s) char *s; { return(1.); } --- 95,101 ----- struct tm *localtime(c) long *c; { return localtime(c); } struct tm *gmtime(c) long *c; { return gmtime(c); } char *asctime(t) struct tm *t; { return(""); } + char *timezone(z,d) int z, d; { return(""); } abort() {} int abs(i) int i; { return(i); } double atof(s) char *s; { return(1.); } !xxFUNNYxx then : 'compare equal, ok' echo "OK" rm -f llib-lc cp /tmp/upd.$$.tmp llib-lc ; chmod a-w llib-lc else echo "Old source file not same version;" \ "use diff listings by hand" fi rm -f /tmp/upd.$$.tmp /tmp/upd.$$.dif