What is wrong with this code ?
The Lint Program
lint at mimsy.umd.edu
Mon Dec 11 03:20:36 AEST 1989
In article <1156 at nsscb.UUCP> nrg at nsscb.UUCP (G.Narotham Reddy) writes:
main(argc,argv)
int argc;
char *argv[];
{
struct stat nfile;
stat(argv[1], &nfile);
if (nfile.st_mode & S_IFMT == S_IFREG)
printf("%s regular file\n", argv[1]);
else if (nfile.st_mode & S_IFMT == S_IEXEC)
printf("%s executable\n", argv[1]);
else if (nfile.st_mode & S_IFMT == S_IWRITE)
printf("%s writable\n", argv[1]);
else if (nfile.st_mode & S_IFMT == S_IREAD)
printf("%s readable\n", argv[1]);
else if (nfile.st_mode & S_IFMT == S_IFDIR)
printf("%s dir\n", argv[1]);
}
t.c(11): warning: constant in conditional context
t.c(11): warning: null effect
t.c(13): warning: constant in conditional context
t.c(13): warning: null effect
t.c(15): warning: constant in conditional context
t.c(15): warning: null effect
t.c(17): warning: constant in conditional context
t.c(17): warning: null effect
t.c(19): warning: constant in conditional context
t.c(19): warning: null effect
t.c(6): warning: argument argc unused in function main
stat returns value which is always ignored
printf returns value which is always ignored
More information about the Comp.lang.c
mailing list