Home | History | Annotate | Download | only in example
      1 /* hostid.c - Print the numeric identifier for the current host.
      2  *
      3  * Copyright 2015 Ranjan Kumar <ranjankumar.bth (at) gmail.com>
      4  *
      5  * No Standard.
      6  *
      7  * This is still in coreutils and gethostid() in posix, but a "globally unique
      8  * 32 bit identifier" is a concept the Linux world has outgrown.
      9 
     10 USE_HOSTID(NEWTOY(hostid, ">0", TOYFLAG_USR|TOYFLAG_BIN))
     11 
     12 config HOSTID
     13   bool "hostid"
     14   default n
     15   help
     16     usage: hostid
     17 
     18     Print the numeric identifier for the current host.
     19 */
     20 #define FOR_hostid
     21 #include "toys.h"
     22 
     23 void hostid_main(void)
     24 {
     25   xprintf("%08lx\n", gethostid());
     26 }
     27