[Prev][Next][Index][Thread]

# Re: Quick Question [ANSI]

- Date: Tue, 5 Sep 1995 23:59:18 PDT
- From:
- Content-Transfer-Encoding: 8bit
- Content-Type: text/plain; charset=LATIN1

    --- cut here
    *** server.c	Wed Sep  6 14:27:49 1995
    --- server.c	Wed Sep  6 14:35:18 1995
    ***************
    *** 841,846 ****
    --- 841,881 ----
      }

      static package
    + bf_cnotify(Var arglist, Byte next, void *vdata, Objid progr)
    + { /* (same as notify()) */
    +     if (!is_wizard(progr) && progr != arglist.v.list[1].v.obj) {
    + 	free_var(arglist);
    + 	return make_error_pack(E_PERM);
    +     }
    +
    +     {
    + #	define CTRL_ESCAPE	'^'
    + 	char *buf = str_dup(arglist.v.list[2].v.str);
    + 	char *buf1, *buf2;
    +
    + 	for (buf1 = buf2 = buf; *buf1; buf1++, buf2++)
    + 	    if (*buf1 == CTRL_ESCAPE) {
    + 		buf1++;
    + 		if (*buf1 == '\0')
    + 		    break;
    + 		if (*buf1 != CTRL_ESCAPE)
    + 		    *buf2 = *buf1 - '@';
    + 		else
    + 		    *buf2 = *buf1;
    + 	    }
    + 	    else
    + 		*buf2 = *buf1;
    +
    + 	*buf2 = '\0';
    +
    + 	notify(arglist.v.list[1].v.obj, buf);
    + 	free_str(buf);
    + 	free_var(arglist);
    +     }
    +     return no_var_pack();
    + }
    +
    + static package
      bf_boot_player(Var arglist, Byte next, void *vdata, Objid progr)
      { /* (object) */
          Objid oid = arglist.v.list[1].v.obj;
    ***************
    *** 872,877 ****
    --- 907,913 ----
          (void) register_function("connection_name", 1, 1, bf_connection_name,
      			     TYPE_OBJ);
          (void) register_function("notify", 2, 2, bf_notify, TYPE_OBJ, TYPE_STR);
    +     (void) register_function("cnotify", 2, 2, bf_cnotify, TYPE_OBJ, TYPE_STR);
          (void) register_function("boot_player", 1, 1, bf_boot_player, TYPE_OBJ);
      }

    --- cut here

      This patch adds new built-in function 'cnotify()'. It works exactly like
    'notify()' built-in, except that it interprets '^'ed character into control
    character. (It's my own patch, so I may say some legal(...) words. Anyone
    may use, copy, or modify it. I, the author, make no warranty of any kind
    and accepts no responsibility for this software or any results of its use.)
    (I HATE such words!)

    example:
      cnotify(this, "^[[;H^[[J");   => clear the screen

    ----
    Ahn Jin-su    (jsahn@boulez.snu.ac.kr) (Deedlit@LambdaMOO)
    School of Electrical Engineering
    Seoul National University, Korea

- Prev: Re: Quick Question [ANSI]
- Next: Re: Quick Question [ANSI]
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index