home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / disasm / source / utils.cpp < prev   
Encoding:
C/C++ Source or Header  |  2009-09-14  |  590 b   |  41 lines

  1. #include <stdarg.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6. #include "utils.h"
  7.  
  8. void oops(const char *format, ...) {
  9.     va_list val;
  10.  
  11.     va_start(val, format);
  12.     vprintf(format, val);
  13.     va_end(val);
  14.     getchar();
  15.     exit(5);
  16. }
  17.  
  18. void strtrim(char *s) {
  19.     char *t = s;
  20.     char *u = s;
  21.  
  22.     while(*t)
  23.         ++t;
  24.  
  25.     while(t>s && isspace((unsigned char)t[-1]))
  26.         --t;
  27.  
  28.     while(u<t && isspace((unsigned char)*u))
  29.         ++u;
  30.  
  31.     memmove(s, u, t-u);
  32.     s[t-u] = 0;
  33. }
  34.  
  35. char *strtack(char *s, const char *t) {
  36.     while(*s = *t)
  37.         ++s, ++t;
  38.  
  39.     return s;
  40. }
  41.