Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenhostname.cGo to the documentation of this file.00001 /* 00002 * ReactOS Win32 Applications 00003 * Copyright (C) 2005 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 /* $Id: hostname.c 43790 2009-10-27 10:34:16Z dgorbachev $ 00020 * 00021 * COPYRIGHT : See COPYING in the top level directory 00022 * PROJECT : ReactOS/Win32 get host name 00023 * FILE : subsys/system/hostname/hostname.c 00024 * PROGRAMMER: Emanuele Aliberti (ea@reactos.com) 00025 */ 00026 #include <windows.h> 00027 #include <stdio.h> 00028 #include <stdlib.h> 00029 #include <string.h> 00030 00031 int main (int argc, char ** argv) 00032 { 00033 if (1 == argc) 00034 { 00035 TCHAR ComputerName [MAX_COMPUTERNAME_LENGTH + 1]; 00036 DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0]; 00037 00038 ZeroMemory (ComputerName, sizeof ComputerName ); 00039 if (GetComputerName(ComputerName, & ComputerNameSize)) 00040 { 00041 printf ("%s\n", ComputerName); 00042 return EXIT_SUCCESS; 00043 } 00044 fprintf (stderr, "%s: Win32 error %ld.\n", 00045 argv[0], GetLastError()); 00046 return EXIT_FAILURE; 00047 }else{ 00048 if (0 == strcmp(argv[1],"-s")) 00049 { 00050 fprintf(stderr,"%s: -s not supported.\n",argv[0]); 00051 return EXIT_FAILURE; 00052 }else{ 00053 printf("Print the current host's name.\n\nhostname\n"); 00054 } 00055 } 00056 return EXIT_SUCCESS; 00057 } 00058 /* EOF */ Generated on Thu Feb 9 04:39:01 2012 for ReactOS by
1.6.3
|