File:  [MW Coherent from dump] / coherent / b / lib / libc / ndir / tst.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:36 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <stdio.h>
#include "dirent.h"


main (argc, argv)
int argc;
char **argv;

{
   	DIR *dirp;
	struct dirent *dp;
	char name[30];
	int i;

	if (argc) 
		strcpy (name, argv[1]);
	else
		strcpy (name, "testdir");


	printf("\nDIRENTBASESIZ = %d.\n\n",(int) DIRENTBASESIZ);
	printf("before opendir(%s)\n",name);
	if (dirp = opendir (name))
		printf("Opened %s.\n",name);
	else {
		printf("Can't open %s.\n",name);
		exit(1);
	}

	printf ("Entry\tinode\toffset\treclen\tname\n\n");

	for (i=1, dp=readdir(dirp); dp != NULL ;i++, dp=readdir(dirp) ) {
	   if (dp ) {	
		printf ("%d\t",i);
		printf ("%ld\t",dp->d_ino);
		printf ("%ld\t",dp->d_off);
		printf ("%d\t",dp->d_reclen);
		printf ("%s\n",dp->d_name);
	   } else {
		printf ("Error reading direct.\n");
		break;
	   }
#if DBG
	printf("Done");
#endif	
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.