This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: cygpath 1.7 wrong
Corinna Vinschen schrieb:
On Jun 13 15:03, Reini Urban wrote:
1.5$ perl -e'print Cygwin::mount_flags("/cygdrive")'
binmode,cygdrive,/cygdrive
1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
binmode,cygdrive,/cygdrive/
Doesn't work for me:
1.7$ perl -e'print Cygwin::mount_flags("/cygdrive")'
Undefined subroutine &Cygwin::mount_flags called at -e line 1.
How does a standalone example look like?
Sorry, this perl is perl5.10.0-4 from [Exp].
Also I recompiled it for cygwin-1.7 with the wchar support. (returning
utf8 converted from wchar)
perl5.8.8 doesn't has this function yet.
Something like:
#include <stdlib.h>
#include <stdio.h>
#include <sys/cygwin.h>
char *Cygwin_mount_flags(char *pathname) {
char flags[260]; /* I know, I know. stack vs heap */
/* TODO: Check for cygdrive registry setting,
* and then use CW_GET_CYGDRIVE_INFO
*/
if (!strcmp(pathname, "/cygdrive")) {
char user[260];
char system[260];
char user_flags[260];
char system_flags[260];
cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
system_flags);
if (strlen(user) > 0) {
sprintf(flags, "%s,cygdrive,%s", user_flags, user);
} else {
sprintf(flags, "%s,cygdrive,%s", system_flags, system);
}
return flags;
} else {
struct mntent *mnt;
setmntent (0, 0);
while ((mnt = getmntent (0))) {
if (!strcmp(pathname, mnt->mnt_dir)) {
strcpy(flags, mnt->mnt_type);
if (strlen(mnt->mnt_opts) > 0) {
strcat(flags, ",");
strcat(flags, mnt->mnt_opts);
}
break;
}
}
endmntent (0);
return flags;
}
}
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/