configure.in: Add check for <sys/utsname.h>
authorTheodore Tso <tytso@mit.edu>
Mon, 16 Nov 1998 18:04:33 +0000 (18:04 +0000)
committerTheodore Tso <tytso@mit.edu>
Mon, 16 Nov 1998 18:04:33 +0000 (18:04 +0000)
utility.c (putf): Add support for %s, %m, %r, %v using information
from the uname() system call.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11041 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/telnet/telnetd/ChangeLog
src/appl/telnet/telnetd/configure.in
src/appl/telnet/telnetd/utility.c

index 2ac0776cf05669ab91901f36a56966b11cf57032..daa0693a8b0364cd752844506eb161f13ccf2680 100644 (file)
@@ -1,3 +1,10 @@
+1998-11-14  Theodore Ts'o  <tytso@rsts-11.mit.edu>
+
+       * configure.in: Add check for <sys/utsname.h>.
+
+       * utility.c (putf): Add support for %s, %m, %r, %v using
+               information from the uname() system call.
+
 1998-11-13  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Makefile.in: Set the myfulldir and mydir variables (which are
index 26631b0f6cda87b7a28baf7808d528506e44d683..8a57d84eb8894bbcad3d31d9b3af2af5dba25ad2 100644 (file)
@@ -21,7 +21,7 @@ if test -z "$ac_sysv_termio"; then
 fi
 fi
 AC_HEADER_TIME
-AC_CHECK_HEADERS(string.h arpa/nameser.h utmp.h sys/time.h sys/tty.h sac.h sys/ptyvar.h sys/filio.h sys/stream.h)
+AC_CHECK_HEADERS(string.h arpa/nameser.h utmp.h sys/time.h sys/tty.h sac.h sys/ptyvar.h sys/filio.h sys/stream.h sys/utsname.h)
 AC_CHECK_FUNCS(gettosbyname)
 dnl Make our operating system-specific security checks and definitions for
 dnl login.
index 8f888bc0239ae85deaecb9bcfb4e58bf76428122..408c6f4adf6af7dac5ef660bc6d803f90562b4c3 100644 (file)
 #define PRINTOPTIONS
 #include "telnetd.h"
 
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
 /*
  * utility functions performing io related tasks
  */
@@ -450,6 +454,11 @@ putf(cp, where)
        char *slash;
        time_t t;
        char db[100];
+#ifdef HAVE_SYS_UTSNAME_H
+       struct utsname utsinfo;
+
+       (void) uname(&utsinfo);
+#endif
 
        putlocation = where;
 
@@ -483,6 +492,24 @@ putf(cp, where)
                        putstr(db);
                        break;
 
+#ifdef HAVE_SYS_UTSNAME_H
+               case 's':
+                       putstr(utsinfo.sysname);
+                       break;
+
+               case 'm':
+                       putstr(utsinfo.machine);
+                       break;
+
+               case 'r':
+                       putstr(utsinfo.release);
+                       break;
+
+               case 'v':
+                       putstr(utsinfo.version);
+                       break;
+#endif
+
                case '%':
                        putchr('%');
                        break;