home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / mc454src.zip / mc-4.5.4.src / mc-4.5.4.dif < prev    next >
Text File  |  1999-01-04  |  77KB  |  2,935 lines

  1. diff -Naur mc-4.5.4/gtkedit/editcmd.c mc-4.5.4.emx/gtkedit/editcmd.c
  2. --- mc-4.5.4/gtkedit/editcmd.c    Wed Dec 30 11:50:36 1998
  3. +++ mc-4.5.4.emx/gtkedit/editcmd.c    Fri Jan  1 18:23:24 1999
  4. @@ -390,10 +390,14 @@
  5.  
  6.      if (*p != '/') {
  7.      if (strlen (cwd) == 0) {
  8. +#ifdef GETCWD
  9. +        GETCWD (cwd, MAX_PATH_LEN);
  10. +#else
  11.  #ifdef HAVE_GETCWD
  12.          getcwd (cwd, MAX_PATH_LEN);
  13.  #else
  14.          getwd (cwd);
  15. +#endif
  16.  #endif
  17.      }
  18.      r = malloc (strlen (cwd) + strlen (p) + 2);
  19. diff -Naur mc-4.5.4/gtkedit/syntax.c mc-4.5.4.emx/gtkedit/syntax.c
  20. --- mc-4.5.4/gtkedit/syntax.c    Wed Dec 30 11:50:36 1998
  21. +++ mc-4.5.4.emx/gtkedit/syntax.c    Sat Jan  2 07:36:36 1999
  22. @@ -3027,8 +3027,13 @@
  23.      fclose (f);
  24.      return fopen (syntax_file, "r");
  25.      }
  26. +#ifdef OS2EMX_CHG
  27. +    memset (line, 0, 80);
  28. +    fread (line, 79, 1, f);
  29. +#else
  30.      memset (line, 0, 79);
  31.      fread (line, 80, 1, f);
  32. +#endif
  33.      if (!strstr (line, "syntax rules version")) {
  34.      goto rename_rule_file;
  35.      } else {
  36. @@ -3037,6 +3042,9 @@
  37.      if (atoi (p) < atoi (CURRENT_SYNTAX_RULES_VERSION)) {
  38.          char s[1024];
  39.        rename_rule_file:
  40. +#ifdef OS2EMX_CHG
  41. +            fclose(f);  /* cannot rename open file */ 
  42. +#endif
  43.          strcpy (s, syntax_file);
  44.          strcat (s, ".OLD");
  45.          unlink (s);
  46. diff -Naur mc-4.5.4/intl/dcgettext.c mc-4.5.4.emx/intl/dcgettext.c
  47. --- mc-4.5.4/intl/dcgettext.c    Thu Mar 19 18:15:14 1998
  48. +++ mc-4.5.4.emx/intl/dcgettext.c    Fri Jan  1 18:50:22 1999
  49. @@ -277,7 +277,11 @@
  50.        ADD_BLOCK (block_list, dirname);
  51.  
  52.        __set_errno (0);
  53. +#ifdef GETCWD
  54. +      while ((ret = GETCWD (dirname, path_max)) == NULL && errno == ERANGE)
  55. +#else
  56.        while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
  57. +#endif
  58.      {
  59.        path_max += PATH_INCR;
  60.        dirname = (char *) alloca (path_max + dirname_len);
  61. diff -Naur mc-4.5.4/slang/slgetkey.c mc-4.5.4.emx/slang/slgetkey.c
  62. --- mc-4.5.4/slang/slgetkey.c    Wed Dec 30 11:50:36 1998
  63. +++ mc-4.5.4.emx/slang/slgetkey.c    Fri Jan  1 20:31:26 1999
  64. @@ -26,7 +26,11 @@
  65.  # endif
  66.  #endif
  67.  
  68. -#ifdef OS2_NT /* see the replacement in src/slint.c */
  69. +#ifdef ALTERNATIVE_CONSOLE
  70. +extern int(*os_init_key)(char *term);
  71. +#endif
  72. +
  73. +#if defined OS2_NT || defined OS2EMX /* see the replacement in src/slint.c */
  74.  unsigned int SLang_getkey (void)
  75.  {
  76.     unsigned int imax;
  77. @@ -44,6 +48,9 @@
  78.     else if (0xFFFF == (ch = SLsys_getkey ())) return ch;
  79.     
  80.  #ifdef DEC_8BIT_HACK
  81. +#ifdef OS2EMX /* os2 keyb */
  82. +   if(os_init_key==0)
  83. +#endif
  84.     if (ch & 0x80)
  85.       {
  86.      unsigned char i;
  87. @@ -89,7 +96,7 @@
  88.     SLang_ungetkey_string(&ch, 1);
  89.  }
  90.  
  91. -#ifdef OS2_NT /* see the replacement in src/slint.c */
  92. +#if defined OS2_NT || defined OS2EMX  /* see the replacement in src/slint.c */
  93.  int SLang_input_pending (int tsecs)
  94.  {
  95.     int n;
  96. diff -Naur mc-4.5.4/src/background.h mc-4.5.4.emx/src/background.h
  97. --- mc-4.5.4/src/background.h    Wed Dec 30 11:50:38 1998
  98. +++ mc-4.5.4.emx/src/background.h    Fri Jan  1 20:58:20 1999
  99. @@ -4,7 +4,9 @@
  100.  /* Background code requires socketpair to be available */
  101.  /* Do not add the background code if it is not supported */
  102.  #ifdef USE_NETCODE
  103. +#ifndef OS2EMX
  104.  #        define WITH_BACKGROUND
  105. +#endif
  106.  #endif
  107.  
  108.  /* Used for parent/child communication.  These are numbers that
  109. diff -Naur mc-4.5.4/src/chattrib.c mc-4.5.4.emx/src/chattrib.c
  110. --- mc-4.5.4/src/chattrib.c    Thu Jan  1 00:00:00 1970
  111. +++ mc-4.5.4.emx/src/chattrib.c    Sat Jan  2 11:07:20 1999
  112. @@ -0,0 +1,408 @@
  113. +/* Chattrib command  
  114. +
  115. +   This program is free software; you can redistribute it and/or modify
  116. +   it under the terms of the GNU General Public License as published by
  117. +   the Free Software Foundation; either version 2 of the License, or
  118. +   (at your option) any later version.
  119. +
  120. +   This program is distributed in the hope that it will be useful,
  121. +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  122. +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  123. +   GNU General Public License for more details.
  124. +
  125. +   You should have received a copy of the GNU General Public License
  126. +   along with this program; if not, write to the Free Software
  127. +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  128. +
  129. +*/
  130. +
  131. +#include <config.h>
  132. +
  133. +#include <string.h>
  134. +#include <stdio.h>
  135. +
  136. +#include "tty.h"
  137. +#include "mad.h"
  138. +#include "util.h"
  139. +#include "win.h"
  140. +#include "color.h"
  141. +#include "dlg.h"
  142. +#include "widget.h"
  143. +#include "dialog.h"    /* For do_refresh() */
  144. +
  145. +#include "dir.h"
  146. +#include "panel.h"        /* Needed for the externs */
  147. +#include "file.h"
  148. +#include "main.h"
  149. +
  150. +#include "hetnet.h"
  151. +#include "chattrib.h"
  152. +
  153. +static int single_set;
  154. +struct Dlg_head *ch_dlg;
  155. +
  156. +#define PX        5
  157. +#define PY        2
  158. +
  159. +#define FX        40
  160. +#define FY        2
  161. +
  162. +#define BX        6
  163. +#define BY        13
  164. +
  165. +#define TX        5
  166. +#define TY        9
  167. +
  168. +#define ATTRIBUTES    4
  169. +#define BUTTONS        6
  170. +
  171. +#define B_MARKED    B_USER
  172. +#define B_ALL        B_USER+1
  173. +#define B_SETMRK        B_USER+2
  174. +#define B_CLRMRK        B_USER+3
  175. +
  176. +int     mode_change, need_update;
  177. +int     c_file,      end_chattrib;
  178. +
  179. +umode_t and_mask,    or_mask,   c_stat;
  180. +char    *c_fname,    *c_fown,   *c_fgrp, *c_fperm;
  181. +int     c_fsize;
  182. +
  183. +static WLabel        *statl;
  184. +static int           normal_color;
  185. +static int           title_color;
  186. +static int           selection_color;
  187. +
  188. +/* bsedos.h */
  189. +static
  190. +struct {
  191. +    mode_t      mode;
  192. +    char        *text;
  193. +    int         selected;
  194. +    WCheck      *check;
  195. +} check_attr[ATTRIBUTES] = {
  196. +
  197. +    {    
  198. +    MC_FILE_ARCHIVED, "Archive", 0, 0,
  199. +    },
  200. +    {
  201. +    MC_FILE_READONLY, "Read Only", 0, 0,
  202. +    },
  203. +    {
  204. +    MC_FILE_HIDDEN, "Hidden", 0, 0,
  205. +    },
  206. +    {
  207. +    MC_FILE_SYSTEM, "System", 0, 0,
  208. +    },
  209. +};
  210. +
  211. +static
  212. +struct {
  213. +    int ret_cmd, flags, y, x;
  214. +    char *text;
  215. +} chattrib_but[BUTTONS] = {
  216. +
  217. +    {
  218. +    B_CANCEL, NORMAL_BUTTON, 2, 33, "&Cancel",
  219. +    },
  220. +    {
  221. +    B_ENTER, DEFPUSH_BUTTON, 2, 17, "&Set",
  222. +    },
  223. +    {
  224. +    B_CLRMRK, NORMAL_BUTTON, 0, 42, "C&lear marked",
  225. +    },
  226. +    {
  227. +    B_SETMRK, NORMAL_BUTTON, 0, 27, "S&et marked",
  228. +    },
  229. +    {
  230. +    B_MARKED, NORMAL_BUTTON, 0, 12, "&Marked all",
  231. +    },
  232. +    {
  233. +    B_ALL, NORMAL_BUTTON, 0, 0, "Set &all",
  234. +    },
  235. +};
  236. +
  237. +static void chattrib_toggle_select (void)
  238. +{
  239. +    int Id = ch_dlg->current->dlg_id - BUTTONS + single_set * 2;
  240. +
  241. +    attrset (COLOR_NORMAL);
  242. +    check_attr[Id].selected ^= 1;
  243. +
  244. +    dlg_move (ch_dlg, PY + ATTRIBUTES - Id, PX + 1);
  245. +    addch ((check_attr[Id].selected) ? '*' : ' ');
  246. +    dlg_move (ch_dlg, PY + ATTRIBUTES - Id, PX + 3);
  247. +}
  248. +
  249. +static void chattrib_refresh (void)
  250. +{
  251. +    attrset   (COLOR_NORMAL);
  252. +    dlg_erase (ch_dlg);
  253. +
  254. +    draw_box (ch_dlg, 1, 2, 16 - single_set, 66);
  255. +    draw_box (ch_dlg, PY, PX, ATTRIBUTES + 2, 33);
  256. +    draw_box (ch_dlg, FY, FX, 10, 25);
  257. +
  258. +    dlg_move (ch_dlg, FY + 1, FX + 2);
  259. +    addstr ("Name");
  260. +    dlg_move (ch_dlg, FY + 3, FX + 2);
  261. +    addstr ("Attributes (Hex)");
  262. +    dlg_move (ch_dlg, FY + 5, FX + 2);
  263. +    addstr ("Owner name");
  264. +    dlg_move (ch_dlg, FY + 7, FX + 2);
  265. +    addstr ("Group name");
  266. +
  267. +    attrset (title_color);
  268. +    dlg_move (ch_dlg, 1, 27);
  269. +    addstr (" Attrib command ");
  270. +    dlg_move (ch_dlg, PY, PX + 1);
  271. +    addstr (" Attributes ");
  272. +    dlg_move (ch_dlg, FY, FX + 1);
  273. +    addstr (" File ");
  274. +
  275. +    attrset (selection_color);
  276. +
  277. +    dlg_move (ch_dlg, TY, TX);
  278. +    addstr ("Use SPACE to change an option,");
  279. +    dlg_move (ch_dlg, TY + 1, TX);
  280. +    addstr ("ARROW KEYS to move between options"); 
  281. +    dlg_move (ch_dlg, TY + 2, TX);
  282. +    addstr ("and T or INS to mark"); 
  283. +
  284. +}
  285. +
  286. +static int chattrib_callback (Dlg_head *h, int Par, int Msg)
  287. +{
  288. +    char buffer [10];
  289. +
  290. +    switch (Msg) {
  291. +    case DLG_ACTION:
  292. +    if (Par >= BUTTONS - single_set * 2){
  293. +        c_stat ^= check_attr[Par - BUTTONS + single_set * 2].mode;
  294. +        sprintf (buffer, "0x%02x", c_stat);
  295. +        label_set_text (statl, buffer);
  296. +        chattrib_toggle_select ();
  297. +        mode_change = 1;
  298. +    }
  299. +    break;
  300. +
  301. +    case DLG_KEY:
  302. +    if ((Par == 'T' || Par == 't' || Par == KEY_IC) &&
  303. +        ch_dlg->current->dlg_id >= BUTTONS - single_set * 2) {
  304. +        chattrib_toggle_select ();
  305. +        if (Par == KEY_IC)
  306. +        dlg_one_down (ch_dlg);
  307. +        return 1;
  308. +    }
  309. +    break;
  310. +#ifndef HAVE_X
  311. +    case DLG_DRAW:
  312. +    chattrib_refresh ();
  313. +    break;
  314. +#endif
  315. +    }
  316. +    return 0;
  317. +}
  318. +
  319. +static void init_chattrib (void)
  320. +{
  321. +    int i;
  322. +
  323. +    do_refresh ();
  324. +    end_chattrib = c_file = need_update = 0;
  325. +    single_set = (cpanel->marked < 2) ? 2 : 0;
  326. +
  327. +    if (use_colors){
  328. +    normal_color = COLOR_NORMAL;
  329. +    title_color  = COLOR_HOT_NORMAL;
  330. +    selection_color = COLOR_NORMAL;
  331. +    } else {
  332. +    normal_color = NORMAL_COLOR;
  333. +    title_color  = SELECTED_COLOR;
  334. +    selection_color = SELECTED_COLOR;
  335. +    }
  336. +
  337. +    ch_dlg = create_dlg (0, 0, 18 - single_set, 70, dialog_colors,
  338. +             chattrib_callback, "[Chattrib]", "chattrib", DLG_CENTER);
  339. +            
  340. +    x_set_dialog_title (ch_dlg, "Cattrib command");
  341. +
  342. +#define XTRACT(i) BY+chattrib_but[i].y-single_set, BX+chattrib_but[i].x, \
  343. +     chattrib_but[i].ret_cmd, chattrib_but[i].flags, chattrib_but[i].text, 0, 0, NULL
  344. +
  345. +/*    tk_new_frame (ch_dlg, "b."); */
  346. +    for (i = 0; i < BUTTONS; i++) {
  347. +    if (i == 2 && single_set)
  348. +        break;
  349. +    else
  350. +        add_widgetl (ch_dlg, button_new (XTRACT (i)), XV_WLAY_RIGHTOF);
  351. +    }
  352. +
  353. +
  354. +#define XTRACT2(i) 0, check_attr [i].text, NULL
  355. +/*    tk_new_frame (ch_dlg, "c."); */
  356. +    for (i = 0; i < ATTRIBUTES; i++) {
  357. +    check_attr[i].check = check_new (PY + (ATTRIBUTES - i), PX + 2,
  358. +                     XTRACT2 (i));
  359. +    add_widget (ch_dlg, check_attr[i].check);
  360. +    }
  361. +}
  362. +
  363. +
  364. +static void chattrib_done (void)
  365. +{
  366. +    if (need_update)
  367. +    update_panels (UP_OPTIMIZE, UP_KEEPSEL);
  368. +    repaint_screen ();
  369. +}
  370. +
  371. +static
  372. +char *next_file (void)
  373. +{
  374. +    while (!cpanel->dir.list[c_file].f.marked)
  375. +    c_file++;
  376. +
  377. +    return cpanel->dir.list[c_file].fname;
  378. +}
  379. +
  380. +
  381. +static void do_chattrib (mode_t sf)
  382. +{
  383. +    sf &= and_mask;
  384. +    sf |= or_mask;
  385. +
  386. +    set_attrib(cpanel->dir.list[c_file].fname, sf);
  387. +
  388. +    do_file_mark (cpanel, c_file, 0);
  389. +}
  390. +
  391. +static void apply_mask (mode_t sf)
  392. +{
  393. +    char *fname;
  394. +    mode_t sf_stat;
  395. +
  396. +    need_update = end_chattrib = 1;
  397. +    do_chattrib (sf);
  398. +
  399. +    do {
  400. +    fname = next_file ();
  401. +    if ((sf_stat = get_attrib (fname)) < 0)
  402. +        break;
  403. +
  404. +    c_stat = sf_stat;
  405. +    do_chattrib (c_stat);
  406. +    } while (cpanel->marked);
  407. +}
  408. +
  409. +
  410. +void chattrib_cmd ()
  411. +{
  412. +    char buffer [10];
  413. +    char *fname;
  414. +    int i;
  415. +    int attr;
  416. +
  417. +#ifdef OS2EMX
  418. +  /* maybe function for "supported features" in all filesystems */
  419. +    if(!fs_has_attrib(cpanel->cwd)) {
  420. +        message (1, _(" Oops... "),
  421. +             _(" I can't run the Attrib command on this fs "));
  422. +            return;
  423. +    }
  424. +#endif
  425. +
  426. +    do {            /* do while any files remaining */
  427. +    init_chattrib ();
  428. +    if (cpanel->marked)
  429. +        fname = next_file ();    /* next marked file */
  430. +    else
  431. +        fname = selection (cpanel)->fname;    /* single file */
  432. +
  433. +          /* get status of file */
  434. +        if(mc_getattrib(fname,&attr)<0)
  435. +        break;
  436. +
  437. +    c_stat = attr;
  438. +    mode_change = 0;    /* clear changes flag */
  439. +
  440. +    /* set check buttons */
  441. +    for (i = 0; i < ATTRIBUTES; i++){
  442. +        check_attr[i].check->state = (c_stat & check_attr[i].mode) ? 1 : 0;
  443. +        check_attr[i].selected = 0;
  444. +    }
  445. +
  446. +/*    tk_new_frame (ch_dlg, "l."); */
  447. +    /* Set the labels */
  448. +    c_fname = name_trunc (fname, 21);
  449. +    add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname, NULL));
  450. +    c_fown = "unknown";
  451. +    add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown, NULL));
  452. +    c_fgrp = "unknown";
  453. +    add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp, NULL));
  454. +    sprintf (buffer, "0x%02x", c_stat);
  455. +    statl = label_new (FY+4, FX+2, buffer, NULL);
  456. +    add_widget (ch_dlg, statl);
  457. +/*    tk_end_frame (); */
  458. +    
  459. +    run_dlg (ch_dlg);    /* retrieve an action */
  460. +    
  461. +    /* do action */
  462. +    switch (ch_dlg->ret_value){
  463. +    case B_ENTER:
  464. +        if (mode_change)mc_setattrib (fname, c_stat);  /*.ado */
  465. +        need_update = 1;
  466. +        break;
  467. +    
  468. +    case B_CANCEL:
  469. +        end_chattrib = 1;
  470. +        break;
  471. +    
  472. +    case B_ALL:
  473. +    case B_MARKED:
  474. +        and_mask = or_mask = 0;
  475. +        and_mask = ~and_mask;
  476. +
  477. +        for (i = 0; i < ATTRIBUTES; i++) {
  478. +        if (check_attr[i].selected || ch_dlg->ret_value == B_ALL)
  479. +            if (check_attr[i].check->state & C_BOOL)
  480. +            or_mask |= check_attr[i].mode;
  481. +            else
  482. +            and_mask &= ~check_attr[i].mode;
  483. +        }
  484. +
  485. +        apply_mask (attr);
  486. +        break;
  487. +    
  488. +    case B_SETMRK:
  489. +        and_mask = or_mask = 0;
  490. +        and_mask = ~and_mask;
  491. +
  492. +        for (i = 0; i < ATTRIBUTES; i++) {
  493. +        if (check_attr[i].selected)
  494. +            or_mask |= check_attr[i].mode;
  495. +        }
  496. +
  497. +        apply_mask (attr);
  498. +        break;
  499. +    case B_CLRMRK:
  500. +        and_mask = or_mask = 0;
  501. +        and_mask = ~and_mask;
  502. +
  503. +        for (i = 0; i < ATTRIBUTES; i++) {
  504. +        if (check_attr[i].selected)
  505. +            and_mask &= ~check_attr[i].mode;
  506. +        }
  507. +
  508. +        apply_mask (attr);
  509. +        break;
  510. +    }
  511. +
  512. +    if (cpanel->marked && ch_dlg->ret_value!=B_CANCEL) {
  513. +        do_file_mark (cpanel, c_file, 0);
  514. +        need_update = 1;
  515. +    }
  516. +    destroy_dlg (ch_dlg);
  517. +    } while (cpanel->marked && !end_chattrib);
  518. +    chattrib_done ();
  519. +}
  520. +
  521. diff -Naur mc-4.5.4/src/chattrib.h mc-4.5.4.emx/src/chattrib.h
  522. --- mc-4.5.4/src/chattrib.h    Thu Jan  1 00:00:00 1970
  523. +++ mc-4.5.4.emx/src/chattrib.h    Mon Dec 28 07:54:14 1998
  524. @@ -0,0 +1,7 @@
  525. +#ifndef __CHATTRIB_H
  526. +#define __CHATTRIB_H
  527. +
  528. +void chattrib_cmd (void);
  529. +
  530. +
  531. +#endif
  532. \ No newline at end of file
  533. diff -Naur mc-4.5.4/src/chmod.c mc-4.5.4.emx/src/chmod.c
  534. --- mc-4.5.4/src/chmod.c    Wed Dec 30 11:50:40 1998
  535. +++ mc-4.5.4.emx/src/chmod.c    Sat Jan  2 11:07:04 1999
  536. @@ -313,7 +313,17 @@
  537.      int i;
  538.      struct stat sf_stat;
  539.  
  540. -#if 0
  541. +
  542. +#ifdef OS2EMX
  543. +  /* maybe function for "supported features" in all filesystems */
  544. +    if(!fs_has_chmod(cpanel->cwd)) {
  545. +        message (1, _(" Oops... "),
  546. +             _(" I can't run the Chmod command on this fs "));
  547. +            return;
  548. +    }
  549. +#endif
  550. +
  551. +#if (0)  
  552.      /* Don't do things like this: you do not want to enumerate all
  553.         filesystems that can not support chmod, here. */
  554.      if (!vfs_current_is_local ()) {
  555. @@ -426,6 +436,8 @@
  556.      chmod_done ();
  557.  }
  558.  
  559. +#ifndef OS2EMX  /* no link chown.o achown.o */
  560. +
  561.  void ch1_cmd (int id)
  562.  {
  563.    if (advanced_chfns)
  564. @@ -442,3 +454,4 @@
  565.        chown_cmd ();
  566.  }
  567.  
  568. +#endif
  569. \ No newline at end of file
  570. diff -Naur mc-4.5.4/src/command.c mc-4.5.4.emx/src/command.c
  571. --- mc-4.5.4/src/command.c    Wed Dec 30 11:50:40 1998
  572. +++ mc-4.5.4.emx/src/command.c    Fri Jan  1 21:15:16 1999
  573. @@ -188,7 +188,16 @@
  574.      cmd = input_w (cmdline)->buffer;
  575.      while (*cmd == ' ' || *cmd == '\t' || *cmd == '\n')
  576.          cmd++;
  577. -
  578. +#if defined LOCAL_DRIVES
  579. +        if (cmd[1] == ':' && (cmd[2] == 0 || isspace (cmd[2])) &&
  580. +            toupper (cmd[0]) >= 'A' && toupper (cmd[0]) <= 'Z') {
  581. +          char chg[6] = "cd X:";
  582. +          chg[3] = cmd[0];
  583. +          do_cd_command (chg);
  584. +          new_input (input_w (cmdline));
  585. +          return MSG_HANDLED;
  586. +        }
  587. +#endif
  588.      if (strncmp (cmd, "cd ", 3) == 0 || strcmp (cmd, "cd") == 0){
  589.          do_cd_command (cmd);
  590.          new_input (input_w (cmdline));
  591. diff -Naur mc-4.5.4/src/complete.c mc-4.5.4.emx/src/complete.c
  592. --- mc-4.5.4/src/complete.c    Wed Dec 30 11:50:40 1998
  593. +++ mc-4.5.4.emx/src/complete.c    Fri Jan  1 21:16:20 1999
  594. @@ -28,6 +28,9 @@
  595.  #ifdef HAVE_UNISTD_H
  596.  #   include <unistd.h>
  597.  #endif
  598. +#ifdef OS2EMX  /* for <dirent.h> */
  599. +#include<sys/types.h>
  600. +#endif
  601.  
  602.  /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
  603.  #if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)
  604. diff -Naur mc-4.5.4/src/drive.c mc-4.5.4.emx/src/drive.c
  605. --- mc-4.5.4/src/drive.c    Thu Jan  1 00:00:00 1970
  606. +++ mc-4.5.4.emx/src/drive.c    Mon Dec 28 07:54:16 1998
  607. @@ -0,0 +1,181 @@
  608. +/* Ch-Drive command  
  609. +   
  610. +   This program is free software; you can redistribute it and/or modify
  611. +   it under the terms of the GNU General Public License as published by
  612. +   the Free Software Foundation; either version 2 of the License, or
  613. +   (at your option) any later version.
  614. +   
  615. +   This program is distributed in the hope that it will be useful,
  616. +   but WITHOUT ANY WARRANTY; without even the implied warranty of
  617. +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  618. +   GNU General Public License for more details.
  619. +
  620. +   You should have received a copy of the GNU General Public License
  621. +   along with this program; if not, write to the Free Software
  622. +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
  623. +   
  624. +   */
  625. +
  626. +
  627. +#include <config.h>
  628. +#include <string.h>
  629. +#include <stdio.h>
  630. +#include <stdlib.h>
  631. +#include <ctype.h>
  632. +#include "tty.h"
  633. +#include "mad.h"
  634. +#include "util.h"
  635. +#include "win.h"
  636. +#include "color.h"
  637. +#include "dlg.h"
  638. +#include "widget.h"
  639. +#include "dialog.h"
  640. +#include "dir.h"
  641. +#include "panel.h"
  642. +#include "main.h"
  643. +#include "cmd.h"
  644. +
  645. +
  646. +struct Dlg_head *drive_dlg;
  647. +WPanel *this_panel;
  648. +
  649. +static int drive_dlg_callback (Dlg_head *h, int Par, int Msg);
  650. +static void drive_dlg_refresh (void);
  651. +static void drive_cmd(void);
  652. +
  653. +#define B_DRIVE_BASE 100
  654. +#define BUTW      5
  655. +#define BUTPR     5
  656. +#define BUTH      2
  657. +
  658. +#define NBX (nDrivesAvail>=BUTPR?BUTPR:nDrivesAvail)
  659. +
  660. +static void drive_cmd()            
  661. +{
  662. +    int  i, nNewDrive, nDrivesAvail;
  663. +    char szTempBuf[7], szDrivesAvail[27*4], *p;
  664. +
  665. +    /* Dialogbox position */
  666. +    int  x_pos;
  667. +    int  y_pos;
  668. +    int  y_height;
  669. +    int  x_width;
  670. +
  671. +    int  m_drv;
  672. +
  673. +    /* Get drives name and count */
  674. +    nDrivesAvail=get_logical_drives((int*)szDrivesAvail);
  675. +    p=szDrivesAvail+4*nDrivesAvail;
  676. +
  677. +    /* Create Dialog */
  678. +    do_refresh ();
  679. +    
  680. +    m_drv = nDrivesAvail;
  681. +    /* Center on x, relative to panel */
  682. +    y_height = 7-BUTH+BUTH*(m_drv/BUTPR+1);
  683. +    x_width  = NBX * BUTW + 8;
  684. +    
  685. +    x_pos = this_panel->widget.x + 
  686. +             (this_panel->widget.cols - x_width)/2;
  687. +    y_pos = (LINES-y_height)/2-2;
  688. +
  689. +    drive_dlg = create_dlg (y_pos, x_pos, y_height, x_width, dialog_colors,
  690. +    drive_dlg_callback, "[ChDrive]", "drive", DLG_NONE);
  691. +
  692. +    x_set_dialog_title (drive_dlg, "Change Drive");
  693. +
  694. +
  695. +    /* Add a button for each drive */
  696. +    for (i = 0; i < m_drv; i++) {
  697. +        int J=m_drv-i-1;
  698. +        p -= 4;
  699. +        sprintf (szTempBuf, "&%c", *p);
  700. +        add_widgetl(drive_dlg,
  701. +        button_new (3+2*(J/BUTPR), J%BUTPR*BUTW+4, 
  702. +                B_DRIVE_BASE+m_drv-i-1,
  703. +        NORMAL_BUTTON, szTempBuf, 0, NULL, NULL),
  704. +        XV_WLAY_RIGHTOF);
  705. +    }
  706. +
  707. +    run_dlg(drive_dlg);   
  708. +    /* do action */
  709. +    if (drive_dlg->ret_value != B_CANCEL) {
  710. +    int  errocc = 0; /* no error */
  711. +    char drvLetter;
  712. +    nNewDrive = drive_dlg->ret_value - B_DRIVE_BASE;
  713. +    drvLetter =  (char) *(szDrivesAvail + (nNewDrive*4));
  714. +
  715. +        if(chg_drive(drvLetter)!=drvLetter)
  716. +        errocc = 1;
  717. +    else {
  718. +#ifdef GETCWD
  719. +        GETCWD (this_panel->cwd, sizeof (this_panel->cwd)-2);
  720. +#else
  721. +        getcwd (this_panel->cwd, sizeof (this_panel->cwd)-2);
  722. +#endif
  723. +        if (toupper(drvLetter) == toupper(*(this_panel->cwd))) {
  724. +            clean_dir (&this_panel->dir, this_panel->count);
  725. +            this_panel->count = do_load_dir(&this_panel->dir,
  726. +                this_panel->sort_type,
  727. +                this_panel->reverse,
  728. +                this_panel->case_sensitive,
  729. +                this_panel->filter);
  730. +            this_panel->top_file = 0;
  731. +            this_panel->selected = 0;
  732. +            this_panel->marked = 0;
  733. +            this_panel->total = 0;
  734. +            show_dir(this_panel);
  735. +            reread_cmd();
  736. +        } else
  737. +            errocc = 1;
  738. +    }
  739. +    if (errocc)
  740. +        message (1, " Error ", " Can't access drive %c: ",
  741. +        *(szDrivesAvail+(nNewDrive*4)) );
  742. +    }
  743. +    destroy_dlg (drive_dlg);
  744. +    repaint_screen ();
  745. +}
  746. +
  747. +void drive_cmd_a()
  748. +{
  749. +    this_panel = left_panel;
  750. +    drive_cmd();
  751. +}
  752. +
  753. +void drive_cmd_b()
  754. +{                                  
  755. +    this_panel = right_panel;
  756. +    drive_cmd();
  757. +}
  758. +
  759. +void drive_chg(WPanel *panel)
  760. +{
  761. +    this_panel  = panel;
  762. +    drive_cmd();
  763. +}
  764. +
  765. +static int drive_dlg_callback (Dlg_head *h, int Par, int Msg)
  766. +{
  767. +    switch (Msg) {
  768. +#ifndef HAVE_X
  769. +    case DLG_DRAW:
  770. +    drive_dlg_refresh ();
  771. +    break;
  772. +#endif
  773. +    }
  774. +    return 0;
  775. +}
  776. +
  777. +static void drive_dlg_refresh (void)
  778. +{
  779. +    attrset (dialog_colors[0]);
  780. +    dlg_erase (drive_dlg);
  781. +    draw_box (drive_dlg, 1, 1, drive_dlg->lines-2, drive_dlg->cols-2);
  782. +
  783. +    attrset (dialog_colors[2]);
  784. +    dlg_move (drive_dlg, 1, drive_dlg->cols/2 - 7);
  785. +    addstr (" Change Drive ");
  786. +}
  787. +
  788. +
  789. diff -Naur mc-4.5.4/src/drive.h mc-4.5.4.emx/src/drive.h
  790. --- mc-4.5.4/src/drive.h    Thu Jan  1 00:00:00 1970
  791. +++ mc-4.5.4.emx/src/drive.h    Mon Dec 28 07:54:16 1998
  792. @@ -0,0 +1,8 @@
  793. +void drive_cmd_a(WPanel *);
  794. +void drive_cmd_b(WPanel *);
  795. +void drive_chg(WPanel *panel);
  796. +
  797. +#include "hetnet.h"
  798. +
  799. +
  800. +
  801. diff -Naur mc-4.5.4/src/ext.c mc-4.5.4.emx/src/ext.c
  802. --- mc-4.5.4/src/ext.c    Wed Dec 30 11:50:40 1998
  803. +++ mc-4.5.4.emx/src/ext.c    Sun Jan  3 19:47:28 1999
  804. @@ -135,7 +135,13 @@
  805.      /* Note: this has to be done after the getlocalcopy call,
  806.       * since it uses tmpnam as well
  807.       */
  808. -    file_name = strdup (tmpnam (NULL));
  809. +#ifdef OS2EMX
  810. +stdlog("US:%i\n",is_unix_shell());
  811. +    if(!is_unix_shell())
  812. +        file_name = strdup (tmpnam_ext(".cmd"));
  813. +    else
  814. +#endif
  815. +        file_name = strdup (tmpnam (NULL));
  816.  
  817.      if ((cmd_file_fd = open (file_name, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)) == -1){
  818.      message (1, MSG_ERROR, _(" Can't create temporary command file \n %s "),
  819. @@ -143,7 +149,12 @@
  820.      return;
  821.      }
  822.      cmd_file = fdopen (cmd_file_fd, "w");
  823. -    fprintf (cmd_file, "#!%s\n", shell);
  824. +#ifdef OS2EMX
  825. +    if(!is_unix_shell())
  826. +        fprintf (cmd_file, "@rem %s\n", shell);
  827. +    else 
  828. +#endif
  829. +       fprintf (cmd_file, "#!%s\n", shell);
  830.           
  831.      prompt [0] = 0;
  832.      for (;*data && *data != '\n'; data++){
  833. @@ -162,6 +173,9 @@
  834.              free (file_name);
  835.              return;
  836.          }
  837. +#ifdef OS2EMX
  838. +                os2_canon_str(parameter);
  839. +#endif
  840.          fputs (parameter, cmd_file);
  841.          written_nonspace = 1;
  842.          free (parameter);
  843. @@ -191,6 +205,9 @@
  844.                  p = buffer;
  845.                  data += i - 1;
  846.          } else if ((i = check_format_var (data, &v)) > 0 && v){
  847. +#ifdef OS2EMX
  848. +                    os2_canon_str(v);
  849. +#endif
  850.              fputs (v, cmd_file);
  851.              free (v);
  852.              data += i;
  853. @@ -216,6 +233,9 @@
  854.              text = quote_block (quote_func, drops);
  855.              } else
  856.                  text = expand_format (*data, !is_cd);
  857. +#ifdef OS2EMX
  858. +                    os2_canon_str(text);
  859. +#endif
  860.              if (!is_cd)
  861.                  fputs (text, cmd_file);
  862.              else {
  863. diff -Naur mc-4.5.4/src/features.inc mc-4.5.4.emx/src/features.inc
  864. --- mc-4.5.4/src/features.inc    Wed Dec 30 11:50:38 1998
  865. +++ mc-4.5.4.emx/src/features.inc    Fri Jan  1 21:22:28 1999
  866. @@ -80,7 +80,7 @@
  867.  ;
  868.  
  869.  static const int status_mouse_support = 
  870. -#ifdef HAVE_LIBGPM
  871. +#if defined HAVE_LIBGPM || defined OS2EMX
  872.      1;
  873.  #else
  874.      0;
  875. diff -Naur mc-4.5.4/src/file.c mc-4.5.4.emx/src/file.c
  876. --- mc-4.5.4/src/file.c    Wed Dec 30 11:50:40 1998
  877. +++ mc-4.5.4.emx/src/file.c    Fri Jan  1 21:23:44 1999
  878. @@ -147,6 +147,10 @@
  879.   * preserve_uidgid = preserve && uid == 0 */
  880.  int file_mask_preserve_uidgid = 0;
  881.  
  882. +#ifdef OS2EMX  /* !root -> disable chown */
  883. +#define geteuid() (1)
  884. +#endif
  885. +
  886.  /* The bits to preserve in created files' modes on file copy */
  887.  int file_mask_umask_kill = 0777777;
  888.  
  889. diff -Naur mc-4.5.4/src/hetnet.c mc-4.5.4.emx/src/hetnet.c
  890. --- mc-4.5.4/src/hetnet.c    Thu Jan  1 00:00:00 1970
  891. +++ mc-4.5.4.emx/src/hetnet.c    Sat Jan  2 14:22:54 1999
  892. @@ -0,0 +1,142 @@
  893. +#include<stdlib.h>
  894. +#include<stdio.h>
  895. +#include<string.h>
  896. +#include<config.h>
  897. +#include "hetnet.h"
  898. +#include "main.h"
  899. +
  900. +static
  901. +char *remote_host(char *path)
  902. +{ char *rc="unknown",buf[256],*p,*q,*r;
  903. +  strcpy(buf,path);
  904. +  p=strchr(buf,'#');
  905. +  if(p){ q=strchr(p,'/');
  906. +         if(q){ *q=0;
  907. +                r=strrchr(p,'@');
  908. +                if(!r)r=strchr(p,':');
  909. +                if(r){ rc=r+1;
  910. +                       r=strchr(rc,':'); if(r)*r=0; /* host:port */
  911. +                     }
  912. +              }  
  913. +       }
  914. +  return strdup(rc);
  915. +}
  916. +
  917. +static
  918. +struct os_info { char *host;
  919. +                 char *os;
  920. +               } *OS;
  921. +
  922. +int add_host_os(char *h, char *o)
  923. +{ int n=0;
  924. +  if(OS)while(OS[n].host)
  925. +     { if(!strcmp(h,OS[n].host))return -1; 
  926. +       n++; 
  927. +     }
  928. +  OS=(struct os_info*)realloc(OS,(n+2)*sizeof(struct os_info));
  929. +  OS[n].host=strdup(h); OS[n].os=strdup(o); n++;
  930. +  OS[n].host=0;         OS[n].os=0;
  931. +  return n;
  932. +}
  933. +
  934. +char *remote_os(char *path)
  935. +{ char *host;
  936. +  struct os_info *os;
  937. +  if(!OS)
  938. +    { FILE *F;
  939. +      char file[256];
  940. +      int n=0;
  941. +      sprintf(file,"%s/mc.hst",mc_home);
  942. +      F=fopen(file,"rt");
  943. +      if(F){ char buf[256];
  944. +             while(fgets(buf,256,F))
  945. +               { char hs[256],os[32];
  946. +                 if(sscanf(buf,"%s %s",hs,os)==2)add_host_os(hs,os); 
  947. +               }
  948. +             fclose(F);
  949. +           } 
  950. +      add_host_os("UNKNOWN","UNKNOWN");    
  951. +    }
  952. +  host=remote_host(path);
  953. +  os=OS;
  954. +  while(os->host) { if(!strcmp(os->host,host))
  955. +                       { free(host);   
  956. +                         return strdup(os->os);
  957. +                       }
  958. +                    os++;
  959. +                  }
  960. +  free(host); 
  961. +  return strdup("UNKNOWN");
  962. +} 
  963. +
  964. +int os_has_chown(char *os)
  965. +/*----------------------*/
  966. +{ if(!strcasecmp(os,"OS/2"))return 0;
  967. +  return 1;
  968. +}
  969. +
  970. +int os_has_chmod(char *os)
  971. +/*-----------------------*/
  972. +{ if(!strcasecmp(os,"OS/2"))return 0;
  973. +  return 1;
  974. +}
  975. +
  976. +int os_has_attrib(char *os)
  977. +/*------------------------*/
  978. +{ if(!strcasecmp(os,"OS/2"))return 1;
  979. +  return 0;
  980. +}
  981. +
  982. +
  983. +
  984. +int fs_has_chmod(char *path)
  985. +/*------------------------*/
  986. +{ int rc;
  987. +  char *p;
  988. +  if((p=strchr(path,'#'))!=0){ 
  989. +      if(!strncmp(p,"#ftp:",5)||!strncmp(p,"#mc:",4)){
  990. +          char *os = (char *) remote_os (path);
  991. +          rc=os_has_chmod(os); 
  992. +          free (os);
  993. +      } else
  994. +      rc = 0; 
  995. +  }
  996. +  else 
  997. +     rc=os_has_chmod(OS_INFO);  /* compiled local os */
  998. +  return rc;
  999. +}  
  1000. +
  1001. +int fs_has_attrib(char *path)
  1002. +/*--------------------------*/
  1003. +{ int rc=0;
  1004. +  char *p;
  1005. +  if((p=strchr(path,'#'))!=0){ 
  1006. +      if(!strncmp(p,"#mc:",4)){
  1007. +          char *os = (char *) remote_os (path);
  1008. +          rc=os_has_attrib(os); 
  1009. +          free (os);
  1010. +      } else
  1011. +      rc = 0; 
  1012. +  }
  1013. +  else 
  1014. +     rc=os_has_attrib(OS_INFO);  /* compiled local os */
  1015. +  return rc;
  1016. +}  
  1017. +
  1018. +int fs_has_chown(char *path)
  1019. +/*--------------------------*/
  1020. +{ int rc=0;
  1021. +  char *p;
  1022. +  if((p=strchr(path,'#'))!=0){ 
  1023. +      if(!strncmp(p,"#mc:",4)){
  1024. +          char *os = (char *) remote_os (path);
  1025. +          rc=os_has_chown(os); 
  1026. +          free (os);
  1027. +      } else
  1028. +      rc = 0; 
  1029. +  }
  1030. +  else 
  1031. +     rc=os_has_chown(OS_INFO);  /* compiled local os */
  1032. +  return rc;
  1033. +}  
  1034. +
  1035. diff -Naur mc-4.5.4/src/hetnet.h mc-4.5.4.emx/src/hetnet.h
  1036. --- mc-4.5.4/src/hetnet.h    Thu Jan  1 00:00:00 1970
  1037. +++ mc-4.5.4.emx/src/hetnet.h    Sat Jan  2 14:22:16 1999
  1038. @@ -0,0 +1,47 @@
  1039. +#ifndef __HETNET_H
  1040. +#define __HETNET_H
  1041. +
  1042. +/* required function for heterohenous network */
  1043. +
  1044. +int  get_drive (void);
  1045. +int  chg_drive (int drive);   /* 'A','B'...  return: new current drive */
  1046. +int  get_logical_drives (int *drives_avail);
  1047. +
  1048. +
  1049. +/* linux flags as standard */
  1050. +#define MC_O_RDONLY        00
  1051. +#define MC_O_WRONLY        01
  1052. +#define MC_O_RDWR        02
  1053. +#define MC_O_CREAT      0100    
  1054. +#define MC_O_EXCL         0200    
  1055. +#define MC_O_NOCTTY      0400    
  1056. +#define MC_O_TRUNC     01000    
  1057. +#define MC_O_APPEND     02000
  1058. +#define MC_O_NDELAY     04000
  1059. +#define MC_O_SYNC    010000
  1060. +
  1061. +unsigned flags_to_mc (unsigned flags);
  1062. +unsigned flags_from_mc (unsigned flags);
  1063. +
  1064. +/* os/2 attributes as standard */
  1065. +#define MC_FILE_READONLY        0x0001
  1066. +#define MC_FILE_HIDDEN            0x0002
  1067. +#define MC_FILE_SYSTEM            0x0004
  1068. +#define MC_FILE_ARCHIVED        0x0020
  1069. +
  1070. +int get_attrib (char *filename);                 /* -1..error */
  1071. +int set_attrib (char *filename, unsigned attr);  /* -1..error */
  1072. +
  1073. +char *remote_os(char *path);
  1074. +
  1075. +int add_host_os   (char *h, char *o);
  1076. +
  1077. +int os_has_chown  (char *os);
  1078. +int os_has_chmode (char *os);
  1079. +int os_has_attrib (char *os);
  1080. +
  1081. +#ifndef OS_INFO
  1082. +#define OS_INFO "UNKNOWN"
  1083. +#endif
  1084. +
  1085. +#endif /* __HETNET_H */
  1086. diff -Naur mc-4.5.4/src/key.c mc-4.5.4.emx/src/key.c
  1087. --- mc-4.5.4/src/key.c    Wed Dec 30 11:50:40 1998
  1088. +++ mc-4.5.4.emx/src/key.c    Fri Jan  1 21:28:32 1999
  1089. @@ -92,6 +92,13 @@
  1090.  static int disabled_channels = 0; /* Disable channels checking */
  1091.  int xgetch_second (void);
  1092.  
  1093. +#ifdef ALTERNATIVE_CONSOLE  
  1094. +int  (*os_init_key)(char *term); /* 0..continue standard init_key */
  1095. +int  (*os_get_key_code)(int no_delay);
  1096. +int  (*os_get_event)(Gpm_Event *event, int redo_event, int block);
  1097. +int  (*os_get_modifier)();
  1098. +#endif 
  1099. +
  1100.  #ifndef PORT_HAS_FILE_HANDLERS
  1101.  /* File descriptor monitoring add/remove routines */
  1102.  typedef struct SelectList {
  1103. @@ -236,6 +243,10 @@
  1104.  {
  1105.  #ifndef HAVE_X
  1106.      char *term = (char *) getenv ("TERM");
  1107. +
  1108. +#ifdef ALTERNATIVE_CONSOLE  
  1109. +    if (os_init_key)if(os_init_key(term))return;
  1110. +#endif 
  1111.      
  1112.      /* This has to be the first define_sequence */
  1113.      /* So, we can assume that the first keys member has ESC */
  1114. @@ -447,6 +458,10 @@
  1115.      static key_def *this = NULL, *parent;
  1116.      static struct timeval esctime = { -1, -1 };
  1117.      static int lastnodelay = -1;
  1118. +
  1119. +#ifdef ALTERNATIVE_CONSOLE  
  1120. +    if (os_get_key_code)return os_get_key_code(no_delay);
  1121. +#endif 
  1122.      
  1123.      if (no_delay != lastnodelay) {
  1124.          this = NULL;
  1125. @@ -690,6 +705,10 @@
  1126.      struct timeval *time_addr = NULL;
  1127.      static int dirty = 3;
  1128.  
  1129. +#ifdef ALTERNATIVE_CONSOLE  
  1130. +    if (os_get_event)return os_get_event(event,redo_event,block);
  1131. +#endif 
  1132. +
  1133.      if ((dirty == 3) || is_idle ()){
  1134.      mc_refresh ();
  1135.      doupdate ();
  1136. @@ -977,14 +996,18 @@
  1137.  
  1138.      return (int) modifiers;
  1139.  #else
  1140. +#ifdef ALTERNATIVE_CONSOLE  
  1141. +    return os_get_modifier?os_get_modifier():0;
  1142. +#else
  1143.      return 0;
  1144.  #endif
  1145. +#endif
  1146.  }
  1147.  
  1148.  int
  1149.  ctrl_pressed ()
  1150.  {
  1151. -#ifdef __linux__
  1152. +#if defined __linux__ || defined ALTERNATIVE_CONSOLE
  1153.      if (get_modifier () & CONTROL_PRESSED)
  1154.      return 1;
  1155.  #endif
  1156. diff -Naur mc-4.5.4/src/key.h mc-4.5.4.emx/src/key.h
  1157. --- mc-4.5.4/src/key.h    Wed Dec 30 11:50:38 1998
  1158. +++ mc-4.5.4.emx/src/key.h    Fri Jan  1 21:28:56 1999
  1159. @@ -88,4 +88,11 @@
  1160.      void application_keypad_mode (void);
  1161.  #endif
  1162.  
  1163. +#ifdef ALTERNATIVE_CONSOLE
  1164. +void OS_Setup_Console(char *termvalue, int kbd, int mouse); 
  1165. +extern int (*os_init_key)(char *term); /* 0..continue standard procedure */
  1166. +extern int (*os_get_key_code)(int no_delay);
  1167. +extern int (*os_get_event)(Gpm_Event *event, int redo_event, int block);
  1168. +#endif
  1169. +
  1170.  #endif    /* __KEY_H */
  1171. diff -Naur mc-4.5.4/src/keys.h mc-4.5.4.emx/src/keys.h
  1172. --- mc-4.5.4/src/keys.h    Wed Dec 30 11:50:38 1998
  1173. +++ mc-4.5.4.emx/src/keys.h    Sat Jan  2 13:38:26 1999
  1174. @@ -11,5 +11,8 @@
  1175.  #define KEY_KP_SUBTRACT    4002
  1176.  #define KEY_KP_MULTIPLY    4003
  1177.  
  1178. -
  1179. +#ifdef OS2EMX  /* 0x200 alt */
  1180. +#define KEY_F(x) (0x400|(unsigned)x)
  1181. +#else
  1182.  #define KEY_F(x) 1000+x
  1183. +#endif
  1184. diff -Naur mc-4.5.4/src/learn.c mc-4.5.4.emx/src/learn.c
  1185. --- mc-4.5.4/src/learn.c    Wed Dec 30 11:50:40 1998
  1186. +++ mc-4.5.4.emx/src/learn.c    Fri Jan  1 21:30:06 1999
  1187. @@ -346,6 +346,14 @@
  1188.      alternate_plus_minus = 1; /* don't translate KP_ADD, KP_SUBTRACT and
  1189.                                   KP_MULTIPLY to '+', '-' and '*' in
  1190.                                   correct_key_code */
  1191. +#ifdef ALTERNATIVE_CONSOLE
  1192. +    if (os_get_key_code) {
  1193. +        message (1, _(" Oops... "),
  1194. +             _(" I can run the Learn keys only on \"unix\" console or \"xterm\". "));
  1195. +            return;
  1196. +    }
  1197. +#endif
  1198. +
  1199.  #ifndef HAVE_X
  1200.      application_keypad_mode ();
  1201.  #endif
  1202. diff -Naur mc-4.5.4/src/main.c mc-4.5.4.emx/src/main.c
  1203. --- mc-4.5.4/src/main.c    Wed Dec 30 11:50:40 1998
  1204. +++ mc-4.5.4.emx/src/main.c    Sat Jan  2 13:22:10 1999
  1205. @@ -128,7 +128,11 @@
  1206.  #include "chmod.h"
  1207.  #include "chown.h"
  1208.  
  1209. -#ifdef OS2_NT
  1210. +#ifdef HETER_NET
  1211. +#include "chattrib.h"
  1212. +#endif
  1213. +
  1214. +#if defined (OS2_NT)  || defined (LOCAL_DRIVES)
  1215.  #    include <io.h>
  1216.  #    include <drive.h>
  1217.  #endif
  1218. @@ -226,6 +230,10 @@
  1219.  /* If true message "The shell is already running a command" never */
  1220.  int force_subshell_execution = 0;
  1221.  
  1222. +#ifdef OS2EMX
  1223. +int disable_os_kbd = 0;
  1224. +#endif
  1225. +
  1226.  /* If true program softkeys (HP terminals only) on startup and after every 
  1227.     command ran in the subshell to the description found in the termcap/terminfo 
  1228.     database */
  1229. @@ -1215,7 +1223,7 @@
  1230.      { ' ', N_("FT&P link..."),              'P', ftplink_cmd },
  1231.  #endif
  1232.      { ' ', "", ' ', 0 },
  1233. -#ifdef OS2_NT
  1234. +#if defined (OS2_NT)  || defined (LOCAL_DRIVES)
  1235.      { ' ', N_("&Drive...       M-d"),       'D', drive_cmd_a },
  1236.  #endif
  1237.      { ' ', N_("&Rescan         C-r"),       'R', reread_cmd }
  1238. @@ -1236,7 +1244,7 @@
  1239.      { ' ', N_("FT&P link..."),           'P', ftplink_cmd },
  1240.  #endif
  1241.      { ' ', "", ' ', 0 },
  1242. -#ifdef OS2_NT
  1243. +#if defined (OS2_NT)  || defined (LOCAL_DRIVES)
  1244.      { ' ', N_("&Drive...       M-d"),    'D', drive_cmd_b },
  1245.  #endif
  1246.      { ' ', N_("&Rescan         C-r"),    'R', reread_cmd }
  1247. @@ -1246,11 +1254,18 @@
  1248.      { ' ', N_("&User menu          F2"), 'U', user_menu_cmd },
  1249.      { ' ', N_("&View               F3"), 'V', view_cmd },
  1250.      { ' ', N_("Vie&w file...         "), 'W', view_file_cmd },
  1251. +#ifdef OS2EMX
  1252. +    { ' ', N_("&Filtered view        "), 'F', filtered_view_cmd },
  1253. +#else
  1254.      { ' ', N_("&Filtered view     M-!"), 'F', filtered_view_cmd },
  1255. +#endif
  1256.      { ' ', N_("&Edit               F4"), 'E', edit_cmd },
  1257.      { ' ', N_("&Copy               F5"), 'C', copy_cmd },
  1258. +#ifdef OS2EMX
  1259. +    { ' ', N_("&Attrib               "), 'A', chattrib_cmd },
  1260. +#endif
  1261.      { ' ', N_("c&Hmod           C-x c"), 'H', chmod_cmd },
  1262. -#ifndef OS2_NT                       
  1263. +#if !defined (OS2_NT) && !defined OS2EMX                       
  1264.      { ' ', N_("&Link            C-x l"), 'L', link_cmd },
  1265.      { ' ', N_("&SymLink         C-x s"), 'S', symlink_cmd },
  1266.      { ' ', N_("edit s&Ymlink  C-x C-s"), 'Y', edit_symlink_cmd },
  1267. @@ -1263,7 +1278,11 @@
  1268.      { ' ', N_("&Quick cd          M-c"), 'Q', quick_cd_cmd },
  1269.      { ' ', "", ' ', 0 },
  1270.      { ' ', N_("select &Group      M-+"), 'G', select_cmd },
  1271. +#ifdef OS2EMX
  1272. +    { ' ', N_("u&Nselect group    M--"),'N', unselect_cmd },
  1273. +#else
  1274.      { ' ', N_("u&Nselect group    M-\\"),'N', unselect_cmd },
  1275. +#endif
  1276.      { ' ', N_("reverse selec&Tion M-*"), 'T', reverse_selection_cmd },
  1277.      { ' ', "", ' ', 0 },
  1278.      { ' ', N_("e&Xit              F10"), 'X', (callfn) quit_cmd }
  1279. @@ -1278,7 +1297,11 @@
  1280.  #ifndef HAVE_GNOME
  1281.      { ' ', N_("&Directory tree"),               'D', tree_box },
  1282.  #endif
  1283. +#ifdef OS2EMX
  1284. +    { ' ', N_("&Find file            M-x"),     'F', find_cmd },
  1285. +#else
  1286.      { ' ', N_("&Find file            M-?"),     'F', find_cmd },
  1287. +#endif
  1288.      { ' ', N_("s&Wap panels          C-u"),     'W', swap_cmd },
  1289.      { ' ', N_("switch &Panels on/off C-o"),     'P', view_other_cmd },
  1290.      { ' ', N_("&Compare directories  C-x d"),   'C', compare_dirs_cmd },
  1291. @@ -1639,7 +1662,7 @@
  1292.      if (console_flag && !use_subshell)
  1293.      restore_console ();
  1294.  
  1295. -#ifndef OS2_NT
  1296. +#if !defined (OS2_NT) && !defined OS2EMX
  1297.      {
  1298.      struct sigaction sigtstp_action;
  1299.      
  1300. @@ -1692,7 +1715,7 @@
  1301.      { XCTRL('t'),   copy_other_tagged },
  1302.  #endif
  1303.      { 'c',          chmod_cmd },
  1304. -#ifndef OS2_NT
  1305. +#if !defined (OS2_NT) && !defined OS2EMX
  1306.      { 'o',          chown_cmd },
  1307.      { 'l',          link_cmd },
  1308.      { XCTRL('l'),   other_symlink_cmd },
  1309. @@ -1747,11 +1770,15 @@
  1310.      { XCTRL('z'), suspend_cmd },
  1311.  #endif
  1312.      /* The filtered view command */
  1313. +#ifndef OS2EMX
  1314.      { ALT('!'),   filtered_view_cmd_cpanel },
  1315. -    
  1316. +#endif    
  1317.      /* Find file */
  1318. +#ifdef OS2EMX
  1319. +    { ALT('x'),      find_cmd },
  1320. +#else
  1321.      { ALT('?'),      find_cmd },
  1322. -    
  1323. +#endif    
  1324.      /* Panel refresh */
  1325.      { XCTRL('r'), reread_cmd },
  1326.  
  1327. @@ -1909,7 +1936,7 @@
  1328.  }
  1329.  
  1330.  /* In OS/2 and Windows NT people want to actually type the '\' key frequently */
  1331. -#ifdef OS2_NT
  1332. +#if defined (OS2_NT) || defined (OS2EMX)
  1333.  #   define check_key_backslash(x) 0
  1334.  #else
  1335.  #   define check_key_backslash(x) ((x) == '\\')
  1336. @@ -2233,7 +2260,11 @@
  1337.  #ifndef HAVE_X
  1338.      fprintf (stderr,
  1339.          _("with mouse support on xterm%s.\n"),
  1340. +#ifdef OS2EMX
  1341. +         status_mouse_support ? _(" and the OS/2 console") : "");
  1342. +#else
  1343.           status_mouse_support ? _(" and the Linux console") : "");
  1344. +#endif
  1345.  #endif /* HAVE_X */
  1346.  
  1347.      fprintf (stderr, features);
  1348. @@ -2361,6 +2392,10 @@
  1349.  static void
  1350.  sigchld_handler_no_subshell (int sig)
  1351.  {
  1352. +#ifdef OS2EMX
  1353. +  return;
  1354. +#else
  1355. +
  1356.  #ifndef HAVE_X
  1357.      int pid, status;
  1358.  
  1359. @@ -2393,11 +2428,15 @@
  1360.  
  1361.      /* If we get here, some other child exited; ignore it */
  1362.  #endif /* ! HAVE_X  */
  1363. +#endif /*OS2EMX*/
  1364.  }
  1365.  
  1366.  void
  1367.  init_sigchld (void)
  1368.  {
  1369. +#ifdef OS2EMX
  1370. +  return;
  1371. +#else
  1372.      struct sigaction sigchld_action;
  1373.  
  1374.      sigchld_action.sa_handler =
  1375. @@ -2415,6 +2454,7 @@
  1376.  #endif
  1377.  
  1378.      sigaction (SIGCHLD, &sigchld_action, NULL);
  1379. +#endif /* OS2EMX */
  1380.  }    
  1381.  
  1382.  #endif /* _OS_NT, __os2__, UNIX */
  1383. @@ -2447,6 +2487,9 @@
  1384.      "-d, --nomouse      Disable mouse support.\n"
  1385.      "-f, --libdir       Print configured paths.\n"
  1386.      "-h, --help         Shows this help message.\n"
  1387. +#ifdef OS2EMX
  1388. +    "-K, --uxconsole    Use \"unix\" console, disable mouse support.\n" 
  1389. +#endif
  1390.      "-k, --resetsoft    Reset softkeys (HP terminals only) to their terminfo/termcap\n"
  1391.      "                   default.\n"
  1392.      "-P, --printwd      At exit, print the last working directory.\n"
  1393. @@ -2641,6 +2684,9 @@
  1394.      { "forceexec",     'r', POPT_ARG_NONE,     NULL,              'r' },
  1395.  #endif
  1396.      { "printwd",     'P', POPT_ARG_NONE,     &print_last_wd,       0 },
  1397. +#ifdef OS2EMX
  1398. +    { "uxconsole",      'K', POPT_ARG_NONE,     &disable_os_kbd,          0 },    
  1399. +#endif
  1400.      { "resetsoft",     'k', POPT_ARG_NONE,     &reset_hp_softkeys,       0 },
  1401.      { "slow", 's', POPT_ARG_NONE,         &slow_terminal,       0 },
  1402.  #if defined(HAVE_SLANG) && !defined(OS2_NT)
  1403. @@ -2867,6 +2913,16 @@
  1404.      SLtt_Ignore_Beep = 1;
  1405.  #endif
  1406.  #endif
  1407. +
  1408. +#ifdef ALTERNATIVE_CONSOLE
  1409. +
  1410. +#ifndef HAVE_GNOME
  1411. +    handle_args (argc, argv);
  1412. +#endif
  1413. +    OS_Setup_Console(getenv ("TERM"),!disable_os_kbd,use_mouse_p); 
  1414. +    init_key ();
  1415. +
  1416. +#else
  1417.      
  1418.      /* NOTE: This has to be called before slang_init or whatever routine
  1419.         calls any define_sequence */
  1420. @@ -2875,7 +2931,7 @@
  1421.  #ifndef HAVE_GNOME
  1422.      handle_args (argc, argv);
  1423.  #endif
  1424. -    
  1425. +#endif    
  1426.      /* Used to report the last working directory at program end */
  1427.      if (print_last_wd){
  1428.  #ifndef OS2_NT    
  1429. @@ -2992,6 +3048,10 @@
  1430.  #   endif
  1431.          prompt = (geteuid () == 0) ? "# " : "$ ";
  1432.  
  1433. +#ifdef OS2EMX
  1434. +    OS_adjust();
  1435. +#endif
  1436. +
  1437.      /* Program main loop */
  1438.      do_nc ();
  1439.      
  1440. @@ -3017,7 +3077,7 @@
  1441.          numeric_keypad_mode ();
  1442.  #   endif
  1443.  
  1444. -#ifndef OS2_NT
  1445. +#if !defined OS2_NT && !defined OS2EMX
  1446.      signal (SIGCHLD, SIG_DFL);  /* Disable the SIGCHLD handler */
  1447.  #endif
  1448.      
  1449. diff -Naur mc-4.5.4/src/screen.c mc-4.5.4.emx/src/screen.c
  1450. --- mc-4.5.4/src/screen.c    Wed Dec 30 11:50:40 1998
  1451. +++ mc-4.5.4.emx/src/screen.c    Fri Jan  1 21:32:32 1999
  1452. @@ -53,7 +53,7 @@
  1453.  #include "../vfs/vfs.h"
  1454.  #include "../vfs/extfs.h"
  1455.  
  1456. -#if defined(OS2_NT)
  1457. +#if defined (OS2_NT) || defined LOCAL_DRIVES 
  1458.  # include "drive.h"
  1459.  #endif
  1460.  
  1461. @@ -2172,7 +2172,7 @@
  1462.      { ALT('r'),   goto_middle_file }, /* M-r like emacs */
  1463.      { ALT('j'),   goto_bottom_file },
  1464.  
  1465. -#ifdef OS2_NT
  1466. +#if defined (OS2_NT) || defined LOCAL_DRIVES 
  1467.      { ALT(KEY_F(11)), drive_cmd_a },
  1468.      { ALT(KEY_F(12)), drive_cmd_b },
  1469.      { ALT('d'),   drive_chg },
  1470. diff -Naur mc-4.5.4/src/tree.c mc-4.5.4.emx/src/tree.c
  1471. --- mc-4.5.4/src/tree.c    Wed Dec 30 11:50:40 1998
  1472. +++ mc-4.5.4.emx/src/tree.c    Fri Jan  1 21:40:24 1999
  1473. @@ -564,6 +564,9 @@
  1474.          if (name [len - 1] == '\n'){
  1475.          name [--len] = 0;
  1476.          }
  1477. +#ifdef OS2EMX_CHG
  1478. +            while(len&&name[len-1]=='\r')name[--len]=0;
  1479. +#endif
  1480.  #ifdef OS2_NT
  1481.              /* .ado: Drives for NT and OS/2 */
  1482.              if ((len > 2)         && 
  1483. @@ -574,8 +577,12 @@
  1484.                  strcpy (oldname, name);
  1485.              } else
  1486.  #endif
  1487. +#ifdef HETER_NET
  1488. +        if (name [0] != PATH_SEP && name[0] && name[1]!=':'){
  1489. +#else
  1490.              /* UNIX Version */
  1491.          if (name [0] != PATH_SEP){
  1492. +#endif
  1493.          /* Clear-text decompression */
  1494.          char *s = strtok (name, " ");
  1495.  
  1496. @@ -596,12 +603,26 @@
  1497.      }
  1498.      if (!tree->tree_first){
  1499.      /* Nothing loaded -> let's add some standard directories */
  1500. +#ifdef LOCAL_DRIVES 
  1501. +        int D[32],*d;
  1502. +        char buf[16]="X:/";
  1503. +    tree_add_entry (tree, "C:/");
  1504. +#else
  1505.      tree_add_entry (tree, PATH_SEP_STR);
  1506. +#endif
  1507.      tree->selected_ptr = tree->tree_first;
  1508.      tree_rescan_cmd (tree);
  1509.      tree_add_entry (tree, home_dir);
  1510.      tree_chdir (tree, home_dir);
  1511.      tree_rescan_cmd (tree);
  1512. +#ifdef LOCAL_DRIVES
  1513. +        get_logical_drives(D);  
  1514. +        d=D;
  1515. +        while(*d){
  1516. +              buf[0]=*d++;
  1517. +              tree_add_entry (tree, buf);
  1518. +        }
  1519. +#endif
  1520.      }
  1521.  }
  1522.  
  1523. diff -Naur mc-4.5.4/src/user.c mc-4.5.4.emx/src/user.c
  1524. --- mc-4.5.4/src/user.c    Wed Dec 30 11:50:40 1998
  1525. +++ mc-4.5.4.emx/src/user.c    Fri Jan  1 21:41:26 1999
  1526. @@ -501,7 +501,11 @@
  1527.      int do_quote;
  1528.      char prompt [80] = "";
  1529.      int  col;
  1530. +#ifdef OS2EMX
  1531. +    char *file_name = tmpnam_ext(".cmd");
  1532. +#else
  1533.      char *file_name = tmpnam (0);
  1534. +#endif
  1535.  
  1536.  #ifdef OS2_NT
  1537.      /* OS/2 and NT requires the command to end in .cmd */
  1538. diff -Naur mc-4.5.4/src/util.c mc-4.5.4.emx/src/util.c
  1539. --- mc-4.5.4/src/util.c    Wed Dec 30 11:50:40 1998
  1540. +++ mc-4.5.4.emx/src/util.c    Fri Jan  1 21:44:10 1999
  1541. @@ -324,7 +324,7 @@
  1542.      if (ismode (mode_bits, S_IXUSR)) mode [3] = 'x';
  1543.      if (ismode (mode_bits, S_IWUSR)) mode [2] = 'w';
  1544.      if (ismode (mode_bits, S_IRUSR)) mode [1] = 'r';
  1545. -#ifndef OS2_NT
  1546. +#if !defined (OS2_NT) && !defined (OS2EMX)
  1547.      if (ismode (mode_bits, S_ISUID)) mode [3] = (mode [3] == 'x') ? 's' : 'S';
  1548.      if (ismode (mode_bits, S_ISGID)) mode [6] = (mode [6] == 'x') ? 's' : 'S';
  1549.      if (ismode (mode_bits, S_IFCHR)) mode [0] = 'c';
  1550. @@ -657,7 +657,13 @@
  1551.  char *x_basename (char *s)
  1552.  {
  1553.      char  *where;
  1554. +#ifdef HETER_NET
  1555. +    where = strrchr (s, PATH_SEP);
  1556. +    if(!where&&PATH_SEP=='/')where = strrchr (s, '\\');
  1557. +    return where ? where + 1 : s;
  1558. +#else
  1559.      return ((where = strrchr (s, PATH_SEP)))? where + 1 : s;
  1560. +#endif
  1561.  }
  1562.  
  1563.  char *get_full_name (char *dir, char *file)
  1564. @@ -850,6 +856,9 @@
  1565.  char *get_current_wd (char *buffer, int size)
  1566.  {
  1567.      char *p;
  1568. +#ifdef GETCWD
  1569. +   return GETCWD (buffer, size);
  1570. +#endif
  1571.  
  1572.  #ifdef HAVE_GETWD
  1573.      p = (char *) getwd (buffer);
  1574. diff -Naur mc-4.5.4/src/utilunix.c mc-4.5.4.emx/src/utilunix.c
  1575. --- mc-4.5.4/src/utilunix.c    Wed Dec 30 11:50:40 1998
  1576. +++ mc-4.5.4.emx/src/utilunix.c    Fri Jan  1 21:49:52 1999
  1577. @@ -62,6 +62,9 @@
  1578.  #ifdef __QNX__
  1579.  #   include <unix.h>        /* exec*() from <process.h> */
  1580.  #endif
  1581. +#ifdef OS2EMX
  1582. +#include <process.h>            /* P_WAIT */
  1583. +#endif
  1584.  #include "util.h"
  1585.  #include "global.h"
  1586.  #include "fsusage.h"
  1587. @@ -518,7 +521,11 @@
  1588.                   break;
  1589.                   }
  1590.               va_end (ap);
  1591. +#ifdef OS2EMX /* execvp or P_NOWAIT -> mcserver Connection closed  */
  1592. +                     spawnvp(P_WAIT,command,args);
  1593. +#else
  1594.               execvp (command, args);
  1595. +#endif
  1596.               exit (0);
  1597.          }
  1598.              default:
  1599. @@ -587,6 +594,24 @@
  1600.      int i, start;
  1601.      char stub_char;
  1602.  
  1603. +#ifdef HETER_NET /* if path begin with "C:","A:"... !!! ftp server !!! */
  1604. +    int delta = 0;
  1605. +    if (path[0] == '/' && path[1] && path[2] == ':') {    /*  "/C:" */
  1606. +      char *q = path, *p = path + 1;
  1607. +      while (*p)
  1608. +        *q++ = *p++;
  1609. +      *q = 0;
  1610. +    }
  1611. +    if (path[0] && path[1] == ':') {    /* "C:" */
  1612. +      delta += 2;
  1613. +      path += 2;
  1614. +      if (path[0] == 0) {
  1615. +        path[0] = '/';
  1616. +        path[1] = 0;
  1617. +      }
  1618. +    }
  1619. +#endif
  1620. +
  1621.      stub_char = (*path == PATH_SEP) ? PATH_SEP : '.';
  1622.  
  1623.      /* Walk along path looking for things to compact. */
  1624. @@ -669,6 +694,13 @@
  1625.              while (--start > -1 && path[start] != PATH_SEP);
  1626.              if (!strncmp (path + start + 1, "../", 3))
  1627.                  continue;
  1628. +#ifdef HETER_NET
  1629. +                /* remove group "/C:/" or "C:" */
  1630. +                if(path[start+2]==':') { 
  1631. +                   while (--start > -1 && path[start] != PATH_SEP);
  1632. +                      i-=2;
  1633. +                } 
  1634. +#endif
  1635.              strcpy (path + start + 1, path + i + 2);
  1636.              i = start;
  1637.              continue;
  1638. @@ -680,6 +712,9 @@
  1639.          *path = stub_char;
  1640.          path[1] = '\0';
  1641.      }
  1642. +#ifdef HETER_NET
  1643. +    path-=delta;
  1644. +#endif
  1645.      return path;
  1646.  }
  1647.  
  1648. @@ -771,6 +806,11 @@
  1649.      struct mount_entry *entry = NULL;
  1650.      struct mount_entry *temp = mount_list;
  1651.      struct fs_usage fs_use;
  1652. +
  1653. +#ifdef OS2EMX
  1654. +    os2_my_statfs(myfs_stats,path);
  1655. +    return;
  1656. +#endif
  1657.  
  1658.      while (temp){
  1659.      i = strlen (temp->me_mountdir);
  1660. diff -Naur mc-4.5.4/src/zz mc-4.5.4.emx/src/zz
  1661. --- mc-4.5.4/src/zz    Thu Jan  1 00:00:00 1970
  1662. +++ mc-4.5.4.emx/src/zz    Fri Jan  1 22:33:16 1999
  1663. @@ -0,0 +1,5 @@
  1664. +_g_log
  1665. +_g_vsnprintf 
  1666. +_g_strdup_vprintf
  1667. +_g_free 
  1668. +_g_snprintf
  1669. diff -Naur mc-4.5.4/vfs/extfs.c mc-4.5.4.emx/vfs/extfs.c
  1670. --- mc-4.5.4/vfs/extfs.c    Wed Dec 30 11:50:34 1998
  1671. +++ mc-4.5.4.emx/vfs/extfs.c    Fri Jan  1 19:09:22 1999
  1672. @@ -62,6 +62,10 @@
  1673.  static char extfs_need_archive [MAXEXTFS];
  1674.  static int extfs_no = 0;
  1675.  
  1676. +#ifdef OS2EMX
  1677. +#define SLASH_TO_BACK(cmd) {char *p=cmd; while(*p){if(*p=='/')*p='\\'; p++;}}
  1678. +#endif
  1679. +
  1680.  static void extfs_fill_names (vfs *me, void (*func)(char *))
  1681.  {
  1682.      struct archive *a = first_archive;
  1683. @@ -213,6 +217,9 @@
  1684.                          " list ", local_name ? local_name : tmp, 0);
  1685.      if (tmp)
  1686.      free (tmp);
  1687. +#ifdef OS2EMX
  1688. +    SLASH_TO_BACK (cmd);
  1689. +#endif
  1690.      result = popen (cmd, "r");
  1691.      free (cmd);
  1692.      free (mc_extfsdir);
  1693. @@ -576,6 +583,9 @@
  1694.      free (mc_extfsdir);
  1695.      free (archive_name);
  1696.      free (q);
  1697. +#ifdef OS2EMX
  1698. +    SLASH_TO_BACK (cmd);
  1699. +#endif
  1700.  #ifndef VFS_STANDALONE
  1701.      shell_execute(cmd, 0);
  1702.  #else
  1703. @@ -628,6 +638,9 @@
  1704.      free (q);
  1705.      free (mc_extfsdir);
  1706.      free (archive_name);
  1707. +#ifdef OS2EMX
  1708. +        SLASH_TO_BACK (cmd);
  1709. +#endif
  1710.          if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID, shell, cmd) && !do_create){
  1711.              free (entry->inode->local_filename);
  1712.              entry->inode->local_filename = NULL;
  1713. @@ -640,7 +653,9 @@
  1714.      
  1715.      local_handle = open (entry->inode->local_filename, flags, mode);
  1716.      if (local_handle == -1) ERRNOR (EIO, NULL);
  1717. -    
  1718. +#ifdef OS2EMX_CHG
  1719. +    lseek (local_handle, 0, SEEK_SET);
  1720. +#endif
  1721.      extfs_info = (struct pseudofile *) xmalloc (sizeof (struct pseudofile), "Extfs: extfs_open");
  1722.      extfs_info->archive = archive;
  1723.      extfs_info->entry = entry;
  1724. @@ -690,6 +705,9 @@
  1725.                  file->entry->inode->local_filename, 0);
  1726.      free (archive_name);
  1727.      free (file_name);
  1728. +#ifdef OS2EMX
  1729. +        SLASH_TO_BACK (cmd);
  1730. +#endif
  1731.      if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID, shell, cmd))
  1732.          errno_code = EIO;
  1733.      free (cmd);
  1734. @@ -996,6 +1014,10 @@
  1735.      s_fstat,
  1736.  
  1737.      extfs_chmod,        /* chmod ... strange, returns success? */
  1738. +#ifdef HETER_NET        /* setattrib, getattrib */
  1739. +    NULL,
  1740. +    NULL,
  1741. +#endif
  1742.      NULL,
  1743.      NULL,
  1744.  
  1745. diff -Naur mc-4.5.4/vfs/fish.c mc-4.5.4.emx/vfs/fish.c
  1746. --- mc-4.5.4/vfs/fish.c    Wed Dec 30 11:50:34 1998
  1747. +++ mc-4.5.4.emx/vfs/fish.c    Fri Jan  1 19:13:50 1999
  1748. @@ -808,6 +808,10 @@
  1749.      vfs_s_fstat,
  1750.  
  1751.      fish_chmod,
  1752. +#ifdef HETER_NET /* setattrib, getattrib */
  1753. +    NULL, 
  1754. +    NULL,
  1755. +#endif
  1756.      fish_chown,
  1757.      NULL,        /* utime */
  1758.  
  1759. diff -Naur mc-4.5.4/vfs/ftpfs.c mc-4.5.4.emx/vfs/ftpfs.c
  1760. --- mc-4.5.4/vfs/ftpfs.c    Wed Dec 30 11:50:34 1998
  1761. +++ mc-4.5.4.emx/vfs/ftpfs.c    Sat Jan  2 15:40:26 1999
  1762. @@ -371,8 +371,13 @@
  1763.  #endif
  1764.      } else 
  1765.      name = strdup (quser (bucket));
  1766. -    
  1767. +#ifdef HETER_NET    
  1768. +    if (get_reply (qsock(bucket), 
  1769. +          reply_str, sizeof (reply_str)-1) == COMPLETE) {
  1770. +        if(strstr(reply_str,"OS/2"))add_host_os(qhost(bucket), "OS/2"); 
  1771. +#else
  1772.      if (get_reply (qsock(bucket), NULL, 0) == COMPLETE) {
  1773. +#endif
  1774.  #if defined(HSC_PROXY)
  1775.      if (qproxy(bucket)) {
  1776.          print_vfs_message("ftpfs: sending proxy login name");
  1777. @@ -1184,6 +1189,9 @@
  1778.      struct dir *dcache;
  1779.      int got_intr = 0;
  1780.      int has_spaces = (strchr (remote_path, ' ') != NULL);
  1781. +#ifdef HETER_NET  /* IBM ftp server send only "total 0" for empty dir */
  1782. +    int total=-1;
  1783. +#endif
  1784.  
  1785.      canonicalize_pathname (remote_path);
  1786.      for (p = qdcache(bucket)->next;p != qdcache(bucket);
  1787. @@ -1238,6 +1246,9 @@
  1788.      dcache->count = 1;
  1789.      dcache->symlink_status = FTPFS_NO_SYMLINKS;
  1790.  
  1791. +#ifdef HETER_NET /* remove '/' from "C:/"  */
  1792. +    canonicalize_pathname (remote_path);
  1793. +#endif
  1794.      if (bucket->strict_rfc959_list_cmd == 1) 
  1795.          sock = open_data_connection (bucket, "LIST", 0, TYPE_ASCII, 0);
  1796.      else if (has_spaces)
  1797. @@ -1281,8 +1292,24 @@
  1798.              fputs ("\n", logfile);
  1799.          fflush (logfile);
  1800.      }
  1801. +#ifdef HETER_NET
  1802. +        if(strncmp(buffer, "total", 5) == 0) {
  1803. +           int t;
  1804. +           if(sscanf(buffer+5,"%i",&t) == 1) total=t;
  1805. +        }
  1806.      if (buffer [0] == 0 && eof)
  1807. +          if(file_list->next != file_list||total != 0)
  1808.          break;
  1809. +        else /* IBM ftp server format */
  1810. +          sprintf(buffer," 0  DIR   01-01-80 00:00  ..");   
  1811. +/* fake file -> message
  1812. +   File exists but can not be stat-ed: .. No such file or directory
  1813. +   if no files in directory
  1814. +*/
  1815. +#else
  1816. +    if (buffer [0] == 0 && eof)
  1817. +        break;
  1818. +#endif
  1819.      fe = xmalloc(sizeof(struct direntry), "struct direntry");
  1820.      fe->freshly_created = 0;
  1821.      fe->local_filename = NULL;
  1822. @@ -1573,7 +1600,14 @@
  1823.  static int ftpfs_chmod (vfs *me, char *path, int mode)
  1824.  {
  1825.      char buf[40];
  1826. -    
  1827. +#ifdef HETER_NET /* IBM ftp server for OS/2 -> 1.answer 502 + 2.answer 550 */
  1828. +                 /* => synchronization command<->answer failed             */
  1829. +    char *os=(char *)remote_os(path);
  1830. +    if(os_has_chmod(os)==0){
  1831. +        free(os);
  1832. +        return 0;
  1833. +    }
  1834. +#endif    
  1835.      sprintf(buf, "SITE CHMOD %4.4o %%s", mode & 07777);
  1836.      return send_ftp_command(path, buf, OPT_IGNORE_ERROR | OPT_FLUSH);
  1837.  }
  1838. @@ -1725,6 +1759,10 @@
  1839.      s_fstat,
  1840.  
  1841.      ftpfs_chmod,
  1842. +#ifdef HETER_NET    /* setattrib, getattrib */
  1843. +    NULL,
  1844. +    NULL,
  1845. +#endif
  1846.      ftpfs_chown,    /* not really implemented but returns success */
  1847.      NULL,
  1848.  
  1849. @@ -1936,3 +1974,56 @@
  1850.  }
  1851.  #endif
  1852.  #endif /* USE_NETRC */
  1853. +
  1854. +#ifdef HETER_NET
  1855. +
  1856. +char *
  1857. +ftp_tilde_expand (char *ftp_name)
  1858. +{
  1859. +  char *rc = 0, *p, *q, *user = 0, *host = 0, *home = 0, buf[512];
  1860. +  strcpy (buf, ftp_name);
  1861. +  p = strstr (buf, "#ftp:");
  1862. +  if (p) {
  1863. +    p += 5;
  1864. +    user = p;
  1865. +    while (*p) {
  1866. +      if (*p == ':')
  1867. +    *p++ = 0;
  1868. +      else if (*p == '@') {
  1869. +    *p++ = 0;
  1870. +    host = p;
  1871. +      }
  1872. +      else if (*p == '/')
  1873. +    *p++ = 0;
  1874. +      else
  1875. +    p++;
  1876. +    }
  1877. +    if (host && user) {
  1878. +      struct connection *bucket;
  1879. +      struct linklist *lptr;
  1880. +      for (lptr = connections_list->next;
  1881. +       lptr != connections_list; lptr = lptr->next) {
  1882. +    bucket = lptr->data;
  1883. +    if (!strcmp (host, qhost (bucket)) && !strcmp (user, quser (bucket))) {
  1884. +      home = qhome (bucket);
  1885. +      q = buf;
  1886. +      p = ftp_name;
  1887. +      while (*p) {
  1888. +        if (*p == '~') {
  1889. +          strcpy (q, home);
  1890. +          q += strlen (home);
  1891. +          p++;
  1892. +        }
  1893. +        else
  1894. +          *q++ = *p++;
  1895. +      }
  1896. +      *q = 0;
  1897. +      return strdup (buf);
  1898. +    }
  1899. +      }
  1900. +    }
  1901. +  }
  1902. +  return 0;
  1903. +}
  1904. +#endif
  1905. +
  1906. diff -Naur mc-4.5.4/vfs/local.c mc-4.5.4.emx/vfs/local.c
  1907. --- mc-4.5.4/vfs/local.c    Wed Dec 30 11:50:34 1998
  1908. +++ mc-4.5.4.emx/vfs/local.c    Fri Jan  1 19:27:06 1999
  1909. @@ -147,6 +147,35 @@
  1910.      return chmod (path, mode);
  1911.  }
  1912.  
  1913. +#ifdef HETER_NET
  1914. +
  1915. +static int 
  1916. +local_setattrib (vfs * me, char *path, int attr)
  1917. +{
  1918. +#ifdef OS2EMX
  1919. +  return set_attrib (path, attr) ? -1 : 0;
  1920. +#else
  1921. +  return -1;
  1922. +#endif
  1923. +}
  1924. +
  1925. +static int 
  1926. +local_getattrib (vfs * me, char *path, int *attr)
  1927. +{
  1928. +#ifdef OS2EMX
  1929. +  int rc = get_attrib (path);
  1930. +  if (rc == -1)
  1931. +    return -1;
  1932. +  *attr = rc;
  1933. +  return 0;
  1934. +#else
  1935. +  return -1;
  1936. +#endif
  1937. +}
  1938. +
  1939. +#endif /* HETER_NET */
  1940. +
  1941. +
  1942.  static int
  1943.  local_chown (vfs *me, char *path, int owner, int group)
  1944.  {
  1945. @@ -208,7 +237,11 @@
  1946.  static int
  1947.  local_chdir (vfs *me, char *path)
  1948.  {
  1949. +#if defined CHDIR
  1950. +    return CHDIR (path);
  1951. +#else
  1952.      return chdir (path);
  1953. +#endif
  1954.  }
  1955.  
  1956.  int
  1957. @@ -322,6 +355,10 @@
  1958.      local_fstat,
  1959.  
  1960.      local_chmod,
  1961. +#ifdef HETER_NET        
  1962. +    local_setattrib,
  1963. +    local_getattrib,
  1964. +#endif
  1965.      local_chown,
  1966.      local_utime,
  1967.  
  1968. diff -Naur mc-4.5.4/vfs/mcfs.c mc-4.5.4.emx/vfs/mcfs.c
  1969. --- mc-4.5.4/vfs/mcfs.c    Wed Dec 30 11:50:34 1998
  1970. +++ mc-4.5.4.emx/vfs/mcfs.c    Fri Jan  1 19:34:16 1999
  1971. @@ -73,6 +73,9 @@
  1972.  static int my_errno;
  1973.  
  1974.  static char *mcfs_gethome (mcfs_connection *mc);
  1975. +#ifdef HETER_NET
  1976. +static void mcfs_getosinfo (mcfs_connection *mc);
  1977. +#endif
  1978.  
  1979.  /* Extract the hostname and username from the path */
  1980.  /* path is in the form: hostname:user/remote-dir */
  1981. @@ -91,7 +94,13 @@
  1982.      if (mcfs_connections [i].host == 0)
  1983.          continue;
  1984.      name = copy_strings ("/#mc:", mcfs_connections [i].user,
  1985. +#ifdef HETER_NET  /* C:/ */
  1986. +                 "@",   mcfs_connections [i].host,
  1987. +                             mcfs_connections [i].home[0]!='/'?"/":"",
  1988. +                             mcfs_connections [i].home ,0 );
  1989. +#else
  1990.                   "@",   mcfs_connections [i].host, 0);
  1991. +#endif
  1992.      (*func) (name);
  1993.      free (name);
  1994.      }
  1995. @@ -334,7 +343,9 @@
  1996.      bucket->port    = *port;
  1997.      bucket->sock    = sock;
  1998.      bucket->version = version;
  1999. -
  2000. +#ifdef HETER_NET
  2001. +    mcfs_getosinfo(bucket);
  2002. +#endif
  2003.      return bucket;
  2004.  }
  2005.  
  2006. @@ -516,7 +527,11 @@
  2007.      return 0;
  2008.  
  2009.      rpc_send (mc->sock, RPC_INT, MC_OPEN, RPC_STRING, remote_file,
  2010. +#ifdef HETER_NET
  2011. +              RPC_INT, flags_to_mc (flags), RPC_INT, mode, RPC_END);
  2012. +#else
  2013.            RPC_INT, flags, RPC_INT, mode, RPC_END);
  2014. +#endif
  2015.      free (remote_file);    
  2016.  
  2017.      if (0 == rpc_get (mc->sock, RPC_INT, &result, RPC_INT, &error_num, RPC_END))
  2018. @@ -909,6 +924,45 @@
  2019.      return the_error (-1, EIO);
  2020.  }
  2021.  
  2022. +#ifdef HETER_NET
  2023. +static void mcfs_getosinfo (mcfs_connection *mc)
  2024. +{   
  2025. +    char *buffer=0;
  2026. +    rpc_send (mc->sock, RPC_INT, MC_GETOSINFO, RPC_END);
  2027. +    if (rpc_get (mc->sock, RPC_STRING, &buffer, RPC_END)) 
  2028. +         add_host_os(mc->host,buffer); 
  2029. +    if(buffer)free(buffer);
  2030. +}
  2031. +
  2032. +int 
  2033. +mcfs_setattrib (vfs * me, char *path, int attr)
  2034. +{
  2035. +  return mcfs_rpc_path_int (MC_SETATTRIB, path, attr);
  2036. +}
  2037. +
  2038. +int 
  2039. +mcfs_getattrib (vfs * me, char *path, int *attr)
  2040. +{
  2041. +  mcfs_connection *mc;
  2042. +  char *file;
  2043. +  int error;
  2044. +
  2045. +  if (!(file = mcfs_get_path (&mc, path)))
  2046. +    return -1;
  2047. +
  2048. +  rpc_send (mc->sock, RPC_INT, MC_GETATTRIB, RPC_STRING, file, RPC_END);
  2049. +  free (file);
  2050. +  if (!rpc_get (mc->sock, RPC_INT, attr, RPC_INT, &error, RPC_END))
  2051. +    return the_error (-1, errno);
  2052. +
  2053. +  if (is_error (*attr, error))
  2054. +    return -1;
  2055. +
  2056. +  return 0;
  2057. +}
  2058. +#endif
  2059. +
  2060. +
  2061.  static int mcfs_chmod (vfs *me, char *path, int mode)
  2062.  {
  2063.      return mcfs_rpc_path_int (MC_CHMOD, path, mode);
  2064. @@ -1149,6 +1203,10 @@
  2065.      mcfs_fstat,
  2066.  
  2067.      mcfs_chmod,
  2068. +#ifdef HETER_NET
  2069. +    mcfs_setattrib,
  2070. +    mcfs_getattrib,
  2071. +#endif
  2072.      mcfs_chown,
  2073.      mcfs_utime,
  2074.  
  2075. @@ -1177,3 +1235,56 @@
  2076.  
  2077.  MMAPNULL
  2078.  };
  2079. +
  2080. +#ifdef HETER_NET
  2081. +char *
  2082. +mcfs_tilde_expand (char *mcfs_name)
  2083. +{
  2084. +  char *rc = 0, *p, *q, *user = 0, *host = 0, *home = 0, buf[512];
  2085. +  strcpy (buf, mcfs_name);
  2086. +  p = strstr (buf, "#mc:");
  2087. +  if (p) {
  2088. +    p += 4;
  2089. +    user = p;
  2090. +    while (*p) {
  2091. +      if (*p == '@') {
  2092. +    *p++ = 0;
  2093. +    host = p;
  2094. +      }
  2095. +      else if (*p == '/')
  2096. +    *p++ = 0;
  2097. +      else
  2098. +    p++;
  2099. +    }
  2100. +    if (!host) {
  2101. +      host = user;
  2102. +      user = 0;
  2103. +    }
  2104. +    if (host) {
  2105. +      int ic;
  2106. +      for (ic = 0; ic < mcfs_open_connections; ic++) {
  2107. +    if (!strcmp (mcfs_connections[ic].host, host) && (!user ||
  2108. +                   !strcmp (mcfs_connections[ic].user, user))) {
  2109. +      home = mcfs_connections[ic].home;
  2110. +      q = buf;
  2111. +      p = mcfs_name;
  2112. +      while (*p) {
  2113. +        if (*p == '~') {
  2114. +          strcpy (q, home);
  2115. +          q += strlen (home);
  2116. +          p++;
  2117. +        }
  2118. +        else
  2119. +          *q++ = *p++;
  2120. +      }
  2121. +      *q = 0;
  2122. +      return strdup (buf);
  2123. +    }
  2124. +      }
  2125. +    }
  2126. +  }
  2127. +  return 0;
  2128. +}
  2129. +
  2130. +#endif
  2131. +
  2132. diff -Naur mc-4.5.4/vfs/mcfs.h mc-4.5.4.emx/vfs/mcfs.h
  2133. --- mc-4.5.4/vfs/mcfs.h    Wed Dec 30 11:50:36 1998
  2134. +++ mc-4.5.4.emx/vfs/mcfs.h    Fri Jan  1 19:34:50 1999
  2135. @@ -38,6 +38,12 @@
  2136.      
  2137.      MC_UTIME,           /* it has to go here for compatibility with old
  2138.                 servers/clients. sigh ... */
  2139. +#ifdef HETER_NET
  2140. +    MC_GETOSINFO,
  2141. +    /* DOS, OS/2, Windows file system (FAT,HPFS,FAT32) on server  */
  2142. +    MC_SETATTRIB,         
  2143. +    MC_GETATTRIB,           
  2144. +#endif
  2145.  
  2146.      MC_INVALID_PASS = 0x1000,
  2147.      MC_NEED_PASSWORD,
  2148. diff -Naur mc-4.5.4/vfs/mcserv.c mc-4.5.4.emx/vfs/mcserv.c
  2149. --- mc-4.5.4/vfs/mcserv.c    Wed Dec 30 11:50:34 1998
  2150. +++ mc-4.5.4.emx/vfs/mcserv.c    Sat Jan  2 14:21:46 1999
  2151. @@ -133,6 +133,13 @@
  2152.  /* if the server will use rcmd based authentication (hosts.equiv .rhosts) */
  2153.  int r_auth = 0;
  2154.  
  2155. +#ifdef HETER_NET
  2156. +#ifndef OS_INFO
  2157. +#define OS_INFO "UNKNOWN"
  2158. +#endif
  2159. +static int compat_mode = 0;    /* compatibility with old clients */
  2160. +#endif
  2161. +
  2162.  #define OPENDIR_HANDLES 8
  2163.  
  2164.  #define DO_QUIT_VOID() \
  2165. @@ -159,6 +166,41 @@
  2166.  
  2167.  /* {{{ Misc routines */
  2168.  
  2169. +#ifdef HETER_NET
  2170. +/*  "/C:/.." --> "C:/..."  etc.    */
  2171. +/* ! server side !                 */
  2172. +char *
  2173. +adjust (char **str)
  2174. +{
  2175. +  char *rc = *str, buf[512], *p;
  2176. +  if (rc[0] == '/' && rc[1] && rc[2] == ':')
  2177. +    rc++;        /* "/C:"  -> "C:"  */
  2178. +  if (rc[0] && rc[1] == ':' && !rc[2]) { 
  2179. +    /* cannot _chdir2 to "X:" -> "X:/" */
  2180. +    strcpy (buf, rc);
  2181. +    strcat (buf, "/");
  2182. +    free (*str);
  2183. +    *str = strdup (buf);
  2184. +    rc = *str;
  2185. +  }
  2186. +  /*  "/"  -> "H:/" */
  2187. +  else if (rc[0] == '/' && home_dir && home_dir[0] && home_dir[1] == ':') {
  2188. +    strncpy (buf, home_dir, 2);
  2189. +    strcpy (buf + 2, rc);
  2190. +    free (*str);
  2191. +    *str = strdup (buf);
  2192. +    rc = *str;
  2193. +  }
  2194. +  p = rc;            /* duplicate "//" */
  2195. +  while (*p) {
  2196. +    while (*p == '/' && *(p + 1) == '/')
  2197. +      strcpy (p, p + 1);
  2198. +    p++;
  2199. +  }
  2200. +  return rc;
  2201. +}
  2202. +#endif
  2203. +
  2204.  void send_status (int status, int errno_number)
  2205.  {
  2206.      rpc_send (msock, RPC_INT, status, RPC_INT, errno_number, RPC_END);
  2207. @@ -175,8 +217,14 @@
  2208.      char *arg;
  2209.  
  2210.      rpc_get (msock, RPC_STRING, &arg, RPC_INT, &flags, RPC_INT, &mode,RPC_END);
  2211. -    
  2212. +#ifdef HETER_NET
  2213. +    handle = open (adjust (&arg), flags_from_mc (flags), mode);
  2214. +#else
  2215.      handle = open (arg, flags, mode);
  2216. +#endif
  2217. +#ifdef OS2EMX_CHG
  2218. +    lseek (handle, 0, SEEK_SET);
  2219. +#endif
  2220.      send_status (handle, errno);
  2221.      free (arg);
  2222.  }
  2223. @@ -326,7 +374,11 @@
  2224.      int    n;
  2225.  
  2226.      rpc_get (msock, RPC_STRING, &file, RPC_END);
  2227. +#ifdef HETER_NET
  2228. +    n = lstat (adjust (&file), &st);
  2229. +#else
  2230.      n = lstat (file, &st);
  2231. +#endif
  2232.      send_status (n, errno);
  2233.      if (n >= 0)
  2234.      send_stat_info (&st);
  2235. @@ -355,8 +407,11 @@
  2236.      char   *file;
  2237.  
  2238.      rpc_get (msock, RPC_STRING, &file, RPC_END);
  2239. -
  2240. +#ifdef HETER_NET
  2241. +    n = stat (adjust (&file), &st);
  2242. +#else
  2243.      n = stat (file, &st);
  2244. +#endif
  2245.      send_status (n, errno);
  2246.      if (n >= 0)
  2247.      send_stat_info (&st);
  2248. @@ -415,7 +470,11 @@
  2249.      }
  2250.  
  2251.      if (verbose) printf ("handle=%d\n", handle);
  2252. +#ifdef HETER_NET
  2253. +    p = opendir (adjust (&arg));
  2254. +#else
  2255.      p = opendir (arg);
  2256. +#endif
  2257.      if (p){
  2258.      mcfs_DIR.dirs [handle] = p;
  2259.      mcfs_DIR.names [handle] = arg;
  2260. @@ -456,7 +515,11 @@
  2261.      rpc_send (msock, RPC_BLOCK, length, dirent->d_name, RPC_END);
  2262.      fname = malloc (dnamelen + length + 2);
  2263.      strcat (strcat (strcpy (fname, mcfs_DIR.names [handle]), "/"), dirent->d_name);
  2264. -    n = lstat (fname, &st);
  2265. +#ifdef HETER_NET
  2266. +        n = lstat (adjust (&fname), &st);
  2267. +#else
  2268. +        n = lstat (fname, &st);
  2269. +#endif
  2270.      send_status (n, errno);
  2271.      free (fname);
  2272.      if (n >= 0)
  2273. @@ -484,7 +547,15 @@
  2274.  
  2275.      rpc_get (msock, RPC_STRING, &file, RPC_END);
  2276.      
  2277. +#ifdef HETER_NET
  2278. +#ifdef CHDIR
  2279. +    status = CHDIR (adjust (&file));
  2280. +#else
  2281. +    status = chdir (adjust (&file));
  2282. +#endif
  2283. +#else
  2284.      status = chdir (file);
  2285. +#endif
  2286.      send_status (status, errno);
  2287.      free (file);
  2288.  }
  2289. @@ -496,7 +567,11 @@
  2290.  
  2291.      rpc_get (msock, RPC_STRING, &file, RPC_END);
  2292.      
  2293. +#ifdef HETER_NET
  2294. +    status = rmdir (adjust (&file));
  2295. +#else
  2296.      status = rmdir (file);
  2297. +#endif
  2298.      send_status (status, errno);
  2299.      free (file);
  2300.  }
  2301. @@ -508,7 +583,11 @@
  2302.  
  2303.      rpc_get (msock, RPC_STRING, &file, RPC_INT, &mode, RPC_END);
  2304.      
  2305. +#ifdef HETER_NET
  2306. +    status = mkdir (adjust (&file), mode);
  2307. +#else
  2308.      status = mkdir (file, mode);
  2309. +#endif
  2310.      send_status (status, errno);
  2311.      free (file);
  2312.  }
  2313. @@ -519,8 +598,12 @@
  2314.      int  mode, dev, status;
  2315.  
  2316.      rpc_get (msock, RPC_STRING, &file, RPC_INT, &mode, RPC_INT, &dev, RPC_END);
  2317. -    
  2318. +
  2319. +#ifdef HETER_NET
  2320. +    status = mknod (adjust (&file), mode, dev);
  2321. +#else
  2322.      status = mknod (file, mode, dev);
  2323. +#endif
  2324.      send_status (status, errno);
  2325.      free (file);
  2326.  }
  2327. @@ -532,7 +615,11 @@
  2328.      int  n;
  2329.  
  2330.      rpc_get (msock, RPC_STRING, &file, RPC_END);
  2331. +#ifdef HETER_NET
  2332. +    n = readlink (adjust (&file), buffer, 2048);
  2333. +#else
  2334.      n = readlink (file, buffer, 2048);
  2335. +#endif
  2336.      send_status (n, errno);
  2337.      if (n >= 0) {
  2338.          buffer [n] = 0;
  2339. @@ -547,7 +634,11 @@
  2340.      int  status;
  2341.      
  2342.      rpc_get (msock, RPC_STRING, &file, RPC_END);
  2343. +#ifdef HETER_NET
  2344. +    status = unlink (adjust (&file));
  2345. +#else
  2346.      status = unlink (file);
  2347. +#endif
  2348.      send_status (status, errno);
  2349.      free (file);
  2350.  }
  2351. @@ -558,7 +649,11 @@
  2352.      int  status;
  2353.      
  2354.      rpc_get (msock, RPC_STRING, &f1, RPC_STRING, &f2, RPC_END);
  2355. +#ifdef HETER_NET
  2356. +    status = rename (adjust (&f1), adjust (&f2));
  2357. +#else
  2358.      status = rename (f1, f2);
  2359. +#endif
  2360.      send_status (status, errno);
  2361.      free (f1); free (f2);
  2362.  }
  2363. @@ -569,7 +664,11 @@
  2364.      int  status;
  2365.      
  2366.      rpc_get (msock, RPC_STRING, &f1, RPC_STRING, &f2, RPC_END);
  2367. +#ifdef HETER_NET
  2368. +    status = symlink (adjust (&f1), adjust (&f2));
  2369. +#else
  2370.      status = symlink (f1, f2);
  2371. +#endif
  2372.      send_status (status, errno);
  2373.      free (f1); free (f2);
  2374.  }
  2375. @@ -580,8 +679,13 @@
  2376.      int  status;
  2377.      
  2378.      rpc_get (msock, RPC_STRING, &f1, RPC_STRING, &f2, RPC_END);
  2379. +#ifdef HETER_NET
  2380. +    status = link (adjust (&f1), adjust (&f2));
  2381. +    send_status (status, errno);
  2382. +#else
  2383.      status = link (f1, f2);
  2384.      send_status (link (f1, f2), errno);
  2385. +#endif
  2386.      free (f1); free (f2);
  2387.  }
  2388.  
  2389. @@ -590,9 +694,17 @@
  2390.  
  2391.  /* {{{ Misc commands */
  2392.  
  2393. +
  2394.  void do_gethome (void)
  2395.  {
  2396. +#ifdef HETER_NET
  2397. +    char *p = home_dir;
  2398. +    if (compat_mode && p && p[0] && p[1] == ':')
  2399. +      p += 2;
  2400. +    rpc_send (msock, RPC_STRING, (p) ? p : "/", RPC_END);
  2401. +#else
  2402.      rpc_send (msock, RPC_STRING, (home_dir) ? home_dir : "/", RPC_END);
  2403. +#endif
  2404.  }
  2405.  
  2406.  void do_getupdir (void)
  2407. @@ -606,18 +718,68 @@
  2408.      int  mode, status;
  2409.      
  2410.      rpc_get (msock, RPC_STRING, &file, RPC_INT, &mode, RPC_END);
  2411. +#ifdef HETER_NET
  2412. +    status = chmod (adjust (&file), mode);
  2413. +#else
  2414.      status = chmod (file, mode);
  2415. +#endif
  2416.      send_status (status, errno);
  2417.      free (file);
  2418.  }
  2419.  
  2420. +#ifdef HETER_NET
  2421. +void do_getosinfo (void)
  2422. +{
  2423. +    rpc_send (msock, RPC_STRING, OS_INFO, RPC_END);
  2424. +}
  2425. +
  2426. +void 
  2427. +do_setattrib (void)
  2428. +{
  2429. +  char *file;
  2430. +  int attr, status;
  2431. +
  2432. +  rpc_get (msock, RPC_STRING, &file, RPC_INT, &attr, RPC_END);
  2433. +#ifdef OS2EMX
  2434. +  status = set_attrib (adjust (&file), attr);
  2435. +#else
  2436. +  status = -1;
  2437. +#endif
  2438. +  send_status (status, errno);
  2439. +  free (file);
  2440. +
  2441. +}
  2442. +
  2443. +void 
  2444. +do_getattrib (void)
  2445. +{
  2446. +  int attr;
  2447. +  char *file;
  2448. +
  2449. +  rpc_get (msock, RPC_STRING, &file, RPC_END);
  2450. +#ifdef OS2EMX
  2451. +  attr = get_attrib (adjust (&file));
  2452. +#else
  2453. +  attr = -1;
  2454. +#endif
  2455. +  send_status (attr, errno);
  2456. +  free (file);
  2457. +}
  2458. +
  2459. +#endif /* HETER_NET */
  2460. +
  2461. +
  2462.  void do_chown (void)
  2463.  {
  2464.      char *file;
  2465.      int  owner, group, status;
  2466.      
  2467.      rpc_get (msock, RPC_STRING, &file,RPC_INT, &owner, RPC_INT,&group,RPC_END);
  2468. +#ifdef HETER_NET
  2469. +    status = chown (adjust (&file), owner, group);
  2470. +#else
  2471.      status = chown (file, owner, group);
  2472. +#endif
  2473.      send_status (status, errno);
  2474.      free (file);
  2475.  }
  2476. @@ -644,7 +806,11 @@
  2477.      free (ms);
  2478.      times.actime  = (time_t) atime;
  2479.      times.modtime = (time_t) mtime;
  2480. +#ifdef HETER_NET
  2481. +    status = utime (adjust (&file), ×);
  2482. +#else
  2483.      status = utime (file, ×);
  2484. +#endif
  2485.      send_status (status, errno);
  2486.      free (file);
  2487.  }
  2488. @@ -887,7 +1053,11 @@
  2489.      if (this == 0)
  2490.      return 0;
  2491.  
  2492. +#ifdef CHDIR
  2493. +    if (CHDIR (this->pw_dir) == -1)
  2494. +#else
  2495.      if (chdir (this->pw_dir) == -1)
  2496. +#endif
  2497.          return 0;
  2498.      
  2499.      if (this->pw_dir [strlen (this->pw_dir) - 1] == '/')
  2500. @@ -1031,6 +1201,11 @@
  2501.      { "login",      do_login },
  2502.      { "quit",       do_quit },
  2503.      { "utime",      do_utime },
  2504. +#ifdef HETER_NET
  2505. +    { "getosinfo",  do_getosinfo},
  2506. +    { "setattrib",  do_setattrib},
  2507. +    { "getattrib",  do_getattrib},
  2508. +#endif
  2509.  };
  2510.  
  2511.  static int ncommands = sizeof(commands)/sizeof(struct _command);
  2512. @@ -1207,7 +1382,11 @@
  2513.      extern char *optarg;
  2514.      int c;
  2515.  
  2516. -    while ((c = getopt (argc, argv, "fdiqp:v")) != -1){
  2517. +#ifdef HETER_NET
  2518. +    while ((c = getopt (argc, argv, "fdiqop:v")) != -1) {
  2519. +#else
  2520. +    while ((c = getopt (argc, argv, "fdiqp:v")) != -1) {
  2521. +#endif
  2522.      switch (c){
  2523.      case 'd':
  2524.          isDaemon = 1;
  2525. @@ -1230,6 +1409,11 @@
  2526.          portnum = atoi (optarg);
  2527.          break;
  2528.  
  2529. +#ifdef HETER_NET
  2530. +        case 'o':
  2531. +            compat_mode = 1;
  2532. +            break;
  2533. +#endif
  2534.      case 'i':
  2535.          inetd_started = 1;
  2536.          break;
  2537. @@ -1246,6 +1430,9 @@
  2538.          /*    "-r  use rhost based authentication\n" */
  2539.  #ifndef HAVE_PAM
  2540.              "-f  force ftp authentication\n"
  2541. +#endif
  2542. +#ifdef HETER_NET
  2543. +                    "-o  old clients compatibility mode\n"
  2544.  #endif
  2545.              "-v  verbose mode\n"
  2546.              "-p  to specify a port number to listen\n");
  2547. diff -Naur mc-4.5.4/vfs/sfs.c mc-4.5.4.emx/vfs/sfs.c
  2548. --- mc-4.5.4/vfs/sfs.c    Wed Dec 30 11:50:34 1998
  2549. +++ mc-4.5.4.emx/vfs/sfs.c    Sun Jan  3 08:36:56 1999
  2550. @@ -30,7 +30,11 @@
  2551.  #include "local.h"
  2552.  
  2553.  /* This is needed, or libvfs.so will lack symbol shell. Should look up who requires it */
  2554. +#ifndef OS2EMX
  2555.  char *shell = "/bin/sh";
  2556. +#else /* in src/main.c */
  2557. +extern char *shell;
  2558. +#endif
  2559.  
  2560.  struct cachedfile {
  2561.      char *name, *cache;
  2562. @@ -92,8 +96,11 @@
  2563.      s++;
  2564.      }
  2565.      free( name );
  2566. -
  2567. +#ifdef OS2EMX_CHG
  2568. +    if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID, shell, pad)) {
  2569. +#else
  2570.      if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID, "/bin/sh", pad)) {
  2571. +#endif
  2572.      return -1;
  2573.      }
  2574.  
  2575. @@ -388,6 +395,10 @@
  2576.      local_fstat,
  2577.  
  2578.      sfs_chmod,
  2579. +#ifdef HETER_NET /* setattrib, getattrib */
  2580. +    NULL, 
  2581. +    NULL,
  2582. +#endif
  2583.      sfs_chown,
  2584.      sfs_utime,
  2585.  
  2586. diff -Naur mc-4.5.4/vfs/shared_ftp_fish.c mc-4.5.4.emx/vfs/shared_ftp_fish.c
  2587. --- mc-4.5.4/vfs/shared_ftp_fish.c    Wed Dec 30 11:50:34 1998
  2588. +++ mc-4.5.4.emx/vfs/shared_ftp_fish.c    Fri Jan  1 19:40:46 1999
  2589. @@ -189,7 +189,12 @@
  2590.  
  2591.          path_name = copy_strings ( X_myname, quser (bucket),
  2592.                        "@",      qhost (bucket), 
  2593. -                      qcdir(bucket), 0);
  2594. +#ifdef HETER_NET  /* C:/ */
  2595. +                                       qhome(bucket)[0]!='/'?"/":"",
  2596. +                         qhome(bucket), 0);
  2597. +#else
  2598. +                         qcdir(bucket), 0);
  2599. +#endif
  2600.          (*func)(path_name);
  2601.          free (path_name);
  2602.      }
  2603. @@ -282,7 +287,21 @@
  2604.      struct linklist *file_list, *lptr;
  2605.      struct dir *dcache;
  2606.      struct stat sb;
  2607. -
  2608. +#ifdef HETER_NET
  2609. +  char *dirname;
  2610. +  canonicalize_pathname (file_name);
  2611. +  dirname = strdup (file_name);
  2612. +  /* !!! internal canonicalize_pathname in */
  2613. +  /* retrieve_dir overwrite file_name      */
  2614. +  p = strrchr (dirname, '/');
  2615. +  *(++p) = '\0';
  2616. +  p = file_name + (p - dirname);    /* p...file_part */
  2617. +  dcache = retrieve_dir (bucket, dirname, op & DO_RESOLVE_SYMLINK);
  2618. +  free (dirname);
  2619. +  if (dcache == NULL)
  2620. +    return NULL;
  2621. +  file_list = dcache->file_list;
  2622. +#else
  2623.      p = strrchr(file_name, '/');
  2624.      q = *p;
  2625.      *p = '\0';
  2626. @@ -291,6 +310,7 @@
  2627.          return NULL;
  2628.      file_list = dcache->file_list;
  2629.      *p++ = q;
  2630. +#endif
  2631.      if (!*p) 
  2632.          p = ".";
  2633.      for (lptr = file_list->next; lptr != file_list; lptr = lptr->next) {
  2634. diff -Naur mc-4.5.4/vfs/tar.c mc-4.5.4.emx/vfs/tar.c
  2635. --- mc-4.5.4/vfs/tar.c    Wed Dec 30 11:50:34 1998
  2636. +++ mc-4.5.4.emx/vfs/tar.c    Fri Jan  1 19:43:44 1999
  2637. @@ -527,6 +527,10 @@
  2638.      vfs_s_fstat,
  2639.  
  2640.      NULL,
  2641. +#ifdef HETER_NET /* setattrib, getattrib */
  2642. +    NULL, 
  2643. +    NULL,
  2644. +#endif
  2645.      NULL,
  2646.      NULL,
  2647.  
  2648. diff -Naur mc-4.5.4/vfs/tcputil.c mc-4.5.4.emx/vfs/tcputil.c
  2649. --- mc-4.5.4/vfs/tcputil.c    Wed Dec 30 11:50:36 1998
  2650. +++ mc-4.5.4.emx/vfs/tcputil.c    Fri Jan  1 19:45:50 1999
  2651. @@ -240,7 +240,7 @@
  2652.      sock_callbacks = new;
  2653.  }
  2654.  
  2655. -#if defined(IS_AIX) || defined(linux) || defined(SCO_FLAVOR) || defined(__QNX__)
  2656. +#if defined(IS_AIX) || defined(linux) || defined(SCO_FLAVOR) || defined(__QNX__) || defined(OS2EMX)
  2657.  static void sig_pipe (int unused)
  2658.  #else
  2659.  static void sig_pipe (void)
  2660. diff -Naur mc-4.5.4/vfs/utilvfs.c mc-4.5.4.emx/vfs/utilvfs.c
  2661. --- mc-4.5.4/vfs/utilvfs.c    Wed Dec 30 11:50:36 1998
  2662. +++ mc-4.5.4.emx/vfs/utilvfs.c    Fri Jan  1 19:55:26 1999
  2663. @@ -80,7 +80,11 @@
  2664.      for (; *dir != '/' && *dir; dir++)
  2665.          ;
  2666.      if (*dir){
  2667. -        retval = strdup (dir);
  2668. +#ifdef HETER_NET
  2669. +            retval=strdup(dir[1]&&dir[2]==':'?dir+1:dir);
  2670. +#else    
  2671. +            retval = strdup (dir);
  2672. +#endif
  2673.          *dir = 0;
  2674.      } else
  2675.          retval = strdup ("/");
  2676. diff -Naur mc-4.5.4/vfs/vfs.c mc-4.5.4.emx/vfs/vfs.c
  2677. --- mc-4.5.4/vfs/vfs.c    Wed Dec 30 11:50:36 1998
  2678. +++ mc-4.5.4.emx/vfs/vfs.c    Sat Jan  2 15:11:44 1999
  2679. @@ -471,6 +471,35 @@
  2680.      return result;
  2681.  }
  2682.  
  2683. +#ifdef HETER_NET
  2684. +int 
  2685. +mc_setattrib (char *path, int a)
  2686. +{
  2687. +  vfs *vfs;
  2688. +  int result;
  2689. +
  2690. +  path = vfs_canon (path);
  2691. +  vfs = vfs_type (path);
  2692. +  result = vfs->setattrib ? (*vfs->setattrib) (vfs, path, a) : 0;
  2693. +  free (path);
  2694. +  return result;
  2695. +}
  2696. +
  2697. +int 
  2698. +mc_getattrib (char *path, int *a)
  2699. +{
  2700. +  vfs *vfs;
  2701. +  int result;
  2702. +
  2703. +  path = vfs_canon (path);
  2704. +  vfs = vfs_type (path);
  2705. +  result = vfs->getattrib ? (*vfs->getattrib) (vfs, path, a) : 0;
  2706. +  free (path);
  2707. +  return result;
  2708. +}
  2709. +
  2710. +#endif /* HETER_NET */
  2711. +
  2712.  int
  2713.  mc_close (int handle)
  2714.  {
  2715. @@ -514,13 +543,26 @@
  2716.      vfs = vfs_type (dirname);
  2717.  
  2718.      info = vfs->opendir ? (*vfs->opendir)(vfs, dirname) : NULL;
  2719. +#ifdef HETER_NET  /* non_unix ftp server cdup disabled */
  2720. +    if (p)
  2721. +        free (p);
  2722. +    if (!info){
  2723. +        message_2s (1, MSG_ERROR,
  2724. +                   _(" I can't open directory \"%s\""), dirname );
  2725. +        free(dirname);
  2726. +        errno = vfs->opendir ? ferrno (vfs) : EOPNOTSUPP;
  2727. +    return NULL;
  2728. +    }
  2729. +    free(dirname);
  2730. +#else
  2731.      free (dirname);
  2732.      if (p)
  2733.          free (p);
  2734.      if (!info){
  2735. -        errno = vfs->opendir ? ferrno (vfs) : E_NOTSUPP;
  2736. +        errno = vfs->opendir ? ferrno (vfs) : EOPNOTSUPP;
  2737.      return NULL;
  2738.      }
  2739. +#endif
  2740.      handle = get_bucket ();
  2741.      vfs_file_table [handle].fs_info = info;
  2742.      vfs_file_table [handle].operations = vfs;
  2743. @@ -690,11 +732,31 @@
  2744.  
  2745.  #define ISSLASH(a) (!a || (a == '/'))
  2746.  
  2747. +#ifdef HETER_NET
  2748. +char *ftp_tilde_expand(char *ftp_name);
  2749. +char *mcfs_tilde_expand(char *mcfs_name);
  2750. +
  2751. +static int 
  2752. +is_relative (char *path)
  2753. +{
  2754. +  int rc = 1;
  2755. +  if (*path == '/')
  2756. +    rc = 0;
  2757. +  else if (*path && path[1] == ':' && path[2] == '/')
  2758. +    rc = 0;
  2759. +  return rc;
  2760. +}
  2761. +
  2762. +#endif 
  2763. +
  2764.  char *
  2765.  vfs_canon (char *path)
  2766.  {
  2767.      if (!path) vfs_die("Can not canonize NULL");
  2768.  
  2769. +#ifdef HETER_NET
  2770. +   if(strchr(path,'~')){
  2771. +#endif
  2772.      /* Tilde expansion */
  2773.      if (*path == '~'){ 
  2774.          char *local, *result;
  2775. @@ -707,9 +769,27 @@
  2776.      } else 
  2777.          return strdup (path);
  2778.      }
  2779. -
  2780. +#ifdef HETER_NET
  2781. +    if (strstr (path, "#ftp:") || strstr (path, "#mc:")) {    
  2782. +      /* ftp mcfs Tilde expansion */
  2783. +      char *result, *local;
  2784. +      local = strstr (path, "#ftp:") ? ftp_tilde_expand (path) :
  2785. +    mcfs_tilde_expand (path);
  2786. +      if (local) {
  2787. +    result = vfs_canon (local);
  2788. +    free (local);
  2789. +    return result;
  2790. +      }
  2791. +      /* unknown host, user ... continue */
  2792. +    }
  2793. +  }
  2794. +#endif
  2795. +#ifdef HETER_NET
  2796. +    if (is_relative (path)) {/* Relative to current directory */
  2797. +#else
  2798.      /* Relative to current directory */
  2799.      if (*path != '/'){ 
  2800. +#endif
  2801.          char *local, *result;
  2802.  
  2803.      if (current_dir [strlen (current_dir) - 1] == '/')
  2804. @@ -1057,7 +1137,12 @@
  2805.      fdin = mc_open (filename, O_RDONLY);
  2806.      if (fdin == -1)
  2807.          return NULL;
  2808. +#ifdef OS2EMX
  2809. +    tmp = strrchr (filename, '.');
  2810. +    tmp = tmpnam_ext (tmp ? tmp : ".tmp");
  2811. +#else
  2812.      tmp = tempnam (NULL, "mclocalcopy");
  2813. +#endif
  2814.      fdout = open (tmp, O_CREAT|O_WRONLY|O_TRUNC|O_EXCL, 0600);
  2815.      if (fdout == -1){
  2816.          mc_close (fdin);
  2817. @@ -1502,6 +1587,76 @@
  2818.      return idx;
  2819.  }
  2820.  
  2821. +#ifdef HETER_NET
  2822. +int 
  2823. +parse_ls_lga_os2 (char *p, struct stat *s, char **filename, char **linkname)
  2824. +/* IBM TCPIP ftp server      */
  2825. +/* return : 1.. ok 0..err    */
  2826. +{
  2827. +  int rc = 0;
  2828. +  char *q;
  2829. +  struct tm tim;
  2830. +  memset (s, 0, sizeof (*s));
  2831. +  memset (&tim, 0, sizeof (tim));
  2832. +  q = strtok (p, " \t");
  2833. +  if (q) {
  2834. +    s->st_size = atoi (q);
  2835. +    q = strtok (0, " -\t");
  2836. +    if (q) {
  2837. +      if(!isdigit(*q)){
  2838. +         if (!strcmp (q, "DIR"))
  2839. +      s->st_mode |= S_IFDIR | 0777;
  2840. +         else
  2841. +      s->st_mode = S_IFREG | (strchr (q, 'R') ? 0444 : 0666);
  2842. +         q = strtok (0, " -\t");
  2843. +      } else
  2844. +      s->st_mode = S_IFREG | 0666;
  2845. +      if (q) {
  2846. +    tim.tm_mon = atoi (q) - 1;
  2847. +    q = strtok (0, " -\t");
  2848. +    if (q) {
  2849. +      tim.tm_mday = atoi (q);
  2850. +      q = strtok (0, " \t");
  2851. +      if (q) {
  2852. +        tim.tm_year = atoi (q);
  2853. +        q = strtok (0, " :\t");
  2854. +        if (q) {
  2855. +          tim.tm_hour = atoi (q);
  2856. +          q = strtok (0, " \t");
  2857. +          if (q) {
  2858. +        tim.tm_min = atoi (q);
  2859. +        q = strtok (0, " \t\r\n");
  2860. +        if (q) {
  2861. +          if (filename)
  2862. +            *filename = strdup (q);
  2863. +          if (linkname)
  2864. +            *linkname = NULL;
  2865. +          if ((q = strrchr (*filename, '.')) != 0) {
  2866. +            q = strdup (q + 1);
  2867. +            if (!strcasecmp (q, "exe") || !strcasecmp (q, "cmd") || 
  2868. +                                                  !strcasecmp (q, "bat"))
  2869. +              s->st_mode |= 0111;
  2870. +            free (q);
  2871. +          }
  2872. +          s->st_nlink = 1;
  2873. +          s->st_atime = mktime (&tim);
  2874. +          if (s->st_atime == -1)
  2875. +            s->st_atime = 0;
  2876. +          s->st_mtime = s->st_ctime = s->st_atime;
  2877. +          rc = 1;
  2878. +        }
  2879. +          }
  2880. +        }
  2881. +      }
  2882. +    }
  2883. +      }
  2884. +    }
  2885. +  };
  2886. +  return rc;
  2887. +}
  2888. +#endif /* HETER_NET */
  2889. +
  2890. +
  2891.  int
  2892.  vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname)
  2893.  {
  2894. @@ -1514,7 +1669,15 @@
  2895.  
  2896.      p_copy = strdup(p);
  2897.      if ((i = vfs_parse_filetype(*(p++))) == -1)
  2898. +#ifdef HETER_NET /* Should parse here the IBM ftp server format ;) */
  2899. +      { if (parse_ls_lga_os2 (p, s, filename, linkname))
  2900. +           return 1;
  2901. +       /*  if(parse_ls_lga_???... for other non standard formats   */
  2902. +        goto error;
  2903. +      }
  2904. +#else
  2905.          goto error;
  2906. +#endif
  2907.  
  2908.      s->st_mode = i;
  2909.      if (*p == '['){
  2910. diff -Naur mc-4.5.4/vfs/vfs.h mc-4.5.4.emx/vfs/vfs.h
  2911. --- mc-4.5.4/vfs/vfs.h    Wed Dec 30 11:50:36 1998
  2912. +++ mc-4.5.4.emx/vfs/vfs.h    Fri Jan  1 19:58:18 1999
  2913. @@ -82,6 +82,10 @@
  2914.      int  (*fstat)             (void *vfs_info, struct stat *buf);
  2915.                     
  2916.      int  (*chmod)             (vfs *me, char *path, int mode);
  2917. +#ifdef HETER_NET
  2918. +    int  (*setattrib)      (vfs *me, char *path, int attr);
  2919. +    int  (*getattrib)      (vfs *me, char *path, int *attr);
  2920. +#endif
  2921.      int  (*chown)             (vfs *me, char *path, int owner, int group);
  2922.      int  (*utime)             (vfs *me, char *path, struct utimbuf *times);
  2923.                     
  2924. @@ -201,6 +205,10 @@
  2925.      int mc_fstat (int fd, struct stat *buf);
  2926.  
  2927.      int mc_chmod    (char *path, int mode);
  2928. +#ifdef HETER_NET
  2929. +        int mc_setattrib(char *path, int  attr);
  2930. +        int mc_getattrib(char *path, int *attr);
  2931. +#endif
  2932.      int mc_chown    (char *path, int owner, int group);
  2933.      int mc_utime    (char *path, struct utimbuf *times);
  2934.      int mc_readlink (char *path, char *buf, int bufsiz);
  2935.