summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-03-09 10:55:38 -0700
committerKarl Williamson <khw@cpan.org>2017-11-06 12:50:05 -0700
commitf55ac4a45513e50ae06769ee748ea079c9577a7f (patch)
tree663fe20c1c662cf29b46b6689d8d8b69f3125029 /vms
parentb59bf0b2884b21b6f3ce5eca607ab7a6096d87f5 (diff)
downloadperl-f55ac4a45513e50ae06769ee748ea079c9577a7f.tar.gz
Change some strncmp(), etc. to strBEGINs()
The latter is much clearer as to what's going on, and the programmer and program reader don't have to count characters.
Diffstat (limited to 'vms')
-rw-r--r--vms/vms.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/vms/vms.c b/vms/vms.c
index 49494e4331..72cf4d6351 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -285,7 +285,7 @@ is_unix_filespec(const char *path)
const char * pch1;
ret_val = 0;
- if (strncmp(path,"\"^UP^",5) != 0) {
+ if (! strBEGINs(path,"\"^UP^")) {
pch1 = strchr(path, '/');
if (pch1 != NULL)
ret_val = 1;
@@ -6427,7 +6427,7 @@ int_fileify_dirspec(const char *dir, char *buf, int *utf8_fl)
if (!cp1) cp1 = strstr(my_esa,"]<");
dirlen = cp1 - my_esa;
memcpy(buf, my_esa, dirlen);
- if (!strncmp(cp1+2,"000000]",7)) {
+ if (strBEGINs(cp1+2,"000000]")) {
buf[dirlen-1] = '\0';
/* fix-me Not full ODS-5, just extra dots in directories for now */
cp1 = buf + dirlen - 1;
@@ -7032,7 +7032,7 @@ int_tounixspec(const char *spec, char *rslt, int * utf8_fl)
* glob passes filenames with trailing '\n' and expects this preserved.
*/
if (decc_posix_compliant_pathnames) {
- if (strncmp(spec, "\"^UP^", 5) == 0) {
+ if (! strBEGINs(spec, "\"^UP^")) {
char * uspec;
char *tunix;
int tunix_len;
@@ -7463,7 +7463,7 @@ posix_root_to_vms(char *vmspath, int vmspath_len,
#if __CRTL_VER >= 80200000
/* If not a posix spec already, convert it */
if (decc_posix_compliant_pathnames) {
- if (strncmp(unixpath,"\"^UP^",5) != 0) {
+ if (! strBEGINs(unixpath,"\"^UP^")) {
sprintf(vmspath,"\"^UP^%s\"",unixpath);
}
else {
@@ -7578,7 +7578,7 @@ posix_root_to_vms(char *vmspath, int vmspath_len,
/* on any failure, returned the POSIX ^UP^ filespec */
if (!(sts & 1)) {
/* This can happen if user does not have permission to read directories */
- if (strncmp(unixpath,"\"^UP^",5) != 0)
+ if (! strBEGINs(unixpath,"\"^UP^"))
sprintf(vmspath,"\"^UP^%s\"",unixpath);
else
my_strlcpy(vmspath, unixpath, vmspath_len + 1);
@@ -7717,7 +7717,7 @@ posix_to_vmsspec_hardway(char *vmspath, int vmspath_len, const char *unixpath,
quoted = 0;
/* This could have a "^UP^ on the front */
- if (strncmp(unixptr,"\"^UP^",5) == 0) {
+ if (strBEGINs(unixptr,"\"^UP^")) {
quoted = 1;
unixptr+= 5;
unixlen-= 5;
@@ -8435,7 +8435,7 @@ int_tovmsspec(const char *path, char *rslt, int dir_flag, int * utf8_flag)
/*--------------------------------------------------*/
#if __CRTL_VER >= 80200000
if (decc_posix_compliant_pathnames) {
- if (strncmp(path,"\"^UP^",5) == 0) {
+ if (strBEGINs(path,"\"^UP^")) {
posix_to_vmsspec_hardway(rslt, rslt_len, path, dir_flag, utf8_flag);
return rslt;
}
@@ -8576,7 +8576,7 @@ int_tovmsspec(const char *path, char *rslt, int dir_flag, int * utf8_flag)
islnm = simple_trnlnm(rslt,trndev,VMS_MAXRSS-1);
}
else if (strEQ(rslt,"dev")) {
- if (strncmp(cp2,"/null", 5) == 0) {
+ if (strBEGINs(cp2,"/null")) {
if ((cp2[5] == 0) || (cp2[5] == '/')) {
strcpy(rslt,"NLA0");
cp1 = rslt + 4;
@@ -11838,7 +11838,7 @@ static int
is_null_device(const char *name)
{
if (decc_bug_devnull != 0) {
- if (strncmp("/dev/null", name, 9) == 0)
+ if (strBEGINs(name, "/dev/null"))
return 1;
}
/* The VMS null device is named "_NLA0:", usually abbreviated as "NL:".