Various Win32 fixes. Win95 doesn't support MoveFileEx() (which was used for a
[openssl.git] / apps / apps.c
index 7c9510e3b54f03a99e707a830a5929dab2ac1703..f9cc27052b58b46f1737a8bb6480862b15eaa059 100644 (file)
@@ -1,5 +1,5 @@
 /* apps/apps.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
 #include "apps.h"
 #undef NON_MAIN
 
-#ifdef WIN16
-#define APPS_WIN16
-#ifdef FLAT_BUILD
-#include "bss_file.c"
-#else
-#include "../crypto/bio/bss_file.c"
-#endif
+#ifdef WINDOWS
+#  include "bss_file.c"
 #endif
 
-#ifndef NOPROTO
 int app_init(long mesgwin);
-#else
-int app_init();
-#endif
-
 #ifdef undef /* never finished - probably never will be :-) */
-int args_from_file(file,argc,argv)
-char *file;
-int *argc;
-char **argv[];
+int args_from_file(char *file, int *argc, char **argv[])
        {
        FILE *fp;
        int num,i;
@@ -162,8 +149,7 @@ char **argv[];
        }
 #endif
 
-int str2fmt(s)
-char *s;
+int str2fmt(char *s)
        {
        if      ((*s == 'D') || (*s == 'd'))
                return(FORMAT_ASN1);
@@ -178,10 +164,7 @@ char *s;
        }
 
 #if defined(MSDOS) || defined(WIN32) || defined(WIN16)
-void program_name(in,out,size)
-char *in;
-char *out;
-int size;
+void program_name(char *in, char *out, int size)
        {
        int i,n;
        char *p=NULL;
@@ -218,10 +201,7 @@ int size;
        out[n]='\0';
        }
 #else
-void program_name(in,out,size)
-char *in;
-char *out;
-int size;
+void program_name(char *in, char *out, int size)
        {
        char *p;
 
@@ -236,22 +216,22 @@ int size;
 #endif
 
 #ifdef WIN32
-int WIN32_rename(from,to)
-char *from;
-char *to;
+int WIN32_rename(char *from, char *to)
        {
+#ifdef WINNT
        int ret;
+/* Note: MoveFileEx() doesn't work under Win95, Win98 */
 
        ret=MoveFileEx(from,to,MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED);
        return(ret?0:-1);
+#else
+        unlink(to);
+        return MoveFile(from, to);
+#endif
        }
 #endif
 
-int chopup_args(arg,buf,argc,argv)
-ARGS *arg;
-char *buf;
-int *argc;
-char **argv[];
+int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
        {
        int num,len,i;
        char *p;
@@ -317,8 +297,7 @@ char **argv[];
        }
 
 #ifndef APP_INIT
-int app_init(mesgwin)
-long mesgwin;
+int app_init(long mesgwin)
        {
        return(1);
        }