diff -bur arj/unarj.c mc/unarj.c
--- arj/unarj.c	Mon Sep 29 14:00:24 1997
+++ mc/unarj.c	Fri Sep 22 21:44:29 2000
@@ -42,6 +42,7 @@
  * 02/17/93  R. Jung     Added archive modified date support.
  * 01/22/94  R. Jung     Changed copyright message.
  * 07/29/96  R. Jung     Added "/" to list of path separators.
+ * 02/16/98 pavel@ucw.cz Added v mode, added p mode. THIS IS MODIFIED VERSION.
  *
  */
 
@@ -89,6 +90,7 @@
 uchar  header[HEADERSIZE_MAX];
 char   arc_name[FNAME_MAX];
 int    command;
+char   *file_to_extract;
 int    bitcount;
 int    file_type;
 int    no_output;
@@ -103,6 +105,11 @@
 "        UNARJ l archive        (list archive)\n",
 "        UNARJ t archive        (test archive)\n",
 "        UNARJ x archive        (extract with pathnames)\n",
+"        UNARJ v archive        (list archive with pathnames)\n",
+"        UNARJ p archive file   (print single file from archive to stderr)\n",
+"\n",
+"Warning, this version has been modified by pavel@ucw.cz\n",
+"to be used as virtual fs within mc (Midnight Commander).\n",
 "\n",
 "This is an ARJ demonstration program and ** IS NOT OPTIMIZED ** for speed.\n",
 "You may freely use, copy and distribute this program, provided that no fee\n",
@@ -723,15 +730,24 @@
     if (command == 'E')
         strcpy(name, &filename[entry_pos]);
     else
+        if (command == 'X')
     {
         strcpy(name, DEFAULT_DIR);
         strcat(name, filename);
     }
+    else
+	    if (strcmp( &filename[0], file_to_extract ))
+	    {
+	        skip();
+	        return 0;
+	    }
+            else
+	        strcpy( name, "stderr" );
 
     if (host_os != OS)
         default_case_path(name);
 
-    if (file_exists(name))
+    if ((command != 'P') && file_exists(name))
     {
         printf(M_FEXISTS, name);
         printf(M_SKIPPED, name);
@@ -739,7 +755,10 @@
         error_count++;
         return 0;
     }
+    if (command != 'P')
     outfile = file_open(name, writemode[file_type & 1]);
+    else
+        outfile = stderr;
     if (outfile == NULL)
     {
         printf(M_CANTOPEN, name);
@@ -865,9 +884,12 @@
     strcpy(fmode_str, "    ");
     if (host_os == OS)
         get_mode_str(fmode_str, (uint) file_mode);
-    if (strlen(&filename[entry_pos]) > 12)
+    if ((strlen(&filename[entry_pos]) > 12) || (command == 'V'))
+        if (command != 'V')
         printf("%-12s\n             ", &filename[entry_pos]);
     else
+	    printf("%s\n             ", filename);
+    else
         printf("%-12s ", &filename[entry_pos]);
     printf("%10ld %10ld %u.%03u %s %08lX %4s%c%c%c%u%c%c%c\n",
         origsize, compsize, r / 1000, r % 1000, &date_str[2], file_crc,
@@ -910,11 +932,13 @@
     {
         switch (command)
         {
+        case 'P':
         case 'E':
         case 'X':
             if (extract())
                 file_count++;
             break;
+        case 'V':
         case 'L':
             list_arc(file_count++);
             skip();
@@ -934,6 +958,7 @@
             file_count, torigsize, tcompsize, r / 1000, r % 1000, &date_str[2]);
     }
     else
+    if (command != 'V')
         printf(M_NBRFILES, file_count);
 
     fclose(arcfile);
@@ -977,14 +1002,20 @@
         if (strlen(argv[1]) > 1)
             error(M_BADCOMND, argv[1]);
         command = toupper(*argv[1]);
-        if (strchr("ELTX", command) == NULL)
+        if (strchr("ELTXV", command) == NULL)
             error(M_BADCOMND, argv[1]);
         arc_p = argv[2];
     }
     else
     {
+        command = toupper(*argv[1]);
+	if ((command!='P') || (argc != 4))
+	{
         help();
         return EXIT_FAILURE;
+	}
+	file_to_extract = argv[3];
+	arc_p = argv[2];
     }
 
     strncopy(arc_name, arc_p, FNAME_MAX);
