/* This file is part of the origami distribution. (Amiga Port)
 *
 * Source code written by
 * mini MKTEMP for ORIGAMI (ST-port)
 * (C) 1990 M. Schwingen
 * This does just enough to work. Improvements are welcome.
 *
 * changed for amiga multitasking os by Thomas Hadig in September 1991
 * Version : 1.6.42 alpha, June 1992
 */

#include <stdio.h>
#ifdef LATTICE
#include <proto/exec.h>
#else
#include <clib/exec_protos.h>
#endif

char tmpcnt = 'A';

/*{{{  mktemp*/
void mktemp(char *str)
 {
  char buf[11];
  char *p1,*p2;

  sprintf(buf,"%08.8x%c",FindTask(NULL),tmpcnt++);
  /*{{{  replace ' ' with '0'*/
  p1 = buf;
  while (*p1)
   {
    if (*p1==' ') *p1=0;
    p1++;
   }
  /*}}}  */
  p2 = str;
  p1--;
  /*{{{  replace "XX...." with buf-string (backwards !)*/
  while (*p2)
   {
    if (*p2 == 'X') *p2 = *p1--;
    p2++;
   }
  /*}}}  */
  if (tmpcnt>=0x7B) tmpcnt='A';
 }
/*}}}  */
