Couple of fixes to Pavel's VFS stuff.

I do think I am going to expand the VFS functions again, I do not like
this macro stuff.

Miguel.
This commit is contained in:
Miguel de Icaza 1998-05-26 19:46:37 +00:00
parent 37c46d866c
commit 9ee743dea5
2 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,7 @@
1998-05-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* vfs.c (MC_DIROP): Macro now returns the proper value.
1998-maj-18 Tamasi Gyorgy (gt_cosy@usa.net) 1998-maj-18 Tamasi Gyorgy (gt_cosy@usa.net)
* Makefile.in ('install' target): 'mcserv' not installed, if * Makefile.in ('install' target): 'mcserv' not installed, if

View File

@ -412,15 +412,31 @@ type mc_##name inarg \
\ \
if (!dirp){ \ if (!dirp){ \
errno = EFAULT; \ errno = EFAULT; \
return NULL; \ return onerr; \
} \ } \
handle = *(int *) dirp; \ handle = *(int *) dirp; \
vfs = vfs_op (handle); \ vfs = vfs_op (handle); \
return vfs->name ? (*vfs->name) callarg : onerr; \ return vfs->name ? (*vfs->name) callarg : onerr; \
} }
#define MC_DIROP_VOID(name, inarg, callarg ) \
void mc_##name inarg \
{ \
int handle; \
vfs *vfs; \
\
if (!dirp){ \
errno = EFAULT; \
return; \
} \
handle = *(int *) dirp; \
vfs = vfs_op (handle); \
if (vfs->name) \
(*vfs->name) callarg; \
}
MC_DIROP (readdir, struct dirent *, (DIR *dirp), (vfs_info (handle)), NULL) MC_DIROP (readdir, struct dirent *, (DIR *dirp), (vfs_info (handle)), NULL)
MC_DIROP (seekdir, void, (DIR *dirp, int offset), (vfs_info (handle), offset), -1) MC_DIROP_VOID (seekdir, (DIR *dirp, int offset), (vfs_info (handle), offset))
MC_DIROP (telldir, int, (DIR *dirp), (vfs_info (handle)), -1) MC_DIROP (telldir, int, (DIR *dirp), (vfs_info (handle)), -1)
int mc_closedir (DIR *dirp) int mc_closedir (DIR *dirp)
@ -1504,6 +1520,6 @@ vfs_die (char *m)
char * char *
vfs_get_password (char *msg) vfs_get_password (char *msg)
{ {
return input_dialog (msg, _("Password:"), ""); return (char *) input_dialog (msg, _("Password:"), "");
} }
#endif #endif