diff options
author | Jerry D. Hedden <jdhedden@cpan.org> | 2007-10-01 15:32:19 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-10-02 12:31:32 +0000 |
commit | 74dc058dc967bba1ab16a57522ef421ee59cc29b (patch) | |
tree | 3be50fbae73e60671c67c379aa1ac563a80ddb1e /cygwin/cygwin.c | |
parent | bd3d0583950212b2f79deb8cb857c0f408cdf2aa (diff) | |
download | perl-74dc058dc967bba1ab16a57522ef421ee59cc29b.tar.gz |
/cygdrive is configurable
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510710011632n175427fdx39e173372862526e@mail.gmail.com>
p4raw-id: //depot/perl@32006
Diffstat (limited to 'cygwin/cygwin.c')
-rw-r--r-- | cygwin/cygwin.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c index 8a1ef03839..c3bec61698 100644 --- a/cygwin/cygwin.c +++ b/cygwin/cygwin.c @@ -292,28 +292,31 @@ XS(XS_Cygwin_mount_flags) char flags[260]; if (items != 1) - Perl_croak(aTHX_ "Usage: Cygwin::mount_flags(mnt_dir)"); + Perl_croak(aTHX_ "Usage: Cygwin::mount_flags(mnt_dir|'/cygwin')"); pathname = SvPV_nolen(ST(0)); - - /* TODO: check for cygdrive registry setting. use CW_GET_CYGDRIVE_INFO then + + /* 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(system) > 0) - strcpy (flags, system_flags); - if (strlen(user) > 0) - strcpy(flags, user_flags); - if (strlen(flags) > 0) - strcat(flags, ","); - strcat(flags, "cygdrive"); + + if (strlen(user) > 0) { + sprintf(flags, "%s,cygdrive,%s", user_flags, user); + } else { + sprintf(flags, "%s,cygdrive,%s", system_flags, system); + } + ST(0) = sv_2mortal(newSVpv(flags, 0)); XSRETURN(1); + } else { struct mntent *mnt; setmntent (0, 0); |