summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbjj <bjj>2001-01-29 08:38:44 (GMT)
committerbjj <bjj>2001-01-29 08:38:44 (GMT)
commit76450e1e889b399a20aba3fe5b53a255d983d042 (patch)
tree17dcc9712b7a0948445bc702d34e1cb1a150d48c
parent4b5f1c63c1300edeeb17532cddf578e2f9f1cc53 (diff)
downloadmoo-cvs-76450e1e889b399a20aba3fe5b53a255d983d042.zip
moo-cvs-76450e1e889b399a20aba3fe5b53a255d983d042.tar.gz
moo-cvs-76450e1e889b399a20aba3fe5b53a255d983d042.tar.bz2
moo-cvs-76450e1e889b399a20aba3fe5b53a255d983d042.tar.xz
Fix Sourceforge Bug #127620: add_verb() should return verbindex
And now it does. Old servers always returned 0, new servers will always return a positive integer.
-rw-r--r--db.h7
-rw-r--r--db_verbs.c15
-rw-r--r--verbs.c17
3 files changed, 31 insertions, 8 deletions
diff --git a/db.h b/db.h
index b1373f8..c239445 100644
--- a/db.h
+++ b/db.h
@@ -385,7 +385,7 @@ extern const char *db_unparse_prep(db_prep_spec);
* persistent.
*/
-extern void db_add_verb(Objid oid, const char *vnames,
+extern int db_add_verb(Objid oid, const char *vnames,
Objid owner, unsigned flags,
db_arg_spec dobj, db_prep_spec prep,
db_arg_spec iobj);
@@ -518,6 +518,11 @@ extern void db_delete_verb(db_verb_handle);
/*
* $Log$
+ * Revision 1.4 2001/01/29 08:38:44 bjj
+ * Fix Sourceforge Bug #127620: add_verb() should return verbindex
+ * And now it does. Old servers always returned 0, new servers will always
+ * return a positive integer.
+ *
* Revision 1.3 1998/12/14 13:17:32 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/db_verbs.c b/db_verbs.c
index 423fb40..740688d 100644
--- a/db_verbs.c
+++ b/db_verbs.c
@@ -194,12 +194,13 @@ db_unparse_prep(db_prep_spec prep)
#define OBJMASK 0x3
#define PERMMASK 0xF
-void
+int
db_add_verb(Objid oid, const char *vnames, Objid owner, unsigned flags,
db_arg_spec dobj, db_prep_spec prep, db_arg_spec iobj)
{
Object *o = dbpriv_find_object(oid);
Verbdef *v, *newv;
+ int count;
db_priv_affected_callable_verb_lookup();
@@ -211,10 +212,13 @@ db_add_verb(Objid oid, const char *vnames, Objid owner, unsigned flags,
newv->next = 0;
newv->program = 0;
if (o->verbdefs) {
- for (v = o->verbdefs; v->next; v = v->next);
+ for (v = o->verbdefs, count = 2; v->next; v = v->next, ++count);
v->next = newv;
- } else
+ } else {
o->verbdefs = newv;
+ count = 1;
+ }
+ return count;
}
static Verbdef *
@@ -760,6 +764,11 @@ char rcsid_db_verbs[] = "$Id$";
/*
* $Log$
+ * Revision 1.6 2001/01/29 08:38:44 bjj
+ * Fix Sourceforge Bug #127620: add_verb() should return verbindex
+ * And now it does. Old servers always returned 0, new servers will always
+ * return a positive integer.
+ *
* Revision 1.5 1998/12/14 13:17:39 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/verbs.c b/verbs.c
index 0e028bf..e34423b 100644
--- a/verbs.c
+++ b/verbs.c
@@ -176,6 +176,7 @@ bf_add_verb(Var arglist, Byte next, void *vdata, Objid progr)
Objid oid = arglist.v.list[1].v.obj;
Var info = arglist.v.list[2];
Var args = arglist.v.list[3];
+ Var result;
Objid owner;
unsigned flags;
const char *names;
@@ -183,7 +184,8 @@ bf_add_verb(Var arglist, Byte next, void *vdata, Objid progr)
db_prep_spec prep;
enum error e;
- if ((e = validate_verb_info(info, &owner, &flags, &names)) != E_NONE); /* Already failed */
+ if ((e = validate_verb_info(info, &owner, &flags, &names)) != E_NONE)
+ /* Already failed */ ;
else if ((e = validate_verb_args(args, &dobj, &prep, &iobj)) != E_NONE)
free_str(names);
else if (!valid(oid)) {
@@ -193,12 +195,14 @@ bf_add_verb(Var arglist, Byte next, void *vdata, Objid progr)
|| (progr != owner && !is_wizard(progr))) {
free_str(names);
e = E_PERM;
- } else
- db_add_verb(oid, names, owner, flags, dobj, prep, iobj);
+ } else {
+ result.type = TYPE_INT;
+ result.v.num = db_add_verb(oid, names, owner, flags, dobj, prep, iobj);
+ }
free_var(arglist);
if (e == E_NONE)
- return no_var_pack();
+ return make_var_pack(result);
else
return make_error_pack(e);
}
@@ -579,6 +583,11 @@ char rcsid_verbs[] = "$Id$";
/*
* $Log$
+ * Revision 1.4 2001/01/29 08:38:44 bjj
+ * Fix Sourceforge Bug #127620: add_verb() should return verbindex
+ * And now it does. Old servers always returned 0, new servers will always
+ * return a positive integer.
+ *
* Revision 1.3 1998/12/14 13:19:16 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*