server/tools/atoi36.c

37 lines
1,010 B
C
Raw Normal View History

2010-08-08 10:06:34 +02:00
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <base36.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
2011-03-07 08:02:35 +01:00
int main(int argc, char **argv)
2010-08-08 10:06:34 +02:00
{
2011-03-07 08:02:35 +01:00
int i = 1, reverse = 0;
if (strstr(argv[0], "itoa36"))
reverse = 1;
if (argc > 1) {
if (strcmp(argv[1], "-r") == 0) {
i = 2;
reverse = 1;
2010-08-08 10:06:34 +02:00
}
}
2011-03-07 08:02:35 +01:00
for (; i != argc; ++i) {
2010-08-08 10:06:34 +02:00
if (reverse) {
printf("%s -> %s\n", argv[i], itoa36(atoi(argv[i])));
2011-03-07 08:02:35 +01:00
} else
printf("%s -> %d\n", argv[i], atoi36(argv[i]));
2010-08-08 10:06:34 +02:00
}
return 0;
}