Several fixes

This commit is contained in:
ceriel 1991-09-19 11:26:10 +00:00
parent 80e3ee2e79
commit 6e485ef169
4 changed files with 20 additions and 9 deletions

View file

@ -1,4 +1,5 @@
#include <lib.h> #include <lib.h>
#include <unistd.h>
#define execl _execl #define execl _execl
#define execle _execle #define execle _execle
#define execv _execv #define execv _execv

View file

@ -2,22 +2,31 @@
#define fcntl _fcntl #define fcntl _fcntl
#include <fcntl.h> #include <fcntl.h>
#if _ANSI #if _ANSI
#include <stdarg.h>
#endif #endif
#if _ANSI #if _ANSI
#include <stdarg.h>
PUBLIC int fcntl(int fd, int cmd, ...) PUBLIC int fcntl(int fd, int cmd, ...)
{
#else #else
PUBLIC int fcntl(fd, cmd) #include <varargs.h>
PUBLIC int fcntl(va_alist)
va_dcl
{
int fd; int fd;
int cmd; int cmd;
#endif #endif
{ va_list ap;
va_list argp;
int int3; /* third integer parameter for callm1 */ int int3; /* third integer parameter for callm1 */
char *ptr1; /* first pointer parameter for callm1 */ char *ptr1; /* first pointer parameter for callm1 */
va_start(argp, cmd); #if _ANSI
va_start(ap, cmd);
#else
va_start(ap);
fd = va_arg(ap, int);
cmd = va_arg(ap, int);
#endif
/* Set up for the sensible case where there is no variable parameter. This /* Set up for the sensible case where there is no variable parameter. This
* covers F_GETFD, F_GETFL and invalid commands. * covers F_GETFD, F_GETFL and invalid commands.
@ -30,16 +39,16 @@ int cmd;
case F_DUPFD: case F_DUPFD:
case F_SETFD: case F_SETFD:
case F_SETFL: case F_SETFL:
int3 = va_arg(argp, int); int3 = va_arg(ap, int);
break; break;
case F_GETLK: case F_GETLK:
case F_SETLK: case F_SETLK:
case F_SETLKW: case F_SETLKW:
ptr1 = (char *) va_arg(argp, struct flock *); ptr1 = (char *) va_arg(ap, struct flock *);
break; break;
} }
/* Clean up and make the system call. */ /* Clean up and make the system call. */
va_end(argp); va_end(ap);
return(_callm1(FS, FCNTL, fd, cmd, int3, ptr1, NIL_PTR, NIL_PTR)); return(_callm1(FS, FCNTL, fd, cmd, int3, ptr1, NIL_PTR, NIL_PTR));
} }

View file

@ -13,7 +13,7 @@
#define DIRECT_SIZE (sizeof (struct direct)) #define DIRECT_SIZE (sizeof (struct direct))
PRIVATE _PROTOTYPE(void, go_back(char *path) ); PRIVATE _PROTOTYPE(void go_back, (char *path) );
char *getcwd(buffer, size) char *getcwd(buffer, size)
char *buffer; char *buffer;

View file

@ -1,6 +1,7 @@
/* POSIX fpathconf (Sec. 5.7.1) Author: Andy Tanenbaum */ /* POSIX fpathconf (Sec. 5.7.1) Author: Andy Tanenbaum */
#include <lib.h> #include <lib.h>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#define fstat _fstat #define fstat _fstat
#include <sys/stat.h> #include <sys/stat.h>