OBJS = $(OBJ_DIR)\getpass.obj $(OBJ_DIR)\homedir.obj $(OBJ_DIR)\hugehelp.obj &
$(OBJ_DIR)\main.obj $(OBJ_DIR)\urlglob.obj $(OBJ_DIR)\writeenv.obj &
- $(OBJ_DIR)\writeout.obj $(OBJ_DIR)\curlutil.obj $(OBJ_DIR)\rawstr.obj
+ $(OBJ_DIR)\writeout.obj $(OBJ_DIR)\curlutil.obj $(OBJ_DIR)\rawstr.obj &
+ $(OBJ_DIR)\os-specific.obj
RESOURCE = $(OBJ_DIR)\curl.res
version.h ..\include\curl\curlver.h ..\lib\curlx.h &
..\include\curl\mprintf.h ..\lib\strequal.h ..\lib\strtoofft.h &
..\lib\setup.h ..\lib\config-win32.h ..\include\curl\curlbuild.h &
- ..\include\curl\curlrules.h ..\lib\timeval.h ..\lib\memdebug.h
+ ..\include\curl\curlrules.h ..\lib\timeval.h ..\lib\memdebug.h &
+ os-specific.h
$(OBJ_DIR)\urlglob.obj: urlglob.c setup.h config-win32.h ..\lib\setup_once.h &
..\include\curl\curl.h ..\include\curl\curlver.h &
..\include\curl\easy.h ..\include\curl\multi.h ..\include\curl\curl.h &
..\include\curl\mprintf.h urlglob.h ..\lib\memdebug.h ..\lib\setup.h &
..\lib\config-win32.h ..\include\curl\curlbuild.h &
- ..\include\curl\curlrules.h
+ ..\include\curl\curlrules.h os-specific.h
$(OBJ_DIR)\writeenv.obj: writeenv.c setup.h config-win32.h ..\lib\setup_once.h
$(OBJ_DIR)\curlutil.obj: curlutil.c setup.h config-win32.h ..\lib\setup_once.h &
curlutil.h
+$(OBJ_DIR)\os-specific.obj: os-specific.c os-specific.h setup.h config-win32.h &
+ ..\lib\setup_once.h
+
$(OBJ_DIR)\rawstr.obj: ..\lib\rawstr.c ..\lib\setup.h ..\lib\config-win32.h &
..\include\curl\curlbuild.h ..\include\curl\curlrules.h ..\lib\setup_once.h &
..\include\curl\curl.h ..\include\curl\curlver.h ..\include\curl\curlrules.h &
$(top_srcdir)/lib/rawstr.c
CURL_SOURCES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
- getpass.c homedir.c curlutil.c
+ getpass.c homedir.c curlutil.c os-specific.c
CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
- config-riscos.h urlglob.h version.h \
+ config-riscos.h urlglob.h version.h os-specific.h \
writeout.h writeenv.h getpass.h homedir.h curlutil.h
curl_SOURCES = $(CURL_SOURCES) $(CURLX_ONES) $(CURL_HFILES)
o.main: c.main
gcc $(compileropts) -c -o main.o c.main
+o.os-specific: c.os-specific
+ gcc $(compileropts) -c -o os-specific.o c.os-specific
+
o.urlglob: c.urlglob
gcc $(compileropts) -c -o urlglob.o c.urlglob
o.main: c.main
o.main: h.setup
+o.main: h.os-specific
o.main: h.urlglob
o.main: h.writeout
o.main: h.version
+o.os-specific: c.os-specific
+o.os-specific: h.setup
+o.os-specific: h.os-specific
+
o.urlglob: c.urlglob
o.urlglob: h.setup
+o.urlglob: h.os-specific
o.urlglob: h.urlglob
o.writeout: c.writeout
getpassr.obj \\r
homedirr.obj \\r
curlutilr.obj \\r
+ os-specificr.obj \\r
rawstrr.obj \\r
strtoofftr.obj \\r
mainr.obj \\r
getpassd.obj \\r
homedird.obj \\r
curlutild.obj \\r
+ os-specificd.obj \\r
rawstrd.obj \\r
strtoofftd.obj \\r
maind.obj \\r
$(CCR) $(CFLAGS) /Fo"$@" homedir.c\r
curlutilr.obj: curlutil.c\r
$(CCR) $(CFLAGS) /Fo"$@" curlutil.c\r
+os-specificr.obj: os-specific.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" os-specific.c\r
rawstrr.obj: ../lib/rawstr.c\r
$(CCR) $(CFLAGS) /Fo"$@" ../lib/rawstr.c\r
strtoofftr.obj: ../lib/strtoofft.c\r
$(CCD) $(CFLAGS) /Fo"$@" homedir.c\r
curlutild.obj: curlutil.c\r
$(CCD) $(CFLAGS) /Fo"$@" curlutil.c\r
+os-specificd.obj: os-specific.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" os-specific.c\r
rawstrd.obj: ../lib/rawstr.c\r
$(CCD) $(CFLAGS) /Fo"$@" ../lib/rawstr.c\r
strtoofftd.obj: ../lib/strtoofft.c\r
#include <netinet/tcp.h> /* for TCP_KEEPIDLE, TCP_KEEPINTVL */
#endif
+#ifdef __VMS
+# include "curlmsg_vms.h"
+#endif
+
+#include "os-specific.h"
+
/* The last #include file should be: */
#ifdef CURLDEBUG
#ifndef CURLTOOLDEBUG
#define mkdir(x,y) (mkdir)(x)
#endif
-#ifdef VMS
-#include "curlmsg_vms.h"
-#endif
-
/*
* Large file support (>2Gb) using WIN32 functions.
*/
show_error:
-#ifdef VMS
- if (!config->showerror) {
- vms_show = VMSSTS_HIDE;
+#ifdef __VMS
+ if(is_vms_shell()) {
+ /* VMS DCL shell behavior */
+ if(!config->showerror) {
+ vms_show = VMSSTS_HIDE;
+ }
}
-#else
- if((res!=CURLE_OK) && config->showerror) {
- fprintf(config->errors, "curl: (%d) %s\n", res,
- errorbuffer[0]? errorbuffer:
- curl_easy_strerror((CURLcode)res));
- if(CURLE_SSL_CACERT == res) {
+ else
+#endif
+ {
+ if((res!=CURLE_OK) && config->showerror) {
+ fprintf(config->errors, "curl: (%d) %s\n", res,
+ errorbuffer[0]? errorbuffer:
+ curl_easy_strerror((CURLcode)res));
+ if(CURLE_SSL_CACERT == res) {
#define CURL_CA_CERT_ERRORMSG1 \
"More details here: http://curl.haxx.se/docs/sslcerts.html\n\n" \
"curl performs SSL certificate verification by default, using a \"bundle\"\n" \
"If you'd like to turn off curl's verification of the certificate, use\n" \
" the -k (or --insecure) option.\n"
- fprintf(config->errors, "%s%s",
- CURL_CA_CERT_ERRORMSG1,
- CURL_CA_CERT_ERRORMSG2 );
+ fprintf(config->errors, "%s%s",
+ CURL_CA_CERT_ERRORMSG1,
+ CURL_CA_CERT_ERRORMSG2 );
+ }
}
}
-#endif
if (outfile && !curlx_strequal(outfile, "-") && outs.stream)
fclose(outs.stream);
#ifdef __NOVELL_LIBC__
pressanykey();
#endif
-#ifdef VMS
- if (res > CURL_LAST) res = CURL_LAST; /* If CURL_LAST exceeded then */
- return (vms_cond[res]|vms_show); /* curlmsg.h is out of sync. */
+#ifdef __VMS
+ vms_special_exit(res, vms_show);
#else
return res;
#endif
README = ../docs/MANUAL
MKHELP = ../src/mkhelp.pl
-OBJS = getpass.c hugehelp.c main.c urlglob.c writeenv.c writeout.c curlutil.c ../lib/rawstr.c
+OBJS = getpass.c hugehelp.c main.c urlglob.c writeenv.c writeout.c curlutil.c os-specific.c ../lib/rawstr.c
all: hugehelp.c $(OBJS:.c=.o)
--- /dev/null
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * $Id$
+ ***************************************************************************/
+#include "setup.h"
+
+#include <curl/curl.h>
+
+#ifdef __VMS
+# include "curlmsg_vms.h"
+#endif
+
+#define ENABLE_CURLX_PRINTF
+#include "curlx.h"
+
+#include "os-specific.h"
+
+#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG)
+# include "memdebug.h"
+#endif
+
+#ifdef __VMS
+
+int vms_shell = -1;
+
+/* VMS has a DCL shell and and also has Unix shells ported to it.
+ * When curl is running under a Unix shell, we want it to be as much
+ * like Unix as possible.
+ */
+int is_vms_shell(void)
+{
+ char *shell;
+
+ /* Have we checked the shell yet? */
+ if(vms_shell >= 0)
+ return vms_shell;
+
+ shell = getenv("SHELL");
+
+ /* No shell, means DCL */
+ if(shell == NULL) {
+ vms_shell = 1;
+ return 1;
+ }
+
+ /* Have to make sure some one did not set shell to DCL */
+ if(strcmp(shell, "DCL") == 0) {
+ vms_shell = 1;
+ return 1;
+ }
+
+ vms_shell = 0;
+ return 0;
+}
+
+/*
+ * VMS has two exit() routines. When running under a Unix style shell, then
+ * Unix style and the __posix_exit() routine is used.
+ *
+ * When running under the DCL shell, then the VMS encoded codes and decc$exit()
+ * is used.
+ *
+ * We can not use exit() or return a code from main() because the actual
+ * routine called depends on both the compiler version, compile options, and
+ * feature macro settings, and one of the exit routines is hidden at compile
+ * time.
+ *
+ * Since we want Curl to work properly under the VMS DCL shell and Unix
+ * shells under VMS, this routine should compile correctly regardless of
+ * the settings.
+ */
+
+void vms_special_exit(int code, int vms_show)
+{
+ int vms_code;
+
+ /* The Posix exit mode is only available after VMS 7.0 */
+#if __CRTL_VER >= 70000000
+ if(is_vms_shell() == 0) {
+ decc$__posix_exit(code);
+ }
+#endif
+
+ if(code > CURL_LAST) { /* If CURL_LAST exceeded then */
+ vms_code = CURL_LAST; /* curlmsg.h is out of sync. */
+ }
+ else {
+ vms_code = vms_cond[code] | vms_show;
+ }
+ decc$exit(vms_code);
+}
+
+#endif /* __VMS */
+
--- /dev/null
+#ifndef HEADER_CURL_OS_SPECIFIC_H
+#define HEADER_CURL_OS_SPECIFIC_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * $Id$
+ ***************************************************************************/
+
+#ifdef __VMS
+
+extern int vms_shell;
+
+void decc$__posix_exit(int __status);
+void decc$exit(int __status);
+
+int is_vms_shell(void);
+void vms_special_exit(int code, int vms_show);
+
+#undef exit
+#define exit(__code) vms_special_exit((__code), (0))
+
+#endif /* __VMS */
+
+#endif /* HEADER_CURL_OS_SPECIFIC_H */
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
#include <curl/mprintf.h>
#include "urlglob.h"
+#include "os-specific.h"
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG)
#include "memdebug.h"
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\os-specific.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=..\lib\rawstr.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\os-specific.h\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\setup.h\r
# End Source File\r
# Begin Source File\r