chiark / gitweb /
str: Support new prefix-matching feature in str_match.
[mLib-python] / report.pyx
index e3749b43c35ec47ad492d02744a0876112106c47..cb368f6f71042e1a2eceab6681d5c952f5d02e0f 100644 (file)
 # along with mLib/Python; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-cdef extern from 'mLib/quis.h':
-  void _ego "ego"(char *prog)
-  char *_quis "quis"()
-
-cdef extern from 'mLib/report.h':
-  void _moan "moan"(char *f, char *msg)
-
-import sys
-
 quis = '<UNNAMED>'
-def ego(prog):
-  _ego(prog)
+cdef char *_progstring
+_progstring = NULL
+
+def ego(char *prog):
+  global quis, _progstring
+  if _progstring:
+    xfree(_progstring)
+  _progstring = xstrdup(prog)
+  _ego(_progstring)
   quis = _quis()
 
-def moan(msg):
+def moan(char *msg):
   _moan('%s', msg)
-def die(msg, rc = 1):
+def die(char *msg, rc = 126):
   _moan('%s', msg)
-  sys.exit(rc)
+  raise SystemExit, rc
 
 #----- That's all, folks ----------------------------------------------------