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:
parent
b4fd412b3e
commit
e6b30aee0f
@ -52,15 +52,13 @@ typedef struct _property {
|
||||
char *value;
|
||||
} *properties;
|
||||
|
||||
#ifdef _SYS_PARAM_H_
|
||||
/* for pidfile.c */
|
||||
struct pidfh {
|
||||
int pf_fd;
|
||||
char pf_path[MAXPATHLEN + 1];
|
||||
__dev_t pf_dev;
|
||||
dev_t pf_dev;
|
||||
ino_t pf_ino;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Avoid pulling in all the include files for no need */
|
||||
struct termios;
|
||||
@ -120,12 +118,10 @@ const char *pw_tempname(void);
|
||||
int pw_tmp(int _mfd);
|
||||
#endif
|
||||
|
||||
#ifdef _SYS_PARAM_H_
|
||||
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
|
||||
int pidfile_write(struct pidfh *pfh);
|
||||
int pidfile_close(struct pidfh *pfh);
|
||||
int pidfile_remove(struct pidfh *pfh);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
0
headers/compatibility/bsd/netinet/in_systm.h
Normal file
0
headers/compatibility/bsd/netinet/in_systm.h
Normal file
@ -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.
|
||||
*/
|
||||
#ifndef _BSD_SYS_PARAM_H_
|
||||
@ -27,4 +27,8 @@
|
||||
# define howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||
#endif
|
||||
|
||||
#ifndef MAXLOGNAME
|
||||
# define MAXLOGNAME 32
|
||||
#endif
|
||||
|
||||
#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.
|
||||
*/
|
||||
#ifndef _BSD_UNISTD_H_
|
||||
@ -9,12 +9,20 @@
|
||||
#include_next <unistd.h>
|
||||
|
||||
|
||||
#define L_SET SEEK_SET
|
||||
#define L_INCR SEEK_CUR
|
||||
#define L_XTND SEEK_END
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void endusershell(void);
|
||||
char *getpass(const char *prompt);
|
||||
char *getusershell(void);
|
||||
int issetugid(void);
|
||||
void setusershell(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ SharedLibrary libbsd.so :
|
||||
signal.c
|
||||
stringlist.c
|
||||
unvis.c
|
||||
usershell.c
|
||||
vis.c
|
||||
;
|
||||
|
39
src/libs/bsd/usershell.c
Normal file
39
src/libs/bsd/usershell.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2008, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user