Path: clinet!santra!tut!enea!mcvax!seismo!rutgers!mtune!mtuxo!mtgzz!tgl
From: tgl@mtgzz.UUCP
Newsgroups: comp.sys.ibm.pc
Subject: Re: MSC 4.0 bugs
Summary: 3 known bugs in stat() routine
Keywords: Microsoft C 4.0 bugs
Message-ID: <2687@mtgzz.UUCP>
Date: 13 May 87 15:48:45 GMT
References: <699@sdcc18.ucsd.EDU> <96@eagle_snax.UUCP>
Organization: AT&T, Middletown NJ
Lines: 44

/* statbugs.c */

#include	"assert.h"
#include	"stdio.h"
#include	"sys/types.h"
#include	"stat.h"

char	*Device		= "CON";
char	*Executable	= "\\COMMAND.COM";
char	*Subdirdotdot	= "\\BIN\\..";

struct stat	Statb;

main()
{
	int	v;

	v = stat(Device, &Statb);
	assert(v == 0);

	if ((Statb.st_mode & S_IFMT) != S_IFCHR)
		printf("stat(%s,-).st_mode = %#x\t\tSHOULD BE 0x2---\n",
			Device, Statb.st_mode);

	v = stat(Executable, &Statb);
	assert(v == 0);

	if ((Statb.st_mode & S_IEXEC) == 0)
		printf("stat(%s,-).st_mode = %#x\tSHOULD INCLUDE 0x--4-\n",
			Executable, Statb.st_mode);

	v = stat(Subdirdotdot, &Statb);

	if (v != 0)
		printf("stat(%s,-) = %d\t\t\tSHOULD BE 0\n", Subdirdotdot);
}


/**
	C>statbugs
	stat(CON,-).st_mode = 0x81b6		SHOULD BE 0x2---
	stat(\COMMAND.COM,-).st_mode = 0x8124	SHOULD INCLUDE 0x--4-
	stat(\BIN\..,-) = -1			SHOULD BE 0
**/
