00001 /*****************************************************************************\ 00002 * * 00003 * Name : machine_name * 00004 * Author : Morgan McLeod * 00005 * * 00006 ******************************************************************************* 00007 * Copyright (c) 1998-$now By Author. This program is free software; you can * 00008 * redistribute it and/or modify it under the terms of the GNU General Public * 00009 * License as published by the Free Software Foundation; either version 2 of * 00010 * the License or (at your option) any later version. This is online at: * 00011 * http://www.fsf.org/copyleft/gpl.html * 00012 * Please send any updates to: fred@gruntose.com * 00013 \*****************************************************************************/ 00014 00015 #include <basis/string_array.h> 00016 #include <loggers/console_logger.h> 00017 #include <opsystem/ini_config.h> 00018 #include <data_struct/static_memory_gremlin.h> 00019 #include <sockets/tcpip_stack.h> 00020 00021 #include <errno.h> 00022 #ifdef __WIN32__ 00023 #include <winsock2.h> 00024 #endif 00025 00026 HOOPLE_STARTUP_CODE; 00027 00028 #define mn_out program_wide_logger() 00029 00030 int main(int argc, char *argv[]) 00031 { 00032 SET_DEFAULT_CONSOLE_LOGGER; 00033 if (argc < 2) { 00034 mn_out.log("The single argument to this program is expected to be " 00035 "an ini file name."); 00036 return 1; 00037 } 00038 00039 tcpip_stack stack; 00040 00041 string_array adapters; 00042 if (!stack.enumerate_adapters(adapters)) { 00043 mn_out.log("failed to enumerate adapters"); 00044 return 1; 00045 } 00046 mn_out.log("got adapters:"); 00047 for (int i = 0; i < adapters.length(); i++) 00048 mn_out.log(adapters[i]); 00049 00050 ini_configurator ini(argv[1], ini_configurator::AUTO_STORE); 00051 istring hostname = stack.hostname(); 00052 ini.store("Common", "HostName", hostname); 00053 ini.store("Common", "IPAddress", adapters[0]); 00054 return 0; 00055 } 00056 00057 #ifdef __BUILD_STATIC_APPLICATION__ 00058 // static dependencies found by buildor_gen_deps.sh: 00059 #include <basis/array.cpp> 00060 #include <basis/byte_array.cpp> 00061 #include <basis/callstack_tracker.cpp> 00062 #include <basis/chaos.cpp> 00063 #include <basis/convert_utf.cpp> 00064 #include <basis/definitions.cpp> 00065 #include <basis/earth_time.cpp> 00066 #include <basis/guards.cpp> 00067 #include <basis/istring.cpp> 00068 #include <basis/log_base.cpp> 00069 #include <basis/memory_checker.cpp> 00070 #include <basis/mutex.cpp> 00071 #include <basis/object_base.cpp> 00072 #include <basis/outcome.cpp> 00073 #include <basis/packable.cpp> 00074 #include <basis/portable.cpp> 00075 #include <basis/sequence.cpp> 00076 #include <basis/set.cpp> 00077 #include <basis/utility.cpp> 00078 #include <basis/version_record.cpp> 00079 #include <data_struct/amorph.cpp> 00080 #include <data_struct/bit_vector.cpp> 00081 #include <data_struct/byte_hasher.cpp> 00082 #include <data_struct/configurator.cpp> 00083 #include <data_struct/hash_table.cpp> 00084 #include <data_struct/pointer_hash.cpp> 00085 #include <data_struct/stack.cpp> 00086 #include <data_struct/static_memory_gremlin.cpp> 00087 #include <data_struct/string_hash.cpp> 00088 #include <data_struct/string_hasher.cpp> 00089 #include <data_struct/string_table.cpp> 00090 #include <data_struct/symbol_table.cpp> 00091 #include <data_struct/table_configurator.cpp> 00092 #include <loggers/console_logger.cpp> 00093 #include <loggers/file_logger.cpp> 00094 #include <loggers/locked_logger.cpp> 00095 #include <loggers/null_logger.cpp> 00096 #include <loggers/program_wide_logger.cpp> 00097 #include <opsystem/byte_filer.cpp> 00098 #include <opsystem/command_line.cpp> 00099 #include <opsystem/critical_events.cpp> 00100 #include <opsystem/directory.cpp> 00101 #include <opsystem/filename.cpp> 00102 #include <opsystem/ini_config.cpp> 00103 #include <opsystem/ini_parser.cpp> 00104 #include <opsystem/path_configuration.cpp> 00105 #include <opsystem/rendezvous.cpp> 00106 #include <sockets/address_base.cpp> 00107 #include <sockets/address.cpp> 00108 #include <sockets/imp_sockets.cpp> 00109 #include <sockets/machine_uid.cpp> 00110 #include <sockets/tcpip_stack.cpp> 00111 #include <textual/byte_format.cpp> 00112 #include <textual/parser_bits.cpp> 00113 #include <textual/string_manipulation.cpp> 00114 #include <textual/tokenizer.cpp> 00115 #endif // __BUILD_STATIC_APPLICATION__ 00116
1.5.1