aboutsummaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-04-16 09:01:16 +0000
committerYang Tse <yangsita@gmail.com>2007-04-16 09:01:16 +0000
commit0563a7a9238843b5c4a0338452999c8c26623198 (patch)
tree211ce60c12203bd52b9b054a77eb60e5f8b4488b /ares
parent945ba7cb7ed834762400b832d3201d4dbbb8679a (diff)
ares_getopt() command-line parser function does not belong to actual
c-ares library. It is just a convinience source code helper function for use in example programs adig.c and ahost.c
Diffstat (limited to 'ares')
-rw-r--r--ares/Makefile.inc2
-rw-r--r--ares/Makefile.vc612
-rw-r--r--ares/adig.c1
-rw-r--r--ares/ahost.c1
-rw-r--r--ares/ares.h1
-rw-r--r--ares/ares_getopt.c4
-rw-r--r--ares/ares_getopt.h37
-rw-r--r--ares/vc/adig/adig.dsp8
-rw-r--r--ares/vc/ahost/ahost.dsp30
-rw-r--r--ares/vc/areslib/areslib.dsp4
10 files changed, 73 insertions, 27 deletions
diff --git a/ares/Makefile.inc b/ares/Makefile.inc
index 332f8d57c..55735e2d6 100644
--- a/ares/Makefile.inc
+++ b/ares/Makefile.inc
@@ -6,7 +6,7 @@ ares_timeout.c ares_destroy.c ares_mkquery.c ares_version.c \
ares_expand_name.c ares_parse_a_reply.c windows_port.c \
ares_expand_string.c ares_parse_ptr_reply.c ares_parse_aaaa_reply.c \
ares_getnameinfo.c inet_net_pton.c bitncmp.c inet_ntop.c \
-ares_parse_ns_reply.c ares_getopt.c
+ares_parse_ns_reply.c
HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h \
nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h \
diff --git a/ares/Makefile.vc6 b/ares/Makefile.vc6
index 7a43b5453..7982638aa 100644
--- a/ares/Makefile.vc6
+++ b/ares/Makefile.vc6
@@ -57,7 +57,6 @@ OBJECTS = $(OBJ_DIR)\ares_fds.obj \
$(OBJ_DIR)\ares__read_line.obj \
$(OBJ_DIR)\ares_gethostbyname.obj \
$(OBJ_DIR)\ares_getnameinfo.obj \
- $(OBJ_DIR)\ares_getopt.obj \
$(OBJ_DIR)\ares_strerror.obj \
$(OBJ_DIR)\ares_cancel.obj \
$(OBJ_DIR)\ares_init.obj \
@@ -122,15 +121,14 @@ $(DEF_FILE): $(OBJECTS) Makefile.VC6
@echo ares_inet_pton >> $@
@echo ares_writev >> $@
@echo ares_getnameinfo >> $@
- @echo ares_getopt >> $@
@echo ares_gettimeofday >> $@
@echo ares_parse_aaaa_reply >> $@
-ahost.exe: $(OBJ_DIR) $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\getopt.obj cares_imp.lib
- link $(LDFLAGS) -out:$@ $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\getopt.obj cares_imp.lib $(EX_LIBS)
+ahost.exe: $(OBJ_DIR) $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
+ link $(LDFLAGS) -out:$@ $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
-adig.exe: $(OBJ_DIR) $(OBJ_DIR)\adig.obj $(OBJ_DIR)\getopt.obj cares_imp.lib
- link $(LDFLAGS) -out:$@ $(OBJ_DIR)\adig.obj $(OBJ_DIR)\getopt.obj cares_imp.lib $(EX_LIBS)
+adig.exe: $(OBJ_DIR) $(OBJ_DIR)\adig.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
+ link $(LDFLAGS) -out:$@ $(OBJ_DIR)\adig.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
clean:
- del $(OBJ_DIR)\*.obj *.ilk *.pdb *.pbt *.pbi *.pbo *._xe *.map
@@ -232,4 +230,4 @@ $(OBJ_DIR)\bitncmp.obj: bitncmp.c bitncmp.h
$(OBJ_DIR)\inet_ntop.obj: inet_ntop.c setup.h setup_once.h nameser.h \
ares_ipv6.h inet_ntop.h
-$(OBJ_DIR)\ares_getopt.obj: ares_getopt.c setup.h setup_once.h ares.h
+$(OBJ_DIR)\ares_getopt.obj: ares_getopt.c ares_getopt.h
diff --git a/ares/adig.c b/ares/adig.c
index 446d55bc5..3a5c63efd 100644
--- a/ares/adig.c
+++ b/ares/adig.c
@@ -42,6 +42,7 @@
#include "ares.h"
#include "ares_dns.h"
#include "inet_ntop.h"
+#include "ares_getopt.h"
#ifdef WATT32
#undef WIN32 /* Redefined in MingW headers */
diff --git a/ares/ahost.c b/ares/ahost.c
index d6a227f67..dfb51a931 100644
--- a/ares/ahost.c
+++ b/ares/ahost.c
@@ -38,6 +38,7 @@
#include "ares_dns.h"
#include "inet_ntop.h"
#include "inet_net_pton.h"
+#include "ares_getopt.h"
#ifndef optind
extern int optind;
diff --git a/ares/ares.h b/ares/ares.h
index 18d3a724c..83a1c8e46 100644
--- a/ares/ares.h
+++ b/ares/ares.h
@@ -218,7 +218,6 @@ int ares_parse_ns_reply(const unsigned char *abuf, int alen,
void ares_free_string(void *str);
void ares_free_hostent(struct hostent *host);
const char *ares_strerror(int code);
-int ares_getopt(int nargc, char * const nargv[], const char *ostr);
#ifdef __cplusplus
}
diff --git a/ares/ares_getopt.c b/ares/ares_getopt.c
index a14b6da30..c3e81fc40 100644
--- a/ares/ares_getopt.c
+++ b/ares/ares_getopt.c
@@ -44,12 +44,10 @@
* #endif
*/
-#include "setup.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "ares.h"
+#include "ares_getopt.h"
/* declarations to provide consistent linkage */
extern char *optarg;
diff --git a/ares/ares_getopt.h b/ares/ares_getopt.h
new file mode 100644
index 000000000..e15dc6bfc
--- /dev/null
+++ b/ares/ares_getopt.h
@@ -0,0 +1,37 @@
+#ifndef ARES_GETOPT_H
+#define ARES_GETOPT_H
+
+/*
+ * Copyright (c) 1987-2001 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:
+ *
+ * A. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * B. 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.
+ * C. Neither the names of the copyright holders 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 COPYRIGHT HOLDERS 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.
+ */
+
+
+int ares_getopt(int nargc, char * const nargv[], const char *ostr);
+
+
+#endif /* ARES_GETOPT_H */
diff --git a/ares/vc/adig/adig.dsp b/ares/vc/adig/adig.dsp
index 38d6d7de5..21cabd578 100644
--- a/ares/vc/adig/adig.dsp
+++ b/ares/vc/adig/adig.dsp
@@ -89,10 +89,18 @@ LINK32=link.exe
SOURCE=..\..\adig.c
# End Source File
+# Begin Source File
+
+SOURCE=..\..\ares_getopt.c
+# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\ares_getopt.h
+# End Source File
# End Group
# Begin Group "Resource Files"
diff --git a/ares/vc/ahost/ahost.dsp b/ares/vc/ahost/ahost.dsp
index 772c47682..cefccc2fb 100644
--- a/ares/vc/ahost/ahost.dsp
+++ b/ares/vc/ahost/ahost.dsp
@@ -7,19 +7,19 @@
CFG=ahost - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "ahost.mak".
-!MESSAGE
+!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "ahost.mak" CFG="ahost - Win32 Debug"
-!MESSAGE
+!MESSAGE
!MESSAGE Possible choices for configuration are:
-!MESSAGE
+!MESSAGE
!MESSAGE "ahost - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ahost - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
+!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
@@ -48,7 +48,7 @@ BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\areslib\Release"
!ELSEIF "$(CFG)" == "ahost - Win32 Debug"
@@ -63,18 +63,18 @@ LINK32=link.exe
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 wsock32.lib areslib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\areslib\Debug"
-!ENDIF
+!ENDIF
# Begin Target
@@ -87,10 +87,18 @@ LINK32=link.exe
SOURCE=..\..\ahost.c
# End Source File
+# Begin Source File
+
+SOURCE=..\..\ares_getopt.c
+# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\ares_getopt.h
+# End Source File
# End Group
# Begin Group "Resource Files"
diff --git a/ares/vc/areslib/areslib.dsp b/ares/vc/areslib/areslib.dsp
index 9e9d9bdad..05061afff 100644
--- a/ares/vc/areslib/areslib.dsp
+++ b/ares/vc/areslib/areslib.dsp
@@ -129,10 +129,6 @@ SOURCE=..\..\ares_gethostbyname.c
# End Source File
# Begin Source File
-SOURCE=..\..\ares_getopt.c
-# End Source File
-# Begin Source File
-
SOURCE=..\..\ares_getsock.c
# End Source File
# Begin Source File