summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrelyea%netscape.com <devnull@localhost>2009-03-29 19:04:26 +0000
committerrelyea%netscape.com <devnull@localhost>2009-03-29 19:04:26 +0000
commitd9cec53a0f68a320a867deb6cda6a9bb13281988 (patch)
tree8095b9883e83fb1196e460c4da005a478b0f10fa
parent7eae255347d9fafbb39bcd4a722f84cc816886ad (diff)
downloadnss-hg-d9cec53a0f68a320a867deb6cda6a9bb13281988.tar.gz
1) Add time command to time specific functions.
2) improve the help system. 3) bug fixes for arrays.
-rw-r--r--security/nss/cmd/lib/pk11table.c39
-rw-r--r--security/nss/cmd/lib/pk11table.h8
2 files changed, 47 insertions, 0 deletions
diff --git a/security/nss/cmd/lib/pk11table.c b/security/nss/cmd/lib/pk11table.c
index 69710f85e..52ff7fa14 100644
--- a/security/nss/cmd/lib/pk11table.c
+++ b/security/nss/cmd/lib/pk11table.c
@@ -1311,6 +1311,11 @@ const Commands _commands[] = {
"reads filename as script of commands to execute\n",
{ArgVar|ArgNew, ArgNone, ArgNone, ArgNone, ArgNone,
ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
+ {"Time", F_Time,
+"Time pkcs11 command\n\n"
+"Execute a pkcs #11 command and time the results\n",
+ {ArgVar|ArgFull, ArgNone, ArgNone, ArgNone, ArgNone,
+ ArgNone, ArgNone, ArgNone, ArgNone, ArgNone }},
{"System", F_System,
"Fix Me... ",
{ArgULong, ArgNone, ArgNone, ArgNone, ArgNone,
@@ -1329,4 +1334,38 @@ const Commands _commands[] = {
const Commands *commands= &_commands[0];
const int commandCount = sizeof(_commands) / sizeof(_commands[0]);
+const Topics _topics[] = {
+ { "variables",
+"Variables are random strings of characters. These should begin with alpha\n"
+" characters, and should not contain any spaces, nor should they match any\n"
+" built-in constants. There is some checking in the code for these things,\n"
+" but it's not 100% and using invalid variable names can cause problems.\n"
+" Variables are created by any 'OUT' parameter. If the variable does not\n"
+" exist, it will be created. For in parameters variables must already exist.\n"
+ },
+ { "constants",
+"pk11util recognizes *lots* of constants. All CKA_, CKF_, CKO_, CKU_, CKS_,\n"
+" CKC_, CKK_, CKH_, CKM_, CKT_ values from the PKCS #11 spec are recognized.\n"
+" Constants can be specified with their fully qualified CK?_ value, or the\n"
+" prefix can be dropped. Constants are matched case insensitve.\n"
+ },
+ { "arrays",
+"Arrays are special variables which represent 'C' arrays. Each array \n"
+" variable can be referenced as a group (using just the name), or as \n"
+" individual elements (with the [int] operator). Example:\n"
+" print myArray # prints the full array.\n"
+" print myArray[3] # prints the 3rd elemement of the array \n"
+ },
+ { "sizes",
+"Size operaters returns the size in bytes of a variable, or the number of\n"
+" elements in an array.\n"
+" size(var) and sizeof(var) return the size of var in bytes.\n"
+" sizea(var) and sizeofarray(var) return the number of elements in var.\n"
+" If var is not an array, sizea(var) returns 1.\n"
+ },
+};
+
+const Topics *topics=&_topics[0];
+const int topicCount = sizeof(_topics)/sizeof(_topics[0]);
+
diff --git a/security/nss/cmd/lib/pk11table.h b/security/nss/cmd/lib/pk11table.h
index cdb4970c9..aed07c325 100644
--- a/security/nss/cmd/lib/pk11table.h
+++ b/security/nss/cmd/lib/pk11table.h
@@ -29,6 +29,7 @@ typedef enum {
F_Load,
F_Unload,
F_System,
+ F_Time,
F_Help,
F_Quit,
} FunctionType;
@@ -59,6 +60,7 @@ typedef enum {
ArgFile = 0x800,
ArgStatic = 0x1000,
ArgOpt = 0x2000,
+ ArgFull = 0x4000,
} ArgType;
typedef enum _constType
@@ -135,6 +137,10 @@ typedef struct _module {
CK_FUNCTION_LIST *functionList;
} Module;
+typedef struct _topics {
+ char *name;
+ char *helpString;
+} Topics;
/*
* the command array itself. Make name to function and it's arguments
@@ -148,4 +154,6 @@ extern const Constant *consts;
extern const int constCount;
extern const Commands *commands;
extern const int commandCount;
+extern const Topics *topics;
+extern const int topicCount;