Minor formatting changes.

This commit is contained in:
Barry Warsaw 1996-12-19 22:10:44 +00:00
parent 62ac99ebf5
commit 43d68b8fb0

View file

@ -522,7 +522,8 @@ posix_listdir(self, args)
return NULL; return NULL;
if (_dos_findfirst(namebuf, _A_RDONLY | if (_dos_findfirst(namebuf, _A_RDONLY |
_A_HIDDEN | _A_SYSTEM | _A_SUBDIR, &ep) != 0){ _A_HIDDEN | _A_SYSTEM | _A_SUBDIR, &ep) != 0)
{
errno = ENOENT; errno = ENOENT;
return posix_error(); return posix_error();
} }
@ -718,11 +719,11 @@ posix_uname(self, args)
if (res < 0) if (res < 0)
return posix_error(); return posix_error();
return Py_BuildValue("(sssss)", return Py_BuildValue("(sssss)",
u.sysname, u.sysname,
u.nodename, u.nodename,
u.release, u.release,
u.version, u.version,
u.machine); u.machine);
} }
#endif /* HAVE_UNAME */ #endif /* HAVE_UNAME */
@ -875,8 +876,9 @@ posix_execve(self, args)
} }
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
if (!PyArg_Parse((*getitem)(argv, i), if (!PyArg_Parse((*getitem)(argv, i),
"s;argv must be list of strings", "s;argv must be list of strings",
&argvlist[i])) { &argvlist[i]))
{
goto fail_1; goto fail_1;
} }
} }
@ -893,7 +895,8 @@ posix_execve(self, args)
while (PyDict_Next(env, &pos, &key, &val)) { while (PyDict_Next(env, &pos, &key, &val)) {
char *p, *k, *v; char *p, *k, *v;
if (!PyArg_Parse(key, "s;non-string key in env", &k) || if (!PyArg_Parse(key, "s;non-string key in env", &k) ||
!PyArg_Parse(val, "s;non-string value in env", &v)) { !PyArg_Parse(val, "s;non-string value in env", &v))
{
goto fail_2; goto fail_2;
} }
p = PyMem_NEW(char, PyString_Size(key)+PyString_Size(val) + 2); p = PyMem_NEW(char, PyString_Size(key)+PyString_Size(val) + 2);
@ -1240,11 +1243,11 @@ posix_times(self, args)
if (c == (clock_t) -1) if (c == (clock_t) -1)
return posix_error(); return posix_error();
return Py_BuildValue("ddddd", return Py_BuildValue("ddddd",
(double)t.tms_utime / HZ, (double)t.tms_utime / HZ,
(double)t.tms_stime / HZ, (double)t.tms_stime / HZ,
(double)t.tms_cutime / HZ, (double)t.tms_cutime / HZ,
(double)t.tms_cstime / HZ, (double)t.tms_cstime / HZ,
(double)c / HZ); (double)c / HZ);
} }
#endif /* HAVE_TIMES */ #endif /* HAVE_TIMES */
#ifdef MS_WIN32 #ifdef MS_WIN32
@ -1328,7 +1331,7 @@ posix_tcsetpgrp(self, args)
return NULL; return NULL;
if (tcsetpgrp(fd, pgid) < 0) if (tcsetpgrp(fd, pgid) < 0)
return posix_error(); return posix_error();
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
} }
#endif /* HAVE_TCSETPGRP */ #endif /* HAVE_TCSETPGRP */
@ -1344,11 +1347,9 @@ posix_open(self, args)
int flag; int flag;
int mode = 0777; int mode = 0777;
int fd; int fd;
if (!PyArg_Parse(args, "(si)", &file, &flag)) { if (!PyArg_ParseTuple(args, "si|i", &file, &flag, &mode))
PyErr_Clear(); return NULL;
if (!PyArg_Parse(args, "(sii)", &file, &flag, &mode))
return NULL;
}
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
fd = open(file, flag, mode); fd = open(file, flag, mode);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
@ -1489,16 +1490,16 @@ posix_fstat(self, args)
if (res != 0) if (res != 0)
return posix_error(); return posix_error();
return Py_BuildValue("(llllllllll)", return Py_BuildValue("(llllllllll)",
(long)st.st_mode, (long)st.st_mode,
(long)st.st_ino, (long)st.st_ino,
(long)st.st_dev, (long)st.st_dev,
(long)st.st_nlink, (long)st.st_nlink,
(long)st.st_uid, (long)st.st_uid,
(long)st.st_gid, (long)st.st_gid,
(long)st.st_size, (long)st.st_size,
(long)st.st_atime, (long)st.st_atime,
(long)st.st_mtime, (long)st.st_mtime,
(long)st.st_ctime); (long)st.st_ctime);
} }
static PyObject * static PyObject *
@ -1514,6 +1515,7 @@ posix_fdopen(self, args)
PyObject *f; PyObject *f;
if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize)) if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize))
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
fp = fdopen(fd, mode); fp = fdopen(fd, mode);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
@ -1730,7 +1732,7 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_TCSETPGRP #ifdef HAVE_TCSETPGRP
{"tcsetpgrp", posix_tcsetpgrp}, {"tcsetpgrp", posix_tcsetpgrp},
#endif /* HAVE_TCSETPGRP */ #endif /* HAVE_TCSETPGRP */
{"open", posix_open}, {"open", posix_open, 1},
{"close", posix_close}, {"close", posix_close},
{"dup", posix_dup}, {"dup", posix_dup},
{"dup2", posix_dup2}, {"dup2", posix_dup2},