mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Patch #696645: Remove VMS code with uncertain authorship.
This commit is contained in:
parent
0d58ba9fda
commit
7a924e6eb2
3 changed files with 58 additions and 299 deletions
|
|
@ -28,70 +28,11 @@
|
||||||
#define BUILD 0
|
#define BUILD 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __VMS
|
|
||||||
# ifdef __DECC
|
|
||||||
# pragma extern_model save
|
|
||||||
# pragma extern_model strict_refdef
|
|
||||||
extern long ctl$gl_imghdrbf;
|
|
||||||
# pragma extern_model restore
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __ALPHA
|
|
||||||
# define EIHD$L_IMGIDOFF 24
|
|
||||||
# define EIHI$Q_LINKTIME 8
|
|
||||||
# define _IMGIDOFF EIHD$L_IMGIDOFF
|
|
||||||
# define _LINKTIME EIHI$Q_LINKTIME
|
|
||||||
# else
|
|
||||||
# define IHD$W_IMGIDOFF 6
|
|
||||||
# define IHI$Q_LINKTIME 56
|
|
||||||
# define _IMGIDOFF IHD$W_IMGIDOFF
|
|
||||||
# define _LINKTIME IHI$Q_LINKTIME
|
|
||||||
# endif /* __VMS */
|
|
||||||
|
|
||||||
long*
|
|
||||||
vms__get_linktime (void)
|
|
||||||
{
|
|
||||||
long* al_imghdrbf;
|
|
||||||
unsigned short* aw_imgidoff;
|
|
||||||
unsigned short w_imgidoff;
|
|
||||||
long* aq_linktime;
|
|
||||||
unsigned char* ab_ihi;
|
|
||||||
|
|
||||||
al_imghdrbf = &ctl$gl_imghdrbf;
|
|
||||||
|
|
||||||
al_imghdrbf = (long *)*al_imghdrbf;
|
|
||||||
al_imghdrbf = (long *)*al_imghdrbf;
|
|
||||||
|
|
||||||
aw_imgidoff = (unsigned short *)
|
|
||||||
((unsigned char *)al_imghdrbf + _IMGIDOFF);
|
|
||||||
|
|
||||||
w_imgidoff = *aw_imgidoff;
|
|
||||||
|
|
||||||
ab_ihi = (unsigned char *)al_imghdrbf + w_imgidoff;
|
|
||||||
|
|
||||||
aq_linktime = (long *) (ab_ihi + _LINKTIME);
|
|
||||||
|
|
||||||
return aq_linktime;
|
|
||||||
} /* vms__get_linktime (void) */
|
|
||||||
extern void vms__cvt_v2u_time (long * aq_vmstime, time_t * al_unixtime);
|
|
||||||
/* input , output */
|
|
||||||
#endif /* __VMS */
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
Py_GetBuildInfo(void)
|
Py_GetBuildInfo(void)
|
||||||
{
|
{
|
||||||
static char buildinfo[50];
|
static char buildinfo[50];
|
||||||
#ifdef __VMS
|
|
||||||
time_t l_unixtime;
|
|
||||||
|
|
||||||
vms__cvt_v2u_time(vms__get_linktime (), &l_unixtime );
|
|
||||||
|
|
||||||
memset(buildinfo, 0, 40);
|
|
||||||
sprintf(buildinfo, "#%d, %.24s", BUILD, ctime (&l_unixtime));
|
|
||||||
#else
|
|
||||||
PyOS_snprintf(buildinfo, sizeof(buildinfo),
|
PyOS_snprintf(buildinfo, sizeof(buildinfo),
|
||||||
"#%d, %.20s, %.9s", BUILD, DATE, TIME);
|
"#%d, %.20s, %.9s", BUILD, DATE, TIME);
|
||||||
#endif
|
|
||||||
return buildinfo;
|
return buildinfo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
#include "compile.h" /* For CO_FUTURE_DIVISION */
|
#include "compile.h" /* For CO_FUTURE_DIVISION */
|
||||||
|
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
extern int PyVMS_init(int* pvi_argc, char*** pvi_argv);
|
#include <unixlib.h>
|
||||||
extern PyObject* pyvms_gr_empty_string;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
|
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
|
||||||
|
|
@ -305,7 +304,14 @@ Py_Main(int argc, char **argv)
|
||||||
if (command == NULL && filename == NULL && _PyOS_optind < argc &&
|
if (command == NULL && filename == NULL && _PyOS_optind < argc &&
|
||||||
strcmp(argv[_PyOS_optind], "-") != 0)
|
strcmp(argv[_PyOS_optind], "-") != 0)
|
||||||
{
|
{
|
||||||
|
#ifdef __VMS
|
||||||
|
filename = decc$translate_vms(argv[_PyOS_optind]);
|
||||||
|
if (filename == (char *)0 || filename == (char *)-1)
|
||||||
filename = argv[_PyOS_optind];
|
filename = argv[_PyOS_optind];
|
||||||
|
|
||||||
|
#else
|
||||||
|
filename = argv[_PyOS_optind];
|
||||||
|
#endif
|
||||||
if (filename != NULL) {
|
if (filename != NULL) {
|
||||||
if ((fp = fopen(filename, "r")) == NULL) {
|
if ((fp = fopen(filename, "r")) == NULL) {
|
||||||
fprintf(stderr, "%s: can't open file '%s'\n",
|
fprintf(stderr, "%s: can't open file '%s'\n",
|
||||||
|
|
@ -370,43 +376,12 @@ Py_Main(int argc, char **argv)
|
||||||
#endif /* __VMS */
|
#endif /* __VMS */
|
||||||
|
|
||||||
Py_SetProgramName(argv[0]);
|
Py_SetProgramName(argv[0]);
|
||||||
#ifdef __VMS
|
|
||||||
PyVMS_init(&argc, &argv);
|
|
||||||
#endif
|
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
|
|
||||||
#ifdef __VMS
|
|
||||||
/* create an empty string object */
|
|
||||||
pyvms_gr_empty_string = Py_BuildValue("s#", Py_None, (unsigned int)0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Py_VerboseFlag ||
|
if (Py_VerboseFlag ||
|
||||||
(command == NULL && filename == NULL && stdin_is_interactive))
|
(command == NULL && filename == NULL && stdin_is_interactive))
|
||||||
#ifndef __VMS
|
|
||||||
fprintf(stderr, "Python %s on %s\n%s\n",
|
fprintf(stderr, "Python %s on %s\n%s\n",
|
||||||
Py_GetVersion(), Py_GetPlatform(), COPYRIGHT);
|
Py_GetVersion(), Py_GetPlatform(), COPYRIGHT);
|
||||||
#else
|
|
||||||
fprintf(stderr, "Python %s on %s %s (%s_float)\n%s\n",
|
|
||||||
Py_GetVersion(), Py_GetPlatform(),
|
|
||||||
# ifdef __ALPHA
|
|
||||||
"Alpha",
|
|
||||||
# else
|
|
||||||
"VAX",
|
|
||||||
# endif
|
|
||||||
# if __IEEE_FLOAT
|
|
||||||
"T",
|
|
||||||
# else
|
|
||||||
# if __D_FLOAT
|
|
||||||
"D",
|
|
||||||
# else
|
|
||||||
# if __G_FLOAT
|
|
||||||
"G",
|
|
||||||
# endif /* __G_FLOAT */
|
|
||||||
# endif /* __D_FLOAT */
|
|
||||||
# endif /* __IEEE_FLOAT */
|
|
||||||
COPYRIGHT); /* << @@ defined above in this file */
|
|
||||||
/* Py_GetCopyright()); */
|
|
||||||
#endif /* __VMS */
|
|
||||||
|
|
||||||
if (command != NULL) {
|
if (command != NULL) {
|
||||||
/* Backup _PyOS_optind and force sys.argv[0] = '-c' */
|
/* Backup _PyOS_optind and force sys.argv[0] = '-c' */
|
||||||
|
|
|
||||||
|
|
@ -28,18 +28,6 @@
|
||||||
# include <unixio.h>
|
# include <unixio.h>
|
||||||
# include <unixlib.h>
|
# include <unixlib.h>
|
||||||
# include <stat.h>
|
# include <stat.h>
|
||||||
/* ----- */
|
|
||||||
/* DECC on Alpha does redefine these already */
|
|
||||||
# ifndef shell$from_vms
|
|
||||||
# define shell$from_vms(_p1_,_p2_,_p3_) decc$from_vms(_p1_,_p2_,_p3_)
|
|
||||||
# endif
|
|
||||||
# ifndef shell$translate_vms
|
|
||||||
# define shell$translate_vms(_p1_) decc$translate_vms(_p1_)
|
|
||||||
# endif
|
|
||||||
# ifndef shell$to_vms
|
|
||||||
# define shell$to_vms(_p1_,_p2_,_p3_,_p4_,_p5_) \
|
|
||||||
decc$to_vms(_p1_,_p2_,_p3_,_p4_,_p5_)
|
|
||||||
# endif
|
|
||||||
# include <wait.h> /* define wait() */
|
# include <wait.h> /* define wait() */
|
||||||
#endif /* defined(__VMS) */
|
#endif /* defined(__VMS) */
|
||||||
|
|
||||||
|
|
@ -147,7 +135,7 @@ corresponding Unix manual entries for more information on calls.");
|
||||||
#define HAVE_SYSTEM 1
|
#define HAVE_SYSTEM 1
|
||||||
#define HAVE_WAIT 1
|
#define HAVE_WAIT 1
|
||||||
#define HAVE_TTYNAME 1
|
#define HAVE_TTYNAME 1
|
||||||
#endif /* PYOS_OS2 && PYCC_GCC */
|
#endif /* PYOS_OS2 && PYCC_GCC && __VMS */
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
#endif /* __BORLANDC__ */
|
#endif /* __BORLANDC__ */
|
||||||
#endif /* ! __WATCOMC__ || __QNX__ */
|
#endif /* ! __WATCOMC__ || __QNX__ */
|
||||||
|
|
@ -336,154 +324,53 @@ extern char **environ;
|
||||||
#endif /* !_MSC_VER */
|
#endif /* !_MSC_VER */
|
||||||
|
|
||||||
#if defined(__VMS)
|
#if defined(__VMS)
|
||||||
static char psxmod_gt_psxpath[1026];
|
|
||||||
|
|
||||||
static int
|
|
||||||
psxmod_from_vms_action (char *spec)
|
|
||||||
{
|
|
||||||
(void)strcpy(psxmod_gt_psxpath, spec);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return a dictionary corresponding to the VMS 'environment table' */
|
|
||||||
static char* at_home = "HOME";
|
|
||||||
static char* at_path = "PATH";
|
|
||||||
|
|
||||||
static char psxmod_t_command [] = "SYS$COMMAND";
|
|
||||||
/* add some values to provide a similar environment like POSIX */
|
/* add some values to provide a similar environment like POSIX */
|
||||||
|
static
|
||||||
void
|
void
|
||||||
psmmod_add_posix_env(PyObject *d)
|
vms_add_posix_env(PyObject *d)
|
||||||
{
|
{
|
||||||
/* -------------------- */
|
|
||||||
struct dsc$descriptor_s r_device_name;
|
|
||||||
long l_devbufsiz;
|
|
||||||
long l_tt_page;
|
|
||||||
long l_item_code;
|
|
||||||
long l_status;
|
|
||||||
PyObject *o;
|
PyObject *o;
|
||||||
struct dsc$descriptor_s r_resultant_string;
|
char* str;
|
||||||
char t_resultant_string[13]; /* enough space for username (12)+ '\0' */
|
|
||||||
char *at_resultant_string;
|
|
||||||
short int w_resultant_length;
|
|
||||||
|
|
||||||
/* set up string descriptor */
|
str = getenv("LINES");
|
||||||
r_device_name.dsc$w_length = strlen(psxmod_t_command);
|
o = Py_BuildValue("s", str);
|
||||||
r_device_name.dsc$b_dtype = DSC$K_DTYPE_T;
|
|
||||||
r_device_name.dsc$b_class = DSC$K_CLASS_S;
|
|
||||||
r_device_name.dsc$a_pointer = &psxmod_t_command[0];
|
|
||||||
|
|
||||||
/* -------------------- */
|
|
||||||
/* COLUMNS = $getdvi("SYS$COMMAND","DEVBUFSIZ") */
|
|
||||||
l_item_code = DVI$_DEVBUFSIZ;
|
|
||||||
l_status = lib$getdvi(&l_item_code,
|
|
||||||
0, /* [channel] */
|
|
||||||
&r_device_name,
|
|
||||||
&l_devbufsiz, /* integer-value */
|
|
||||||
0, /* resultant_string */
|
|
||||||
0); /* resultant_length */
|
|
||||||
if (l_status == SS$_NORMAL) {
|
|
||||||
/* create a string object here to comply with POSIX */
|
|
||||||
|
|
||||||
/* set up string descriptor */
|
|
||||||
r_resultant_string.dsc$w_length =
|
|
||||||
(sizeof(t_resultant_string) - 1); /* ommit '\0' at end */
|
|
||||||
r_resultant_string.dsc$b_dtype = DSC$K_DTYPE_T;
|
|
||||||
r_resultant_string.dsc$b_class = DSC$K_CLASS_S;
|
|
||||||
r_resultant_string.dsc$a_pointer = &t_resultant_string[0];
|
|
||||||
|
|
||||||
/* Convert Signed Integer to Decimal Text */
|
|
||||||
l_status = ots$cvt_l_ti(&l_devbufsiz, &r_resultant_string, 1,
|
|
||||||
4, 0);
|
|
||||||
if (l_status == SS$_NORMAL) {
|
|
||||||
/* terminate string for 'C'-style */
|
|
||||||
t_resultant_string[sizeof(t_resultant_string)-1] = '\0';
|
|
||||||
/* string appears as: ' value' -- skip ' ' */
|
|
||||||
at_resultant_string = &t_resultant_string[0];
|
|
||||||
while ((*at_resultant_string == ' ' ) &&
|
|
||||||
(*at_resultant_string != '\0')) {
|
|
||||||
at_resultant_string++; /* skip prefix spaces */
|
|
||||||
}
|
|
||||||
|
|
||||||
o = Py_BuildValue("s", at_resultant_string);
|
|
||||||
if (o != NULL) {
|
|
||||||
(void) PyDict_SetItemString(d, "COLUMNS", o);
|
|
||||||
Py_DECREF(o);
|
|
||||||
}
|
|
||||||
} /* (l_status = ots$cvt_l_ti() == SS$_NORMAL) */
|
|
||||||
} /* (l_status = lib$getdvi(DVI$_DEVBUFSIZ) == SS$_NORMAL) */
|
|
||||||
/* LINES = $getdvi("SYS$COMMAND","TT_PAGE") */
|
|
||||||
l_item_code = DVI$_TT_PAGE;
|
|
||||||
l_status = lib$getdvi(&l_item_code,
|
|
||||||
0, /* [channel] */
|
|
||||||
&r_device_name,
|
|
||||||
&l_tt_page, /* integer-value */
|
|
||||||
0, /* resultant_string */
|
|
||||||
0); /* resultant_length */
|
|
||||||
if (l_status == SS$_NORMAL) {
|
|
||||||
/* create a string object here to comply with POSIX */
|
|
||||||
|
|
||||||
/* set up string descriptor */
|
|
||||||
r_resultant_string.dsc$w_length =
|
|
||||||
(sizeof(t_resultant_string) - 1); /* ommit '\0' at end */
|
|
||||||
r_resultant_string.dsc$b_dtype = DSC$K_DTYPE_T;
|
|
||||||
r_resultant_string.dsc$b_class = DSC$K_CLASS_S;
|
|
||||||
r_resultant_string.dsc$a_pointer = &t_resultant_string[0];
|
|
||||||
|
|
||||||
/* Convert Signed Integer to Decimal Text */
|
|
||||||
l_status = ots$cvt_l_ti(&l_tt_page, &r_resultant_string,
|
|
||||||
1, 4, 0);
|
|
||||||
if (l_status == SS$_NORMAL) {
|
|
||||||
/* terminate string for 'C'-style */
|
|
||||||
t_resultant_string[sizeof(t_resultant_string)-1] = '\0';
|
|
||||||
/* string appears as: ' value' -- skip ' ' */
|
|
||||||
at_resultant_string = &t_resultant_string[0];
|
|
||||||
while ((*at_resultant_string == ' ' ) &&
|
|
||||||
(*at_resultant_string != '\0')) {
|
|
||||||
at_resultant_string++; /* skip prefix spaces */
|
|
||||||
}
|
|
||||||
|
|
||||||
o = Py_BuildValue("s", at_resultant_string);
|
|
||||||
if (o != NULL) {
|
if (o != NULL) {
|
||||||
(void)PyDict_SetItemString(d, "LINES", o);
|
(void)PyDict_SetItemString(d, "LINES", o);
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
}
|
}
|
||||||
} /* (l_status = ots$cvt_l_ti() == SS$_NORMAL) */
|
|
||||||
} /* (l_status = lib$getdvi(DVI$_TT_PAGE) == SS$_NORMAL) */
|
|
||||||
/* else -- ignore error */
|
|
||||||
|
|
||||||
/* LOGNAME = $getjpi(0,"USERNAME") */
|
str = getenv("COLUMNS");
|
||||||
l_item_code = JPI$_USERNAME;
|
o = Py_BuildValue("s", str);
|
||||||
|
|
||||||
/* set up string descriptor */
|
|
||||||
r_resultant_string.dsc$w_length =
|
|
||||||
(sizeof(t_resultant_string) - 1); /* ommit '\0' at end */
|
|
||||||
r_resultant_string.dsc$b_dtype = DSC$K_DTYPE_T;
|
|
||||||
r_resultant_string.dsc$b_class = DSC$K_CLASS_S;
|
|
||||||
r_resultant_string.dsc$a_pointer = &t_resultant_string[0];
|
|
||||||
|
|
||||||
l_status = lib$getjpi(&l_item_code, 0, 0, 0,
|
|
||||||
&r_resultant_string, &w_resultant_length);
|
|
||||||
if (l_status == SS$_NORMAL){
|
|
||||||
t_resultant_string[w_resultant_length] = '\0';
|
|
||||||
|
|
||||||
/* remove any trailing spaces by replacing 1st one with '\0' */
|
|
||||||
at_resultant_string = &t_resultant_string[0];
|
|
||||||
while ((*at_resultant_string != ' ' ) &&
|
|
||||||
(*at_resultant_string != '\0')) {
|
|
||||||
/* lowercase for compatibility with POSIX */
|
|
||||||
*at_resultant_string = tolower(*at_resultant_string);
|
|
||||||
at_resultant_string++; /* skip non-blank */
|
|
||||||
}
|
|
||||||
*at_resultant_string = '\0'; /* terminate */
|
|
||||||
|
|
||||||
o = Py_BuildValue("s", &t_resultant_string[0]);
|
|
||||||
if (o != NULL) {
|
if (o != NULL) {
|
||||||
(void) PyDict_SetItemString(d, "LOGNAME", o);
|
(void)PyDict_SetItemString(d, "COLUMNS", o);
|
||||||
(void) PyDict_SetItemString(d, "USERNAME", o);
|
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
}
|
}
|
||||||
} /* (l_status == SS$_NORMAL) */
|
|
||||||
|
|
||||||
|
str = getenv("USER");
|
||||||
|
o = Py_BuildValue("s", str);
|
||||||
|
if (o != NULL) {
|
||||||
|
(void)PyDict_SetItemString(d, "USERNAME", o);
|
||||||
|
Py_DECREF(o);
|
||||||
|
}
|
||||||
|
o = Py_BuildValue("s", str);
|
||||||
|
if (o != NULL) {
|
||||||
|
(void)PyDict_SetItemString(d, "LOGNAME", o);
|
||||||
|
Py_DECREF(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
str = getenv("HOME");
|
||||||
|
o = Py_BuildValue("s", str);
|
||||||
|
if (o != NULL) {
|
||||||
|
(void)PyDict_SetItemString(d, "HOME", o);
|
||||||
|
Py_DECREF(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
str = getenv("PATH");
|
||||||
|
o = Py_BuildValue("s", str);
|
||||||
|
if (o != NULL) {
|
||||||
|
(void)PyDict_SetItemString(d, "PATH", o);
|
||||||
|
Py_DECREF(o);
|
||||||
|
}
|
||||||
/* OS = "OpenVMS" */
|
/* OS = "OpenVMS" */
|
||||||
o = PyString_FromString ("OpenVMS");
|
o = PyString_FromString ("OpenVMS");
|
||||||
if (o != NULL) {
|
if (o != NULL) {
|
||||||
|
|
@ -491,40 +378,6 @@ psmmod_add_posix_env(PyObject *d)
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @@ posix env:
|
|
||||||
COLUMNS=80 $ write sys$output f$getdvi("SYS$COMMAND","DEVBUFSIZ")
|
|
||||||
LINES=47 $ write sys$output f$getdvi("SYS$COMMAND","TT_PAGE")
|
|
||||||
LOGNAME=zessin $ write sys$output f$edit(f$getjpi(0,"username"), -
|
|
||||||
"collapse,lowercase")
|
|
||||||
OS=OpenVMS
|
|
||||||
PS1=HERE $
|
|
||||||
|
|
||||||
TZ=CET-1:00CET DST,M3.5.0/2:00,M10.5.0/3:00
|
|
||||||
$ write sys$output f$trnlnm("POSIX$DEFAULT_TZ")
|
|
||||||
"CET-1:00CET DST-2:00,M3.5.0/2:00,M10.5.0/3:00"
|
|
||||||
$ write sys$output f$trnlnm("UCX$TZ")
|
|
||||||
"MET-1MET_DST-2,M3.5.0/2,M10.5.0/3"
|
|
||||||
PAGER=more
|
|
||||||
TERM=vt300_series
|
|
||||||
SHELL=/bin/sh
|
|
||||||
HOME=/dka100/user/zessin
|
|
||||||
_=/bin/env
|
|
||||||
|
|
||||||
>>> for v in os.environ.items():
|
|
||||||
... print v
|
|
||||||
...
|
|
||||||
('HOME', '/user_here/zessin')
|
|
||||||
('COLUMNS', '80')
|
|
||||||
('LINES', '24')
|
|
||||||
('PATH', '/python_disk/python/python-1_5_2/vms')
|
|
||||||
('OS', 'OpenVMS')
|
|
||||||
('USER', 'ZESSIN')
|
|
||||||
('LOGNAME', 'zessin')
|
|
||||||
('TERM', 'vt300-80')
|
|
||||||
('USERNAME', 'zessin')
|
|
||||||
>>>
|
|
||||||
*/
|
|
||||||
#endif /* __VMS */
|
#endif /* __VMS */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
@ -553,19 +406,7 @@ convertenviron(void)
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#if defined(__VMS)
|
|
||||||
if ((strncmp(at_home, *e, sizeof(at_home)) == 0) ||
|
|
||||||
(strncmp(at_path, *e, sizeof(at_path)) == 0)) {
|
|
||||||
(void)shell$from_vms(p+1, psxmod_from_vms_action, 0);
|
|
||||||
/* 0 = no wildcard expansion */
|
|
||||||
v = PyString_FromString(psxmod_gt_psxpath);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
v = PyString_FromString(p+1);
|
v = PyString_FromString(p+1);
|
||||||
}
|
|
||||||
#else
|
|
||||||
v = PyString_FromString(p+1);
|
|
||||||
#endif
|
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
Py_DECREF(k);
|
Py_DECREF(k);
|
||||||
|
|
@ -579,9 +420,8 @@ convertenviron(void)
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
}
|
}
|
||||||
#if defined(__VMS)
|
#if defined(__VMS)
|
||||||
psmmod_add_posix_env(d);
|
vms_add_posix_env(d);
|
||||||
#endif /* defined(__VMS) */
|
#elif defined(PYOS_OS2)
|
||||||
#if defined(PYOS_OS2)
|
|
||||||
{
|
{
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
char buffer[1024]; /* OS/2 Provides a Documented Max of 1024 Chars */
|
char buffer[1024]; /* OS/2 Provides a Documented Max of 1024 Chars */
|
||||||
|
|
@ -1340,14 +1180,12 @@ posix_chdir(PyObject *self, PyObject *args)
|
||||||
return posix_1str(args, "et:chdir", chdir, "U:chdir", _wchdir);
|
return posix_1str(args, "et:chdir", chdir, "U:chdir", _wchdir);
|
||||||
#elif defined(PYOS_OS2) && defined(PYCC_GCC)
|
#elif defined(PYOS_OS2) && defined(PYCC_GCC)
|
||||||
return posix_1str(args, "et:chdir", _chdir2, NULL, NULL);
|
return posix_1str(args, "et:chdir", _chdir2, NULL, NULL);
|
||||||
#else
|
#elif defined(__VMS)
|
||||||
#ifdef __VMS
|
|
||||||
return posix_1str(args, "et:chdir", (int (*)(const char *))chdir,
|
return posix_1str(args, "et:chdir", (int (*)(const char *))chdir,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
#else
|
#else
|
||||||
return posix_1str(args, "et:chdir", chdir, NULL, NULL);
|
return posix_1str(args, "et:chdir", chdir, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FCHDIR
|
#ifdef HAVE_FCHDIR
|
||||||
|
|
@ -1499,13 +1337,11 @@ posix_getcwd(PyObject *self, PyObject *noargs)
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
||||||
res = _getcwd2(buf, sizeof buf);
|
res = _getcwd2(buf, sizeof buf);
|
||||||
#else
|
#elif defined(__VMS)
|
||||||
#if defined(__VMS)
|
|
||||||
/* 0 = force Unix-style path if in the VMS DCL environment! */
|
/* 0 = force Unix-style path if in the VMS DCL environment! */
|
||||||
res = getcwd(buf, sizeof buf, 0);
|
res = getcwd(buf, sizeof buf, 0);
|
||||||
#else
|
#else
|
||||||
res = getcwd(buf, sizeof buf);
|
res = getcwd(buf, sizeof buf);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
|
|
@ -1540,6 +1376,9 @@ posix_getcwdu(PyObject *self, PyObject *noargs)
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
#if defined(PYOS_OS2) && defined(PYCC_GCC)
|
||||||
res = _getcwd2(buf, sizeof buf);
|
res = _getcwd2(buf, sizeof buf);
|
||||||
|
#elif defined(__VMS)
|
||||||
|
/* 0 = force Unix-style path if in the VMS DCL environment! */
|
||||||
|
res = getcwd(buf, sizeof buf, 0);
|
||||||
#else
|
#else
|
||||||
res = getcwd(buf, sizeof buf);
|
res = getcwd(buf, sizeof buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -5338,6 +5177,10 @@ posix_fstat(PyObject *self, PyObject *args)
|
||||||
int res;
|
int res;
|
||||||
if (!PyArg_ParseTuple(args, "i:fstat", &fd))
|
if (!PyArg_ParseTuple(args, "i:fstat", &fd))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#ifdef __VMS
|
||||||
|
/* on OpenVMS we must ensure that all bytes are written to the file */
|
||||||
|
fsync(fd);
|
||||||
|
#endif
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
res = FSTAT(fd, &st);
|
res = FSTAT(fd, &st);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue