// File: jkingan[P]ladyheather/heathui.cpp
// Function: edit_write_cmd()
int edit_write_cmd()
{
int valid;
   // process a file write/delete command
   if(edit_buffer[0]) {
      if(dump_type == 's') {
         reset_first_key(21);
         prot_menu = 0;
         draw_plot(REFRESH_SCREEN);
         draw_maps();
         refresh_page();

         valid = 0;
         if     (strstr(edit_buffer, ".gif")) valid = 1;
         else if(strstr(edit_buffer, ".GIF")) valid = 1;
         else if(strstr(edit_buffer, ".bmp")) valid = 1;
         else if(strstr(edit_buffer, ".BMP")) valid = 1;
         if(valid == 0) {
            first_key = ' ';
            edit_error("Screen dump file type must be .gif or .bmp");
         }
         else if(dump_screen(invert_dump, top_line, edit_buffer) == 0) {
            first_key = ' ';
            edit_error("Could not write screen image file");
         }
      }
      else if(dump_type == 'c') {  // luxor cal .SCR file
         dump_cal_file();
      }
      else if(dump_type == 'd') {   //delete file
         if(path_unlink(edit_buffer)) {
            sprintf(out, "Could not delete file: %s", edit_buffer);
         }
         else {
            sprintf(out, "File %s deleted", edit_buffer);
         }
         edit_error(out);
      }
      else if(dump_type == 'm') {  // MTIE data
         dump_mtie_data();
      }
      else {
         dump_log(edit_buffer, dump_type);
      }
   }
   else {
      edit_error("Missing file name");
   }

   top_line = 0;
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x3562b1(%rip), %rax    # 0x39e4c0
cmpb $0x0, (%rax)
je 0x483ff
leaq 0x2553ce(%rip), %rax    # 0x29d5ed
movzbl (%rax), %eax
cmpl $0x73, %eax
jne 0x4834a
movl $0x15, %edi
callq 0x37780
leaq 0x2320fc(%rip), %rax    # 0x27a338
movb $0x0, (%rax)
movl $0x1, %edi
callq 0x24e80
callq 0x154ea0
callq 0xb0d0
movl $0x0, -0x4(%rbp)
leaq 0x35625f(%rip), %rdi    # 0x39e4c0
leaq 0x128975(%rip), %rsi    # 0x170bdd
callq 0x9090
cmpq $0x0, %rax
je 0x4827c
movl $0x1, -0x4(%rbp)
jmp 0x482e6
leaq 0x35623d(%rip), %rdi    # 0x39e4c0
leaq 0x127c90(%rip), %rsi    # 0x16ff1a
callq 0x9090
cmpq $0x0, %rax
je 0x4829e
movl $0x1, -0x4(%rbp)
jmp 0x482e4
leaq 0x35621b(%rip), %rdi    # 0x39e4c0
leaq 0x131c49(%rip), %rsi    # 0x179ef5
callq 0x9090
cmpq $0x0, %rax
je 0x482c0
movl $0x1, -0x4(%rbp)
jmp 0x482e2
leaq 0x3561f9(%rip), %rdi    # 0x39e4c0
leaq 0x131bfc(%rip), %rsi    # 0x179eca
callq 0x9090
cmpq $0x0, %rax
je 0x482e0
movl $0x1, -0x4(%rbp)
jmp 0x482e2
jmp 0x482e4
jmp 0x482e6
cmpl $0x0, -0x4(%rbp)
jne 0x48307
leaq 0x255e45(%rip), %rax    # 0x29e138
movl $0x20, (%rax)
leaq 0x131bcf(%rip), %rdi    # 0x179ecf
callq 0x30d60
jmp 0x48345
leaq 0x22f706(%rip), %rax    # 0x277a14
movl (%rax), %edi
leaq 0x22f709(%rip), %rax    # 0x277a20
movl (%rax), %esi
leaq 0x3561a0(%rip), %rdx    # 0x39e4c0
callq 0x12810
cmpl $0x0, %eax
jne 0x48343
leaq 0x255e07(%rip), %rax    # 0x29e138
movl $0x20, (%rax)
leaq 0x131bbc(%rip), %rdi    # 0x179efa
callq 0x30d60
jmp 0x48345
jmp 0x483fd
leaq 0x25529c(%rip), %rax    # 0x29d5ed
movzbl (%rax), %eax
cmpl $0x63, %eax
jne 0x48363
callq 0x47e30
jmp 0x483fb
leaq 0x255283(%rip), %rax    # 0x29d5ed
movzbl (%rax), %eax
cmpl $0x64, %eax
jne 0x483cb
leaq 0x356147(%rip), %rdi    # 0x39e4c0
callq 0xa430
cmpl $0x0, %eax
je 0x483a1
leaq 0x353076(%rip), %rdi    # 0x39b400
leaq 0x131b8b(%rip), %rsi    # 0x179f1c
leaq 0x356128(%rip), %rdx    # 0x39e4c0
movb $0x0, %al
callq 0x9060
jmp 0x483bd
leaq 0x353058(%rip), %rdi    # 0x39b400
leaq 0x131b87(%rip), %rsi    # 0x179f36
leaq 0x35610a(%rip), %rdx    # 0x39e4c0
movb $0x0, %al
callq 0x9060
leaq 0x35303c(%rip), %rdi    # 0x39b400
callq 0x30d60
jmp 0x483f9
leaq 0x25521b(%rip), %rax    # 0x29d5ed
movzbl (%rax), %eax
cmpl $0x6d, %eax
jne 0x483e1
callq 0x480e0
jmp 0x483f7
leaq 0x3560d8(%rip), %rdi    # 0x39e4c0
leaq 0x2551fe(%rip), %rax    # 0x29d5ed
movzbl (%rax), %esi
callq 0x11e6e0
jmp 0x483f9
jmp 0x483fb
jmp 0x483fd
jmp 0x4840b
leaq 0x131b40(%rip), %rdi    # 0x179f46
callq 0x30d60
leaq 0x22f60e(%rip), %rax    # 0x277a20
movl $0x0, (%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq