-/* $Id: httpd.js,v 1.51 2005/07/10 22:41:17 mmondor Exp $ */
+/* $Id: httpd.js,v 1.52 2005/07/11 01:50:56 mmondor Exp $ */
/*
* Copyright (c) 2005, Matthew Mondor
err.put(x + " while reading options file\n");
exit();
}
+eval(file_read('string.js')); /* startsWith()/endsWith() */
eval(file_read('ml.js')); /* MLTag object for HTML generation */
eval(file_read('root.js')); /* Root object for virtual chroot(2) */
* Server identification
*/
SERVER_VERSION = 'mmondor_js_httpd/0.0.1 (NetBSD)';
-SERVER_CVSID = '$Id: httpd.js,v 1.51 2005/07/10 22:41:17 mmondor Exp $';
+SERVER_CVSID = '$Id: httpd.js,v 1.52 2005/07/11 01:50:56 mmondor Exp $';
--- /dev/null
+/* $Id: string.js,v 1.1 2005/07/11 01:50:56 mmondor Exp $ */
+
+/*
+ * Copyright (c) 2005, Matthew Mondor
+ * ALL RIGHTS RESERVED.
+ */
+
+/*
+ * Extension to the standard String object to support startsWith() and
+ * endsWith() very useful methods.
+ */
+
+
+
+String.prototype.startsWith = function(str)
+{
+ var t = str.length;
+
+ if (this.length >= t && this.substr(0, t) == str)
+ return true;
+
+ return false;
+}
+
+String.prototype.endsWith = function(str)
+{
+ var t1 = str.length;
+ var t2 = this.length;
+
+ if (t2 >= t1 && this.substr(t2 - t1, t1) == str)
+ return true;
+
+ return false;
+}