Commit b0f7e229 authored by Davi Arnaut's avatar Davi Arnaut

WL#5486: Remove code for unsupported platforms

Remove VMS specific code.
parent bccdf5db
......@@ -477,7 +477,7 @@ struct passwd *getpwuid(uid_t);
char* getlogin(void);
#endif
#if !defined(VMS) && !defined(__WIN__)
#if !defined(__WIN__)
void read_user_name(char *name)
{
......@@ -507,7 +507,7 @@ void read_user_name(char *name)
DBUG_VOID_RETURN;
}
#else /* If Windows || VMS */
#else /* If Windows */
void read_user_name(char *name)
{
......
......@@ -40,11 +40,7 @@ size_t dirname_length(const char *name)
continue;
}
#endif
if (*pos == FN_LIBCHAR || *pos == '/'
#ifdef FN_C_AFTER_DIR
|| *pos == FN_C_AFTER_DIR || *pos == FN_C_AFTER_DIR_2
#endif
)
if (*pos == FN_LIBCHAR || *pos == '/')
gpos=pos;
}
return (size_t) (gpos+1-(char*) name);
......@@ -88,8 +84,7 @@ size_t dirname_part(char *to, const char *name, size_t *to_res_length)
from_end Pointer at end of filename (normally end \0)
IMPLEMENTATION
If MSDOS converts '/' to '\'
If VMS converts '<' to '[' and '>' to ']'
If Windows converts '/' to '\'
Adds a FN_LIBCHAR to end if the result string if there isn't one
and the last isn't dev_char.
Copies data from 'from' until ASCII(0) for until from == from_end
......@@ -118,18 +113,12 @@ char *convert_dirname(char *to, const char *from, const char *from_end)
if (!from_end || (from_end - from) > FN_REFLEN-2)
from_end=from+FN_REFLEN -2;
#if FN_LIBCHAR != '/' || defined(FN_C_BEFORE_DIR_2)
#if FN_LIBCHAR != '/'
{
for (; from != from_end && *from ; from++)
{
if (*from == '/')
*to++= FN_LIBCHAR;
#ifdef FN_C_BEFORE_DIR_2
else if (*from == FN_C_BEFORE_DIR_2)
*to++= FN_C_BEFORE_DIR;
else if (*from == FN_C_AFTER_DIR_2)
*to++= FN_C_AFTER_DIR;
#endif
else
{
#ifdef BACKSLASH_MBTAIL
......
......@@ -39,7 +39,7 @@ char *fn_ext(const char *name)
DBUG_ENTER("fn_ext");
DBUG_PRINT("mfunkt",("name: '%s'",name));
#if defined(FN_DEVCHAR) || defined(FN_C_AFTER_DIR) || defined(BASKSLASH_MBTAIL)
#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL)
{
char buff[FN_REFLEN];
size_t res_length;
......
......@@ -18,11 +18,6 @@
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef VMS
#include <rms.h>
#include <iodef.h>
#include <descrip.h>
#endif /* VMS */
static char * expand_tilde(char **path);
......@@ -300,8 +295,7 @@ size_t normalize_dirname(char *to, const char *from)
/*
Despite the name, this actually converts the name to the system's
format (TODO: rip out the non-working VMS stuff and name this
properly).
format (TODO: name this properly).
*/
(void) intern_filename(buff, from);
length= strlen(buff); /* Fix that '/' is last */
......@@ -443,73 +437,10 @@ size_t unpack_filename(char * to, const char *from)
/* Used before system command's like open(), create() .. */
/* Returns used length of to; total length should be FN_REFLEN */
size_t system_filename(char * to, const char *from)
size_t system_filename(char *to, const char *from)
{
#ifndef FN_C_BEFORE_DIR
return (size_t) (strmake(to,from,FN_REFLEN-1)-to);
#else /* VMS */
/* change 'dev:lib/xxx' to 'dev:[lib]xxx' */
/* change 'dev:xxx' to 'dev:xxx' */
/* change './xxx' to 'xxx' */
/* change './lib/' or lib/ to '[.lib]' */
/* change '/x/y/z to '[x.y]x' */
/* change 'dev:/x' to 'dev:[000000]x' */
int libchar_found;
size_t length;
char * to_pos,from_pos,pos;
char buff[FN_REFLEN];
DBUG_ENTER("system_filename");
libchar_found=0;
(void) strmov(buff,from); /* If to == from */
from_pos= buff;
if ((pos=strrchr(from_pos,FN_DEVCHAR))) /* Skip device part */
{
pos++;
to_pos=strnmov(to,from_pos,(size_t) (pos-from_pos));
from_pos=pos;
}
else
to_pos=to;
if (from_pos[0] == FN_CURLIB && from_pos[1] == FN_LIBCHAR)
from_pos+=2; /* Skip './' */
if (strchr(from_pos,FN_LIBCHAR))
{
*(to_pos++) = FN_C_BEFORE_DIR;
if (strinstr(from_pos,FN_ROOTDIR) == 1)
{
from_pos+=strlen(FN_ROOTDIR); /* Actually +1 but... */
if (! strchr(from_pos,FN_LIBCHAR))
{ /* No dir, use [000000] */
to_pos=strmov(to_pos,FN_C_ROOT_DIR);
libchar_found++;
}
}
else
*(to_pos++)=FN_C_DIR_SEP; /* '.' gives current dir */
while ((pos=strchr(from_pos,FN_LIBCHAR)))
{
if (libchar_found++)
*(to_pos++)=FN_C_DIR_SEP; /* Add '.' between dirs */
if (strinstr(from_pos,FN_PARENTDIR) == 1 &&
from_pos+strlen(FN_PARENTDIR) == pos)
to_pos=strmov(to_pos,FN_C_PARENT_DIR); /* Found '../' */
else
to_pos=strnmov(to_pos,from_pos,(size_t) (pos-from_pos));
from_pos=pos+1;
}
*(to_pos++)=FN_C_AFTER_DIR;
}
length= (size_t) (strmov(to_pos,from_pos)-to);
DBUG_PRINT("exit",("name: '%s'",to));
DBUG_RETURN(length);
#endif
} /* system_filename */
}
/* Fix a filename to intern (UNIX format) */
......
......@@ -106,7 +106,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
#if !defined(__WIN__)
res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
#endif
#if !defined(VMS)
if (MyFlags & MY_COPYTIME)
{
struct utimbuf timep;
......@@ -114,7 +114,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
timep.modtime = stat_buff.st_mtime;
(void) utime((char*) to, &timep); /* last accessed and modified times */
}
#endif
DBUG_RETURN(0);
}
......
......@@ -72,16 +72,6 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
getwd(pathname);
strmake(buf,pathname,size-1);
}
#elif defined(VMS)
if (size < 2)
DBUG_RETURN(-1);
if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
{
my_errno=errno;
my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
DBUG_RETURN(-1);
}
intern_filename(buf,buf);
#else
#error "No way to get current directory"
#endif
......@@ -103,27 +93,12 @@ int my_setwd(const char *dir, myf MyFlags)
int res;
size_t length;
char *start, *pos;
#if defined(VMS)
char buff[FN_REFLEN];
#endif
DBUG_ENTER("my_setwd");
DBUG_PRINT("my",("dir: '%s' MyFlags %d", dir, MyFlags));
start=(char *) dir;
if (! dir[0] || (dir[0] == FN_LIBCHAR && dir[1] == 0))
dir=FN_ROOTDIR;
#ifdef VMS
{
pos=strmov(buff,dir);
if (pos[-1] != FN_LIBCHAR)
{
pos[0]=FN_LIBCHAR; /* Mark as directory */
pos[1]=0;
}
system_filename(buff,buff); /* Change to VMS format */
dir=buff;
}
#endif /* VMS */
if ((res=chdir((char*) dir)) != 0)
{
my_errno=errno;
......
......@@ -19,10 +19,6 @@
#include <m_string.h>
#include <m_ctype.h>
#include <signal.h>
#ifdef VMS
#include <my_static.c>
#include <m_ctype.h>
#endif
#ifdef __WIN__
#ifdef _MSC_VER
#include <locale.h>
......@@ -79,14 +75,12 @@ my_bool my_basic_init(void)
my_umask= 0660; /* Default umask for new files */
my_umask_dir= 0700; /* Default umask for new directories */
#ifndef VMS
/* Default creation of new files */
if ((str= getenv("UMASK")) != 0)
my_umask= (int) (atoi_octal(str) | 0600);
/* Default creation of new dir's */
if ((str= getenv("UMASK_DIR")) != 0)
my_umask_dir= (int) (atoi_octal(str) | 0700);
#endif
init_glob_errs();
......@@ -152,9 +146,6 @@ my_bool my_init(void)
DBUG_ENTER("my_init");
DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
my_win_init();
#ifdef VMS
init_ctype(); /* Stupid linker don't link _ctype.c */
#endif
DBUG_PRINT("exit", ("home: '%s'", home_dir));
#ifdef __WIN__
win32_init_tcp_ip();
......
......@@ -40,11 +40,6 @@
# endif
# endif
#endif
#ifdef VMS
#include <rms.h>
#include <iodef.h>
#include <descrip.h>
#endif
#if defined(THREAD) && defined(HAVE_READDIR_R)
#define READDIR(A,B,C) ((errno=readdir_r(A,B,&C)) != 0 || !C)
......@@ -198,9 +193,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
/*
* Convert from directory name to filename.
* On VMS:
* xyzzy:[mukesh.emacs] => xyzzy:[mukesh]emacs.dir.1
* xyzzy:[mukesh] => xyzzy:[000000]mukesh.dir.1
* On UNIX, it's simple: just make sure there is a terminating /
* Returns pointer to dst;
......@@ -208,11 +200,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
char * directory_file_name (char * dst, const char *src)
{
#ifndef VMS
/* Process as Unix format: just remove test the final slash. */
char * end;
char *end;
if (src[0] == 0)
src= (char*) "."; /* Use empty as current */
......@@ -223,125 +212,7 @@ char * directory_file_name (char * dst, const char *src)
end[1]='\0';
}
return dst;
#else /* VMS */
long slen;
long rlen;
char * ptr, rptr;
char bracket;
struct FAB fab = cc$rms_fab;
struct NAM nam = cc$rms_nam;
char esa[NAM$C_MAXRSS];
if (! src[0])
src="[.]"; /* Empty is == current dir */
slen = strlen (src) - 1;
if (src[slen] == FN_C_AFTER_DIR || src[slen] == FN_C_AFTER_DIR_2 ||
src[slen] == FN_DEVCHAR)
{
/* VMS style - convert [x.y.z] to [x.y]z, [x] to [000000]x */
fab.fab$l_fna = src;
fab.fab$b_fns = slen + 1;
fab.fab$l_nam = &nam;
fab.fab$l_fop = FAB$M_NAM;
nam.nam$l_esa = esa;
nam.nam$b_ess = sizeof esa;
nam.nam$b_nop |= NAM$M_SYNCHK;
/* We call SYS$PARSE to handle such things as [--] for us. */
if (SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL)
{
slen = nam.nam$b_esl - 1;
if (esa[slen] == ';' && esa[slen - 1] == '.')
slen -= 2;
esa[slen + 1] = '\0';
src = esa;
}
if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
{
/* what about when we have logical_name:???? */
if (src[slen] == FN_DEVCHAR)
{ /* Xlate logical name and see what we get */
(void) strmov(dst,src);
dst[slen] = 0; /* remove colon */
if (!(src = getenv (dst)))
return dst; /* Can't translate */
/* should we jump to the beginning of this procedure?
Good points: allows us to use logical names that xlate
to Unix names,
Bad points: can be a problem if we just translated to a device
name...
For now, I'll punt and always expect VMS names, and hope for
the best! */
slen = strlen (src) - 1;
if (src[slen] != FN_C_AFTER_DIR && src[slen] != FN_C_AFTER_DIR_2)
{ /* no recursion here! */
(void) strmov(dst, src);
return(dst);
}
}
else
{ /* not a directory spec */
(void) strmov(dst, src);
return(dst);
}
}
bracket = src[slen]; /* End char */
if (!(ptr = strchr (src, bracket - 2)))
{ /* no opening bracket */
(void) strmov (dst, src);
return dst;
}
if (!(rptr = strrchr (src, '.')))
rptr = ptr;
slen = rptr - src;
(void) strmake (dst, src, slen);
if (*rptr == '.')
{ /* Put bracket and add */
dst[slen++] = bracket; /* (rptr+1) after this */
}
else
{
/* If we have the top-level of a rooted directory (i.e. xx:[000000]),
then translate the device and recurse. */
if (dst[slen - 1] == ':'
&& dst[slen - 2] != ':' /* skip decnet nodes */
&& strcmp(src + slen, "[000000]") == 0)
{
dst[slen - 1] = '\0';
if ((ptr = getenv (dst))
&& (rlen = strlen (ptr) - 1) > 0
&& (ptr[rlen] == FN_C_AFTER_DIR || ptr[rlen] == FN_C_AFTER_DIR_2)
&& ptr[rlen - 1] == '.')
{
(void) strmov(esa,ptr);
esa[rlen - 1] = FN_C_AFTER_DIR;
esa[rlen] = '\0';
return (directory_file_name (dst, esa));
}
else
dst[slen - 1] = ':';
}
(void) strmov(dst+slen,"[000000]");
slen += 8;
}
(void) strmov(strmov(dst+slen,rptr+1)-1,".DIR.1");
return dst;
}
(void) strmov(dst, src);
if (dst[slen] == '/' && slen > 1)
dst[slen] = 0;
return dst;
#endif /* VMS */
} /* directory_file_name */
}
#else
......
......@@ -146,9 +146,6 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
DBUG_ENTER("my_lock");
DBUG_PRINT("my",("fd: %d Op: %d start: %ld Length: %ld MyFlags: %d",
fd,locktype,(long) start,(long) length,MyFlags));
#ifdef VMS
DBUG_RETURN(0);
#else
if (my_disable_locking)
DBUG_RETURN(0);
......@@ -223,5 +220,4 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
}
DBUG_PRINT("error",("my_errno: %d (%d)",my_errno,errno));
DBUG_RETURN(-1);
#endif /* ! VMS */
} /* my_lock */
......@@ -100,7 +100,6 @@ int my_copystat(const char *from, const char *to, int MyFlags)
res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */
#endif /* !__WIN__ */
#ifndef VMS
if (MyFlags & MY_COPYTIME)
{
struct utimbuf timep;
......@@ -108,14 +107,6 @@ int my_copystat(const char *from, const char *to, int MyFlags)
timep.modtime = statbuf.st_mtime;
(void) utime((char*) to, &timep);/* Update last accessed and modified times */
}
#else
if (MyFlags & MY_COPYTIME)
{
time_t time[2];
time[0]= statbuf.st_atime;
time[1]= statbuf.st_mtime;
(void) utime((char*) to, time);/* Update last accessed and modified times */
}
#endif
return 0;
} /* my_copystat */
......@@ -16,10 +16,6 @@
/* open a heap-database */
#include "heapdef.h"
#ifdef VMS
#include "hp_static.c" /* Stupid vms-linker */
#endif
#include "my_sys.h"
/*
......
......@@ -22,9 +22,6 @@
#ifdef __WIN__
#include <fcntl.h>
#endif
#ifdef VMS
#include <processes.h>
#endif
#undef GETPID /* For HPUX */
#ifdef THREAD
......
......@@ -23,9 +23,6 @@
#ifdef __WIN__
#include <fcntl.h>
#endif
#ifdef VMS
#include "static.c"
#endif
static void setup_key_functions(MI_KEYDEF *keyinfo);
#define get_next_element(to,pos,size) { memcpy((char*) to,pos,(size_t) size); \
......
......@@ -18,9 +18,6 @@
#include "myrg_def.h"
#include <stddef.h>
#include <errno.h>
#ifdef VMS
#include "mrg_static.c"
#endif
/*
open a MyISAM MERGE table
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment