00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <stdlib.h>
00004 #include <unistd.h>
00005 #include "merc.h"
00006 #include <time.h>
00007 extern bool fCopyOver;
00008 void twiddle(void)
00009 {
00010
00011 static int tw;
00012 static int oldtime;
00013 struct timeval t;
00014 gettimeofday(&t, NULL);
00015 if (t.tv_usec - oldtime > 0)
00016 {
00017
00018 char buf[100];
00019 if (tw == 0)
00020 sprintf(buf, "./twiddle %s", "'\e[1;31m-\e[0m'");
00021 if (tw == 1)
00022 sprintf(buf, "./twiddle %s", "'\e[1;35m/\e[0m'");
00023 if (tw == 2)
00024 sprintf(buf, "./twiddle %s", "'\e[1;33m|\e[0m'");
00025 if (tw == 3)
00026 sprintf(buf, "./twiddle %s", "'\e[1;32m\\\e[0m'");
00027 tw++;
00028 if (tw == 4)
00029 tw = 0;
00030 oldtime = t.tv_usec;
00031
00032
00033
00034 system(buf);
00035 }
00036 return;
00037
00038
00039
00040 }
00041
00042