summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cygwin/cygwin.c
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
committerafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
commit9f11ffb7133c203312a01e4b986886bc88c7d74b (patch)
tree6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/cygwin/cygwin.c
parentImport perl-5.28.1 (diff)
downloadwireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz
wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/cygwin/cygwin.c')
-rw-r--r--gnu/usr.bin/perl/cygwin/cygwin.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/gnu/usr.bin/perl/cygwin/cygwin.c b/gnu/usr.bin/perl/cygwin/cygwin.c
index 24b278f2fd2..fae90af0001 100644
--- a/gnu/usr.bin/perl/cygwin/cygwin.c
+++ b/gnu/usr.bin/perl/cygwin/cygwin.c
@@ -90,15 +90,17 @@ int
do_spawn (char *cmd)
{
dTHX;
- char const **a;
+ char const **argv, **a;
char *s;
char const *metachars = "$&*(){}[]'\";\\?>|<~`\n";
const char *command[4];
+ int result;
+ ENTER;
while (*cmd && isSPACE(*cmd))
cmd++;
- if (strnEQ (cmd,"/bin/sh",7) && isSPACE (cmd[7]))
+ if (strBEGINs (cmd,"/bin/sh") && isSPACE (cmd[7]))
cmd+=5;
/* save an extra exec if possible */
@@ -107,7 +109,7 @@ do_spawn (char *cmd)
goto doshell;
if (*cmd=='.' && isSPACE (cmd[1]))
goto doshell;
- if (strnEQ (cmd,"exec",4) && isSPACE (cmd[4]))
+ if (strBEGINs (cmd,"exec") && isSPACE (cmd[4]))
goto doshell;
for (s=cmd; *s && isALPHA (*s); s++) ; /* catch VAR=val gizmo */
if (*s=='=')
@@ -127,13 +129,16 @@ do_spawn (char *cmd)
command[2] = cmd;
command[3] = NULL;
- return do_spawnvp("sh",command);
+ result = do_spawnvp("sh",command);
+ goto leave;
}
- Newx (PL_Argv, (s-cmd)/2+2, const char*);
- PL_Cmd=savepvn (cmd,s-cmd);
- a=PL_Argv;
- for (s=PL_Cmd; *s;) {
+ Newx (argv, (s-cmd)/2+2, const char*);
+ SAVEFREEPV(argv);
+ cmd=savepvn (cmd,s-cmd);
+ SAVEFREEPV(cmd);
+ a=argv;
+ for (s=cmd; *s;) {
while (*s && isSPACE (*s)) s++;
if (*s)
*(a++)=s;
@@ -142,10 +147,13 @@ do_spawn (char *cmd)
*s++='\0';
}
*a = (char*)NULL;
- if (!PL_Argv[0])
- return -1;
-
- return do_spawnvp(PL_Argv[0],(const char * const *)PL_Argv);
+ if (!argv[0])
+ result = -1;
+ else
+ result = do_spawnvp(argv[0],(const char * const *)argv);
+leave:
+ LEAVE;
+ return result;
}
#if (CYGWIN_VERSION_API_MINOR >= 181)
@@ -488,7 +496,7 @@ XS(XS_Cygwin_mount_flags)
pathname = SvPV_nolen(ST(0));
- if (!strcmp(pathname, "/cygdrive")) {
+ if (strEQ(pathname, "/cygdrive")) {
char user[PATH_MAX];
char system[PATH_MAX];
char user_flags[PATH_MAX];
@@ -511,7 +519,7 @@ XS(XS_Cygwin_mount_flags)
int found = 0;
setmntent (0, 0);
while ((mnt = getmntent (0))) {
- if (!strcmp(pathname, mnt->mnt_dir)) {
+ if (strEQ(pathname, mnt->mnt_dir)) {
strcpy(flags, mnt->mnt_type);
if (strlen(mnt->mnt_opts) > 0) {
strcat(flags, ",");
@@ -536,12 +544,12 @@ XS(XS_Cygwin_mount_flags)
user_flags, system_flags);
if (strlen(user) > 0) {
- if (strcmp(user,pathname)) {
+ if (strNE(user,pathname)) {
sprintf(flags, "%s,cygdrive,%s", user_flags, user);
found++;
}
} else {
- if (strcmp(user,pathname)) {
+ if (strNE(user,pathname)) {
sprintf(flags, "%s,cygdrive,%s", system_flags, system);
found++;
}