aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-11-25 20:13:30 +0200
committerArnold D. Robbins <arnold@skeeve.com>2018-11-25 20:13:30 +0200
commit868a694807f0b0a617a47648910a7004b2b9ff97 (patch)
tree2f3156c1e617440ec7cd96ce1455126f9ea795fc /main.c
parent19d38d292158e651c8c7175ae9bbd3e5855e2c94 (diff)
downloadegawk-868a694807f0b0a617a47648910a7004b2b9ff97.tar.gz
egawk-868a694807f0b0a617a47648910a7004b2b9ff97.tar.bz2
egawk-868a694807f0b0a617a47648910a7004b2b9ff97.zip
Add PROCINFO["platform"] to code and doc.
Diffstat (limited to 'main.c')
-rw-r--r--main.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/main.c b/main.c
index de3ed72a..a97bd180 100644
--- a/main.c
+++ b/main.c
@@ -68,6 +68,7 @@ static void version(void) ATTRIBUTE_NORETURN;
static void init_fds(void);
static void init_groupset(void);
static void save_argv(int, char **);
+static const char *platform_name();
/* These nodes store all the special variables AWK uses */
NODE *ARGC_node, *ARGIND_node, *ARGV_node, *BINMODE_node, *CONVFMT_node;
@@ -981,6 +982,7 @@ load_procinfo()
update_PROCINFO_str("version", VERSION);
update_PROCINFO_str("strftime", def_strftime_format);
+ update_PROCINFO_str("platform", platform_name());
#ifdef HAVE_MPFR
sprintf(name, "GNU MPFR %s", mpfr_get_version());
@@ -1769,3 +1771,25 @@ set_locale_stuff(void)
(void) bindtextdomain(PACKAGE, locale_dir);
(void) textdomain(PACKAGE);
}
+
+/* platform_name --- return the platform name */
+
+static const char *
+platform_name()
+{
+#if defined(__VMS)
+ return "vms";
+#elif defined(__APPLE__)
+ return "macosx";
+#elif defined(__MINGW32__)
+ return "mingw";
+#elif defined(__DJGPP__)
+ return "djgpp";
+#elif defined(__CYGWIN__)
+ return "cygwin";
+#elif defined(__EMX__)
+ return "os2";
+#else
+ return "posix";
+#endif
+}