Minor improvements for the BSD compatibility library:
* Added {get|set|end}usershell() functions.
* Define MAXLOGNAME, and L_SET, L_INCR, and L_XTND.
* The pidfile stuff in libutil.h is now included, too.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23827 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -52,15 +52,13 @@ typedef struct _property {
|
|||||||
char *value;
|
char *value;
|
||||||
} *properties;
|
} *properties;
|
||||||
|
|
||||||
#ifdef _SYS_PARAM_H_
|
|
||||||
/* for pidfile.c */
|
/* for pidfile.c */
|
||||||
struct pidfh {
|
struct pidfh {
|
||||||
int pf_fd;
|
int pf_fd;
|
||||||
char pf_path[MAXPATHLEN + 1];
|
char pf_path[MAXPATHLEN + 1];
|
||||||
__dev_t pf_dev;
|
dev_t pf_dev;
|
||||||
ino_t pf_ino;
|
ino_t pf_ino;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Avoid pulling in all the include files for no need */
|
/* Avoid pulling in all the include files for no need */
|
||||||
struct termios;
|
struct termios;
|
||||||
@@ -120,12 +118,10 @@ const char *pw_tempname(void);
|
|||||||
int pw_tmp(int _mfd);
|
int pw_tmp(int _mfd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _SYS_PARAM_H_
|
|
||||||
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
|
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
|
||||||
int pidfile_write(struct pidfh *pfh);
|
int pidfile_write(struct pidfh *pfh);
|
||||||
int pidfile_close(struct pidfh *pfh);
|
int pidfile_close(struct pidfh *pfh);
|
||||||
int pidfile_remove(struct pidfh *pfh);
|
int pidfile_remove(struct pidfh *pfh);
|
||||||
#endif
|
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _BSD_SYS_PARAM_H_
|
#ifndef _BSD_SYS_PARAM_H_
|
||||||
@@ -27,4 +27,8 @@
|
|||||||
# define howmany(x, y) (((x) + ((y) - 1)) / (y))
|
# define howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAXLOGNAME
|
||||||
|
# define MAXLOGNAME 32
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _BSD_SYS_PARAM_H_ */
|
#endif /* _BSD_SYS_PARAM_H_ */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _BSD_UNISTD_H_
|
#ifndef _BSD_UNISTD_H_
|
||||||
@@ -9,12 +9,20 @@
|
|||||||
#include_next <unistd.h>
|
#include_next <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define L_SET SEEK_SET
|
||||||
|
#define L_INCR SEEK_CUR
|
||||||
|
#define L_XTND SEEK_END
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void endusershell(void);
|
||||||
char *getpass(const char *prompt);
|
char *getpass(const char *prompt);
|
||||||
|
char *getusershell(void);
|
||||||
int issetugid(void);
|
int issetugid(void);
|
||||||
|
void setusershell(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,5 +14,6 @@ SharedLibrary libbsd.so :
|
|||||||
signal.c
|
signal.c
|
||||||
stringlist.c
|
stringlist.c
|
||||||
unvis.c
|
unvis.c
|
||||||
|
usershell.c
|
||||||
vis.c
|
vis.c
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
static int sShellIndex;
|
||||||
|
|
||||||
|
|
||||||
|
char *
|
||||||
|
getusershell(void)
|
||||||
|
{
|
||||||
|
if (sShellIndex++ == 0)
|
||||||
|
return "/bin/sh";
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
endusershell(void)
|
||||||
|
{
|
||||||
|
sShellIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
setusershell(void)
|
||||||
|
{
|
||||||
|
sShellIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user