mirror of https://github.com/ericonr/ep.git
Add chroot and job count support.
This commit is contained in:
parent
e779146066
commit
c5cb3277a9
34
ep.c
34
ep.c
|
@ -30,6 +30,27 @@ int main(int argc, char **argv)
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
out = stdout;
|
out = stdout;
|
||||||
|
|
||||||
|
char *shell_jobs = NULL;
|
||||||
|
int chroot = 0;
|
||||||
|
int c;
|
||||||
|
while((c = getopt(argc, argv, "cj:")) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'c':
|
||||||
|
chroot = 1;
|
||||||
|
break;
|
||||||
|
case 'j':
|
||||||
|
shell_jobs = optarg;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* XXX: log error */
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chroot)
|
||||||
|
p("[chroot] ");
|
||||||
|
|
||||||
const char *home = getenv("HOME");
|
const char *home = getenv("HOME");
|
||||||
const char *hostname = getenv("HOSTNAME");
|
const char *hostname = getenv("HOSTNAME");
|
||||||
|
|
||||||
|
@ -82,5 +103,18 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* print currently active shell jobs */
|
||||||
|
if (shell_jobs) {
|
||||||
|
int n = atoi(shell_jobs);
|
||||||
|
if (n >= 1) {
|
||||||
|
p(" ✦");
|
||||||
|
if (n > 1) {
|
||||||
|
/* jobs emoji is wide */
|
||||||
|
p(" ");
|
||||||
|
p(shell_jobs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p(PROMPT);
|
p(PROMPT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue