+void raw_print(char *buffer, char *filename, size_t size) {
+ char *a, *b, *c, u;
+
+ b = buffer;
+ if(size) {
+ while(size) {
+ *(b++) = size%10 + '0';
+ size /= 10;
+ }
+ } else {
+ *(b++) = '0';
+ }
+
+ a = buffer;
+ c = b;
+ while(a < c) {
+ u = *a;
+ *(a++) = *(--c);
+ *c = u;
+ }
+
+ *(b++) = ' ';
+
+ sprintf(b, " %s\n", filename);
+}
+
+void fancy_print(char *buffer, char *filename, size_t size) {
+ if(size < 1024) {
+ sprintf(buffer,
+ "% 7d %s\n",
+ ((int) size),
+ filename);
+ } else if(size < 1024 * 1024) {
+ sprintf(buffer,
+ "% 6.1fK %s\n",
+ ((double) (size))/(1024.0),
+ filename);
+ } else if(size < 1024 * 1024 * 1024) {
+ sprintf(buffer,
+ "% 6.1fM %s\n",
+ ((double) (size))/(1024.0 * 1024),
+ filename);
+ } else {
+ sprintf(buffer,
+ "% 6.1fG %s\n",
+ ((double) (size))/(1024.0 * 1024.0 * 1024.0),
+ filename);
+ }
+}
+
+void print_sorted(struct file_with_size *root, int width, int height) {
+ char line[BUFFER_SIZE];