*** fstab.c.orig	Sun Aug  4 16:17:01 2002
--- fstab.c	Sun Aug  4 17:52:59 2002
***************
*** 54,62 ****
  #include <string.h>
  #include <unistd.h>
  
! static FILE *_fs_fp;
  static struct fstab _fs_fstab;
! static int LineNo = 0;
  
  static void error __P((int));
  static void fixfsfile __P((void));
--- 54,62 ----
  #include <string.h>
  #include <unistd.h>
  
! static FILE *_fs_fp = NULL, *_fs_fp0 = NULL, *_fs_fp1 = NULL;
  static struct fstab _fs_fstab;
! static int LineNo = 0, phase = 0;
  
  static void error __P((int));
  static void fixfsfile __P((void));
***************
*** 95,102 ****
  
  	for (;;) {
  
! 		if (!(p = fgets(line, sizeof(line), _fs_fp)))
! 			return(0);
  /* OLD_STYLE_FSTAB */
  		++LineNo;
  		if (*line == '#' || *line == '\n')
--- 95,108 ----
  
  	for (;;) {
  
! 	  for(;;) {
! 	    p = fgets(line,sizeof(line), _fs_fp);
! 	    if (p != NULL) break;
! 	    if (phase == 1) return(0); /* end of fstab.userdisk */
! 	    if (_fs_fp1 == NULL) return(0); /* fstab.userdisk is unavailable */
! 	    _fs_fp = _fs_fp1;
! 	    phase = 1;
! 	  }
  /* OLD_STYLE_FSTAB */
  		++LineNo;
  		if (*line == '#' || *line == '\n')
***************
*** 224,235 ****
  int 
  setfsent()
  {
  	if (_fs_fp) {
! 		rewind(_fs_fp);
! 		LineNo = 0;
! 		return(1);
  	}
! 	if ((_fs_fp = fopen(_PATH_FSTAB, "r")) != NULL) {
  		LineNo = 0;
  		return(1);
  	}
--- 230,267 ----
  int 
  setfsent()
  {
+   char path1[BUFSIZ];
+ 
  	if (_fs_fp) {
! 	  if (_fs_fp0 == NULL && _fs_fp1 == NULL) {
! 	    /* bogus */
! 	    return(0);
! 	  }
! 	  if (_fs_fp1) {
! 	    rewind(_fs_fp1);
! 	    _fs_fp = _fs_fp1;
! 	    phase = 1;
! 	  }
! 	  if (_fs_fp0) {
! 	    rewind(_fs_fp0);
! 	    _fs_fp = _fs_fp0;
! 	    phase = 0;
! 	  }
! 	  LineNo = 0;
! 	  return(1);
  	}
! 
! 	sprintf(path1,"%s.userdisk",_PATH_FSTAB); /* /etc/fstab.userdisk */
! 	_fs_fp0 = fopen(_PATH_FSTAB,"r");
! 	_fs_fp1 = fopen(path1,"r");
! 
! 	_fs_fp = _fs_fp0;
! 	phase = 0;
! 	if (_fs_fp == NULL) {
! 	  _fs_fp = _fs_fp1;
! 	  phase = 1;
! 	}
! 	if (_fs_fp != NULL) {
  		LineNo = 0;
  		return(1);
  	}
***************
*** 240,249 ****
  void
  endfsent()
  {
! 	if (_fs_fp) {
! 		(void)fclose(_fs_fp);
! 		_fs_fp = NULL;
! 	}
  }
  
  static void
--- 272,286 ----
  void
  endfsent()
  {
!   if (_fs_fp0) {
!     (void)fclose(_fs_fp0);
!     _fs_fp0 = NULL;
!   }
!   if (_fs_fp1) {
!     (void)fclose(_fs_fp1);
!     _fs_fp1 = NULL;
!   }
!   if (_fs_fp) _fs_fp = NULL;
  }
  
  static void
