stew

a monorepo of some sort
git clone git://git.nsmpr.xyz/stew.git
Log | Files | Refs

main.c (475B)


      1 #include <u.h>
      2 #include <libc.h>
      3 
      4 #include "proquint.h"
      5 
      6 void
      7 main(int argc, char **argv) {
      8 	argc--; argv++;
      9 	for(; *argv; --argc, ++argv) {
     10 		char *s = *argv;
     11 		if (!s[0]) continue; /* this would be very strange */
     12 		char *e;
     13 		ulong d = strtoul(s, &e, 0);
     14 		if (e != s) {
     15 			char quint[12]; /* two quints + separator + \0 */
     16 			uint2quint(quint, d, '-');
     17 			print("%s ", quint);
     18 		} else {
     19 			u32int uint0 = quint2uint(s);
     20 			print("0x%ux ", uint0);
     21 		}
     22 	}
     23 	print("\n");
     24 }