(svn r3380) -Fix: removed 'size' from r3379, because it was pretty silly
authortruelight
Sat, 07 Jan 2006 10:15:46 +0000
changeset 2832 acf08469a0c6
parent 2831 510c08cd43d2
child 2833 0d394d4365fe
(svn r3380) -Fix: removed 'size' from r3379, because it was pretty silly
-Note: no longer showhelp publish -p, as it is deprecated
driver.c
driver.h
openttd.c
--- a/driver.c	Fri Jan 06 22:52:31 2006 +0000
+++ b/driver.c	Sat Jan 07 10:15:46 2006 +0000
@@ -206,23 +206,19 @@
 }
 
 
-int GetDriverList(char* p, int size)
+char *GetDriverList(char* p)
 {
 	const DriverClass* dc;
-	int pos;
 
 	for (dc = _driver_classes; dc != endof(_driver_classes); dc++) {
 		const DriverDesc* dd;
 
-		pos = snprintf(p, size, "List of %s drivers:\n", dc->name);
-		p += pos; size -= pos;
+		p += sprintf(p, "List of %s drivers:\n", dc->name);
 		for (dd = dc->descs; dd->name != NULL; dd++) {
-			pos = snprintf(p, size, "%10s: %s\n", dd->name, dd->longname);
-			p += pos; size -= pos;
+			p += sprintf(p, "%10s: %s\n", dd->name, dd->longname);
 		}
-		pos = snprintf(p, size, "\n");
-		p += pos; size -= pos;
+		p += sprintf(p, "\n");
 	}
 
-	return size;
+	return p;
 }
--- a/driver.h	Fri Jan 06 22:52:31 2006 +0000
+++ b/driver.h	Sat Jan 07 10:15:46 2006 +0000
@@ -8,6 +8,6 @@
 bool GetDriverParamBool(const char* const* parm, const char* name);
 int GetDriverParamInt(const char* const* parm, const char* name, int def);
 
-int GetDriverList(char* p, int size);
+char *GetDriverList(char* p);
 
 #endif /* DRIVER_H */
--- a/openttd.c	Fri Jan 06 22:52:31 2006 +0000
+++ b/openttd.c	Sat Jan 07 10:15:46 2006 +0000
@@ -120,14 +120,11 @@
 static void showhelp(void)
 {
 	char buf[4096], *p;
-	int size, pos;
 
 	p    = buf;
-	size = sizeof(buf);
 
-	pos = snprintf(p, size, "OpenTTD %s\n", _openttd_revision);
-	p += pos; size -= pos;
-	pos = snprintf(p, size,
+	p += sprintf(p, "OpenTTD %s\n", _openttd_revision);
+	p += sprintf(p,
 		"\n"
 		"\n"
 		"Command line options:\n"
@@ -151,9 +148,8 @@
 		"  -c config_file      = Use 'config_file' instead of 'openttd.cfg'\n"
 		"\n"
 	);
-	p += pos; size -= pos;
 
-	size = GetDriverList(p, size);
+	p = GetDriverList(p);
 
 	ShowInfo(buf);
 }