You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
592 B
48 lines
592 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
char *PS1 = NULL;
|
|
unsigned int histsize = DEF_HISTSIZE;
|
|
|
|
// Buffered user data
|
|
struct {
|
|
char *name;
|
|
char *home;
|
|
uid_t uid;
|
|
gid_t gid;
|
|
} uinfo;
|
|
|
|
void sh_fill_uinfo(void);
|
|
void sh_update_ps1(void);
|
|
inline void sh_print_ps1(void);
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
sh_fill_uinfo();
|
|
|
|
for (;;) {
|
|
sh_update_ps1();
|
|
sh_print_ps1();
|
|
}
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
void sh_fill_uinfo(void)
|
|
{
|
|
struct pwuid pw;
|
|
uinfo.uid = getuid();
|
|
uidfo.gid = getgid();
|
|
|
|
}
|
|
|
|
inline void sh_print_ps1(void)
|
|
{
|
|
puts(PS1);
|
|
putchar(' ');
|
|
}
|
|
|
|
void sh_update_ps1(void)
|
|
{
|
|
|
|
} |