summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-04-16 13:36:33 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-04-16 13:36:33 (GMT)
commit3b2f0df2b4603b0565ad30e1e15ae9f0bfe3cb5f (patch)
tree88437ef1c667959b00a3b86ee638cc3a94300aab /win
parentb443cf5d2f6f6c75dc77a88987ed558a2fca9ba5 (diff)
downloadtcl-3b2f0df2b4603b0565ad30e1e15ae9f0bfe3cb5f.zip
tcl-3b2f0df2b4603b0565ad30e1e15ae9f0bfe3cb5f.tar.gz
tcl-3b2f0df2b4603b0565ad30e1e15ae9f0bfe3cb5f.tar.bz2
Complete the purge of K&R function definitions from manually-written code.
Diffstat (limited to 'win')
-rw-r--r--win/nmakehlp.c68
-rw-r--r--win/tclAppInit.c16
-rw-r--r--win/tclWinChan.c14
-rw-r--r--win/tclWinTest.c16
4 files changed, 70 insertions, 44 deletions
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 044cc8f..41419ef 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -6,11 +6,11 @@
*
* Copyright (c) 2002 by David Gravereaux.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* ----------------------------------------------------------------------------
- * RCS: @(#) $Id: nmakehlp.c,v 1.15 2007/02/09 06:43:00 mistachkin Exp $
+ * RCS: @(#) $Id: nmakehlp.c,v 1.16 2007/04/16 13:36:36 dkf Exp $
* ----------------------------------------------------------------------------
*/
@@ -241,7 +241,7 @@ CheckForCompilerFeature(
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL);
return 2;
}
@@ -367,7 +367,7 @@ CheckForLinkerFeature(
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
- WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
+ WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg,lstrlen(msg), &err,NULL);
return 2;
}
@@ -408,9 +408,9 @@ CheckForLinkerFeature(
*/
return !(strstr(Out.buffer, "LNK1117") != NULL ||
- strstr(Err.buffer, "LNK1117") != NULL ||
- strstr(Out.buffer, "LNK4044") != NULL ||
- strstr(Err.buffer, "LNK4044") != NULL);
+ strstr(Err.buffer, "LNK1117") != NULL ||
+ strstr(Out.buffer, "LNK4044") != NULL ||
+ strstr(Err.buffer, "LNK4044") != NULL);
}
DWORD WINAPI
@@ -457,18 +457,16 @@ GrepForDefine(
const char *file,
const char *string)
{
- FILE *f;
char s1[51], s2[51], s3[51];
- int r = 0;
- double d1;
+ FILE *f = fopen(file, "rt");
- f = fopen(file, "rt");
if (f == NULL) {
return 0;
}
do {
- r = fscanf(f, "%50s", s1);
+ int r = fscanf(f, "%50s", s1);
+
if (r == 1 && !strcmp(s1, "#define")) {
/*
* Get next two words.
@@ -484,6 +482,8 @@ GrepForDefine(
*/
if (!strcmp(s2, string)) {
+ double d1;
+
fclose(f);
/*
@@ -506,29 +506,49 @@ GrepForDefine(
/*
* GetVersionFromFile --
* Looks for a match string in a file and then returns the version
- * following the match where a version is anything acceptable to
- * package provide or package ifneeded.
+ * following the match where a version is anything acceptable to *
+ * package provide or package ifneeded.
*/
const char *
-GetVersionFromFile(const char *filename, const char *match)
+GetVersionFromFile(
+ const char *filename,
+ const char *match)
{
size_t cbBuffer = 100;
static char szBuffer[100];
char *szResult = NULL;
FILE *fp = fopen(filename, "r");
+
if (fp != NULL) {
- /* read data until we see our match string */
+ /*
+ * Read data until we see our match string.
+ */
+
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
LPSTR p, q;
- if ((p = strstr(szBuffer, match)) != NULL) {
- /* skip to first digit */
- while (*p && !isdigit(*p)) ++p;
- /* find ending whitespace */
+
+ p = strstr(szBuffer, match);
+ if (p != NULL) {
+ /*
+ * Skip to first digit.
+ */
+
+ while (*p && !isdigit(*p)) {
+ ++p;
+ }
+
+ /*
+ * Find ending whitespace.
+ */
+
q = p;
- while (*q && (isalnum(*q) || *q == '.')) ++q;
- memcpy(szBuffer, p, (q - p));
- szBuffer[(q-p)] = 0;
+ while (*q && (isalnum(*q) || *q == '.')) {
+ ++q;
+ }
+
+ memcpy(szBuffer, p, q - p);
+ szBuffer[q-p] = 0;
szResult = szBuffer;
break;
}
diff --git a/win/tclAppInit.c b/win/tclAppInit.c
index 65318b6..c4ee1c4 100644
--- a/win/tclAppInit.c
+++ b/win/tclAppInit.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAppInit.c,v 1.24 2007/03/19 16:59:09 dgp Exp $
+ * RCS: @(#) $Id: tclAppInit.c,v 1.25 2007/04/16 13:36:36 dkf Exp $
*/
#include "tcl.h"
@@ -47,7 +47,9 @@ static void setargv(int *argcPtr, char ***argvPtr);
*/
int
-main(int argc, char *argv[])
+main(
+ int argc,
+ char *argv[])
{
/*
* The following #if block allows you to change the AppInit function by
@@ -122,8 +124,8 @@ main(int argc, char *argv[])
*/
int
-Tcl_AppInit(interp)
- Tcl_Interp *interp; /* Interpreter for application. */
+Tcl_AppInit(
+ Tcl_Interp *interp) /* Interpreter for application. */
{
if (Tcl_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
@@ -218,9 +220,9 @@ Tcl_AppInit(interp)
#if defined(__GNUC__)
static void
-setargv(argcPtr, argvPtr)
- int *argcPtr; /* Filled with number of argument strings. */
- char ***argvPtr; /* Filled with argument strings (malloc'd). */
+setargv(
+ int *argcPtr, /* Filled with number of argument strings. */
+ char ***argvPtr) /* Filled with argument strings (malloc'd). */
{
char *cmdLine, *p, *arg, *argSpace;
char **argv;
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index f07c192..6c74b6c 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinChan.c,v 1.48 2006/08/30 19:30:25 hobbs Exp $
+ * RCS: @(#) $Id: tclWinChan.c,v 1.49 2007/04/16 13:36:36 dkf Exp $
*/
#include "tclWinInt.h"
@@ -1460,26 +1460,28 @@ FileThreadActionProc(
*/
DWORD
-FileGetType(handle)
- HANDLE handle; /* Opened file handle */
+FileGetType(
+ HANDLE handle) /* Opened file handle */
{
DWORD type;
type = GetFileType(handle);
/*
- * If the file is a character device, we need to try to figure out
- * whether it is a serial port, a console, or something else. We
- * test for the console case first because this is more common.
+ * If the file is a character device, we need to try to figure out whether
+ * it is a serial port, a console, or something else. We test for the
+ * console case first because this is more common.
*/
if ((type == FILE_TYPE_CHAR)
|| ((type == FILE_TYPE_UNKNOWN) && !GetLastError())) {
DWORD consoleParams;
+
if (GetConsoleMode(handle, &consoleParams)) {
type = FILE_TYPE_CONSOLE;
} else {
DCB dcb;
+
dcb.DCBlength = sizeof(DCB);
if (GetCommState(handle, &dcb)) {
type = FILE_TYPE_SERIAL;
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index aa8e819..575c3c2 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.18 2007/03/08 00:27:12 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinTest.c,v 1.19 2007/04/16 13:36:36 dkf Exp $
*/
#include "tclInt.h"
@@ -505,7 +505,9 @@ TestExceptionCmd(
}
static int
-TestplatformChmod(const char *nativePath, int pmode)
+TestplatformChmod(
+ const char *nativePath,
+ int pmode)
{
SID_IDENTIFIER_AUTHORITY userSidAuthority =
{ SECURITY_WORLD_SID_AUTHORITY };
@@ -776,11 +778,11 @@ TestplatformChmod(const char *nativePath, int pmode)
*/
static int
-TestchmodCmd(dummy, interp, argc, argv)
- ClientData dummy; /* Not used. */
- Tcl_Interp *interp; /* Current interpreter. */
- int argc; /* Number of arguments. */
- const char **argv; /* Argument strings. */
+TestchmodCmd(
+ ClientData dummy, /* Not used. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
{
int i, mode;
char *rest;