--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">\r
+<project name="ReactOS" makefile="makefile.ppc" xmlns:xi="http://www.w3.org/2001/XInclude">\r
+ <xi:include href="config-ppc.rbuild">\r
+ <xi:fallback>\r
+ <xi:include href="config.template.rbuild" />\r
+ </xi:fallback>\r
+ </xi:include>\r
+\r
+ <xi:include href="baseaddress.rbuild" />\r
+\r
+ <property name="BOOTPROG_PREPARE" value="ppc-le2be" />\r
+ <property name="BOOTPROG_FLATFORMAT" value="-O elf32-powerpc -B powerpc:common" />\r
+ <property name="BOOTPROG_LINKFORMAT" value="-melf32ppc --no-omagic -Ttext 0xe00000 -Tdata 0xe10000" />\r
+ <property name="BOOTPROG_COPYFORMAT" value="--only-section=.text --only-section=.data --only-section=.bss -O aixcoff-rs6000" />\r
+\r
+ <define name="_M_PPC" />\r
+ <define name="_PPC_" />\r
+ <define name="__PowerPC__" />\r
+ <define name="_REACTOS_" />\r
+ <define name="__MINGW_IMPORT" empty="true" />\r
+ <define name="__restrict__" empty="true" />\r
+ <compilerflag>-v</compilerflag>\r
+ <if property="MP" value="1">\r
+ <define name="CONFIG_SMP" value="1" />\r
+ </if>\r
+ <if property="DBG" value="1">\r
+ <define name="DBG" value="1" />\r
+ <property name="DBG_OR_KDBG" value="true" />\r
+ </if>\r
+ <if property="DBG" value="0">\r
+ <compilerflag>-Os</compilerflag>\r
+ <compilerflag>-Wno-strict-aliasing</compilerflag>\r
+ </if>\r
+ <if property="KDBG" value="1">\r
+ <define name="KDBG" value="1" />\r
+ <property name="DBG_OR_KDBG" value="true" />\r
+ </if>\r
+ <compilerflag>-Wpointer-arith</compilerflag>\r
+\r
+ <include>.</include>\r
+ <include>include</include>\r
+ <include>include/reactos</include>\r
+ <include>include/libs</include>\r
+ <include>include/drivers</include>\r
+ <include>include/subsys</include>\r
+ <include>include/ndk</include>\r
+ <include>w32api/include</include>\r
+ <include>w32api/include/crt</include>\r
+ <include>w32api/include/ddk</include>\r
+\r
+ <directory name="apps">\r
+ <xi:include href="apps/directory.rbuild" />\r
+ </directory>\r
+ <directory name="boot">\r
+ <xi:include href="boot/boot.rbuild" />\r
+ </directory>\r
+ <directory name="drivers">\r
+ <xi:include href="drivers/directory.rbuild" />\r
+ </directory>\r
+ <directory name="hal">\r
+ <xi:include href="hal/directory.rbuild" />\r
+ </directory>\r
+ <directory name="include">\r
+ <xi:include href="include/directory.rbuild" />\r
+ </directory>\r
+ <directory name="lib">\r
+ <xi:include href="lib/directory.rbuild" />\r
+ </directory>\r
+ <directory name="media">\r
+ <xi:include href="media/directory.rbuild" />\r
+ </directory>\r
+ <directory name="modules">\r
+ <xi:include href="modules/directory.rbuild" />\r
+ </directory>\r
+ <directory name="ntoskrnl">\r
+ <xi:include href="ntoskrnl/ntoskrnl.rbuild" />\r
+ </directory>\r
+ <directory name="regtests">\r
+ <xi:include href="regtests/directory.rbuild" />\r
+ </directory>\r
+ <directory name="services">\r
+ <xi:include href="services/directory.rbuild" />\r
+ </directory>\r
+ <directory name="subsys">\r
+ <xi:include href="subsys/directory.rbuild" />\r
+ </directory>\r
+</project>\r
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
-<project name="ReactOS" makefile="makefile.ppc" xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="config-ppc.xml">
- <xi:fallback>
- <xi:include href="config.template.xml" />
- </xi:fallback>
- </xi:include>
-
- <xi:include href="baseaddress.xml" />
-
- <property name="BOOTPROG_PREPARE" value="ppc-le2be" />
- <property name="BOOTPROG_FLATFORMAT" value="-O elf32-powerpc -B powerpc:common" />
- <property name="BOOTPROG_LINKFORMAT" value="-melf32ppc --no-omagic -Ttext 0xe00000 -Tdata 0xe10000" />
- <property name="BOOTPROG_COPYFORMAT" value="--only-section=.text --only-section=.data --only-section=.bss -O aixcoff-rs6000" />
-
- <define name="_M_PPC" />
- <define name="_PPC_" />
- <define name="__PowerPC__" />
- <define name="_REACTOS_" />
- <define name="__MINGW_IMPORT" empty="true" />
- <define name="__restrict__" empty="true" />
- <compilerflag>-v</compilerflag>
- <if property="MP" value="1">
- <define name="CONFIG_SMP" value="1" />
- </if>
- <if property="DBG" value="1">
- <define name="DBG" value="1" />
- <property name="DBG_OR_KDBG" value="true" />
- </if>
- <if property="DBG" value="0">
- <compilerflag>-Os</compilerflag>
- <compilerflag>-Wno-strict-aliasing</compilerflag>
- </if>
- <if property="KDBG" value="1">
- <define name="KDBG" value="1" />
- <property name="DBG_OR_KDBG" value="true" />
- </if>
- <compilerflag>-Wpointer-arith</compilerflag>
-
- <include>.</include>
- <include>include</include>
- <include>include/reactos</include>
- <include>include/libs</include>
- <include>include/drivers</include>
- <include>include/subsys</include>
- <include>include/ndk</include>
- <include>w32api/include</include>
- <include>w32api/include/crt</include>
- <include>w32api/include/ddk</include>
-
- <directory name="apps">
- <xi:include href="apps/directory.xml" />
- </directory>
- <directory name="boot">
- <xi:include href="boot/boot.xml" />
- </directory>
- <directory name="bootdata">
- <xi:include href="bootdata/bootdata.xml" />
- </directory>
- <directory name="drivers">
- <xi:include href="drivers/directory.xml" />
- </directory>
- <directory name="hal">
- <xi:include href="hal/directory.xml" />
- </directory>
- <directory name="include">
- <xi:include href="include/directory.xml" />
- </directory>
- <directory name="lib">
- <xi:include href="lib/directory.xml" />
- </directory>
- <directory name="media">
- <xi:include href="media/directory.xml" />
- </directory>
- <directory name="modules">
- <xi:include href="modules/directory.xml" />
- </directory>
- <directory name="ntoskrnl">
- <xi:include href="ntoskrnl/ntoskrnl.xml" />
- </directory>
- <directory name="regtests">
- <xi:include href="regtests/directory.xml" />
- </directory>
- <directory name="services">
- <xi:include href="services/directory.xml" />
- </directory>
- <directory name="subsys">
- <xi:include href="subsys/directory.xml" />
- </directory>
-</project>
--- /dev/null
+<?xml version="1.0"?>\r
+<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">\r
+<project name="ReactOS" makefile="makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">\r
+ <xi:include href="config.rbuild">\r
+ <xi:fallback>\r
+ <xi:include href="config.template.rbuild" />\r
+ </xi:fallback>\r
+ </xi:include>\r
+\r
+ <xi:include href="baseaddress.rbuild" />\r
+\r
+ <define name="_M_IX86" />\r
+ <define name="_X86_" />\r
+ <define name="__i386__" />\r
+ <define name="_REACTOS_" />\r
+ <if property="MP" value="1">\r
+ <define name="CONFIG_SMP" value="1" />\r
+ </if>\r
+ <if property="DBG" value="1">\r
+ <define name="DBG" value="1" />\r
+ <property name="DBG_OR_KDBG" value="true" />\r
+ </if>\r
+ <if property="KDBG" value="1">\r
+ <define name="KDBG" value="1" />\r
+ <property name="DBG_OR_KDBG" value="true" />\r
+ </if>\r
+ <compilerflag>-Os</compilerflag>\r
+ <compilerflag>-Wno-strict-aliasing</compilerflag>\r
+ <compilerflag>-ftracer</compilerflag>\r
+ <compilerflag>-momit-leaf-frame-pointer</compilerflag>\r
+ <compilerflag>-mpreferred-stack-boundary=2</compilerflag>\r
+ <compilerflag>-Wpointer-arith</compilerflag>\r
+\r
+ <include>.</include>\r
+ <include>include</include>\r
+ <include>include/reactos</include>\r
+ <include>include/libs</include>\r
+ <include>include/drivers</include>\r
+ <include>include/subsys</include>\r
+ <include>include/ndk</include>\r
+ <include>w32api/include</include>\r
+ <include>w32api/include/crt</include>\r
+ <include>w32api/include/ddk</include>\r
+\r
+<!-- TODO\r
+ <directory name="apps">\r
+ <xi:include href="apps/directory.rbuild" />\r
+ </directory>\r
+ <directory name="boot">\r
+ <xi:include href="boot/boot.rbuild" />\r
+ </directory>\r
+-->\r
+ <directory name="boot">\r
+ <xi:include href="boot/boot.rbuild" />\r
+ </directory>\r
+ <directory name="base">\r
+ <xi:include href="base/base.rbuild" />\r
+ </directory>\r
+<!-- TODO\r
+ <directory name="dll">\r
+ <xi:include href="dll/dll.rbuild" />\r
+ </directory>\r
+ <directory name="drivers">\r
+ <xi:include href="drivers/directory.rbuild" />\r
+ </directory>\r
+ <directory name="hal">\r
+ <xi:include href="hal/directory.rbuild" />\r
+ </directory>\r
+ <directory name="include">\r
+ <xi:include href="include/directory.rbuild" />\r
+ </directory>\r
+-->\r
+ <directory name="lib">\r
+ <xi:include href="lib/directory.rbuild" />\r
+ </directory>\r
+ <directory name="media">\r
+ <xi:include href="media/media.rbuild" />\r
+ </directory>\r
+<!-- TODO\r
+ <directory name="modules">\r
+ <xi:include href="modules/directory.rbuild" />\r
+ </directory>\r
+ <directory name="ntoskrnl">\r
+ <xi:include href="ntoskrnl/ntoskrnl.rbuild" />\r
+ </directory>\r
+ <directory name="regtests">\r
+ <xi:include href="regtests/directory.rbuild" />\r
+ </directory>\r
+-->\r
+ <directory name="subsystems">\r
+ <xi:include href="subsystems/subsystems.rbuild" />\r
+ </directory>\r
+\r
+</project>\r
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
-<project name="ReactOS" makefile="makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="config.xml">
- <xi:fallback>
- <xi:include href="config.template.xml" />
- </xi:fallback>
- </xi:include>
-
- <xi:include href="baseaddress.xml" />
-
- <define name="_M_IX86" />
- <define name="_X86_" />
- <define name="__i386__" />
- <define name="_REACTOS_" />
- <if property="MP" value="1">
- <define name="CONFIG_SMP" value="1" />
- </if>
- <if property="DBG" value="1">
- <define name="DBG" value="1" />
- <property name="DBG_OR_KDBG" value="true" />
- </if>
- <if property="KDBG" value="1">
- <define name="KDBG" value="1" />
- <property name="DBG_OR_KDBG" value="true" />
- </if>
- <compilerflag>-Os</compilerflag>
- <compilerflag>-Wno-strict-aliasing</compilerflag>
- <compilerflag>-ftracer</compilerflag>
- <compilerflag>-momit-leaf-frame-pointer</compilerflag>
- <compilerflag>-mpreferred-stack-boundary=2</compilerflag>
- <compilerflag>-Wpointer-arith</compilerflag>
-
- <include>.</include>
- <include>include</include>
- <include>include/reactos</include>
- <include>include/libs</include>
- <include>include/drivers</include>
- <include>include/subsys</include>
- <include>include/ndk</include>
- <include>w32api/include</include>
- <include>w32api/include/crt</include>
- <include>w32api/include/ddk</include>
-
- <directory name="apps">
- <xi:include href="apps/directory.xml" />
- </directory>
- <directory name="boot">
- <xi:include href="boot/boot.xml" />
- </directory>
- <directory name="bootdata">
- <xi:include href="bootdata/bootdata.xml" />
- </directory>
- <directory name="drivers">
- <xi:include href="drivers/directory.xml" />
- </directory>
- <directory name="hal">
- <xi:include href="hal/directory.xml" />
- </directory>
- <directory name="include">
- <xi:include href="include/directory.xml" />
- </directory>
- <directory name="lib">
- <xi:include href="lib/directory.xml" />
- </directory>
- <directory name="media">
- <xi:include href="media/directory.xml" />
- </directory>
- <directory name="modules">
- <xi:include href="modules/directory.xml" />
- </directory>
- <directory name="ntoskrnl">
- <xi:include href="ntoskrnl/ntoskrnl.xml" />
- </directory>
- <directory name="regtests">
- <xi:include href="regtests/directory.xml" />
- </directory>
- <directory name="services">
- <xi:include href="services/directory.xml" />
- </directory>
- <directory name="subsys">
- <xi:include href="subsys/directory.xml" />
- </directory>
-</project>
+++ /dev/null
-/*
- * PROJECT: ReactOS utilities
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/getfirefox/En.rc
- * PURPOSE: English resources
- * COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers
- * Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- */
-/*
- * Based on Wine dlls/shdocvw/En.rc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
-
-IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76
-STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Lade Firefox herunter"
-FONT 8, "MS Shell Dlg"
-{
- CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
- LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
- CHECKBOX "Entferne ""Get Firefox"" nach Fertigstellung aus dem Startmenü", IDC_REMOVE,
- 10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
-}
-
-STRINGTABLE
-BEGIN
- IDS_START_MENU_NAME "Get Firefox"
-END
+++ /dev/null
-/*
- * PROJECT: ReactOS utilities
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/getfirefox/En.rc
- * PURPOSE: English resources
- * COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers
- * Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- */
-/*
- * Based on Wine dlls/shdocvw/En.rc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
-
-IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76
-STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Downloading Firefox"
-FONT 8, "MS Shell Dlg"
-{
- CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12
- LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER
- CHECKBOX "Remove ""Get Firefox"" from Start Menu when done", IDC_REMOVE,
- 10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Cancel", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP
-}
-
-STRINGTABLE
-BEGIN
- IDS_START_MENU_NAME "Get Firefox"
-END
+++ /dev/null
-/*\r
- * PROJECT: ReactOS utilities\r
- * LICENSE: GPL - See COPYING in the top level directory\r
- * FILE: apps/utils/getfirefox/En.rc\r
- * PURPOSE: French resources\r
- * COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers\r
- * Copyright 2005 Ge van Geldorp (gvg@reactos.org)\r
- * Copyright 2005 G. Maton (mustang9@gmail.com) - French translation\r
- */\r
-/*\r
- * Based on Wine dlls/shdocvw/En.rc\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT\r
-\r
-IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76\r
-STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
-CAPTION "Téléchargement de Firefox"\r
-FONT 8, "MS Shell Dlg"\r
-{\r
- CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12\r
- LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER\r
- CHECKBOX "Supprimer ""Obtenir Firefox"" du Menu démarrer une fois terminé", IDC_REMOVE,\r
- 10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP\r
- PUSHBUTTON "Annuler", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP\r
-}\r
-\r
-STRINGTABLE\r
-BEGIN\r
- IDS_START_MENU_NAME "Obtenir Firefox"\r
-END\r
+++ /dev/null
-/*\r
- * PROJECT: ReactOS utilities\r
- * LICENSE: GPL - See COPYING in the top level directory\r
- * FILE: apps/utils/getfirefox/En.rc\r
- * PURPOSE: English resources\r
- * COPYRIGHT: Copyright 2004 Mike McCormack for CodeWeavers\r
- * Copyright 2005 Ge van Geldorp (gvg@reactos.org)\r
- * Copyright 2005 Robert Horvath (talley@cubeclub.hu) - Hungarian translation\r
- */\r
-/*\r
- * Based on Wine dlls/shdocvw/En.rc\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- */\r
-\r
-LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL\r
-\r
-IDD_GETFIREFOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76\r
-STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
-CAPTION "A Firefox letöltése"\r
-FONT 8, "MS Shell Dlg"\r
-{\r
- CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER|PBS_SMOOTH,10,10,200,12\r
- LTEXT "", IDC_STATUS, 10, 30, 200, 10, SS_CENTER\r
- CHECKBOX "A ""Szerezd meg a Firefoxot"" elvátolÃtása a Start Menübõl befejezés után", IDC_REMOVE,\r
- 10, 44, 200, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP\r
- PUSHBUTTON "Mégse", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP\r
-}\r
-\r
-STRINGTABLE\r
-BEGIN\r
- IDS_START_MENU_NAME "Szerezd meg Firefoxot"\r
-END\r
+++ /dev/null
-/*
- * PROJECT: ReactOS utilities
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/getfirefox/getfirefox.c
- * PURPOSE: Main program
- * COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers)
- * Copyright 2004 Mike McCormack (for CodeWeavers)
- * Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- */
-/*
- * Based on Wine dlls/shdocvw/shdocvw_main.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include <precomp.h>
-
-#define NDEBUG
-#include <debug.h>
-
-#define DOWNLOAD_URL L"http://links.reactos.org/getfirefox"
-
-typedef struct _IBindStatusCallbackImpl
- {
- const IBindStatusCallbackVtbl *vtbl;
- LONG ref;
- HWND hDialog;
- BOOL *pbCancelled;
- } IBindStatusCallbackImpl;
-
-static HRESULT WINAPI
-dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject)
-{
- if (NULL == ppvObject)
- {
- return E_POINTER;
- }
-
- if (IsEqualIID(riid, &IID_IUnknown) ||
- IsEqualIID(riid, &IID_IBindStatusCallback))
- {
- IBindStatusCallback_AddRef( This );
- *ppvObject = This;
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI
-dlAddRef(IBindStatusCallback* iface)
-{
- IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
-
- return InterlockedIncrement(&This->ref);
-}
-
-static ULONG WINAPI
-dlRelease(IBindStatusCallback* iface)
-{
- IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
- DWORD ref = InterlockedDecrement(&This->ref);
-
- if( !ref )
- {
- DestroyWindow( This->hDialog );
- HeapFree(GetProcessHeap(), 0, This);
- }
-
- return ref;
-}
-
-static HRESULT WINAPI
-dlOnStartBinding(IBindStatusCallback* iface, DWORD dwReserved, IBinding* pib)
-{
- DPRINT1("OnStartBinding not implemented\n");
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlGetPriority(IBindStatusCallback* iface, LONG* pnPriority)
-{
- DPRINT1("GetPriority not implemented\n");
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlOnLowResource( IBindStatusCallback* iface, DWORD reserved)
-{
- DPRINT1("OnLowResource not implemented\n");
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlOnProgress(IBindStatusCallback* iface, ULONG ulProgress,
- ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
-{
- IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
- HWND Item;
- LONG r;
- WCHAR OldText[100];
-
- Item = GetDlgItem(This->hDialog, IDC_PROGRESS);
- if (NULL != Item && 0 != ulProgressMax)
- {
- SendMessageW(Item, PBM_SETPOS, (ulProgress * 100) / ulProgressMax, 0);
- }
-
- Item = GetDlgItem(This->hDialog, IDC_STATUS);
- if (NULL != Item)
- {
- SendMessageW(Item, WM_GETTEXT, sizeof(OldText) / sizeof(OldText[0]),
- (LPARAM) OldText);
- if (sizeof(OldText) / sizeof(OldText[0]) - 1 <= wcslen(OldText) ||
- 0 != wcscmp(OldText, szStatusText))
- {
- SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) szStatusText);
- }
- }
-
- SetLastError(0);
- r = GetWindowLongPtrW(This->hDialog, GWLP_USERDATA);
- if (0 != r || 0 != GetLastError())
- {
- *This->pbCancelled = TRUE;
- DPRINT("Cancelled\n");
- return E_ABORT;
- }
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlOnStopBinding(IBindStatusCallback* iface, HRESULT hresult, LPCWSTR szError)
-{
- DPRINT1("OnStopBinding not implemented\n");
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlGetBindInfo(IBindStatusCallback* iface, DWORD* grfBINDF, BINDINFO* pbindinfo)
-{
- DPRINT1("GetBindInfo not implemented\n");
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlOnDataAvailable(IBindStatusCallback* iface, DWORD grfBSCF,
- DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
-{
- DPRINT1("OnDataAvailable implemented\n");
-
- return S_OK;
-}
-
-static HRESULT WINAPI
-dlOnObjectAvailable(IBindStatusCallback* iface, REFIID riid, IUnknown* punk)
-{
- DPRINT1("OnObjectAvailable implemented\n");
-
- return S_OK;
-}
-
-static const IBindStatusCallbackVtbl dlVtbl =
-{
- dlQueryInterface,
- dlAddRef,
- dlRelease,
- dlOnStartBinding,
- dlGetPriority,
- dlOnLowResource,
- dlOnProgress,
- dlOnStopBinding,
- dlGetBindInfo,
- dlOnDataAvailable,
- dlOnObjectAvailable
-};
-
-static IBindStatusCallback*
-CreateDl(HWND Dlg, BOOL *pbCancelled)
-{
- IBindStatusCallbackImpl *This;
-
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(IBindStatusCallbackImpl));
- This->vtbl = &dlVtbl;
- This->ref = 1;
- This->hDialog = Dlg;
- This->pbCancelled = pbCancelled;
-
- return (IBindStatusCallback*) This;
-}
-
-static BOOL
-GetShortcutName(LPWSTR ShortcutName)
-{
- if (! SHGetSpecialFolderPathW(0, ShortcutName, CSIDL_PROGRAMS, FALSE))
- {
- return FALSE;
- }
- if (NULL == PathAddBackslashW(ShortcutName))
- {
- return FALSE;
- }
- if (0 == LoadStringW(GetModuleHandle(NULL), IDS_START_MENU_NAME,
- ShortcutName + wcslen(ShortcutName),
- MAX_PATH - wcslen(ShortcutName)))
- {
- return FALSE;
- }
- if (MAX_PATH - 5 < wcslen(ShortcutName))
- {
- return FALSE;
- }
- wcscat(ShortcutName, L".lnk");
-
- return TRUE;
-}
-
-static DWORD WINAPI
-ThreadFunc(LPVOID Context)
-{
- static const WCHAR szUrl[] = DOWNLOAD_URL;
- IBindStatusCallback *dl;
- WCHAR path[MAX_PATH], ShortcutName[MAX_PATH];
- LPWSTR p;
- STARTUPINFOW si;
- PROCESS_INFORMATION pi;
- HWND Dlg = (HWND) Context;
- DWORD r;
- BOOL bCancelled = FALSE;
- BOOL bTempfile = FALSE;
-
- /* built the path for the download */
- p = wcsrchr(szUrl, L'/');
- if (NULL == p)
- {
- goto end;
- }
- if (! GetTempPathW(MAX_PATH, path))
- {
- goto end;
- }
- wcscat(path, p + 1);
-
- /* download it */
- bTempfile = TRUE;
- dl = CreateDl(Context, &bCancelled);
- r = URLDownloadToFileW(NULL, szUrl, path, 0, dl);
- if (NULL != dl)
- {
- IBindStatusCallback_Release(dl);
- }
- if (S_OK != r || bCancelled )
- {
- goto end;
- }
- ShowWindow(Dlg, SW_HIDE);
-
- /* run it */
- memset(&si, 0, sizeof(si));
- si.cb = sizeof(si);
- r = CreateProcessW(path, NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi);
- if (0 == r)
- {
- goto end;
- }
- CloseHandle(pi.hThread);
- WaitForSingleObject(pi.hProcess, INFINITE);
- CloseHandle(pi.hProcess);
-
- if (BST_CHECKED == SendMessageW(GetDlgItem(Dlg, IDC_REMOVE), BM_GETCHECK,
- 0, 0) &&
- GetShortcutName(ShortcutName))
- {
- DeleteFileW(ShortcutName);
- }
-
-end:
- if (bTempfile)
- {
- DeleteFileW(path);
- }
- EndDialog(Dlg, 0);
- return 0;
-}
-
-static INT_PTR CALLBACK
-dlProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
- HANDLE Thread;
- DWORD ThreadId;
- HWND Item;
- HICON Icon;
- WCHAR ShortcutName[MAX_PATH];
-
- switch (Msg)
- {
- case WM_INITDIALOG:
- Icon = LoadIconW((HINSTANCE) GetWindowLongPtr(Dlg, GWLP_HINSTANCE),
- MAKEINTRESOURCEW(IDI_ICON_MAIN));
- if (NULL != Icon)
- {
- SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) Icon);
- SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) Icon);
- }
- SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0);
- Item = GetDlgItem(Dlg, IDC_PROGRESS);
- if (NULL != Item)
- {
- SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0,100));
- SendMessageW(Item, PBM_SETPOS, 0, 0);
- }
- Item = GetDlgItem(Dlg, IDC_REMOVE);
- if (NULL != Item)
- {
- if (GetShortcutName(ShortcutName) &&
- INVALID_FILE_ATTRIBUTES != GetFileAttributesW(ShortcutName))
- {
- SendMessageW(Item, BM_SETCHECK, BST_CHECKED, 0);
- }
- else
- {
- SendMessageW(Item, BM_SETCHECK, BST_UNCHECKED, 0);
- ShowWindow(Item, SW_HIDE);
- }
- }
- Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
- if (NULL == Thread)
- {
- return FALSE;
- }
- CloseHandle(Thread);
- return TRUE;
-
- case WM_COMMAND:
- if (wParam == IDCANCEL)
- {
- SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1);
- PostMessage(Dlg, WM_CLOSE, 0, 0);
- }
- return FALSE;
-
- case WM_CLOSE:
- EndDialog(Dlg, 0);
- return TRUE;
-
- default:
- return FALSE;
- }
-}
-
-
-/***********************************************************************
- * Main program
- */
-int
-main(int argc, char *argv[])
-{
- InitCommonControls();
-
- DialogBoxW(GetModuleHandle(NULL), MAKEINTRESOURCEW(IDD_GETFIREFOX), 0,
- dlProc);
-
- return 0;
-}
+++ /dev/null
-/*
- * PROJECT: ReactOS utilities
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/getfirefox/getfirefox.rc
- * PURPOSE: Language-independent resources
- * COPYRIGHT: Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- */
-
-#include <windows.h>
-#include "resource.h"
-
-#define REACTOS_STR_FILE_DESCRIPTION "Firefox downloader\0"
-#define REACTOS_STR_INTERNAL_NAME "getfirefox\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "getfirefox.exe\0"
-#include <reactos/version.rc>
-
-/*
- * Note: this icon is the "default logo" referenced here:
- * http://www.mozilla.org/foundation/trademarks/faq.html (under "What are the
- * Mozilla Trademarks and Logos?"). Don't use the official Firefox logo as it
- * is trademarked.
- */
-1 ICON "firefox.ico"
-
-#include "De.rc"
-#include "En.rc"
-#include "Fr.rc"
-#include "Hu.rc"
+++ /dev/null
-<module name="getfirefox" type="win32gui" installbase="system32" installname="getfirefox.exe">
- <include base="getfirefox">.</include>
- <define name="UNICODE" />
- <define name="_UNICODE" />
- <define name="__USE_W32API" />
- <define name="WINVER">0x0501</define>
- <define name="_WIN32_IE>0x0600</define>
- <library>comctl32</library>
- <library>ntdll</library>
- <library>shell32</library>
- <library>shlwapi</library>
- <library>urlmon</library>
- <library>uuid</library>
- <pch>precomp.h</pch>
- <file>getfirefox.c</file>
- <file>getfirefox.rc</file>
-</module>
+++ /dev/null
-/*
- * PROJECT: ReactOS utilities
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/getfirefox/precomp.h
- * PURPOSE: Precompiled header file
- * COPYRIGHT: Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- */
-
-#define COBJMACROS
-#define NTOS_MODE_USER
-#define WIN32_NO_STATUS
-#include <windows.h>
-#include <ndk/ntndk.h>
-#include <commctrl.h>
-#include <shlobj.h>
-#include <shlwapi.h>
-#include <urlmon.h>
-
-#include "resource.h"
+++ /dev/null
-/*
- * PROJECT: ReactOS utilities
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: apps/utils/getfirefox/resource.h
- * PURPOSE: Resource constants
- * COPYRIGHT: Copyright 2005 Ge van Geldorp (gvg@reactos.org)
- */
-
-#define IDI_ICON_MAIN 1
-
-#define IDD_GETFIREFOX 100
-
-#define IDC_PROGRESS 1000
-#define IDC_STATUS 1001
-#define IDC_REMOVE 1002
-
-#define IDS_START_MENU_NAME 1100
+++ /dev/null
-/*
- * 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.
- */
-
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS arp utility
- * FILE: apps/utils/net/arp/arp.c
- * PURPOSE: view and manipulate the ARP cache
- * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
- * REVISIONS:
- * GM 27/06/05 Created
- *
- */
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <tchar.h>
-#include <string.h>
-#include <ctype.h>
-#include <winsock2.h>
-#include <iphlpapi.h>
-
-#define UNICODE
-#define _UNICODE
-
-/*
- * Globals
- */
-const char SEPERATOR = '-';
-int _CRT_glob = 0; // stop * from listing dir files in arp -d *
-
-
-/*
- * function declerations
- */
-DWORD DoFormatMessage(VOID);
-INT PrintEntries(PMIB_IPNETROW pIpAddRow);
-INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr);
-INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr);
-INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr);
-VOID Usage(VOID);
-
-
-/*
- * convert error code into meaningful message
- */
-DWORD DoFormatMessage(VOID)
-{
- LPVOID lpMsgBuf;
- DWORD RetVal;
-
- DWORD ErrorCode = GetLastError();
-
- if (ErrorCode != ERROR_SUCCESS)
- {
- RetVal = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- ErrorCode,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
- (LPTSTR) &lpMsgBuf,
- 0,
- NULL );
-
- if (RetVal != 0)
- {
- _tprintf(_T("%s"), (LPTSTR)lpMsgBuf);
-
- LocalFree(lpMsgBuf);
- /* return number of TCHAR's stored in output buffer
- * excluding '\0' - as FormatMessage does*/
- return RetVal;
- }
- }
- return 0;
-}
-
-
-
-/*
- *
- * Takes an ARP entry and prints the IP address,
- * the MAC address and the entry type to screen
- *
- */
-INT PrintEntries(PMIB_IPNETROW pIpAddRow)
-{
- IN_ADDR inaddr;
- TCHAR cMacAddr[20];
-
- /* print IP addresses */
- inaddr.S_un.S_addr = pIpAddRow->dwAddr;
- _tprintf(_T(" %-22s"), inet_ntoa(inaddr));
-
- /* print MAC address */
- _stprintf(cMacAddr, _T("%02x-%02x-%02x-%02x-%02x-%02x"),
- pIpAddRow->bPhysAddr[0],
- pIpAddRow->bPhysAddr[1],
- pIpAddRow->bPhysAddr[2],
- pIpAddRow->bPhysAddr[3],
- pIpAddRow->bPhysAddr[4],
- pIpAddRow->bPhysAddr[5]);
- _tprintf(_T("%-22s"), cMacAddr);
-
- /* print cache type */
- switch (pIpAddRow->dwType)
- {
- case MIB_IPNET_TYPE_DYNAMIC : _tprintf(_T("dynamic\n"));
- break;
- case MIB_IPNET_TYPE_STATIC : _tprintf(_T("static\n"));
- break;
- case MIB_IPNET_TYPE_INVALID : _tprintf(_T("invalid\n"));
- break;
- case MIB_IPNET_TYPE_OTHER : _tprintf(_T("other\n"));
- break;
- }
- return EXIT_SUCCESS;
-}
-
-
-/*
- *
- * Takes optional parameters of an internet address and interface address.
- * Retrieve all entries in the ARP cache. If an internet address is
- * specified, display the ARP entry relating to that address. If an
- * interface address is specified, display all entries relating to
- * that interface.
- *
- */
-/* FIXME: allow user to specify an interface address, via pszIfAddr */
-INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
-{
- INT iRet;
- UINT i, k;
- PMIB_IPNETTABLE pIpNetTable = NULL;
- PMIB_IPADDRTABLE pIpAddrTable = NULL;
- DWORD Size = 0;
- struct in_addr inaddr, inaddr2;
- PTCHAR pszIpAddr;
- TCHAR szIntIpAddr[20];
-
- /* retrieve the IP-to-physical address mapping table */
-
- /* get table size */
- GetIpNetTable(pIpNetTable, &Size, 0);
-
- /* allocate memory for ARP address table */
- pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
- if (pIpNetTable == NULL)
- goto cleanup;
-
- ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
-
- iRet = GetIpNetTable(pIpNetTable, &Size, TRUE);
-
- if (iRet != NO_ERROR)
- {
- _tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
- DoFormatMessage();
- goto cleanup;
- }
-
- /* check there are entries in the table */
- if (pIpNetTable->dwNumEntries == 0)
- {
- _tprintf(_T("No ARP entires found\n"));
- goto cleanup;
- }
-
-
-
- /* Retrieve the interface-to-ip address mapping
- * table to get the IP address for adapter */
-
- /* get table size */
- Size = 0;
- GetIpAddrTable(pIpAddrTable, &Size, 0);
-
- pIpAddrTable = (MIB_IPADDRTABLE *) HeapAlloc(GetProcessHeap(), 0, Size);
- if (pIpAddrTable == NULL)
- goto cleanup;
-
- ZeroMemory(pIpAddrTable, sizeof(*pIpAddrTable));
-
- iRet = GetIpAddrTable(pIpAddrTable, &Size, TRUE);
-
- if (iRet != NO_ERROR)
- {
- _tprintf(_T("GetIpAddrTable failed: %d\n"), iRet);
- DoFormatMessage();
- goto cleanup;
- }
-
-
- for (k=0; k < pIpAddrTable->dwNumEntries; k++)
- {
- if (pIpNetTable->table[0].dwIndex == pIpAddrTable->table[k].dwIndex)
- {
- //printf("debug print: pIpAddrTable->table[?].dwIndex = %lx\n", pIpNetTable->table[k].dwIndex);
- inaddr2.s_addr = pIpAddrTable->table[k].dwAddr;
- pszIpAddr = inet_ntoa(inaddr2);
- strcpy(szIntIpAddr, pszIpAddr);
- }
- }
-
-
- /* print header, including interface IP address and index number */
- _tprintf(_T("\nInterface: %s --- 0x%lx \n"), szIntIpAddr, pIpNetTable->table[0].dwIndex);
- _tprintf(_T(" Internet Address Physical Address Type\n"));
-
- /* go through all ARP entries */
- for (i=0; i < pIpNetTable->dwNumEntries; i++)
- {
-
- /* if the user has supplied their own internet addesss *
- * only print the arp entry which matches that */
- if (pszInetAddr)
- {
- inaddr.S_un.S_addr = pIpNetTable->table[i].dwAddr;
- pszIpAddr = inet_ntoa(inaddr);
-
- /* check if it matches, print it */
- if (strcmp(pszIpAddr, pszInetAddr) == 0)
- PrintEntries(&pIpNetTable->table[i]);
- }
- else
- /* if an address is not supplied, print all entries */
- PrintEntries(&pIpNetTable->table[i]);
- }
-
- return EXIT_SUCCESS;
-
-cleanup:
- if (pIpNetTable != NULL)
- HeapFree(GetProcessHeap(), 0, pIpNetTable);
- if (pIpAddrTable != NULL)
- HeapFree(GetProcessHeap(), 0, pIpAddrTable);
- return EXIT_FAILURE;
-}
-
-
-/*
- *
- * Takes an internet address, a MAC address and an optional interface
- * address as arguments and checks their validity.
- * Fill out an MIB_IPNETROW structure and insert the data into the
- * ARP cache as a static entry.
- *
- */
-INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr)
-{
- PMIB_IPNETROW pAddHost = NULL;
- PMIB_IPNETTABLE pIpNetTable = NULL;
- DWORD dwIpAddr = 0;
- ULONG Size = 0;
- INT iRet, i, val, c;
-
- /* error checking */
-
- /* check IP address */
- if (pszInetAddr != NULL)
- {
- if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE)
- {
- _tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
- return EXIT_FAILURE;
- }
- }
- else
- {
- Usage();
- return EXIT_FAILURE;
- }
-
- /* check MAC address */
- if (strlen(pszEthAddr) != 17)
- {
- _tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
- return EXIT_FAILURE;
- }
- for (i=0; i<17; i++)
- {
- if (pszEthAddr[i] == SEPERATOR)
- continue;
-
- if (!isxdigit(pszEthAddr[i]))
- {
- _tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr);
- return EXIT_FAILURE;
- }
- }
-
- /* We need the IpNetTable to get the adapter index */
- /* Return required buffer size */
- GetIpNetTable(pIpNetTable, &Size, 0);
-
- /* allocate memory for ARP address table */
- pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
- if (pIpNetTable == NULL)
- goto cleanup;
-
- ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
-
- iRet = GetIpNetTable(pIpNetTable, &Size, TRUE);
-
- if (iRet != NO_ERROR)
- {
- _tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
- DoFormatMessage();
- goto cleanup;
- }
-
-
- /* reserve memory on heap and zero */
- pAddHost = (MIB_IPNETROW *) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_IPNETROW));
- if (pAddHost == NULL)
- goto cleanup;
-
- ZeroMemory(pAddHost, sizeof(MIB_IPNETROW));
-
- /* set dwIndex field to the index of a local IP address to
- * indicate the network on which the ARP entry applies */
- if (pszIfAddr)
- {
- if (sscanf(pszIfAddr, "%lx", &pAddHost->dwIndex) == EOF)
- {
- goto cleanup;
- }
- }
- else
- {
- //printf("debug print: pIpNetTable->table[0].dwIndex = %lx\n", pIpNetTable->table[0].dwIndex);
- /* needs testing. I get the correct index on my machine, but need others
- * to test their card index. Any problems and we can use GetAdaptersInfo instead */
- pAddHost->dwIndex = pIpNetTable->table[0].dwIndex;
- }
-
- /* Set MAC address to 6 bytes (typical) */
- pAddHost->dwPhysAddrLen = 6;
-
-
- /* Encode bPhysAddr into correct byte array */
- for (i=0; i<6; i++)
- {
- val =0;
- c = toupper(pszEthAddr[i*3]);
- c = c - (isdigit(c) ? '0' : ('A' - 10));
- val += c;
- val = (val << 4);
- c = toupper(pszEthAddr[i*3 + 1]);
- c = c - (isdigit(c) ? '0' : ('A' - 10));
- val += c;
- pAddHost->bPhysAddr[i] = (BYTE)val;
- }
-
-
- /* copy converted IP address */
- pAddHost->dwAddr = dwIpAddr;
-
-
- /* set type to static */
- pAddHost->dwType = MIB_IPNET_TYPE_STATIC;
-
-
- /* Add the ARP entry */
- if ((iRet = SetIpNetEntry(pAddHost)) != NO_ERROR)
- {
- DoFormatMessage();
- goto cleanup;
- }
-
- HeapFree(GetProcessHeap(), 0, pAddHost);
-
- return EXIT_SUCCESS;
-
-cleanup:
- if (pIpNetTable != NULL)
- HeapFree(GetProcessHeap(), 0, pIpNetTable);
- if (pAddHost != NULL)
- HeapFree(GetProcessHeap(), 0, pAddHost);
- return EXIT_FAILURE;
-}
-
-
-/*
- *
- * Takes an internet address and an optional interface address as
- * arguments and checks their validity.
- * Add the interface number and IP to an MIB_IPNETROW structure
- * and remove the entry from the ARP cache.
- *
- */
-INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
-{
- PMIB_IPNETROW pDelHost = NULL;
- PMIB_IPNETTABLE pIpNetTable = NULL;
- DWORD Size = 0;
- DWORD dwIpAddr = 0;
- INT iRet;
- BOOL bFlushTable = FALSE;
-
- /* error checking */
-
- /* check IP address */
- if (pszInetAddr != NULL)
- {
- /* if wildcard is given, set flag to delete all hosts */
- if (strncmp(pszInetAddr, "*", 1) == 0)
- bFlushTable = TRUE;
- else if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE)
- {
- _tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr);
- exit(EXIT_FAILURE);
- }
- }
- else
- {
- Usage();
- exit(EXIT_FAILURE);
- }
-
- /* We need the IpNetTable to get the adapter index */
- /* Return required buffer size */
- GetIpNetTable(NULL, &Size, 0);
-
- /* allocate memory for ARP address table */
- pIpNetTable = (PMIB_IPNETTABLE) HeapAlloc(GetProcessHeap(), 0, Size);
- if (pIpNetTable == NULL)
- goto cleanup;
-
- ZeroMemory(pIpNetTable, sizeof(*pIpNetTable));
-
- iRet = GetIpNetTable(pIpNetTable, &Size, TRUE);
-
- if (iRet != NO_ERROR)
- {
- _tprintf(_T("failed to allocate memory for GetIpNetTable\n"));
- DoFormatMessage();
- goto cleanup;
- }
-
- /* reserve memory on heap and zero */
- pDelHost = (MIB_IPNETROW *) HeapAlloc(GetProcessHeap(), 0, sizeof(MIB_IPNETROW));
- if (pDelHost == NULL)
- goto cleanup;
-
- ZeroMemory(pDelHost, sizeof(MIB_IPNETROW));
-
-
- /* set dwIndex field to the index of a local IP address to
- * indicate the network on which the ARP entry applies */
- if (pszIfAddr)
- {
- if (sscanf(pszIfAddr, "%lx", &pDelHost->dwIndex) == EOF)
- {
- goto cleanup;
- }
- }
- else
- {
- /* needs testing. I get the correct index on my machine, but need others
- * to test their card index. Any problems and we can use GetAdaptersInfo instead */
- pDelHost->dwIndex = pIpNetTable->table[0].dwIndex;
- }
-
- if (bFlushTable == TRUE)
- {
- /* delete arp cache */
- if ((iRet = FlushIpNetTable(pDelHost->dwIndex)) != NO_ERROR)
- {
- DoFormatMessage();
- goto cleanup;
- }
- else
- {
- HeapFree(GetProcessHeap(), 0, pDelHost);
- return EXIT_SUCCESS;
- }
- }
- else
- /* copy converted IP address */
- pDelHost->dwAddr = dwIpAddr;
-
- /* Add the ARP entry */
- if ((iRet = DeleteIpNetEntry(pDelHost)) != NO_ERROR)
- {
- DoFormatMessage();
- goto cleanup;
- }
-
- HeapFree(GetProcessHeap(), 0, pDelHost);
-
- return EXIT_SUCCESS;
-
-cleanup:
- if (pIpNetTable != NULL)
- HeapFree(GetProcessHeap(), 0, pIpNetTable);
- if (pDelHost != NULL)
- HeapFree(GetProcessHeap(), 0, pDelHost);
- return EXIT_FAILURE;
-}
-
-
-
-/*
- *
- * print program usage to screen
- *
- */
-VOID Usage(VOID)
-{
- _tprintf(_T("\nDisplays and modifies the IP-to-Physical address translation tables used by\n"
- "address resolution protocol (ARP).\n"
- "\n"
- "ARP -s inet_addr eth_addr [if_addr]\n"
- "ARP -d inet_addr [if_addr]\n"
- "ARP -a [inet_addr] [-N if_addr]\n"
- "\n"
- " -a Displays current ARP entries by interrogating the current\n"
- " protocol data. If inet_addr is specified, the IP and Physical\n"
- " addresses for only the specified computer are displayed. If\n"
- " more than one network interface uses ARP, entries for each ARP\n"
- " table are displayed.\n"
- " -g Same as -a.\n"
- " inet_addr Specifies an internet address.\n"
- " -N if_addr Displays the ARP entries for the network interface specified\n"
- " by if_addr.\n"
- " -d Deletes the host specified by inet_addr. inet_addr may be\n"
- " wildcarded with * to delete all hosts.\n"
- " -s Adds the host and associates the Internet address inet_addr\n"
- " with the Physical address eth_addr. The Physical address is\n"
- " given as 6 hexadecimal bytes separated by hyphens. The entry\n"
- " is permanent.\n"
- " eth_addr Specifies a physical address.\n"
- " if_addr If present, this specifies the Internet address of the\n"
- " interface whose address translation table should be modified.\n"
- " If not present, the first applicable interface will be used.\n"
- "Example:\n"
- " > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.\n"
- " > arp -a .... Displays the arp table.\n\n"));
-}
-
-
-
-/*
- *
- * Program entry.
- * Parse command line and call the required function
- *
- */
-INT main(int argc, char* argv[])
-{
- if ((argc < 2) || (argc > 5))
- {
- Usage();
- return EXIT_FAILURE;
- }
-
- if (argv[1][0] == '-')
- {
- switch (argv[1][1])
- {
- case 'a': /* fall through */
- case 'g':
- if (argc == 2)
- DisplayArpEntries(NULL, NULL);
- else if (argc == 3)
- DisplayArpEntries(argv[2], NULL);
- else if ((argc == 4) && ((strcmp(argv[2], "-N")) == 0))
- DisplayArpEntries(NULL, argv[3]);
- else if ((argc == 5) && ((strcmp(argv[3], "-N")) == 0))
- DisplayArpEntries(argv[2], argv[4]);
- else
- Usage();
- return EXIT_FAILURE;
- break;
- case 'd': if (argc == 3)
- Deletehost(argv[2], NULL);
- else if (argc == 4)
- Deletehost(argv[2], argv[3]);
- else
- Usage();
- return EXIT_FAILURE;
- break;
- case 's': if (argc == 4)
- Addhost(argv[2], argv[3], NULL);
- else if (argc == 5)
- Addhost(argv[2], argv[3], argv[4]);
- else
- Usage();
- return EXIT_FAILURE;
- break;
- default:
- Usage();
- return EXIT_FAILURE;
- }
- }
- else
- Usage();
-
- return EXIT_SUCCESS;
-}
+++ /dev/null
-#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 arp\0"
-#define REACTOS_STR_INTERNAL_NAME "arp\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "arp.exe\0"
-#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy@gmail.com)\0"
-#include <reactos/version.rc>
+++ /dev/null
-<module name="arp" type="win32cui" installbase="system32" installname="arp.exe">
- <include base="arp">.</include>
- <define name="__USE_W32API" />
- <library>kernel32</library>
- <library>iphlpapi</library>
- <library>ws2_32</library>
- <library>shlwapi</library>
- <file>arp.c</file>
- <file>arp.rc</file>
-</module>
-
+++ /dev/null
-<directory name="arp">
- <xi:include href="arp/arp.xml" />
-</directory>
-<directory name="finger">
- <xi:include href="finger/finger.xml" />
-</directory>
-<directory name="ftp">
- <xi:include href="ftp/ftp.xml" />
-</directory>
-<directory name="ipconfig">
- <xi:include href="ipconfig/ipconfig.xml" />
-</directory>
-<directory name="netstat">
- <xi:include href="netstat/netstat.xml" />
-</directory>
-<directory name="ping">
- <xi:include href="ping/ping.xml" />
-</directory>
-<directory name="route">
- <xi:include href="route/route.xml" />
-</directory>
-<directory name="telnet">
- <xi:include href="telnet/telnet.xml" />
-</directory>
-<directory name="tracert">
- <xi:include href="tracert/tracert.xml" />
-</directory>
-<directory name="whois">
- <xi:include href="whois/whois.xml" />
-</directory>
+++ /dev/null
-July 22, 1999
-
-To All Licensees, Distributors of Any Version of BSD:
-
-As you know, certain of the Berkeley Software Distribution ("BSD") source code files
-require that further distributions of products containing all or portions of the
-software, acknowledge within their advertising materials that such products contain
-software developed by UC Berkeley and its contributors.
-
-Specifically, the provision reads:
-
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
-
-Effective immediately, licensees and distributors are no longer required to include
-the acknowledgement within advertising materials. Accordingly, the foregoing paragraph
-of those BSD Unix files containing it is hereby deleted in its entirety.
-
-William Hoskins
-Director, Office of Technology Licensing
-University of California, Berkeley "
+++ /dev/null
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include "err.h"
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-extern char *__progname; /* Program name, from crt0. */
-
-void
-err(int eval, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- verr(eval, fmt, ap);
- va_end(ap);
-}
-
-void
-verr(int eval, const char *fmt, va_list ap)
-{
- int sverrno;
-
- sverrno = errno;
- (void)fprintf(stderr, "%s: ", __progname);
- if (fmt != NULL) {
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, ": ");
- }
- (void)fprintf(stderr, "%s\n", strerror(sverrno));
- exit(eval);
-}
-
-void
-errx(int eval, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- verrx(eval, fmt, ap);
- va_end(ap);
-}
-
-void
-verrx(int eval, const char *fmt, va_list ap)
-{
- (void)fprintf(stderr, "%s: ", __progname);
- if (fmt != NULL)
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, "\n");
- exit(eval);
-}
-
-void
-warn(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarn(fmt, ap);
- va_end(ap);
-}
-
-void
-vwarn(fmt, ap)
- const char *fmt;
- va_list ap;
-{
- int sverrno;
-
- sverrno = errno;
- (void)fprintf(stderr, "%s: ", __progname);
- if (fmt != NULL) {
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, ": ");
- }
- (void)fprintf(stderr, "%s\n", strerror(sverrno));
-}
-
-void
-warnx(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
-}
-
-void
-vwarnx(fmt, ap)
- const char *fmt;
- va_list ap;
-{
- (void)fprintf(stderr, "%s: ", __progname);
- if (fmt != NULL)
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, "\n");
-}
+++ /dev/null
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)err.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _ERR_H_
-#define _ERR_H_
-
-/*
- * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two
- * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
- * of them here we may collide with the utility's includes. It's unreasonable
- * for utilities to have to include one of them to include err.h, so we get
- * _BSD_VA_LIST_ from <machine/ansi.h> and use it.
- */
-/*#include <machine/ansi.h>*/
-/*#include <sys/cdefs.h>*/
-#include "various.h"
-#include <stdarg.h>
-
-void err __P((int, const char *, ...));
-void verr __P((int, const char *, va_list));
-void errx __P((int, const char *, ...));
-void verrx __P((int, const char *, va_list));
-void warn __P((const char *, ...));
-void vwarn __P((const char *, va_list));
-void warnx __P((const char *, ...));
-void vwarnx __P((const char *, va_list));
-
-#endif /* !_ERR_H_ */
+++ /dev/null
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * 8/2/97 - Ted Felix <tfelix@fred.net>
- * Ported to Win32 from 4.4BSD-LITE2 at wcarchive.
- * NT Workstation already has finger, and it runs fine under
- * Win95. Thought I'd do this anyways since not everyone has
- * access to NT.
- * Had to remove local handling. Otherwise, same as whois.
- */
-
-/*
- * Finger prints out information about users. It is not portable since
- * certain fields (e.g. the full user name, office, and phone numbers) are
- * extracted from the gecos field of the passwd file which other UNIXes
- * may not have or may use for other things.
- *
- * There are currently two output formats; the short format is one line
- * per user and displays login name, tty, login time, real name, idle time,
- * and office location/phone number. The long format gives the same
- * information (in a more legible format) as well as home directory, shell,
- * mail info, and .plan/.project files.
- */
-
-#include <winsock2.h>
-#include "err.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "various.h"
-#include "getopt.h"
-
-char *__progname;
-
-time_t now;
-int lflag, mflag, pplan, sflag;
-
-static void userlist(int, char **);
-void usage();
-
-int
-main(int argc, char **argv)
-{
- int ch;
-
- while ((ch = getopt(argc, argv, "lmps")) != EOF)
- switch(ch) {
- case 'l':
- lflag = 1; /* long format */
- break;
- case 'm':
- mflag = 1; /* force exact match of names */
- break;
- case 'p':
- pplan = 1; /* don't show .plan/.project */
- break;
- case 's':
- sflag = 1; /* short format */
- break;
- case '?':
- default:
- (void)fprintf(stderr,
- "usage: finger [-lmps] login [...]\n");
- exit(1);
- }
- argc -= optind;
- argv += optind;
-
- (void)time(&now);
- if (!*argv) {
- usage();
- } else {
- userlist(argc, argv);
- /*
- * Assign explicit "large" format if names given and -s not
- * explicitly stated. Force the -l AFTER we get names so any
- * remote finger attempts specified won't be mishandled.
- */
- if (!sflag)
- lflag = 1; /* if -s not explicit, force -l */
- }
- return 0;
-}
-
-
-static void
-userlist(int argc, char **argv)
-{
- int *used;
- char **ap, **nargv, **np, **p;
- WORD wVersionRequested;
- WSADATA wsaData;
- int iErr;
-
-
- if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL ||
- (used = calloc(argc, sizeof(int))) == NULL)
- err(1, NULL);
-
- /* Pull out all network requests into nargv. */
- for (ap = p = argv, np = nargv; *p; ++p)
- if (index(*p, '@'))
- *np++ = *p;
- else
- *ap++ = *p;
-
- *np++ = NULL;
- *ap++ = NULL;
-
- /* If there are local requests */
- if (*argv)
- {
- fprintf(stderr, "Warning: Can't do local finger\n");
- }
-
- /* Start winsock */
- wVersionRequested = MAKEWORD( 1, 1 );
- iErr = WSAStartup( wVersionRequested, &wsaData );
- if ( iErr != 0 )
- {
- /* Tell the user that we couldn't find a usable */
- /* WinSock DLL. */
- fprintf(stderr, "WSAStartup failed\n");
- return;
- }
-
- /* Handle network requests. */
- for (p = nargv; *p;)
- netfinger(*p++);
-
- /* Bring down winsock */
- WSACleanup();
- exit(0);
-}
-
-void usage()
-{
- (void)fprintf(stderr,
- "usage: finger [-lmps] login [...]\n");
- exit(1);
-}
-
+++ /dev/null
-/* $Id$ */
-
-#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 finger\0"
-#define REACTOS_STR_INTERNAL_NAME "finger\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "finger.exe\0"
-#include <reactos/version.rc>
+++ /dev/null
-<module name="finger" type="win32cui" installbase="system32" installname="finger.exe">
- <include base="finger">.</include>
- <define name="__USE_W32API" />
- <define name="__USE_W32_SOCKETS" />
- <library>kernel32</library>
- <library>ws2_32</library>
- <file>finger.c</file>
- <file>err.c</file>
- <file>getopt.c</file>
- <file>net.c</file>
- <file>finger.rc</file>
-</module>
+++ /dev/null
-/*
- * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Fri Jun 13 10:39:00 1997, tfelix@fred.net:
- * Ported to Win32, changed index/rindex to strchr/strrchr
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91";
-#endif /* LIBC_SCCS and not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "getopt.h"
-
-/*
- * get option letter from argument vector
- */
-int opterr = 1, /* if error message should be printed */
- optind = 1, /* index into parent argv vector */
- optopt; /* character checked for validity */
-const char *optarg; /* argument associated with option */
-
-#define BADCH (int)'?'
-#define EMSG ""
-
-int
-getopt(int nargc, char * const *nargv, const char *ostr)
-{
- static const char *place = EMSG; /* option letter processing */
- register char *oli; /* option letter list index */
- char *p;
-
- if (!*place) { /* update scanning pointer */
- if (optind >= nargc || *(place = nargv[optind]) != '-') {
- place = EMSG;
- return(EOF);
- }
- if (place[1] && *++place == '-') { /* found "--" */
- ++optind;
- place = EMSG;
- return(EOF);
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' ||
- !(oli = strchr(ostr, optopt))) {
- /*
- * if the user didn't specify '-' as an option,
- * assume it means EOF.
- */
- if (optopt == (int)'-')
- return(EOF);
- if (!*place)
- ++optind;
- if (opterr) {
- if (!(p = strrchr(*nargv, '/')))
- p = *nargv;
- else
- ++p;
- (void)fprintf(stderr, "%s: illegal option -- %c\n",
- p, optopt);
- }
- return(BADCH);
- }
- if (*++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place)
- ++optind;
- }
- else { /* need an argument */
- if (*place) /* no white space */
- optarg = place;
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- if (!(p = strrchr(*nargv, '/')))
- p = *nargv;
- else
- ++p;
- if (opterr)
- (void)fprintf(stderr,
- "%s: option requires an argument -- %c\n",
- p, optopt);
- return(BADCH);
- }
- else /* white space */
- optarg = nargv[optind];
- place = EMSG;
- ++optind;
- }
- return(optopt); /* dump back option letter */
-}
+++ /dev/null
-/* getopt.h */
-
-extern const char *optarg;
-extern int optind;
-
-int
-getopt(int nargc, char * const *nargv, const char *ostr);
+++ /dev/null
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <sys/types.h>
-#include <winsock2.h>
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "various.h"
-
-int close(int);
-
-void
-netfinger(char *name)
-{
- extern int lflag;
- char c, lastc;
- struct in_addr defaddr;
- struct hostent *hp, def;
- struct servent *sp;
- struct sockaddr_in sin;
- SOCKET s;
- char *alist[1], *host;
-
- /* If this is a local request */
- if (!(host = rindex(name, '@')))
- return;
-
- *host++ = '\0';
- if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != (unsigned long)-1) {
- def.h_name = host;
- def.h_addr_list = alist;
- def.h_addr = (char *)&defaddr;
- def.h_length = sizeof(struct in_addr);
- def.h_addrtype = AF_INET;
- def.h_aliases = 0;
- hp = &def;
- } else if (!(hp = gethostbyname(host))) {
- (void)fprintf(stderr,
- "finger: unknown host: %s\n", host);
- return;
- }
- if (!(sp = getservbyname("finger", "tcp"))) {
- (void)fprintf(stderr, "finger: tcp/finger: unknown service\n");
- return;
- }
- sin.sin_family = hp->h_addrtype;
- bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
- sin.sin_port = sp->s_port;
- if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) {
- perror("finger: socket");
- return;
- }
-
- /* have network connection; identify the host connected with */
- (void)printf("[%s]\n", hp->h_name);
- if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
- fprintf(stderr, "finger: connect rc = %d", WSAGetLastError());
- (void)close(s);
- return;
- }
-
- /* -l flag for remote fingerd */
- if (lflag)
- send(s, "/W ", 3, 0);
- /* send the name followed by <CR><LF> */
- send(s, name, strlen(name), 0);
- send(s, "\r\n", 2, 0);
-
- /*
- * Read from the remote system; once we're connected, we assume some
- * data. If none arrives, we hang until the user interrupts.
- *
- * If we see a <CR> or a <CR> with the high bit set, treat it as
- * a newline; if followed by a newline character, only output one
- * newline.
- *
- * Otherwise, all high bits are stripped; if it isn't printable and
- * it isn't a space, we can simply set the 7th bit. Every ASCII
- * character with bit 7 set is printable.
- */
- lastc = 0;
- while (recv(s, &c, 1, 0) == 1) {
- c &= 0x7f;
- if (c == 0x0d) {
- if (lastc == '\r') /* ^M^M - skip dupes */
- continue;
- c = '\n';
- lastc = '\r';
- } else {
- if (!isprint(c) && !isspace(c))
- c |= 0x40;
- if (lastc != '\r' || c != '\n')
- lastc = c;
- else {
- lastc = '\n';
- continue;
- }
- }
- putchar(c);
- }
- if (lastc != '\n')
- putchar('\n');
- putchar('\n');
-}
+++ /dev/null
-// Various things you need when porting BSD and GNU utilities to
-// Win32.
-
-#ifndef VARIOUS_H
-#define VARIOUS_H
-
-
-typedef float f4byte_t;
-typedef double f8byte_t;
-typedef long uid_t; // SunOS 5.5
-
-#define __P(x) x
-
-/* utmp.h */
-#define UT_LINESIZE 8
-#define UT_HOSTSIZE 16
-
-/* stat.h */
-#define S_ISREG(mode) (((mode)&0xF000) == 0x8000)
-#define S_ISDIR(mode) (((mode)&0xF000) == 0x4000)
-
-#undef MIN //take care of windows default
-#undef MAX //take care of windows default
-#define MIN(a, b) ((a) <= (b) ? (a) : (b))
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-
-#define bcopy(s1, s2, n) memmove(s2, s1, n)
-#define bcmp(s1, s2, n) (memcmp(s1, s2, n) != 0)
-#define bzero(s, n) memset(s, 0, n)
-
-#define index(s, c) strchr(s, c)
-#define rindex(s, c) strrchr(s, c)
-
-void netfinger(char *);
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 1985, 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)cmds.c 5.18 (Berkeley) 4/20/89";
-#endif /* not lint */
-
-/*
- * FTP User Program -- Command Routines.
- */
-//#include <sys/param.h>
-//#include <sys/wait.h>
-#include <sys/stat.h>
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <arpa/ftp.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#else
-#include <winsock.h>
-#endif
-
-#include <signal.h>
-#include <direct.h>
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-
-#include "ftp_var.h"
-#include "pathnames.h"
-#include "prototypes.h"
-
-extern char *globerr;
-extern char home[];
-extern char *remglob();
-extern char *getenv();
-extern int allbinary;
-extern off_t restart_point;
-extern char reply_string[];
-
-const char *mname;
-jmp_buf jabort;
-const char *dotrans(), *domap();
-
-extern short portnum;
-extern char *hostname;
-extern int autologin;
-/*
- * Connect to peer server and
- * auto-login, if possible.
- */
-void setpeer(int argc, const char *argv[])
-{
- char *host;
-
- if (connected) {
- printf("Already connected to %s, use close first.\n",
- hostname);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(to) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc > 3) {
- printf("usage: %s host-name [port]\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc > 2) {
- portnum = atoi(argv[2]);
- if (portnum <= 0) {
- printf("%s: bad port number-- %s\n", argv[1], argv[2]);
- printf ("usage: %s host-name [port]\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- portnum = htons(portnum);
- }
- host = hookup(argv[1], portnum);
- if (host) {
-#if defined(unix) && NBBY == 8
- int overbose;
-#endif
- connected = 1;
- if (autologin)
- (void) login(argv[1]);
-
-#if defined(unix) && NBBY == 8
-/*
- * this ifdef is to keep someone form "porting" this to an incompatible
- * system and not checking this out. This way they have to think about it.
- */
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
- allbinary = 0;
- if (command("SYST") == COMPLETE && overbose) {
- register char *cp, c;
- cp = index(reply_string+4, ' ');
- if (cp == NULL)
- cp = index(reply_string+4, '\r');
- if (cp) {
- if (cp[-1] == '.')
- cp--;
- c = *cp;
- *cp = '\0';
- }
-
- printf("Remote system type is %s.\n",
- reply_string+4);
- if (cp)
- *cp = c;
- }
- if (!strncmp(reply_string, "215 UNIX Type: L8", 17)) {
- setbinary();
- /* allbinary = 1; this violates the RFC */
- if (overbose)
- printf("Using %s mode to transfer files.\n",
- typename);
- } else if (overbose &&
- !strncmp(reply_string, "215 TOPS20", 10)) {
- printf(
-"Remember to set tenex mode when transfering binary files from this machine.\n");
- }
- verbose = overbose;
-#endif /* unix */
- }
- (void) fflush(stdout);
-}
-
-struct types {
- const char *t_name;
- const char *t_mode;
- int t_type;
- char *t_arg;
-} types[] = {
- { "ascii", "A", TYPE_A, 0 },
- { "binary", "I", TYPE_I, 0 },
- { "image", "I", TYPE_I, 0 },
- { "ebcdic", "E", TYPE_E, 0 },
- { "tenex", "L", TYPE_L, bytename },
- {0 }
-};
-
-/*
- * Set transfer type.
- */
-void settype(argc, argv)
- const char *argv[];
-{
- register struct types *p;
- int comret;
-
- if (argc > 2) {
- const char *sep;
-
- printf("usage: %s [", argv[0]);
- sep = " ";
- for (p = types; p->t_name; p++) {
- printf("%s%s", sep, p->t_name);
- if (*sep == ' ')
- sep = " | ";
- }
- printf(" ]\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc < 2) {
- printf("Using %s mode to transfer files.\n", typename);
- (void) fflush(stdout);
- code = 0;
- return;
- }
- for (p = types; p->t_name; p++)
- if (strcmp(argv[1], p->t_name) == 0)
- break;
- if (p->t_name == 0) {
- printf("%s: unknown mode\n", argv[1]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if ((p->t_arg != NULL) && (*(p->t_arg) != '\0'))
- comret = command ("TYPE %s %s", p->t_mode, p->t_arg);
- else
- comret = command("TYPE %s", p->t_mode);
- if (comret == COMPLETE) {
- (void) strcpy(typename, p->t_name);
- type = p->t_type;
- }
-}
-
-const char *stype[] = {
- "type",
- "",
- 0
-};
-
-/*
- * Set binary transfer type.
- */
-/*VARARGS*/
-void setbinary()
-{
- stype[1] = "binary";
- settype(2, stype);
-}
-
-/*
- * Set ascii transfer type.
- */
-/*VARARGS*/
-void setascii()
-{
- stype[1] = "ascii";
- settype(2, stype);
-}
-
-/*
- * Set tenex transfer type.
- */
-/*VARARGS*/
-void settenex()
-{
- stype[1] = "tenex";
- settype(2, stype);
-}
-
-/*
- * Set ebcdic transfer type.
- */
-/*VARARGS*/
-void setebcdic()
-{
- stype[1] = "ebcdic";
- settype(2, stype);
-}
-
-/*
- * Set file transfer mode.
- */
-
-/*ARGSUSED*/
-void fsetmode(argc, argv)
- char *argv[];
-{
-
- printf("We only support %s mode, sorry.\n", modename);
- (void) fflush(stdout);
- code = -1;
-}
-
-
-/*
- * Set file transfer format.
- */
-/*ARGSUSED*/
-void setform(argc, argv)
- char *argv[];
-{
-
- printf("We only support %s format, sorry.\n", formname);
- (void) fflush(stdout);
- code = -1;
-}
-
-/*
- * Set file transfer structure.
- */
-/*ARGSUSED*/
-void setstruct(argc, argv)
- char *argv[];
-{
-
- printf("We only support %s structure, sorry.\n", structname);
- (void) fflush(stdout);
- code = -1;
-}
-
-/*
- * Send a single file.
- */
-void put(argc, argv)
- int argc;
- const char *argv[];
-{
- const char *cmd;
- int loc = 0;
- const char *oldargv1, *oldargv2;
-
- if (argc == 2) {
- argc++;
- argv[2] = argv[1];
- loc++;
- }
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(local-file) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
-usage:
- printf("usage:%s local-file remote-file\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc < 3) {
- (void) strcat(line, " ");
- printf("(remote-file) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 3)
- goto usage;
- oldargv1 = argv[1];
- oldargv2 = argv[2];
- if (!globulize(&argv[1])) {
- code = -1;
- return;
- }
- /*
- * If "globulize" modifies argv[1], and argv[2] is a copy of
- * the old argv[1], make it a copy of the new argv[1].
- */
- if (argv[1] != oldargv1 && argv[2] == oldargv1) {
- argv[2] = argv[1];
- }
- cmd = (argv[0][0] == 'a') ? "APPE" : ((sunique) ? "STOU" : "STOR");
- if (loc && ntflag) {
- argv[2] = dotrans(argv[2]);
- }
- if (loc && mapflag) {
- argv[2] = domap(argv[2]);
- }
- sendrequest(cmd, argv[1], argv[2],
- argv[1] != oldargv1 || argv[2] != oldargv2);
-}
-
-/*
- * Send multiple files.
- */
-void mput(argc, argv)
- const char *argv[];
-{
- register int i;
- int ointer;
- extern jmp_buf jabort;
- const char *tp;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(local-files) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s local-files\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- mname = argv[0];
- mflag = 1;
-// oldintr = signal(SIGINT, mabort);
- (void) setjmp(jabort);
- if (proxy) {
- char *cp, *tp2, tmpbuf[MAXPATHLEN];
-
- while ((cp = remglob(argv,0)) != NULL) {
- if (*cp == 0) {
- mflag = 0;
- continue;
- }
- if (mflag && confirm(argv[0], cp)) {
- tp = cp;
- if (mcase) {
- while (*tp && !islower(*tp)) {
- tp++;
- }
- if (!*tp) {
- tp = cp;
- tp2 = tmpbuf;
- while ((*tp2 = *tp) != (int) NULL) {
- if (isupper(*tp2)) {
- *tp2 = 'a' + *tp2 - 'A';
- }
- tp++;
- tp2++;
- }
- }
- tp = tmpbuf;
- }
- if (ntflag) {
- tp = dotrans(tp);
- }
- if (mapflag) {
- tp = domap(tp);
- }
- sendrequest((sunique) ? "STOU" : "STOR",
- cp, tp, cp != tp || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mput")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
-// (void) signal(SIGINT, oldintr);
- mflag = 0;
- return;
- }
- for (i = 1; i < argc; i++) {
- register char **cpp, **gargs;
-
- if (!doglob) {
- if (mflag && confirm(argv[0], argv[i])) {
- tp = (ntflag) ? dotrans(argv[i]) : argv[i];
- tp = (mapflag) ? domap(tp) : tp;
- sendrequest((sunique) ? "STOU" : "STOR",
- argv[i], tp, tp != argv[i] || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mput")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- continue;
- }
- gargs = glob(argv[i]);
- if (globerr != NULL) {
- printf("%s\n", globerr);
- (void) fflush(stdout);
- if (gargs) {
- blkfree(gargs);
- free((char *)gargs);
- }
- continue;
- }
- for (cpp = gargs; cpp && *cpp != NULL; cpp++) {
- if (mflag && confirm(argv[0], *cpp)) {
- tp = (ntflag) ? dotrans(*cpp) : *cpp;
- tp = (mapflag) ? domap(tp) : tp;
- sendrequest((sunique) ? "STOU" : "STOR",
- *cpp, tp, *cpp != tp || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mput")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
- if (gargs != NULL) {
- blkfree(gargs);
- free((char *)gargs);
- }
- }
-// (void) signal(SIGINT, oldintr);
- mflag = 0;
-}
-
-void reget(argc, argv)
- const char *argv[];
-{
- (void) getit(argc, argv, 1, "r+w");
-}
-
-void get(argc, argv)
- const char *argv[];
-{
- (void) getit(argc, argv, 0, restart_point ? "r+w" : "w" );
-}
-
-/*
- * Receive one file.
- */
-int getit(argc, argv, restartit, mode)
- const char *argv[];
- const char *mode;
-{
- int loc = 0;
- const char *oldargv1, *oldargv2;
-
- if (argc == 2) {
- argc++;
- argv[2] = argv[1];
- loc++;
- }
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(remote-file) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
-usage:
- printf("usage: %s remote-file [ local-file ]\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return (0);
- }
- if (argc < 3) {
- (void) strcat(line, " ");
- printf("(local-file) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 3)
- goto usage;
- oldargv1 = argv[1];
- oldargv2 = argv[2];
- if (!globulize(&argv[2])) {
- code = -1;
- return (0);
- }
- if (loc && mcase) {
- const char *tp = argv[1];
- char *tp2, tmpbuf[MAXPATHLEN];
-
- while (*tp && !islower(*tp)) {
- tp++;
- }
- if (!*tp) {
- tp = argv[2];
- tp2 = tmpbuf;
- while ((*tp2 = *tp) != (int) NULL) {
- if (isupper(*tp2)) {
- *tp2 = 'a' + *tp2 - 'A';
- }
- tp++;
- tp2++;
- }
- argv[2] = tmpbuf;
- }
- }
- if (loc && ntflag)
- argv[2] = dotrans(argv[2]);
- if (loc && mapflag)
- argv[2] = domap(argv[2]);
- if (restartit) {
- struct stat stbuf;
- int ret;
-
- ret = stat(argv[2], &stbuf);
- if (restartit == 1) {
- if (ret < 0) {
- perror(argv[2]);
- return (0);
- }
- restart_point = stbuf.st_size;
- } else {
- if (ret == 0) {
- int overbose;
-
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
- if (command("MDTM %s", argv[1]) == COMPLETE) {
- int yy, mo, day, hour, min, sec;
- struct tm *tm;
- verbose = overbose;
- sscanf(reply_string,
- "%*s %04d%02d%02d%02d%02d%02d",
- &yy, &mo, &day, &hour, &min, &sec);
- tm = gmtime(&stbuf.st_mtime);
- tm->tm_mon++;
- if (tm->tm_year > yy%100)
- return (1);
- else if (tm->tm_year == yy%100) {
- if (tm->tm_mon > mo)
- return (1);
- } else if (tm->tm_mon == mo) {
- if (tm->tm_mday > day)
- return (1);
- } else if (tm->tm_mday == day) {
- if (tm->tm_hour > hour)
- return (1);
- } else if (tm->tm_hour == hour) {
- if (tm->tm_min > min)
- return (1);
- } else if (tm->tm_min == min) {
- if (tm->tm_sec > sec)
- return (1);
- }
- } else {
- printf("%s\n", reply_string);
- (void) fflush(stdout);
- verbose = overbose;
- return (0);
- }
- }
- }
- }
-
- recvrequest("RETR", argv[2], argv[1], mode,
- argv[1] != oldargv1 || argv[2] != oldargv2);
- restart_point = 0;
- return (0);
-}
-
-#if 0
-static void
-mabort()
-{
- int ointer;
- extern jmp_buf jabort;
-
- printf("\n");
- (void) fflush(stdout);
- if (mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with", mname)) {
- interactive = ointer;
- longjmp(jabort,0);
- }
- interactive = ointer;
- }
- mflag = 0;
- longjmp(jabort,0);
-}
-#endif
-
-/*
- * Get multiple files.
- */
-void mget(argc, argv)
- const char *argv[];
-{
- const char *cp, *tp;
- char *tp2, tmpbuf[MAXPATHLEN];
- int ointer;
- extern jmp_buf jabort;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(remote-files) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s remote-files\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- mname = argv[0];
- mflag = 1;
-// oldintr = signal(SIGINT,mabort);
- (void) setjmp(jabort);
- while ((cp = remglob(argv,proxy)) != NULL) {
- if (*cp == '\0') {
- mflag = 0;
- continue;
- }
- if (mflag && confirm(argv[0], cp)) {
- tp = cp;
- if (mcase) {
- while (*tp && !islower(*tp)) {
- tp++;
- }
- if (!*tp) {
- tp = cp;
- tp2 = tmpbuf;
- while ((*tp2 = *tp) != (int) NULL) {
- if (isupper(*tp2)) {
- *tp2 = 'a' + *tp2 - 'A';
- }
- tp++;
- tp2++;
- }
- }
- tp = tmpbuf;
- }
- if (ntflag) {
- tp = dotrans(tp);
- }
- if (mapflag) {
- tp = domap(tp);
- }
- recvrequest("RETR", tp, cp, "w",
- tp != cp || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mget")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
-// (void) signal(SIGINT,oldintr);
- mflag = 0;
-}
-
-char *
-remglob(argv,doswitch)
- char *argv[];
- int doswitch;
-{
- char temp[16];
- static char buf[MAXPATHLEN];
- static FILE *ftemp = NULL;
- static char **args;
- int oldverbose, oldhash;
- char *cp;
- const char *mode;
-
- if (!mflag) {
- if (!doglob) {
- args = NULL;
- }
- else {
- if (ftemp) {
- (void) fclose(ftemp);
- ftemp = NULL;
- }
- }
- return(NULL);
- }
- if (!doglob) {
- if (args == NULL)
- args = argv;
- if ((cp = *++args) == NULL)
- args = NULL;
- return (cp);
- }
- if (ftemp == NULL) {
- (void) strcpy(temp, _PATH_TMP);
- (void) mktemp(temp);
- oldverbose = verbose, verbose = 0;
- oldhash = hash, hash = 0;
- if (doswitch) {
- pswitch(!proxy);
- }
- for (mode = "w"; *++argv != NULL; mode = "a")
- recvrequest ("NLST", temp, *argv, mode, 0);
- if (doswitch) {
- pswitch(!proxy);
- }
- verbose = oldverbose; hash = oldhash;
- ftemp = fopen(temp, "r");
- (void) unlink(temp);
- if (ftemp == NULL) {
- printf("can't find list of remote files, oops\n");
- (void) fflush(stdout);
- return (NULL);
- }
- }
- if (fgets(buf, sizeof (buf), ftemp) == NULL) {
- (void) fclose(ftemp), ftemp = NULL;
- return (NULL);
- }
- if ((cp = index(buf, '\n')) != NULL)
- *cp = '\0';
- return (buf);
-}
-
-static const char *
-onoff(bool)
- int bool;
-{
-
- return (bool ? "on" : "off");
-}
-
-/*
- * Show status.
- */
-/*ARGSUSED*/
-void status(argc, argv)
- char *argv[];
-{
- int i;
-
- if (connected)
- printf("Connected to %s.\n", hostname);
- else
- printf("Not connected.\n");
- if (!proxy) {
- pswitch(1);
- if (connected) {
- printf("Connected for proxy commands to %s.\n", hostname);
- }
- else {
- printf("No proxy connection.\n");
- }
- pswitch(0);
- }
- printf("Mode: %s; Type: %s; Form: %s; Structure: %s\n",
- modename, typename, formname, structname);
- printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n",
- onoff(verbose), onoff(bell), onoff(interactive),
- onoff(doglob));
- printf("Store unique: %s; Receive unique: %s\n", onoff(sunique),
- onoff(runique));
- printf("Case: %s; CR stripping: %s\n",onoff(mcase),onoff(crflag));
- if (ntflag) {
- printf("Ntrans: (in) %s (out) %s\n", ntin,ntout);
- }
- else {
- printf("Ntrans: off\n");
- }
- if (mapflag) {
- printf("Nmap: (in) %s (out) %s\n", mapin, mapout);
- }
- else {
- printf("Nmap: off\n");
- }
- printf("Hash mark printing: %s; Use of PORT cmds: %s\n",
- onoff(hash), onoff(sendport));
- if (macnum > 0) {
- printf("Macros:\n");
- for (i=0; i<macnum; i++) {
- printf("\t%s\n",macros[i].mac_name);
- }
- }
- (void) fflush(stdout);
- code = 0;
-}
-
-/*
- * Set beep on cmd completed mode.
- */
-/*VARARGS*/
-void setbell()
-{
-
- bell = !bell;
- printf("Bell mode %s.\n", onoff(bell));
- (void) fflush(stdout);
- code = bell;
-}
-
-/*
- * Turn on packet tracing.
- */
-/*VARARGS*/
-void settrace()
-{
-
- trace = !trace;
- printf("Packet tracing %s.\n", onoff(trace));
- (void) fflush(stdout);
- code = trace;
-}
-
-/*
- * Toggle hash mark printing during transfers.
- */
-/*VARARGS*/
-void sethash()
-{
-
- hash = !hash;
- printf("Hash mark printing %s", onoff(hash));
- code = hash;
- if (hash)
- printf(" (%d bytes/hash mark)", 1024);
- printf(".\n");
- (void) fflush(stdout);
-}
-
-/*
- * Turn on printing of server echo's.
- */
-/*VARARGS*/
-void setverbose()
-{
-
- verbose = !verbose;
- printf("Verbose mode %s.\n", onoff(verbose));
- (void) fflush(stdout);
- code = verbose;
-}
-
-/*
- * Toggle PORT cmd use before each data connection.
- */
-/*VARARGS*/
-void setport()
-{
-
- sendport = !sendport;
- printf("Use of PORT cmds %s.\n", onoff(sendport));
- (void) fflush(stdout);
- code = sendport;
-}
-
-/*
- * Turn on interactive prompting
- * during mget, mput, and mdelete.
- */
-/*VARARGS*/
-void setprompt()
-{
-
- interactive = !interactive;
- printf("Interactive mode %s.\n", onoff(interactive));
- (void) fflush(stdout);
- code = interactive;
-}
-
-/*
- * Toggle metacharacter interpretation
- * on local file names.
- */
-/*VARARGS*/
-void setglob()
-{
-
- doglob = !doglob;
- printf("Globbing %s.\n", onoff(doglob));
- (void) fflush(stdout);
- code = doglob;
-}
-
-/*
- * Set debugging mode on/off and/or
- * set level of debugging.
- */
-/*VARARGS*/
-void setdebug(argc, argv)
- char *argv[];
-{
- int val;
-
- if (argc > 1) {
- val = atoi(argv[1]);
- if (val < 0) {
- printf("%s: bad debugging value.\n", argv[1]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- } else
- val = !debug;
- debug = val;
- if (debug)
- options |= SO_DEBUG;
- else
- options &= ~SO_DEBUG;
- printf("Debugging %s (debug=%d).\n", onoff(debug), debug);
- (void) fflush(stdout);
- code = debug > 0;
-}
-
-/*
- * Set current working directory
- * on remote machine.
- */
-void cd(argc, argv)
- const char *argv[];
-{
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(remote-directory) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s remote-directory\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (command("CWD %s", argv[1]) == ERROR && code == 500) {
- if (verbose) {
- printf("CWD command not recognized, trying XCWD\n");
- (void) fflush(stdout);
- }
- (void) command("XCWD %s", argv[1]);
- }
-}
-
-/*
- * Set current working directory
- * on local machine.
- */
-void lcd(argc, argv)
- const char *argv[];
-{
- char buf[MAXPATHLEN];
-
- if (argc < 2)
- argc++, argv[1] = home;
- if (argc != 2) {
- printf("usage:%s local-directory\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (!globulize(&argv[1])) {
- code = -1;
- return;
- }
- if (chdir(argv[1]) < 0) {
- perror(argv[1]);
- code = -1;
- return;
- }
- printf("Local directory now %s\n", getcwd(buf,sizeof(buf)));
- (void) fflush(stdout);
- code = 0;
-}
-
-/*
- * Delete a single file.
- */
-void delete(argc, argv)
- const char *argv[];
-{
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(remote-file) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s remote-file\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- (void) command("DELE %s", argv[1]);
-}
-
-/*
- * Delete multiple files.
- */
-void mdelete(argc, argv)
- const char *argv[];
-{
- char *cp;
- int ointer;
- extern jmp_buf jabort;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(remote-files) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s remote-files\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- mname = argv[0];
- mflag = 1;
-// oldintr = signal(SIGINT, mabort);
- (void) setjmp(jabort);
- while ((cp = remglob(argv,0)) != NULL) {
- if (*cp == '\0') {
- mflag = 0;
- continue;
- }
- if (mflag && confirm(argv[0], cp)) {
- (void) command("DELE %s", cp);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with", "mdelete")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
-// (void) signal(SIGINT, oldintr);
- mflag = 0;
-}
-
-/*
- * Rename a remote file.
- */
-void renamefile(argc, argv)
- const char *argv[];
-{
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(from-name) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
-usage:
- printf("%s from-name to-name\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc < 3) {
- (void) strcat(line, " ");
- printf("(to-name) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 3)
- goto usage;
- if (command("RNFR %s", argv[1]) == CONTINUE)
- (void) command("RNTO %s", argv[2]);
-}
-
-/*
- * Get a directory listing
- * of remote files.
- */
-void ls(argc, argv)
- const char *argv[];
-{
- const char *cmd;
-
- if (argc < 2)
- argc++, argv[1] = NULL;
- if (argc < 3)
- argc++, argv[2] = "-";
- if (argc > 3) {
- printf("usage: %s remote-directory local-file\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- cmd = argv[0][0] == 'n' ? "NLST" : "LIST";
-// cmd = argv[0][0] == 'n' ? "NLST -CF" : "NLST -CF";
- if (strcmp(argv[2], "-") && !globulize(&argv[2])) {
- code = -1;
- return;
- }
- if (strcmp(argv[2], "-") && *argv[2] != '|')
- if (!globulize(&argv[2]) || !confirm("output to local-file:", argv[2])) {
- code = -1;
- return;
- }
- recvrequest(cmd, argv[2], argv[1], "w", 0);
-}
-
-/*
- * Get a directory listing
- * of multiple remote files.
- */
-void mls(argc, argv)
- const char *argv[];
-{
- const char *cmd, *dest;
- char mode[1];
- int ointer, i;
- extern jmp_buf jabort;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(remote-files) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 3) {
- (void) strcat(line, " ");
- printf("(local-file) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 3) {
- printf("usage:%s remote-files local-file\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- dest = argv[argc - 1];
- argv[argc - 1] = NULL;
- if (strcmp(dest, "-") && *dest != '|')
- if (!globulize(&dest) || !confirm("output to local-file:", dest)) {
- code = -1;
- return;
- }
- cmd = argv[0][1] == 'l' ? "NLST" : "LIST";
- mname = argv[0];
- mflag = 1;
-// oldintr = signal(SIGINT, mabort);
- (void) setjmp(jabort);
- for (i = 1; mflag && i < argc-1; ++i) {
- *mode = (i == 1) ? 'w' : 'a';
- recvrequest(cmd, dest, argv[i], mode, 0);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with", argv[0])) {
- mflag ++;
- }
- interactive = ointer;
- }
- }
-// (void) signal(SIGINT, oldintr);
- mflag = 0;
-}
-
-/*
- * Do a shell escape
- */
-/*ARGSUSED*/
-void shell(argc, argv)
- char *argv[];
-{
-#if 0
- int pid;
- sig_t (*old1)(), (*old2)();
- char shellnam[40], *shell, *namep;
- union wait status;
-
- old1 = signal (SIGINT, SIG_IGN);
- old2 = signal (SIGQUIT, SIG_IGN);
- if ((pid = fork()) == 0) {
- for (pid = 3; pid < 20; pid++)
- (void) close(pid);
- (void) signal(SIGINT, SIG_DFL);
- (void) signal(SIGQUIT, SIG_DFL);
- shell = getenv("SHELL");
- if (shell == NULL)
- shell = _PATH_BSHELL;
- namep = rindex(shell,'/');
- if (namep == NULL)
- namep = shell;
- (void) strcpy(shellnam,"-");
- (void) strcat(shellnam, ++namep);
- if (strcmp(namep, "sh") != 0)
- shellnam[0] = '+';
- if (debug) {
- printf ("%s\n", shell);
- (void) fflush (stdout);
- }
- if (argc > 1) {
- execl(shell,shellnam,"-c",altarg,(char *)0);
- }
- else {
- execl(shell,shellnam,(char *)0);
- }
- perror(shell);
- code = -1;
- exit(1);
- }
- if (pid > 0)
- while (wait(&status) != pid)
- ;
- (void) signal(SIGINT, old1);
- (void) signal(SIGQUIT, old2);
- if (pid == -1) {
- perror("Try again later");
- code = -1;
- }
- else {
- code = 0;
- }
-#endif
-
- char * AppName;
- char ShellCmd[MAX_PATH];
- char CmdLine[MAX_PATH];
- int i;
- PROCESS_INFORMATION ProcessInformation;
- BOOL Result;
- STARTUPINFO StartupInfo;
- char ShellName[] = "COMSPEC";
- int NumBytes;
-
- NumBytes = GetEnvironmentVariable( ShellName, ShellCmd, MAX_PATH);
-
- if (NumBytes == 0)
- {
- return;
- }
-
- AppName = ShellCmd;
- strcpy( CmdLine, ShellCmd );
-
- if (argc > 1)
- {
- strncat(CmdLine, " /C", MAX_PATH);
- }
-
- for (i=1; i<argc; i++)
- {
- strncat(CmdLine, " ", MAX_PATH);
- strncat(CmdLine, argv[i], MAX_PATH);
- }
-
- StartupInfo.cb = sizeof( StartupInfo );
- StartupInfo.lpReserved = NULL;
- StartupInfo.lpDesktop = NULL;
- StartupInfo.lpTitle = NULL;
- StartupInfo.dwX = 0;
- StartupInfo.dwY = 0;
- StartupInfo.dwXSize = 0;
- StartupInfo.dwYSize = 0;
- StartupInfo.dwFlags = 0;
- StartupInfo.wShowWindow = 0;
- StartupInfo.cbReserved2 = 0;
- StartupInfo.lpReserved2 = NULL;
-
- Result = CreateProcess( AppName, // cmd name
- CmdLine, // cmd line arguments
- NULL,
- NULL, // security attributes
- FALSE, // inherit flags
- 0, // Creation flags
- NULL, // Environment
- NULL, // Current directory
- &StartupInfo, // Startup info structure
- &ProcessInformation); // processInfo structure
-
- if (Result)
- {
- WaitForSingleObject( ProcessInformation.hProcess, 0xffffffff);
-
- CloseHandle( ProcessInformation.hProcess);
- }
-}
-
-/*
- * Send new user information (re-login)
- */
-void user(argc, argv)
- int argc;
- const char **argv;
-{
- char acct[80], *getpass();
- int n, aflag = 0;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(username) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc > 4) {
- printf("usage: %s username [password] [account]\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- n = command("USER %s", argv[1]);
- if (n == CONTINUE) {
- if (argc < 3 )
- argv[2] = getpass("Password: "), argc++;
- n = command("PASS %s", argv[2]);
- }
- if (n == CONTINUE) {
- if (argc < 4) {
- printf("Account: "); (void) fflush(stdout);
- (void) fflush(stdout);
- (void) fgets(acct, sizeof(acct) - 1, stdin);
- acct[strlen(acct) - 1] = '\0';
- argv[3] = acct; argc++;
- }
- n = command("ACCT %s", argv[3]);
- aflag++;
- }
- if (n != COMPLETE) {
- fprintf(stdout, "Login failed.\n");
- (void) fflush(stdout);
- return;
- }
- if (!aflag && argc == 4) {
- (void) command("ACCT %s", argv[3]);
- }
-}
-
-/*
- * Print working directory.
- */
-/*VARARGS*/
-void pwd()
-{
- int oldverbose = verbose;
-
- /*
- * If we aren't verbose, this doesn't do anything!
- */
- verbose = 1;
- if (command("PWD") == ERROR && code == 500) {
- printf("PWD command not recognized, trying XPWD\n");
- (void) fflush(stdout);
- (void) command("XPWD");
- }
- verbose = oldverbose;
-}
-
-/*
- * Make a directory.
- */
-void makedir(argc, argv)
- const char *argv[];
-{
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(directory-name) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage: %s directory-name\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (command("MKD %s", argv[1]) == ERROR && code == 500) {
- if (verbose) {
- printf("MKD command not recognized, trying XMKD\n");
- (void) fflush(stdout);
- }
- (void) command("XMKD %s", argv[1]);
- }
-}
-
-/*
- * Remove a directory.
- */
-void removedir(argc, argv)
- const char *argv[];
-{
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(directory-name) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage: %s directory-name\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (command("RMD %s", argv[1]) == ERROR && code == 500) {
- if (verbose) {
- printf("RMD command not recognized, trying XRMD\n");
- (void) fflush(stdout);
- }
- (void) command("XRMD %s", argv[1]);
- }
-}
-
-/*
- * Send a line, verbatim, to the remote machine.
- */
-void quote(argc, argv)
- const char *argv[];
-{
- int i;
- char buf[BUFSIZ];
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(command line to send) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage: %s line-to-send\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- (void) strcpy(buf, argv[1]);
- for (i = 2; i < argc; i++) {
- (void) strcat(buf, " ");
- (void) strcat(buf, argv[i]);
- }
- if (command(buf) == PRELIM) {
- while (getreply(0) == PRELIM);
- }
-}
-
-/*
- * Send a SITE command to the remote machine. The line
- * is sent almost verbatim to the remote machine, the
- * first argument is changed to SITE.
- */
-
-void site(argc, argv)
- const char *argv[];
-{
- int i;
- char buf[BUFSIZ];
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(arguments to SITE command) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage: %s line-to-send\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- (void) strcpy(buf, "SITE ");
- (void) strcat(buf, argv[1]);
- for (i = 2; i < argc; i++) {
- (void) strcat(buf, " ");
- (void) strcat(buf, argv[i]);
- }
- if (command(buf) == PRELIM) {
- while (getreply(0) == PRELIM);
- }
-}
-
-void do_chmod(argc, argv)
- const char *argv[];
-{
- if (argc == 2) {
- printf("usage: %s mode file-name\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc < 3) {
- (void) strcat(line, " ");
- printf("(mode and file-name) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc != 3) {
- printf("usage: %s mode file-name\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- (void)command("SITE CHMOD %s %s", argv[1], argv[2]);
-}
-
-void do_umask(argc, argv)
- char *argv[];
-{
- int oldverbose = verbose;
-
- verbose = 1;
- (void) command(argc == 1 ? "SITE UMASK" : "SITE UMASK %s", argv[1]);
- verbose = oldverbose;
-}
-
-void idle(argc, argv)
- char *argv[];
-{
- int oldverbose = verbose;
-
- verbose = 1;
- (void) command(argc == 1 ? "SITE IDLE" : "SITE IDLE %s", argv[1]);
- verbose = oldverbose;
-}
-
-/*
- * Ask the other side for help.
- */
-void rmthelp(argc, argv)
- char *argv[];
-{
- int oldverbose = verbose;
-
- verbose = 1;
- (void) command(argc == 1 ? "HELP" : "HELP %s", argv[1]);
- verbose = oldverbose;
-}
-
-/*
- * Terminate session and exit.
- */
-/*VARARGS*/
-void quit()
-{
-
- if (connected)
- disconnect();
- pswitch(1);
- if (connected) {
- disconnect();
- }
- exit(0);
-}
-
-/*
- * Terminate session, but don't exit.
- */
-void disconnect()
-{
- extern int cout;
- extern int data;
-
- if (!connected)
- return;
- (void) command("QUIT");
- cout = (int) NULL;
- connected = 0;
- data = -1;
- if (!proxy) {
- macnum = 0;
- }
-}
-
-int confirm(cmd, file)
- const char *cmd, *file;
-{
- char line[BUFSIZ];
-
- if (!interactive)
- return (1);
- printf("%s %s? ", cmd, file);
- (void) fflush(stdout);
- (void) gets(line);
- return (*line != 'n' && *line != 'N');
-}
-
-#if 0
-static void fatal(msg)
- char *msg;
-{
-
- fprintf(stderr, "ftp: %s\n", msg);
- exit(1);
-}
-#endif
-
-/*
- * Glob a local file name specification with
- * the expectation of a single return value.
- * Can't control multiple values being expanded
- * from the expression, we return only the first.
- */
-int globulize(cpp)
- const char **cpp;
-{
- char **globbed;
-
- if (!doglob)
- return (1);
- globbed = glob(*cpp);
- if (globerr != NULL) {
- printf("%s: %s\n", *cpp, globerr);
- (void) fflush(stdout);
- if (globbed) {
- blkfree(globbed);
- free((char *)globbed);
- }
- return (0);
- }
- if (globbed) {
- *cpp = *globbed++;
- /* don't waste too much memory */
- if (*globbed) {
- blkfree(globbed);
- free((char *)globbed);
- }
- }
- return (1);
-}
-
-void account(argc,argv)
- int argc;
- char **argv;
-{
- char acct[50], *getpass(), *ap;
-
- if (argc > 1) {
- ++argv;
- --argc;
- (void) strncpy(acct,*argv,49);
- acct[49] = '\0';
- while (argc > 1) {
- --argc;
- ++argv;
- (void) strncat(acct,*argv, 49-strlen(acct));
- }
- ap = acct;
- }
- else {
- ap = getpass("Account:");
- }
- (void) command("ACCT %s", ap);
-}
-
-jmp_buf abortprox;
-
-#if 0
-static void
-proxabort()
-{
- extern int proxy;
-
- if (!proxy) {
- pswitch(1);
- }
- if (connected) {
- proxflag = 1;
- }
- else {
- proxflag = 0;
- }
- pswitch(0);
- longjmp(abortprox,1);
-}
-#endif
-
-void doproxy(argc,argv)
- int argc;
- const char *argv[];
-{
- register struct cmd *c;
- struct cmd *getcmd();
-// extern struct cmd cmdtab[];
- extern jmp_buf abortprox;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(command) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s command\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- c = getcmd(argv[1]);
- if (c == (struct cmd *) -1) {
- printf("?Ambiguous command\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (c == 0) {
- printf("?Invalid command\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (!c->c_proxy) {
- printf("?Invalid proxy command\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (setjmp(abortprox)) {
- code = -1;
- return;
- }
-// oldintr = signal(SIGINT, proxabort);
- pswitch(1);
- if (c->c_conn && !connected) {
- printf("Not connected\n");
- (void) fflush(stdout);
- pswitch(0);
-// (void) signal(SIGINT, oldintr);
- code = -1;
- return;
- }
- (*c->c_handler)(argc-1, argv+1);
- if (connected) {
- proxflag = 1;
- }
- else {
- proxflag = 0;
- }
- pswitch(0);
-// (void) signal(SIGINT, oldintr);
-}
-
-void setcase()
-{
- mcase = !mcase;
- printf("Case mapping %s.\n", onoff(mcase));
- (void) fflush(stdout);
- code = mcase;
-}
-
-void setcr()
-{
- crflag = !crflag;
- printf("Carriage Return stripping %s.\n", onoff(crflag));
- (void) fflush(stdout);
- code = crflag;
-}
-
-void setntrans(argc,argv)
- int argc;
- char *argv[];
-{
- if (argc == 1) {
- ntflag = 0;
- printf("Ntrans off.\n");
- (void) fflush(stdout);
- code = ntflag;
- return;
- }
- ntflag++;
- code = ntflag;
- (void) strncpy(ntin, argv[1], 16);
- ntin[16] = '\0';
- if (argc == 2) {
- ntout[0] = '\0';
- return;
- }
- (void) strncpy(ntout, argv[2], 16);
- ntout[16] = '\0';
-}
-
-const char *
-dotrans(name)
- const char *name;
-{
- static char new[MAXPATHLEN];
- const char *cp1;
- char *cp2 = new;
- register int i, ostop, found;
-
- for (ostop = 0; *(ntout + ostop) && ostop < 16; ostop++);
- for (cp1 = name; *cp1; cp1++) {
- found = 0;
- for (i = 0; *(ntin + i) && i < 16; i++) {
- if (*cp1 == *(ntin + i)) {
- found++;
- if (i < ostop) {
- *cp2++ = *(ntout + i);
- }
- break;
- }
- }
- if (!found) {
- *cp2++ = *cp1;
- }
- }
- *cp2 = '\0';
- return(new);
-}
-
-
-void
-setpassive(argc, argv)
- int argc;
- char *argv[];
-{
- passivemode = !passivemode;
- printf("Passive mode %s.\n", onoff(passivemode));
- (void) fflush(stdout);
- code = passivemode;
-}
-
-void setnmap(argc, argv)
- int argc;
- const char *argv[];
-{
- char *cp;
-
- if (argc == 1) {
- mapflag = 0;
- printf("Nmap off.\n");
- (void) fflush(stdout);
- code = mapflag;
- return;
- }
- if (argc < 3) {
- (void) strcat(line, " ");
- printf("(mapout) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 3) {
- printf("Usage: %s [mapin mapout]\n",argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- mapflag = 1;
- code = 1;
- cp = index(altarg, ' ');
- if (proxy) {
- while(*++cp == ' ');
- altarg = cp;
- cp = index(altarg, ' ');
- }
- *cp = '\0';
- (void) strncpy(mapin, altarg, MAXPATHLEN - 1);
- while (*++cp == ' ');
- (void) strncpy(mapout, cp, MAXPATHLEN - 1);
-}
-
-const char *
-domap(name)
- const char *name;
-{
- static char new[MAXPATHLEN];
- const char *cp1 = name;
- char *cpn, *cp2 = mapin;
- const char *tp[9], *te[9];
- int i, toks[9], toknum = 0, match = 1;
-
- for (i=0; i < 9; ++i) {
- toks[i] = 0;
- }
- while (match && *cp1 && *cp2) {
- switch (*cp2) {
- case '\\':
- if (*++cp2 != *cp1) {
- match = 0;
- }
- break;
- case '$':
- if (*(cp2+1) >= '1' && (*cp2+1) <= '9') {
- if (*cp1 != *(++cp2+1)) {
- toks[toknum = *cp2 - '1']++;
- tp[toknum] = cp1;
- while (*++cp1 && *(cp2+1)
- != *cp1);
- te[toknum] = cp1;
- }
- cp2++;
- break;
- }
- /* FALLTHROUGH */
- default:
- if (*cp2 != *cp1) {
- match = 0;
- }
- break;
- }
- if (match && *cp1) {
- cp1++;
- }
- if (match && *cp2) {
- cp2++;
- }
- }
- if (!match && *cp1) /* last token mismatch */
- {
- toks[toknum] = 0;
- }
-
- cpn = new;
- *cpn = '\0';
- cp2 = mapout;
- while (*cp2) {
- match = 0;
- switch (*cp2) {
- case '\\':
- if (*(cp2 + 1)) {
- *cpn++ = *++cp2;
- }
- break;
- case '[':
-LOOP:
- if (*++cp2 == '$' && isdigit(*(cp2+1))) {
- if (*++cp2 == '0') {
- const char *cp3 = name;
-
- while (*cp3) {
- *cpn++ = *cp3++;
- }
- match = 1;
- }
- else if (toks[toknum = *cp2 - '1']) {
- const char *cp3 = tp[toknum];
-
- while (cp3 != te[toknum]) {
- *cpn++ = *cp3++;
- }
- match = 1;
- }
- }
- else {
- while (*cp2 && *cp2 != ',' &&
- *cp2 != ']') {
- if (*cp2 == '\\') {
- cp2++;
- }
- else if (*cp2 == '$' &&
- isdigit(*(cp2+1))) {
- if (*++cp2 == '0') {
- const char *cp3 = name;
-
- while (*cp3) {
- *cpn++ = *cp3++;
- }
- }
- else if (toks[toknum =
- *cp2 - '1']) {
- const char *cp3=tp[toknum];
-
- while (cp3 !=
- te[toknum]) {
- *cpn++ = *cp3++;
- }
- }
- }
- else if (*cp2) {
- *cpn++ = *cp2++;
- }
- }
- if (!*cp2) {
- printf("nmap: unbalanced brackets\n");
- (void) fflush(stdout);
- return(name);
- }
- match = 1;
- cp2--;
- }
- if (match) {
- while (*++cp2 && *cp2 != ']') {
- if (*cp2 == '\\' && *(cp2 + 1)) {
- cp2++;
- }
- }
- if (!*cp2) {
- printf("nmap: unbalanced brackets\n");
- (void) fflush(stdout);
- return(name);
- }
- break;
- }
- switch (*++cp2) {
- case ',':
- goto LOOP;
- case ']':
- break;
- default:
- cp2--;
- goto LOOP;
- }
- break;
- case '$':
- if (isdigit(*(cp2 + 1))) {
- if (*++cp2 == '0') {
- const char *cp3 = name;
-
- while (*cp3) {
- *cpn++ = *cp3++;
- }
- }
- else if (toks[toknum = *cp2 - '1']) {
- const char *cp3 = tp[toknum];
-
- while (cp3 != te[toknum]) {
- *cpn++ = *cp3++;
- }
- }
- break;
- }
- /* intentional drop through */
- default:
- *cpn++ = *cp2;
- break;
- }
- cp2++;
- }
- *cpn = '\0';
- if (!*new) {
- return(name);
- }
- return(new);
-}
-
-void setsunique()
-{
- sunique = !sunique;
- printf("Store unique %s.\n", onoff(sunique));
- (void) fflush(stdout);
- code = sunique;
-}
-
-void setrunique()
-{
- runique = !runique;
- printf("Receive unique %s.\n", onoff(runique));
- (void) fflush(stdout);
- code = runique;
-}
-
-/* change directory to perent directory */
-void cdup()
-{
- if (command("CDUP") == ERROR && code == 500) {
- if (verbose) {
- printf("CDUP command not recognized, trying XCUP\n");
- (void) fflush(stdout);
- }
- (void) command("XCUP");
- }
-}
-
-/* restart transfer at specific point */
-void restart(argc, argv)
- int argc;
- char *argv[];
-{
- extern long atol();
- if (argc != 2)
- printf("restart: offset not specified\n");
- else {
- restart_point = atol(argv[1]);
- printf("restarting at %ld. %s\n", restart_point,
- "execute get, put or append to initiate transfer");
- }
- (void) fflush(stdout);
-}
-
-/* show remote system type */
-void syst()
-{
- (void) command("SYST");
-}
-
-void macdef(argc, argv)
- int argc;
- const char *argv[];
-{
- char *tmp;
- int c;
-
- if (macnum == 16) {
- printf("Limit of 16 macros have already been defined\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(macro name) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc != 2) {
- printf("Usage: %s macro_name\n",argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if (interactive) {
- printf("Enter macro line by line, terminating it with a null line\n");
- (void) fflush(stdout);
- }
- (void) strncpy(macros[macnum].mac_name, argv[1], 8);
- if (macnum == 0) {
- macros[macnum].mac_start = macbuf;
- }
- else {
- macros[macnum].mac_start = macros[macnum - 1].mac_end + 1;
- }
- tmp = macros[macnum].mac_start;
- while (tmp != macbuf+4096) {
- if ((c = getchar()) == EOF) {
- printf("macdef:end of file encountered\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- if ((*tmp = c) == '\n') {
- if (tmp == macros[macnum].mac_start) {
- macros[macnum++].mac_end = tmp;
- code = 0;
- return;
- }
- if (*(tmp-1) == '\0') {
- macros[macnum++].mac_end = tmp - 1;
- code = 0;
- return;
- }
- *tmp = '\0';
- }
- tmp++;
- }
- while (1) {
- while ((c = getchar()) != '\n' && c != EOF)
- /* LOOP */;
- if (c == EOF || getchar() == '\n') {
- printf("Macro not defined - 4k buffer exceeded\n");
- (void) fflush(stdout);
- code = -1;
- return;
- }
- }
-}
-
-/*
- * get size of file on remote machine
- */
-void sizecmd(argc, argv)
- const char *argv[];
-{
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(filename) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s filename\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- (void) command("SIZE %s", argv[1]);
-}
-
-/*
- * get last modification time of file on remote machine
- */
-void modtime(argc, argv)
- const char *argv[];
-{
- int overbose;
-
- if (argc < 2) {
- (void) strcat(line, " ");
- printf("(filename) ");
- (void) fflush(stdout);
- (void) gets(&line[strlen(line)]);
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (argc < 2) {
- printf("usage:%s filename\n", argv[0]);
- (void) fflush(stdout);
- code = -1;
- return;
- }
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
- if (command("MDTM %s", argv[1]) == COMPLETE) {
- int yy, mo, day, hour, min, sec;
- sscanf(reply_string, "%*s %04d%02d%02d%02d%02d%02d", &yy, &mo,
- &day, &hour, &min, &sec);
- /* might want to print this in local time */
- printf("%s\t%02d/%02d/%04d %02d:%02d:%02d GMT\n", argv[1],
- mo, day, yy, hour, min, sec);
- } else
- printf("%s\n", reply_string);
- verbose = overbose;
- (void) fflush(stdout);
-}
-
-/*
- * show status on reomte machine
- */
-void rmtstatus(argc, argv)
- const char *argv[];
-{
- (void) command(argc > 1 ? "STAT %s" : "STAT" , argv[1]);
-}
-
-/*
- * get file if modtime is more recent than current file
- */
-void newer(argc, argv)
- const char *argv[];
-{
- if (getit(argc, argv, -1, "w")) {
- printf("Local file \"%s\" is newer than remote file \"%s\"\n",
- argv[1], argv[2]);
- (void) fflush(stdout);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1985, 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)cmdtab.c 5.9 (Berkeley) 3/21/89";
-#endif /* not lint */
-
-#include "ftp_var.h"
-
-/*
- * User FTP -- Command Tables.
- */
-
-char accounthelp[] = "send account command to remote server";
-char appendhelp[] = "append to a file";
-char asciihelp[] = "set ascii transfer type";
-char beephelp[] = "beep when command completed";
-char binaryhelp[] = "set binary transfer type";
-char casehelp[] = "toggle mget upper/lower case id mapping";
-char cdhelp[] = "change remote working directory";
-char cduphelp[] = "change remote working directory to parent directory";
-char chmodhelp[] = "change file permissions of remote file";
-char connecthelp[] = "connect to remote tftp";
-char crhelp[] = "toggle carriage return stripping on ascii gets";
-char deletehelp[] = "delete remote file";
-char debughelp[] = "toggle/set debugging mode";
-char dirhelp[] = "list contents of remote directory";
-char disconhelp[] = "terminate ftp session";
-char domachelp[] = "execute macro";
-char formhelp[] = "set file transfer format";
-char globhelp[] = "toggle metacharacter expansion of local file names";
-char hashhelp[] = "toggle printing `#' for each buffer transferred";
-char helphelp[] = "print local help information";
-char idlehelp[] = "get (set) idle timer on remote side";
-char lcdhelp[] = "change local working directory";
-char lshelp[] = "list contents of remote directory";
-char macdefhelp[] = "define a macro";
-char mdeletehelp[] = "delete multiple files";
-char mdirhelp[] = "list contents of multiple remote directories";
-char mgethelp[] = "get multiple files";
-char mkdirhelp[] = "make directory on the remote machine";
-char mlshelp[] = "list contents of multiple remote directories";
-char modtimehelp[] = "show last modification time of remote file";
-char modehelp[] = "set file transfer mode";
-char mputhelp[] = "send multiple files";
-char newerhelp[] = "get file if remote file is newer than local file ";
-char nlisthelp[] = "nlist contents of remote directory";
-char nmaphelp[] = "set templates for default file name mapping";
-char ntranshelp[] = "set translation table for default file name mapping";
-char porthelp[] = "toggle use of PORT cmd for each data connection";
-char prompthelp[] = "force interactive prompting on multiple commands";
-char proxyhelp[] = "issue command on alternate connection";
-char pwdhelp[] = "print working directory on remote machine";
-char quithelp[] = "terminate ftp session and exit";
-char quotehelp[] = "send arbitrary ftp command";
-char receivehelp[] = "receive file";
-char regethelp[] = "get file restarting at end of local file";
-char remotehelp[] = "get help from remote server";
-char renamehelp[] = "rename file";
-char restarthelp[]= "restart file transfer at bytecount";
-char rmdirhelp[] = "remove directory on the remote machine";
-char rmtstatushelp[]="show status of remote machine";
-char runiquehelp[] = "toggle store unique for local files";
-char resethelp[] = "clear queued command replies";
-char sendhelp[] = "send one file";
-char passivehelp[] = "enter passive transfer mode";
-char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
-char shellhelp[] = "escape to the shell";
-char sizecmdhelp[] = "show size of remote file";
-char statushelp[] = "show current status";
-char structhelp[] = "set file transfer structure";
-char suniquehelp[] = "toggle store unique on remote machine";
-char systemhelp[] = "show remote system type";
-char tenexhelp[] = "set tenex file transfer type";
-char tracehelp[] = "toggle packet tracing";
-char typehelp[] = "set file transfer type";
-char umaskhelp[] = "get (set) umask on remote side";
-char userhelp[] = "send new user information";
-char verbosehelp[] = "toggle verbose mode";
-
-struct cmd cmdtab[] = {
- { "!", shellhelp, 0, 0, 0, shell },
- { "$", domachelp, 1, 0, 0, domacro },
- { "account", accounthelp, 0, 1, 1, account},
- { "append", appendhelp, 1, 1, 1, put },
- { "ascii", asciihelp, 0, 1, 1, setascii },
- { "bell", beephelp, 0, 0, 0, setbell },
- { "binary", binaryhelp, 0, 1, 1, setbinary },
- { "bye", quithelp, 0, 0, 0, quit },
- { "case", casehelp, 0, 0, 1, setcase },
- { "cd", cdhelp, 0, 1, 1, cd },
- { "cdup", cduphelp, 0, 1, 1, cdup },
- { "chmod", chmodhelp, 0, 1, 1, do_chmod },
- { "close", disconhelp, 0, 1, 1, disconnect },
- { "cr", crhelp, 0, 0, 0, setcr },
- { "delete", deletehelp, 0, 1, 1, delete },
- { "debug", debughelp, 0, 0, 0, setdebug },
- { "dir", dirhelp, 1, 1, 1, ls },
- { "disconnect", disconhelp, 0, 1, 1, disconnect },
- { "form", formhelp, 0, 1, 1, setform },
- { "get", receivehelp, 1, 1, 1, get },
- { "glob", globhelp, 0, 0, 0, setglob },
- { "hash", hashhelp, 0, 0, 0, sethash },
- { "help", helphelp, 0, 0, 1, help },
- { "idle", idlehelp, 0, 1, 1, idle },
- { "image", binaryhelp, 0, 1, 1, setbinary },
- { "lcd", lcdhelp, 0, 0, 0, lcd },
- { "ls", lshelp, 1, 1, 1, ls },
- { "macdef", macdefhelp, 0, 0, 0, macdef },
- { "mdelete", mdeletehelp, 1, 1, 1, mdelete },
- { "mdir", mdirhelp, 1, 1, 1, mls },
- { "mget", mgethelp, 1, 1, 1, mget },
- { "mkdir", mkdirhelp, 0, 1, 1, makedir },
- { "mls", mlshelp, 1, 1, 1, mls },
- { "mode", modehelp, 0, 1, 1, fsetmode },
- { "modtime", modtimehelp, 0, 1, 1, modtime },
- { "mput", mputhelp, 1, 1, 1, mput },
- { "newer", newerhelp, 1, 1, 1, newer },
- { "nmap", nmaphelp, 0, 0, 1, setnmap },
- { "nlist", nlisthelp, 1, 1, 1, ls },
- { "ntrans", ntranshelp, 0, 0, 1, setntrans },
- { "open", connecthelp, 0, 0, 1, setpeer },
- { "passive",passivehelp,0, 0, 0, setpassive },
- { "prompt", prompthelp, 0, 0, 0, setprompt },
- { "proxy", proxyhelp, 0, 0, 1, doproxy },
- { "sendport", porthelp, 0, 0, 0, setport },
- { "put", sendhelp, 1, 1, 1, put },
- { "pwd", pwdhelp, 0, 1, 1, pwd },
- { "quit", quithelp, 0, 0, 0, quit },
- { "quote", quotehelp, 1, 1, 1, quote },
- { "recv", receivehelp, 1, 1, 1, get },
- { "reget", regethelp, 1, 1, 1, reget },
- { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
- { "rhelp", remotehelp, 0, 1, 1, rmthelp },
- { "rename", renamehelp, 0, 1, 1, renamefile },
- { "reset", resethelp, 0, 1, 1, reset },
- { "restart", restarthelp, 1, 1, 1, restart },
- { "rmdir", rmd