forked from github/server
base35 converter mit reverse-option
This commit is contained in:
parent
513bdef26c
commit
e39b51bc13
1 changed files with 15 additions and 3 deletions
|
@ -12,12 +12,24 @@
|
|||
|
||||
#include <base36.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char**argv)
|
||||
{
|
||||
int i;
|
||||
for (i=1;i!=argc;++i) {
|
||||
printf("%s -> %d\n", argv[i], atoi36(argv[i]));
|
||||
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;
|
||||
}
|
||||
}
|
||||
for (;i!=argc;++i) {
|
||||
if (reverse) {
|
||||
printf("%s -> %s\n", argv[i], itoa36(atoi(argv[i])));
|
||||
}
|
||||
else printf("%s -> %d\n", argv[i], atoi36(argv[i]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue