ref: 79a7ec816f9e84257b6dc0a462e0cec8c29affe3
parent: 39d47a954c12c1194e2394c0362b44fd646d85dc
author: mkf <mkf@cloud9p.org>
date: Thu Dec 7 13:06:06 EST 2023
rc: use new APIs
--- a/cmd/rc.c
+++ b/cmd/rc.c
@@ -1,13 +1,15 @@
#include <u.h>
#include <libc.h>
#include <ps2.h>
-#include <mem.h>
#include <err.h>
#include <user.h>
#include "rc.h"
static char *cwd;
+static char *username;
+static user_t *cuser;
+
int
exec(int argc, char* argv0, char **argv)
{
@@ -67,8 +69,9 @@
cwd = "/";
i = 0;
cmd = malloc(25);
-
- printf("%s> ", cuser.name);
+
+ cuser = getcuser();
+ printf("%s> ", cuser->name);
while(1)
{
c = ps2_getc();
@@ -84,7 +87,7 @@
memset(cmd, '\0', 25);
i = 0;
- printf("%s> ", cuser.name);
+ printf("%s> ", cuser->name);
}
else if(c != '\b')
{
@@ -99,4 +102,5 @@
cmd[i] = '\0';
}
}
+ free(cuser);
}