Skip to content

Commit

Permalink
Merge pull request #2072 from ghaerr/optim2
Browse files Browse the repository at this point in the history
[cmds] Add env vars to /etc/sashrc, use HOSTNAME env var in getty not /etc/hostname
  • Loading branch information
ghaerr authored Oct 14, 2024
2 parents 87f65f3 + d3932b8 commit 8ac7271
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions elkscmd/rootfs_template/etc/sashrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# init file for sash
setenv TERM ansi
setenv USER root
setenv HOME /root
setenv SHELL /bin/sash
setenv TZ GMT0
setenv HISTORY 30
setenv HISTPAGE 20
14 changes: 9 additions & 5 deletions elkscmd/sys_utils/getty.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ void consolemsg(const char *str, ...)
}


#ifndef SUPER_SMALL
char Host[256], *Date = 0, *Time = 0;

#if UNUSED
char Host[256];
void host(void) {
char *ptr;
int fp = open(_PATH_HOSTNAME,O_RDONLY), sz;
Expand All @@ -113,6 +112,10 @@ void host(void) {
if (!*Host)
strcpy( Host, "LocalHost" );
}
#endif

#ifndef SUPER_SMALL
char *Date, *Time;

/* Before = "Sun Dec 25 12:34:56 7890"
* Columns = "0....:....1....:....2..."
Expand Down Expand Up @@ -296,7 +299,6 @@ int main(int argc, char **argv)
write(1,Buffer,n);
#else
when();
host();
*Buffer = '\0';
while (read(fd,Buffer,1) > 0) {
ch = *Buffer;
Expand Down Expand Up @@ -359,7 +361,9 @@ int main(int argc, char **argv)
state(Date);
break;
case 'H': /* Host */
state(Host);
if (!(ptr = getenv("HOSTNAME")))
ptr = "LocalHost";
state(ptr);
break;
case 'L': /* Line used */
ptr = rindex(argv[1],'/');
Expand Down

0 comments on commit 8ac7271

Please sign in to comment.