Skip to content
Snippets Groups Projects
Commit 7a8ab7ed authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

Added int umask(void|int).

Rev: src/modules/system/system.c:1.63
Rev: src/modules/system/testsuite.in:1.11
parent 6369f620
No related branches found
No related tags found
No related merge requests found
/* /*
* $Id: system.c,v 1.62 1999/02/10 21:55:29 hubbe Exp $ * $Id: system.c,v 1.63 1999/03/12 17:49:51 mast Exp $
* *
* System-call module for Pike * System-call module for Pike
* *
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "system_machine.h" #include "system_machine.h"
#include "system.h" #include "system.h"
RCSID("$Id: system.c,v 1.62 1999/02/10 21:55:29 hubbe Exp $"); RCSID("$Id: system.c,v 1.63 1999/03/12 17:49:51 mast Exp $");
#ifdef HAVE_WINSOCK_H #ifdef HAVE_WINSOCK_H
#include <winsock.h> #include <winsock.h>
#endif #endif
...@@ -311,6 +311,25 @@ void f_resolvepath(INT32 args) ...@@ -311,6 +311,25 @@ void f_resolvepath(INT32 args)
} }
#endif /* HAVE_RESOLVEPATH */ #endif /* HAVE_RESOLVEPATH */
/* int umask(void|int mask) */
void f_umask(INT32 args)
{
int oldmask;
if (args) {
int setmask;
get_all_args("umask", args, "%d", &setmask);
oldmask = umask(setmask);
}
else {
oldmask = umask(0);
umask(oldmask);
}
pop_n_elems(args);
push_int(oldmask);
}
/* void chmod(string path, int mode) */ /* void chmod(string path, int mode) */
void f_chmod(INT32 args) void f_chmod(INT32 args)
{ {
...@@ -970,6 +989,9 @@ void pike_module_init(void) ...@@ -970,6 +989,9 @@ void pike_module_init(void)
ADD_EFUN("resolvepath", f_resolvepath,tFunc(tStr,tStr), OPT_EXTERNAL_DEPEND); ADD_EFUN("resolvepath", f_resolvepath,tFunc(tStr,tStr), OPT_EXTERNAL_DEPEND);
#endif /* HAVE_RESOLVEPATH */ #endif /* HAVE_RESOLVEPATH */
/* function(int|void:int) */
ADD_EFUN("umask", f_umask, tFunc(tOr(tInt,tVoid),tInt), OPT_SIDE_EFFECT);
/* function(string, int:void) */ /* function(string, int:void) */
ADD_EFUN("chmod", f_chmod,tFunc(tStr tInt,tVoid), OPT_SIDE_EFFECT); ADD_EFUN("chmod", f_chmod,tFunc(tStr tInt,tVoid), OPT_SIDE_EFFECT);
#ifdef HAVE_CHOWN #ifdef HAVE_CHOWN
......
// $Id: testsuite.in,v 1.10 1998/08/04 23:22:00 grubba Exp $ // $Id: testsuite.in,v 1.11 1999/03/12 17:49:52 mast Exp $
// system.c: // system.c:
// RegGetValue __NT__ // RegGetValue __NT__
// cp __NT__ // cp __NT__
// umask
// chmod // chmod
// chown HAVE_CHOWN // chown HAVE_CHOWN
// chroot HAVE_CHROOT // chroot HAVE_CHROOT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment