*** az390.java.orig	Thu Nov 16 15:23:06 2006
--- az390.java	Fri Nov 17 15:52:28 2006
***************
*** 729,734 ****
--- 729,735 ----
        byte ascii_space = (int) ' ';
        byte ebcdic_period = 0x4B;
        byte ebcdic_space = 0x40;
+       public static String newline = System.getProperty("line.separator");
    /* 
     * end of global az390 class data and start of procs
     */
***************
*** 2433,2440 ****
  	 * list symbols in alpah order 
  	 * with optional cross reference
  	 */
! 	 put_prn_line("" +
! 	 		"\r\nSymbol Table Listing\r\n");
  	 TreeSet<String> sort_sym = new TreeSet<String>();
  	 int index = 1;
  	 while (index <= tot_sym){ // RPI 415
--- 2434,2441 ----
  	 * list symbols in alpah order 
  	 * with optional cross reference
  	 */
! 	 put_prn_line("" + newline + 
! 	 		"Symbol Table Listing" + newline);
  	 TreeSet<String> sort_sym = new TreeSet<String>();
  	 int index = 1;
  	 while (index <= tot_sym){ // RPI 415
***************
*** 2489,2495 ****
  	 * list literals in alpha order
  	 * with optional cross reference
  	 */
! 	 put_prn_line("\r\nLiteral Table Listing\r\n");
  	 TreeSet<String> sort_lit = new TreeSet<String>();
  	 int index = 0;
  	 while (index < tot_lit){
--- 2490,2496 ----
  	 * list literals in alpha order
  	 * with optional cross reference
  	 */
! 	 put_prn_line(newline + "Literal Table Listing" + newline);
  	 TreeSet<String> sort_lit = new TreeSet<String>();
  	 int index = 0;
  	 while (index < tot_lit){
***************
*** 4150,4156 ****
  	   		   }
  	   	       try {
  	   	    	  tz390.systerm_io++;
! 	   	          prn_file_buff.write(msg + "\r\n");
  	   	          if (prn_file.length() > tz390.max_file_size){
  	   	        	  abort_error(118,"maximum prn file size exceeded");
  	   	          }
--- 4151,4157 ----
  	   		   }
  	   	       try {
  	   	    	  tz390.systerm_io++;
! 	   	          prn_file_buff.write(msg + newline);
  	   	          if (prn_file.length() > tz390.max_file_size){
  	   	        	  abort_error(118,"maximum prn file size exceeded");
  	   	          }
***************
*** 4165,4171 ****
  	   	        	  }
  	   	        	  String data_line = tz390.get_hex(list_obj_loc,6) + " " + temp_hex;
  	   	        	  tz390.systerm_io++;
! 	   	        	  prn_file_buff.write(data_line + "\r\n");
  		   	          if (prn_file.length() > tz390.max_file_size){
  		   	        	  abort_error(118,"maximum prn file size exceeded");
  		   	          }
--- 4166,4172 ----
  	   	        	  }
  	   	        	  String data_line = tz390.get_hex(list_obj_loc,6) + " " + temp_hex;
  	   	        	  tz390.systerm_io++;
! 	   	        	  prn_file_buff.write(data_line + newline);
  		   	          if (prn_file.length() > tz390.max_file_size){
  		   	        	  abort_error(118,"maximum prn file size exceeded");
  		   	          }
***************
*** 4198,4204 ****
  		   	try {
  		   		if (tz390.opt_objhex){
  		   			tz390.systerm_io++;
! 		   			obj_file.writeBytes(msg + "\r\n");
  		   		} else {
  		   			cvt_obj_hex_to_bin(msg);
  		   			if (!bal_abort){
--- 4199,4205 ----
  		   	try {
  		   		if (tz390.opt_objhex){
  		   			tz390.systerm_io++;
! 		   			obj_file.writeBytes(msg + newline);
  		   		} else {
  		   			cvt_obj_hex_to_bin(msg);
  		   			if (!bal_abort){
*** gz390.java.orig	Thu Nov 16 15:23:06 2006
--- gz390.java	Fri Nov 17 11:32:25 2006
***************
*** 1337,1344 ****
--- 1337,1348 ----
  		 }
  	   	 if (event_name.equals("SUPPORT")){
  	             event_ok = true;
+                      if (System.getProperty("os.name").equals("Linux")) {
+                          exec_cmd("firefox http://www.z390.org");
+                      } else {
                           exec_cmd("cmd.exe /c Start http://www.z390.org");
                       }
+ 		 }
           break;
        case 'T':
        	 if (event_name.equals("TN3270")){
*** lz390.java.orig	Thu Nov 16 15:23:06 2006
--- lz390.java	Fri Nov 17 15:53:43 2006
***************
*** 179,184 ****
--- 179,185 ----
      int tot_rld = 0;
      int[]     rld_loc = null;
      byte[]    rld_len = null;
+   public static String newline = System.getProperty("line.separator");
    /*
     * end of global lz390class data and start of procs
     */
***************
*** 411,417 ****
  	   	   if (tz390.opt_list){ // RPI 484
  	   	      try {
  	   	    	  tz390.systerm_io++;
! 	   	          lst_file_buff.write(msg + "\r\n");
  	   	          if (lst_file.length() > tz390.max_file_size){
  	   	        	  abort_error(34,"maximum lst file size exceeded");
  	   	          }
--- 412,418 ----
  	   	   if (tz390.opt_list){ // RPI 484
  	   	      try {
  	   	    	  tz390.systerm_io++;
! 	   	          lst_file_buff.write(msg + newline);
  	   	          if (lst_file.length() > tz390.max_file_size){
  	   	        	  abort_error(34,"maximum lst file size exceeded");
  	   	          }
*** mz390.java.orig	Thu Nov 16 15:23:06 2006
--- mz390.java	Fri Nov 17 15:50:58 2006
***************
*** 14,19 ****
--- 14,20 ----
  
  import javax.swing.JTextArea;
  
+ 
  public  class  mz390 {
  	/*****************************************************
  	 
***************
*** 963,968 ****
--- 964,970 ----
  	boolean pc_trace_gen = false;
  	String  pc_trace_sub  = null;
  	String  trace_pfx = null;
+         public static String newline = System.getProperty("line.separator");
  	/* 
  	 * end of global mz390 class data and start of procs
  	 */
***************
*** 1507,1513 ****
  		if (!mac_file[cur_mac_file].isFile()){
  			abort_error(39,"file not found - " + load_file_name); //RPI169
  		}
! 		load_macro_name = mac_file[cur_mac_file].getName().toUpperCase();
  		if (tot_mac_name > 0){ // RPI127 leave suffix on main pgm loaded as macro
  			int index = load_macro_name.indexOf('.');
  			if (index > 0){
--- 1509,1515 ----
  		if (!mac_file[cur_mac_file].isFile()){
  			abort_error(39,"file not found - " + load_file_name); //RPI169
  		}
! 		load_macro_name = mac_file[cur_mac_file].getName();
  		if (tot_mac_name > 0){ // RPI127 leave suffix on main pgm loaded as macro
  			int index = load_macro_name.indexOf('.');
  			if (index > 0){
***************
*** 2137,2159 ****
  		try {
  			if  (text_line.length() < 72){ // RPI 264, RPI 437
  				tz390.systerm_io++;
! 				bal_file_buff.write(text_line + "\r\n");
  			} else {
  				tz390.systerm_io++;
! 				bal_file_buff.write(text_line.substring(0,71) + "X\r\n");
  				String text_left = text_line.substring(71);
  				while (text_left.length() > 0){
  					if  (text_left.length() > 56){
  						String cont_line = "               " 
  							+ text_left.substring(0,56) 
! 							+ "X\r\n";
  						tz390.systerm_io++;
  						bal_file_buff.write(cont_line);
  						text_left = text_left.substring(56);
  					} else {
  						tz390.systerm_io++;
  						bal_file_buff.write("               " 
! 								+ text_left + "\r\n");
  						text_left = "";
  					}
  				}
--- 2139,2161 ----
  		try {
  			if  (text_line.length() < 72){ // RPI 264, RPI 437
  				tz390.systerm_io++;
! 				bal_file_buff.write(text_line + newline);
  			} else {
  				tz390.systerm_io++;
! 				bal_file_buff.write(text_line.substring(0,71) + "X" + newline);
  				String text_left = text_line.substring(71);
  				while (text_left.length() > 0){
  					if  (text_left.length() > 56){
  						String cont_line = "               " 
  							+ text_left.substring(0,56) 
! 							+ "X" + newline;
  						tz390.systerm_io++;
  						bal_file_buff.write(cont_line);
  						text_left = text_left.substring(56);
  					} else {
  						tz390.systerm_io++;
  						bal_file_buff.write("               " 
! 								+ text_left + newline);
  						text_left = "";
  					}
  				}
***************
*** 3433,3439 ****
  				pch_text = ("X" + pch_text).trim().substring(1); //RPI 195
  				tz390.systerm_io++;
  				tot_punch_io++;
! 				pch_file_buff[pch_file_index].write(pch_text + "\r\n");
  				if (pch_file[pch_file_index].length() > tz390.max_file_size){
  					abort_error(120,"maximum pch file size exceeded");
  				}
--- 3435,3441 ----
  				pch_text = ("X" + pch_text).trim().substring(1); //RPI 195
  				tz390.systerm_io++;
  				tot_punch_io++;
! 				pch_file_buff[pch_file_index].write(pch_text + newline);
  				if (pch_file[pch_file_index].length() > tz390.max_file_size){
  					abort_error(120,"maximum pch file size exceeded");
  				}
***************
*** 6662,6668 ****
  		sys_dsn = "";
  		sys_mem = "";
  		sys_vol = "";
! 		sys_file = new File(file_name.toUpperCase());
  		try {
  			sys_dsn = sys_file.getCanonicalPath();
  			sys_mem = sys_file.getName();
--- 6664,6670 ----
  		sys_dsn = "";
  		sys_mem = "";
  		sys_vol = "";
! 		sys_file = new File(file_name);
  		try {
  			sys_dsn = sys_file.getCanonicalPath();
  			sys_mem = sys_file.getName();
*** sz390.java.orig	Thu Nov 16 15:23:06 2006
--- sz390.java	Fri Nov 17 15:52:54 2006
***************
*** 487,492 ****
--- 487,493 ----
    int next_fqe_len = 0;
    int opt_getmain_amode31 = 0x02;
    int opt_getmain_cond    = 0x01;
+   public static String newline = System.getProperty("line.separator");
    /*
     * end of global ez390 class data and start of procs
     */
***************
*** 638,644 ****
  	   	   if (tz390.opt_list && log_file_buff != null){
  	   	      try {
  	   	    	  tz390.systerm_io++;
! 	   	          log_file_buff.write(msg + "\r\n");
  	                if (log_file.length() > tz390.max_file_size){
  	                	abort_error(107,"maximum log file size exceeded");
  	                }
--- 639,645 ----
  	   	   if (tz390.opt_list && log_file_buff != null){
  	   	      try {
  	   	    	  tz390.systerm_io++;
! 	   	          log_file_buff.write(msg + newline);
  	                if (log_file.length() > tz390.max_file_size){
  	                	abort_error(107,"maximum log file size exceeded");
  	                }
***************
*** 2474,2480 ****
                  }
                  cur_rec_text = get_ascii_string(cur_dcb_area+4,cur_rec_len);
                  tz390.systerm_io++;
!                 tiot_file[cur_tiot_index].writeBytes(cur_rec_text + '\r' + '\n');
                  tiot_cur_rba[cur_tiot_index] = tiot_file[cur_tiot_index].getFilePointer();
                  if (tiot_file[cur_tiot_index].length() > tz390.max_file_size){
                  	abort_error(104,"maximum file size exceeded for " + tiot_dsn[cur_tiot_index]);
--- 2475,2481 ----
                  }
                  cur_rec_text = get_ascii_string(cur_dcb_area+4,cur_rec_len);
                  tz390.systerm_io++;
!                 tiot_file[cur_tiot_index].writeBytes(cur_rec_text + newline);
                  tiot_cur_rba[cur_tiot_index] = tiot_file[cur_tiot_index].getFilePointer();
                  if (tiot_file[cur_tiot_index].length() > tz390.max_file_size){
                  	abort_error(104,"maximum file size exceeded for " + tiot_dsn[cur_tiot_index]);
***************
*** 2491,2497 ****
  				}
                  cur_rec_text = get_ascii_string(cur_dcb_area,cur_dcb_lrecl);
                  tz390.systerm_io++;
!                 tiot_file[cur_tiot_index].writeBytes(cur_rec_text + '\r' + '\n');
                  if (tiot_file[cur_tiot_index].length() > tz390.max_file_size){
                  	abort_error(105,"maximum file size exceeded for " + tiot_dsn[cur_tiot_index]);
                  }
--- 2492,2498 ----
  				}
                  cur_rec_text = get_ascii_string(cur_dcb_area,cur_dcb_lrecl);
                  tz390.systerm_io++;
!                 tiot_file[cur_tiot_index].writeBytes(cur_rec_text + newline);
                  if (tiot_file[cur_tiot_index].length() > tz390.max_file_size){
                  	abort_error(105,"maximum file size exceeded for " + tiot_dsn[cur_tiot_index]);
                  }
***************
*** 2905,2910 ****
--- 2906,2913 ----
          if(os_name.equals("Windows 95")
             || os_name.equals("Windows 98")){
  	       cmd_pgm = "command.com" ;
+ 	} else if (os_name.equals("Linux")) {
+ 	    cmd_pgm = "perl " + z390.jar_file_dir() + "/cmd.pl";
  	} else {
  	    cmd_pgm = "cmd.exe";
  	}
***************
*** 2922,2927 ****
--- 2925,2931 ----
  	   	return 16;
   	 }
  }
+ 
  public int cmd_proc_start(int cmd_id,String[] exec_cmd){
      /*
       * 1. Terminate any prior cmd process with
***************
*** 2984,2992 ****
       * send input to exec command in process
       */
      if  (cmd_line == null){
!     	cmd_line = "\r\n";
      } else {
!     	cmd_line = cmd_line + "\r\n";
      }
      try {
      	tz390.systerm_io++;
--- 2988,2996 ----
       * send input to exec command in process
       */
      if  (cmd_line == null){
!     	cmd_line = newline;
      } else {
!     	cmd_line = cmd_line + newline;
      }
      try {
      	tz390.systerm_io++;
***************
*** 3449,3461 ****
  				      + " LOC=" + tz390.get_hex(cde_loc[index],8)
  		              + " LEN=" + tz390.get_hex(cde_len[index],8)
  		              + " USE=" + tz390.get_hex(cde_use[index],8)
! 		              + "\r\n");
  			} else {
  				put_log(" CDE  DSN=" + cde_name[index] 
  				      + " LOC=" + tz390.get_hex(cde_loc[index],8)
  				      + " LEN=" + tz390.get_hex(cde_len[index],8)
  				      + " USE=" + tz390.get_hex(cde_use[index],8)
! 				      + "\r\n");
  			}
  			dump_mem(cde_loc[index] & pz390.psw_amode,cde_len[index]);
  		}
--- 3453,3465 ----
  				      + " LOC=" + tz390.get_hex(cde_loc[index],8)
  		              + " LEN=" + tz390.get_hex(cde_len[index],8)
  		              + " USE=" + tz390.get_hex(cde_use[index],8)
! 		              + newline);
  			} else {
  				put_log(" CDE  DSN=" + cde_name[index] 
  				      + " LOC=" + tz390.get_hex(cde_loc[index],8)
  				      + " LEN=" + tz390.get_hex(cde_len[index],8)
  				      + " USE=" + tz390.get_hex(cde_use[index],8)
! 				      + newline);
  			}
  			dump_mem(cde_loc[index] & pz390.psw_amode,cde_len[index]);
  		}
*** tz390.java.orig	Thu Nov 16 15:23:06 2006
--- tz390.java	Fri Nov 17 16:08:34 2006
***************
*** 2963,2968 ****
--- 2963,2969 ----
        int[]     key_tab_index = (int[])Array.newInstance(int.class,max_key_tab);
        int[]     key_tab_low   = (int[])Array.newInstance(int.class,max_key_tab);
        int[]     key_tab_high  = (int[])Array.newInstance(int.class,max_key_tab);
+       public static String newline = System.getProperty("line.separator");
  public void init_tables(){
  	/*
  	 * initialize dir_cur and tables
***************
*** 3347,3353 ****
  	}
  	try {
  		systerm_io++;
! 		systerm_file.writeBytes(systerm_time + systerm_prefix + "STARTED\r\n");
  	} catch (Exception e){
          abort_error(11,"I/O error on systerm file " + e.toString());
  	}
--- 3348,3354 ----
  	}
  	try {
  		systerm_io++;
! 		systerm_file.writeBytes(systerm_time + systerm_prefix + "STARTED" + newline);
  	} catch (Exception e){
          abort_error(11,"I/O error on systerm file " + e.toString());
  	}
***************
*** 3362,3368 ****
  	if (systerm_file != null){
  		try {
  			systerm_io++;
! 			systerm_file.writeBytes(systerm_time + systerm_prefix + msg + "\r\n");
  		} catch (Exception e){
  	        abort_error(12,"I/O error on systerm file " + e.toString());
  		}
--- 3363,3369 ----
  	if (systerm_file != null){
  		try {
  			systerm_io++;
! 			systerm_file.writeBytes(systerm_time + systerm_prefix + msg + newline);
  		} catch (Exception e){
  	        abort_error(12,"I/O error on systerm file " + e.toString());
  		}
***************
*** 3392,3398 ****
      				 + systerm_sec 
      				 + " MEM(MB)=" + right_justify("" + get_mem_usage(),3) 
      				 + " IO=" + systerm_io 
!     				 + systerm_ins_text + "\r\n");
      	 } catch (Exception e){
      	 }
      	 try {
--- 3393,3399 ----
      				 + systerm_sec 
      				 + " MEM(MB)=" + right_justify("" + get_mem_usage(),3) 
      				 + " IO=" + systerm_io 
!     				 + systerm_ins_text + newline);
      	 } catch (Exception e){
      	 }
      	 try {
***************
*** 3592,3601 ****
  	    	} else {
  	    	    file_name = parm;
  	    	}
  	    	if  (file_name.length() > 0
  	            && file_name.indexOf('\\') == -1
! 	    		&& file_name.indexOf(':')  == -1){
  	    		file_name = parm_dir.concat(File.separator + file_name);	
  	    	}
  	    	int index = file_name.indexOf(".");
  	    	if (index == -1){
--- 3593,3606 ----
  	    	} else {
  	    	    file_name = parm;
  	    	}
+ 
+                 String os_name = System.getProperty("os.name");
                  if  (file_name.length() > 0
                          && file_name.indexOf('\\') == -1
!                         && file_name.indexOf(':')  == -1
!                         && !os_name.equals("Linux")) {
                          file_name = parm_dir.concat(File.separator + file_name);
+         
                  }
  	    	int index = file_name.indexOf(".");
  	    	if (index == -1){
***************
*** 3662,3668 ****
  			temp_file = new File(file_name + file_type);
  		}
  		if (temp_file.isFile()){
! 			return temp_file.getPath().toUpperCase();
  		}
  	}
  	return null;
--- 3667,3673 ----
  			temp_file = new File(file_name + file_type);
  		}
  		if (temp_file.isFile()){
! 			return temp_file.getPath();
  		}
  	}
  	return null;
***************
*** 3671,3676 ****
--- 3676,3682 ----
       /*
        * exec command as separate task
        */
+     System.out.println("exec_cmd: " + cmd);
             try {
    	           Runtime.getRuntime().exec(cmd);
    	           return true;
***************
*** 3709,3715 ****
      int index = file_name.lastIndexOf(File.separator);
      if (index != -1){  // get dir path if any
      	pgm_dir = file_name.substring(0,index+1);
!     	file_name = file_name.substring(index + 1).toUpperCase();
      } else if (file_name.length() > 1 && file_name.charAt(1) == ':'){
      	File temp_file = new File(file_name.substring(0,2));
      	try {
--- 3715,3721 ----
      int index = file_name.lastIndexOf(File.separator);
      if (index != -1){  // get dir path if any
      	pgm_dir = file_name.substring(0,index+1);
!     	file_name = file_name.substring(index + 1);
      } else if (file_name.length() > 1 && file_name.charAt(1) == ':'){
      	File temp_file = new File(file_name.substring(0,2));
      	try {
***************
*** 3720,3726 ****
      	file_name = file_name.substring(2); //RPI113
      } else {
      	pgm_dir = dir_cur;
- 	  	file_name = file_name.toUpperCase();
      }
      index = file_name.lastIndexOf('.');
      if (index != -1){  // strip extension if any
--- 3726,3731 ----
***************
*** 3740,3746 ****
  	/*
  	 * set current directory dir_cur
  	 */
! 	dir_cur = System.getProperty("user.dir").toUpperCase() + File.separator;
  }
  public void reset_opsyn(){
  	/*
--- 3745,3751 ----
  	/*
  	 * set current directory dir_cur
  	 */
! 	dir_cur = System.getProperty("user.dir") + File.separator;
  }
  public void reset_opsyn(){
  	/*
***************
*** 4189,4195 ****
  		}
  	}
  	try {
! 		trace_file_buff.write(text + "\r\n");
  	} catch (Exception e){
  		abort_error(17,"trace file write error " + e.toString());
  	}
--- 4194,4200 ----
  		}
  	}
  	try {
! 		trace_file_buff.write(text + newline);
  	} catch (Exception e){
  		abort_error(17,"trace file write error " + e.toString());
  	}
*** z390.java.orig	Thu Nov 16 15:23:06 2006
--- z390.java	Fri Nov 17 16:13:15 2006
***************
*** 332,338 ****
             String job_opt = "";
             String link_opt = "";
             String exec_opt = "";
!            String edit_def = "notepad.exe";
             String edit_cmd = null;
       /*
        * web site and install location
--- 332,339 ----
             String job_opt = "";
             String link_opt = "";
             String exec_opt = "";
!            static String edit_def;
!            public static String newline = System.getProperty("line.separator");
             String edit_cmd = null;
       /*
        * web site and install location
***************
*** 378,383 ****
--- 379,389 ----
    	 * Create instance of z390 class
    	 */
      	    z390 pgm = new z390();
+             if (System.getProperty("os.name").equals("Linux")) {
+ 		edit_def = "xemacs";
+ 	    } else {
+ 		edit_def  = "notepad.exe";
+ 	    }
              pgm.main_applet = false;
              pgm.set_main_mode(args);
              if  (pgm.main_gui){
***************
*** 583,589 ****
  			  } else {
  				  abort_error(52,"invalid install directory - " + install_loc);
  			  }
! 			  temp_file = new File(install_loc + File.separator + "doc");
  			  if (temp_file.isDirectory()){
  				  install_doc = temp_file.getPath();
  			  } else {
--- 589,595 ----
  			  } else {
  				  abort_error(52,"invalid install directory - " + install_loc);
  			  }
! 			  temp_file = new File(install_loc + File.separator + "Doc");
  			  if (temp_file.isDirectory()){
  				  install_doc = temp_file.getPath();
  			  } else {
***************
*** 777,783 ****
     	        }
  	   	    if (log_file != null){
  	   	       try {
! 	   	    	   log_file.write(msg + "\r\n");
  	   	       } catch (Exception e) {
  	   	    	   abort_error(2,"write to log error - " + e.toString());
  	   	       }	   	 	
--- 783,789 ----
     	        }
  	   	    if (log_file != null){
  	   	       try {
! 	   	    	   log_file.write(msg + newline);
  	   	       } catch (Exception e) {
  	   	    	   abort_error(2,"write to log error - " + e.toString());
  	   	       }	   	 	
***************
*** 1066,1073 ****
              	cmd_opcode_ok = true;
              	if (perm_file_execute){
              	   if (!main_batch){
!                       if (!tz390.exec_cmd("notepad.exe")){
!                 	     log_error(16,"notepad.exe not found");
                        }
              	   } else {
              	   	  log_error(54,"interactive command not supported in batch");
--- 1072,1079 ----
              	cmd_opcode_ok = true;
              	if (perm_file_execute){
              	   if (!main_batch){
!                       if (!tz390.exec_cmd(edit_def)){
!                 	     log_error(16,edit_def + " not found");
                        }
              	   } else {
              	   	  log_error(54,"interactive command not supported in batch");
***************
*** 1474,1479 ****
--- 1480,1498 ----
                  } else {
                      cmd_pgm = "cmd.exe";
                  }
+                 if (os_name.equals("Linux")) {
+                     cmd_pgm = "perl";
+                     if  (cmd_line != null){
+ 			cmd_parms = new String[3];
+ 			cmd_parms[0] = cmd_pgm;
+ 			cmd_parms[1] = jar_file_dir() + "/cmd.pl";
+ 			cmd_parms[2] = cmd_line;
+ 		    } else {
+ 			cmd_parms = new String[2];
+ 			cmd_parms[0] = cmd_pgm;
+ 			cmd_parms[1] = jar_file_dir() + "/cmd.pl";
+ 		    }
+ 		} else {
  		    if  (cmd_line != null){
                          cmd_parms = new String[3];
                          cmd_parms[0] = cmd_pgm;
***************
*** 1483,1488 ****
--- 1502,1508 ----
                          cmd_parms = new String[1];
                          cmd_parms[0] = cmd_pgm;
                      }
+ 		}
              	rc = cmd_exec_start(cmd_parms);
                  if  (rc == 0){
     		            monitor_cmd_time_total = 0;
***************
*** 1511,1516 ****
--- 1531,1545 ----
  	   		    return 16;
      	 	}
  	   }
+ 
+     public static String jar_file_dir(){
+ 	/* Return the directory containing the jar file */
+ 	StringBuffer path = new StringBuffer(System.getProperty("java.class.path"));
+         /* Delete everything from the last directory separator onwards: */
+ 	path.delete(path.lastIndexOf(File.separator), path.length());
+         return path.toString();
+     }
+ 
  	   private void sleep_now(){
  		   /*
  		    * sleep for monitor interval if not abort
***************
*** 1531,1542 ****
--- 1560,1575 ----
  		    *
  		    */
  	           if (!tz390.dir_cur.equals(install_loc)){
+ 		       if (System.getProperty("os.name").equals("Linux")) {
+                            cmd_exec_input("CD " + tz390.dir_cur);
+ 		       } else {
  		           if (!tz390.dir_cur.substring(0,2).equals(install_loc.substring(0,2))){
  		           		cmd_exec_input(tz390.dir_cur.substring(0,2));
  		           }
  		           cmd_exec_input("CD " + tz390.dir_cur.substring(2));
  		       }
  		   }
+ 	   }
  	   private void monitor_update(){
  	   /*
  	    * 1.  At monitor_wait intervals, update the
***************
*** 1646,1652 ****
  	   	    		 cmd_startup(null);
  	   	    		 cmd_exec_input(cmd);
  	   	    		 cmd_running = true;
! 	   	    	     cmd_exec_input("\r\n" + "exit" + "\r\n");  //RPI15, RPI 98
  	   	    	 }
    	 	     }
  	   }
--- 1679,1685 ----
  	   	    		 cmd_startup(null);
  	   	    		 cmd_exec_input(cmd);
  	   	    		 cmd_running = true;
! 	   	    	     cmd_exec_input(newline + "exit" + newline);  //RPI15, RPI 98
  	   	    	 }
    	 	     }
  	   }
***************
*** 2451,2458 ****
--- 2484,2499 ----
     	   * link to PDF User Guide
     	   * note start parms are /d"path" file 
     	   */	
+ 	      if (System.getProperty("os.name").equals("Linux")) {
+ 		  if  (tz390.exec_cmd("acroread " + install_doc + "/z390_User_Guide.pdf")) {
+ 		      put_log("Start issued for z390_User_Guide.pdf");
+ 		  } else {
+ 		      log_error(41,"Start error for z390_User_Guide.pdf");
+ 		}
+ 	      } else {
  		  start_doc("/d" +  "\"" + install_doc + "\" z390_User_Guide.pdf");
  	      }
+ 	  }
     	  private void reset_z390_cmd(){
     	  /*
     	   * reset z390_cmd text and set focus
***************
*** 2466,2473 ****
--- 2507,2522 ----
     	  /*
     	   * link to online support www.z390.org
     	   */	
+ 	      if (System.getProperty("os.name").equals("Linux")) {
+                 if  (tz390.exec_cmd("firefox " +  web_site)){
+ 	  	       put_log("Start issued for " + web_site);
+ 		} else {
+ 	           log_error(41,"Start error for " + web_site);
+ 		}
+ 	      } else {
  		  start_doc(web_site);
  	      }
+       }
     	public boolean start_doc(String file_name){
  	       if  (tz390.exec_cmd("cmd.exe /c Start " +  file_name)){
  	  	       put_log("Start issued for " + file_name);
***************
*** 3155,3161 ****
              	        }
                         if  (main_gui){
                         	 if (select_cmd.equals("EDIT")){
!       	     				 if (!tz390.exec_cmd("\"" + edit_cmd + "\" \"" 
        	     						 + selected_file_name + "\"")){
     	     				         log_error(19,"start editor failed - " + edit_cmd);
     	     			         }
--- 3204,3210 ----
              	        }
                         if  (main_gui){
                         	 if (select_cmd.equals("EDIT")){
!       	     				 if (!tz390.exec_cmd("/bin/sh " + "\"" + edit_cmd + "\" \"" 
        	     						 + selected_file_name + "\"")){
     	     				         log_error(19,"start editor failed - " + edit_cmd);
     	     			         }
***************
*** 3198,3205 ****
--- 3247,3258 ----
  			 */
  			if (file_name.length() > tz390.dir_cur.length()
  				&& file_name.substring(0,tz390.dir_cur.length()).equals(tz390.dir_cur)){
+ 			    if (System.getProperty("os.name").equals("Linux")) {
+                                 file_name = file_name.substring(tz390.dir_cur.length()); // skip dir
+ 			    } else {
  				file_name = file_name.substring(tz390.dir_cur.length()+1); // skip dir + sep
  			    }
+ 			}
  			int index = file_name.indexOf(" ");
  			if (index >=0){
  				return "\"" + file_name + "\""; // LSN
***************
*** 3434,3442 ****
               * send input to exec command in process
               */
              	if  (cmd_line == null){
!             		cmd_line = "\r\n";
               	} else {
!             		cmd_line = cmd_line + "\r\n"; 
              	}
              	try {
              		cmd_exec_input_writer.write(cmd_line.getBytes());
--- 3487,3495 ----
               * send input to exec command in process
               */
              	if  (cmd_line == null){
!             		cmd_line = newline;
               	} else {
!             		cmd_line = cmd_line + newline; 
              	}
              	try {
              		cmd_exec_input_writer.write(cmd_line.getBytes());
***************
*** 3513,3519 ****
  						// if ez390 issues exit request close down gui
  						// this is trigged when ez390 exits if 
  						// z390 sent "exit_request to input queue
! 					    cmd_exec_input("\r\n" + "exit" + "\r\n");  // RPI 98
  					} else {
  						put_log(msg);
  					}
--- 3566,3572 ----
  						// if ez390 issues exit request close down gui
  						// this is trigged when ez390 exits if 
  						// z390 sent "exit_request to input queue
! 					    cmd_exec_input(newline + "exit" + newline);  // RPI 98
  					} else {
  						put_log(msg);
  					}
