esh: add a bad $RANDOM

This commit is contained in:
K. Lange 2018-12-26 19:47:57 +09:00
parent 5e3a17d8c4
commit 461a71aefa
1 changed files with 5 additions and 0 deletions

View File

@ -963,6 +963,9 @@ int shell_exec(char * buffer, size_t size, FILE * file, char ** out_buffer) {
if (a >= 0 && a < shell_argc) {
c = shell_argv[a];
}
} else if (!strcmp(var, "RANDOM")) {
sprintf(tmp,"%d",rand()%32768); /* sure, modulo is bad for range restriction, shut up */
c = tmp;
} else {
c = getenv(var);
}
@ -1579,6 +1582,8 @@ int main(int argc, char ** argv) {
signal(SIGINT, sig_break_loop);
srand(getpid() + time(0));
job_hash = hashmap_create_int(10);
getuser();