From aef40e6197cea8075214bd63641880e5823e2800 Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 29 Oct 1999 03:05:12 +0000 Subject: * win/tclWinTest.c: added testvolumetype command, as atime is completely ignored for Windows FAT file systems * win/tclWinPort.h: added sys/utime.h to includes --- win/makefile.vc | 10 ++++---- win/tclWinPort.h | 3 ++- win/tclWinTest.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index f14fdcc..00d7c8b 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -6,7 +6,7 @@ # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # -# RCS: @(#) $Id: makefile.vc,v 1.44 1999/10/05 22:47:05 hobbs Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.45 1999/10/29 03:05:12 hobbs Exp $ # Does not depend on the presence of any environment variables in # order to compile tcl; all needed information is derived from @@ -35,11 +35,11 @@ # ROOT = .. -TOOLS32 = c:\program files\devstudio\vc -TOOLS32_rc = c:\program files\devstudio\sharedide +TOOLS32 = c:\Progra~1\devstudio\vc +TOOLS32_rc = c:\Progra~1\devstudio\sharedide TOOLS16 = c:\msvc -INSTALLDIR = c:\program files\Tcl +INSTALLDIR = c:\Progra~1\Tcl # Set this to the appropriate value of /MACHINE: for your platform MACHINE = IX86 @@ -48,7 +48,7 @@ MACHINE = IX86 #THREADDEFINES = -DTCL_THREADS=1 # Set NODEBUG to 0 to compile with symbols -NODEBUG = 1 +NODEBUG = 0 # The following defines can be used to control the amount of debugging # code that is added to the compilation. diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 1f0e46d..2d171b1 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.10 1999/07/22 21:50:57 redman Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.11 1999/10/29 03:05:13 hobbs Exp $ */ #ifndef _TCLWINPORT @@ -61,6 +61,7 @@ typedef float *TCHAR; #ifndef __MWERKS__ #include #include +#include #endif #include diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 826355f..07f198b 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinTest.c,v 1.3 1999/04/16 00:48:10 stanton Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.4 1999/10/29 03:05:13 hobbs Exp $ */ #include "tclWinInt.h" @@ -16,9 +16,12 @@ /* * Forward declarations of procedures defined later in this file: */ -int TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp)); -static int TesteventloopCmd _ANSI_ARGS_((ClientData dummy, - Tcl_Interp *interp, int argc, char **argv)); +int TclplatformtestInit _ANSI_ARGS_((Tcl_Interp *interp)); +static int TesteventloopCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int argc, char **argv)); +static int TestvolumetypeCmd _ANSI_ARGS_((ClientData dummy, + Tcl_Interp *interp, int objc, + Tcl_Obj *CONST objv[])); /* *---------------------------------------------------------------------- @@ -47,6 +50,8 @@ TclplatformtestInit(interp) Tcl_CreateCommand(interp, "testeventloop", TesteventloopCmd, (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); + Tcl_CreateObjCommand(interp, "testvolumetype", TestvolumetypeCmd, + (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); return TCL_OK; } @@ -127,3 +132,59 @@ TesteventloopCmd(clientData, interp, argc, argv) } return TCL_OK; } + +/* + *---------------------------------------------------------------------- + * + * Testvolumetype -- + * + * This procedure implements the "testvolumetype" command. It is + * used to check the volume type (FAT, NTFS) of a volume. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TestvolumetypeCmd(clientData, interp, objc, objv) + ClientData clientData; /* Not used. */ + Tcl_Interp *interp; /* Current interpreter. */ + int objc; /* Number of arguments. */ + Tcl_Obj *CONST objv[]; /* Argument objects. */ +{ +#define VOL_BUF_SIZE 32 + int found; + char volType[VOL_BUF_SIZE]; + char *path; + + if (objc > 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?name?"); + return TCL_ERROR; + } + if (objc == 2) { + /* + * path has to be really a proper volume, but we don't + * get query APIs for that until NT5 + */ + path = Tcl_GetString(objv[1]); + } else { + path = NULL; + } + found = GetVolumeInformationA(path, NULL, 0, NULL, NULL, + NULL, volType, VOL_BUF_SIZE); + + if (found == 0) { + Tcl_AppendResult(interp, "could not get volume type for \"", + (path?path:""), "\"", (char *) NULL); + TclWinConvertError(GetLastError()); + return TCL_ERROR; + } + Tcl_SetResult(interp, volType, TCL_VOLATILE); + return TCL_OK; +#undef VOL_BUF_SIZE +} -- cgit v0.12