#define TIME_PRINT(elem,marker)\
if (elem)\
{\
- sprintf(buf, " %d%s%n", elem, marker, &tmp);\
- buf+=tmp;\
+ buf+=sprintf(buf, " %d%s", elem, marker);\
}\
/* This implementation might look a little evil but it does work */
char *buf = buffers[buffer_index];
char *buffer = buf;
- int years, months, days, hours, minutes, seconds, tmp;
+ int years, months, days, hours, minutes, seconds;
buffer_index = (buffer_index+1) % 3;
int helpmod_read_strtime(const char *str)
{
- int sum = 0;
- int tmp_sum;
- int tmp;
-
+ int sum = 0, tmp_sum, tmp;
while (*str)
{
const char lamechars[] = {(char)2, (char)3, (char)22, (char)31, (char)0};
if (strpbrk(line, lamechars) != NULL)
return 1;
- /*
- if (strchr(line, (char)2)) bold
- return 1;
- if (strchr(line, (char)3)) colour
- return 1;
- if (strchr(line, (char)22)) reverse
- return 1;
- if (strchr(line, (char)31)) underline
- return 1;
-*/
- return 0;
+ else
+ return 0;
}
int strislower(const char *str)
count++;
return count;
}
+
+float helpmod_percentage(int larger, int smaller)
+{
+ if (larger == 0)
+ return 0.0;
+
+ return 100.0 * ((float)smaller / (float)larger);
+}
+
+int helpmod_select(const char *str, const char **strs, int *enums, int count)
+{
+ int i;
+
+ if (count == 0)
+ return -1;
+
+ for (i = 0;i < count;i++)
+ if (!ci_strcmp(strs[i], str))
+ return enums[i];
+
+ return -1;
+}