aboutsummaryrefslogtreecommitdiffstats
path: root/com32/rosh
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2010-07-06 11:13:42 -0400
committerGene Cumm <gene.cumm@gmail.com>2010-07-07 10:03:53 -0400
commit8f7fa195f59d5d042affed4218924ae98abcc4b2 (patch)
tree69dd4f87167ccb7e5174c6b4d303b5cf21cae75f /com32/rosh
parentc4c5143b4e9a8255a6bbcafc7e81d09166e34298 (diff)
downloadsyslinux-8f7fa195f59d5d042affed4218924ae98abcc4b2.tar.gz
syslinux-8f7fa195f59d5d042affed4218924ae98abcc4b2.tar.xz
syslinux-8f7fa195f59d5d042affed4218924ae98abcc4b2.zip
rosh: show environment
Diffstat (limited to 'com32/rosh')
-rw-r--r--com32/rosh/rosh.c17
-rw-r--r--com32/rosh/rosh.h23
2 files changed, 35 insertions, 5 deletions
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 801fbf59..9efa35ef 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -40,9 +40,16 @@
#define APP_YEAR "2010"
#define APP_VER "beta-b068"
-void rosh_version(void)
+void rosh_version(int vtype)
{
+ char env[256];
+ env[0] = 0;
printf("%s v %s; (c) %s %s.\n\tFrom Syslinux %s, %s\n", APP_LONGNAME, APP_VER, APP_YEAR, APP_AUTHOR, VERSION_STR, DATE);
+ switch (vtype) {
+ case 1:
+ rosh_get_env_ver(env, 256);
+ printf("\tRunning on %s\n", env);
+ }
}
void print_beta(void)
@@ -124,7 +131,7 @@ void rosh_help(int type, const char *cmdstr)
case 2:
istr += rosh_search_nonsp(cmdstr, rosh_search_sp(cmdstr, 0));
if ((cmdstr == NULL) || (strcmp(istr, "") == 0)) {
- rosh_version();
+ rosh_version(0);
puts(rosh_help_str2);
} else {
switch (istr[0]) {
@@ -138,7 +145,7 @@ void rosh_help(int type, const char *cmdstr)
break;
case 1:
default:
- rosh_version();
+ rosh_version(0);
puts(rosh_help_str1);
}
}
@@ -1125,7 +1132,7 @@ char rosh_command(const char *cmdstr, const char *ipwdstr)
case 'v':
case 'V':
if (strncasecmp("version", tstr, tlen) == 0)
- rosh_version();
+ rosh_version(1);
else
rosh_help(1, NULL);
break;
@@ -1184,7 +1191,7 @@ int main(int argc, char *argv[])
if (argc != 1) {
rv = rosh_argcat(cmdstr, argc, argv, 1);
} else {
- rosh_version();
+ rosh_version(0);
print_beta();
cmdstr[0] = '\0';
}
diff --git a/com32/rosh/rosh.h b/com32/rosh/rosh.h
index 135087b8..b016e2f2 100644
--- a/com32/rosh/rosh.h
+++ b/com32/rosh/rosh.h
@@ -90,9 +90,17 @@ int stat(const char *pathname, struct stat *buf)
return ret;
}
+int rosh_get_env_ver(char *dest, size_t n)
+{
+ const struct syslinux_version *slv = syslinux_version();
+ strncpy(dest, slv->version_string, n);
+ return 0;
+}
+
#else
# include <termios.h>
# include <sys/ioctl.h>
+# include <sys/utsname.h>
# define ROSH_IS_COM32 0
static inline char *syslinux_config_file(void)
@@ -100,6 +108,21 @@ static inline char *syslinux_config_file(void)
return "";
}
+int rosh_get_env_ver(char *dest, size_t n)
+{
+ int ret, len;
+ struct utsname env;
+ ret= uname(&env);
+ if (ret >= 0) {
+ strncpy(dest, env.sysname, n);
+ len = strlen(dest);
+ strncpy(dest + len, " ", (n - len));
+ len = strlen(dest);
+ strncpy(dest + len, env.release, (n - len));
+ }
+ return ret;
+}
+
static inline int getscreensize(int fd, int *rows, int *cols)
{
char *str;