[Libsysio-commit] LLNL_HPSS: libsysio/tests test_stddir.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2005-09-09 14:58:37
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9447/tests Modified Files: Tag: LLNL_HPSS test_stddir.c Log Message: Deal with directory record variants that include or don't d_off, d_offset, d_reclen, and d_namlen. Index: test_stddir.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_stddir.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -w -b -B -p -r1.2 -r1.2.2.1 --- test_stddir.c 4 Feb 2005 00:29:26 -0000 1.2 +++ test_stddir.c 9 Sep 2005 14:58:20 -0000 1.2.2.1 @@ -139,6 +139,7 @@ testit(const char *path) { DIR *d; struct dirent *de; + char *fmt; printf("testing directory functions on %s\n", path); @@ -147,10 +148,30 @@ testit(const char *path) return errno; } + fmt = + "\t %s: ino %lu" +#if defined(_DIRENT_HAVE_D_OFF) + " off %lu" +#elif defined(_DIRENT_HAVE_D_OFFSET) + " offset %lu" +#endif +#ifdef _DIRENT_HAVE_D_TYPE + " type %u" +#endif + "\n"; while ((de = SYSIO_INTERFACE_NAME(readdir)(d)) != NULL) - printf("\t %s: ino %lu off %lu type %u\n", - de->d_name, (unsigned long )de->d_ino, - (unsigned long )de->d_off, (int )de->d_type); + printf(fmt, + de->d_name, + (unsigned long )de->d_ino, +#if defined(_DIRENT_HAVE_D_OFF) + (unsigned long )de->d_off, +#elif defined(_DIRENT_HAVE_D_OFFSET) + (unsigned long )de->d_offset, +#endif +#ifdef _DIRENT_HAVE_D_TYPE + (int )de->d_type +#endif + ); if (SYSIO_INTERFACE_NAME(closedir)(d)) { perror("closedir"); |