1 |
;;; erbc5.el --- continuation of erbc.el |
;;; erbc5.el --- continuation of erbc.el |
2 |
;; Time-stamp: <2004-12-31 22:45:55 deego> |
;; Time-stamp: <2005-01-08 12:52:25 deego> |
3 |
;; Copyright (C) 2003 D. Goel |
;; Copyright (C) 2003 D. Goel |
4 |
;; Emacs Lisp Archive entry |
;; Emacs Lisp Archive entry |
5 |
;; Filename: erbc5.el |
;; Filename: erbc5.el |
175 |
|
|
176 |
(ignore-errors (require 'calc)) |
(ignore-errors (require 'calc)) |
177 |
|
|
178 |
(defvar erbnoc-calc-time 3) |
(defvar erbn-calc-time 3) |
179 |
(defcustom erbnoc-calc-p nil |
(defcustom erbn-calc-p nil |
180 |
"Enable this variable at your own risk. |
"Enable this variable at your own risk. |
181 |
Enabling this means that fsbot will do calc operations, but those have |
Enabling this means that fsbot will do calc operations, but those have |
182 |
no timeout build in... leading to DOS attacks. ") |
no timeout build in... leading to DOS attacks. ") |
191 |
which is why turned off by default. |
which is why turned off by default. |
192 |
|
|
193 |
" |
" |
194 |
(unless erbnoc-calc-p |
(unless erbn-calc-p |
195 |
(error "Sorry, but i am a bot! not a calc!")) |
(error "Sorry, but i am a bot! not a calc!")) |
196 |
(unless str (error "Eval what?")) |
(unless str (error "Eval what?")) |
197 |
(unless (stringp str) |
(unless (stringp str) |
198 |
(setq str (format "%s" str))) |
(setq str (format "%s" str))) |
199 |
(with-timeout |
(with-timeout |
200 |
(erbnoc-calc-time "That's WAY too much math for me!") |
(erbn-calc-time "That's WAY too much math for me!") |
201 |
(calc-eval str))) |
(calc-eval str))) |
202 |
|
|
203 |
(defalias 'fs-calc 'fs-calc-eval) |
(defalias 'fs-calc 'fs-calc-eval) |
205 |
(erbutils-defalias '(process-list)) |
(erbutils-defalias '(process-list)) |
206 |
(defalias 'fs-list-processes 'fs-process-list) |
(defalias 'fs-list-processes 'fs-process-list) |
207 |
|
|
208 |
(defcustom erbnoc-sregex-p nil |
(defcustom erbn-sregex-p nil |
209 |
"Nil by default for safety. Enable to permit fs-sregex. |
"Nil by default for safety. Enable to permit fs-sregex. |
210 |
I think it is safe, but not 100% sure, so disabled by default. --DG" |
I think it is safe, but not 100% sure, so disabled by default. --DG" |
211 |
) |
) |
218 |
|
|
219 |
(defun fsi-sregex (&rest args) |
(defun fsi-sregex (&rest args) |
220 |
(cond |
(cond |
221 |
(erbnoc-sregex-p |
(erbn-sregex-p |
222 |
(apply 'sregex args)) |
(apply 'sregex args)) |
223 |
(t |
(t |
224 |
(error "sregexp is disabled in this bot. ")))) |
(error "sregexp is disabled in this bot. ")))) |