A really simple Win32 implementation of 'hostname'. Modified: trunk/reactos/bootdata/packages/reactos.dff Modified: trunk/reactos/subsys/system/directory.xml Added: trunk/reactos/subsys/system/hostname/ Added: trunk/reactos/subsys/system/hostname/hostname.c Added: trunk/reactos/subsys/system/hostname/hostname.rc Added: trunk/reactos/subsys/system/hostname/hostname.xml _____
Modified: trunk/reactos/bootdata/packages/reactos.dff --- trunk/reactos/bootdata/packages/reactos.dff 2005-08-02 18:21:48 UTC (rev 16975) +++ trunk/reactos/bootdata/packages/reactos.dff 2005-08-02 20:17:01 UTC (rev 16976) @@ -175,6 +175,7 @@
subsys\system\dhcp\dhcp.exe 1 subsys\system\sm\sm.exe 1 subsys\system\expand\expand.exe 1 +subsys\system\hostname\hostname.exe 1 services\eventlog\eventlog.exe 1 services\rpcss\rpcss.exe 1 services\umpnpmgr\umpnpmgr.exe 1 _____
Modified: trunk/reactos/subsys/system/directory.xml --- trunk/reactos/subsys/system/directory.xml 2005-08-02 18:21:48 UTC (rev 16975) +++ trunk/reactos/subsys/system/directory.xml 2005-08-02 20:17:01 UTC (rev 16976) @@ -73,6 +73,9 @@
<directory name="winlogon"> <xi:include href="winlogon/winlogon.xml" /> </directory> +<directory name="hostname"> + <xi:include href="hostname/hostname.xml" /> +</directory> <directory name="welcome"> <xi:include href="welcome/welcome.xml" /> </directory> _____
Added: trunk/reactos/subsys/system/hostname/hostname.c --- trunk/reactos/subsys/system/hostname/hostname.c 2005-08-02 18:21:48 UTC (rev 16975) +++ trunk/reactos/subsys/system/hostname/hostname.c 2005-08-02 20:17:01 UTC (rev 16976) @@ -0,0 +1,58 @@
+/* + * ReactOS Win32 Applications + * Copyright (C) 2005 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * COPYRIGHT : See COPYING in the top level directory + * PROJECT : ReactOS/Win32 get host name + * FILE : subsys/system/hostname/hostname.c + * PROGRAMMER: Emanuele Aliberti (ea@reactos.com) + */ +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main (int argc, char ** argv) +{ + if (1 == argc) + { + TCHAR ComputerName [MAX_COMPUTERNAME_LENGTH + 1]; + DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0]; + + ZeroMemory (ComputerName, ComputerNameSize); + if (GetComputerName(ComputerName, & ComputerNameSize)) + { + printf ("%s\n", ComputerName); + return EXIT_SUCCESS; + } + fprintf (stderr, "%s: Win32 error %ld.\n", + argv[0], GetLastError()); + return EXIT_FAILURE; + }else{ + if (0 == strcmp(argv[1],"-s")) + { + fprintf(stderr,"%s: -s not supported.\n",argv[0]); + return EXIT_FAILURE; + }else{ + printf("Print the current host's name.\n\nhostname\n"); + } + } + return EXIT_SUCCESS; +} +/* EOF */ Property changes on: trunk/reactos/subsys/system/hostname/hostname.c ___________________________________________________________________ Name: svn:keywords + author id date revision Name: svn:eol-style + native _____
Added: trunk/reactos/subsys/system/hostname/hostname.rc --- trunk/reactos/subsys/system/hostname/hostname.rc 2005-08-02 18:21:48 UTC (rev 16975) +++ trunk/reactos/subsys/system/hostname/hostname.rc 2005-08-02 20:17:01 UTC (rev 16976) @@ -0,0 +1,4 @@
+#define REACTOS_STR_FILE_DESCRIPTION "Win32 Get local host name\0" +#define REACTOS_STR_INTERNAL_NAME "hostname\0" +#define REACTOS_STR_ORIGINAL_FILENAME "hostname.exe\0" +#include <reactos/version.rc> Property changes on: trunk/reactos/subsys/system/hostname/hostname.rc ___________________________________________________________________ Name: svn:keywords + author id date revision Name: svn:eol-style + native _____
Added: trunk/reactos/subsys/system/hostname/hostname.xml --- trunk/reactos/subsys/system/hostname/hostname.xml 2005-08-02 18:21:48 UTC (rev 16975) +++ trunk/reactos/subsys/system/hostname/hostname.xml 2005-08-02 20:17:01 UTC (rev 16976) @@ -0,0 +1,7 @@
+<module name="hostname" type="win32cui" installbase="system32" installname="hostname.exe" warnings="true"> + <define name="__USE_W32API" /> + <library>kernel32</library> + <file>hostname.c</file> + <file>hostname.rc</file> +</module> + Property changes on: trunk/reactos/subsys/system/hostname/hostname.xml ___________________________________________________________________ Name: svn:keywords + author id date revision Name: svn:eol-style + native