home *** CD-ROM | disk | FTP | other *** search
/ Micro R&D 1 / MicroRD-CD-ROM-Vol1-1994.iso / disktools / misc / dd.lzh / dd / dossupport.c < prev    next >
C/C++ Source or Header  |  1991-11-30  |  831b  |  61 lines

  1. /*
  2.  * dossupport.c - miscellaneous support functions for AmigaDOS 2.0
  3.  *
  4.  * Bruno Costa - 30 Nov 91 - 1 Dec 91
  5.  */
  6.  
  7. #include <exec/types.h>
  8. #include <dos/dos.h>
  9. #include <clib/dos_protos.h>
  10. #include <pragmas/dos_pragmas.h>
  11. #include <string.h>
  12. #include <stdarg.h>
  13. #include "dossupport.h"
  14.  
  15. extern struct Library *DOSBase;
  16.  
  17.  
  18. LONG Printf (char *format, ...)
  19. {
  20.  LONG ret;
  21.  va_list args;
  22.  
  23.  va_start (args, format);
  24.  
  25.  ret = VPrintf (format, args);
  26.  
  27.  va_end (args);
  28.  
  29.  return ret;
  30. }
  31.  
  32.  
  33. BSTR bstr (char *str)
  34. {
  35.  static char buf[256];
  36.  int len = strlen (str);
  37.  
  38.  if (len > 255)
  39.    len = 255;
  40.  
  41.  buf[0] = len;
  42.  strncpy (&buf[1], str, len);
  43.  
  44.  return MKBADDR (buf);
  45. }
  46.  
  47.  
  48. char *cstr (BSTR bstr)
  49. {
  50.  static char str[256];
  51.  char *src = BADDR (bstr);
  52.  char *dst = str;
  53.  int n;
  54.  
  55.  for (n = *src++; n; n--)
  56.    *dst++ = *src++;
  57.  
  58.  *dst = '\0';
  59.  return str;
  60. }
  61.