/*v 1.0*/

/****************************************
*					*
*	Rules for Generic Files		*
*					*
****************************************/

rule("P", "xxx", "*") {
  bitmap = "Fifo.cbm";
  description = "Named Pipe";
}

rule("S", "xxx", "*") {
  bitmap = "Socket.cbm";
  description = "Socket";
}

rule("C", "xxx", "*") {
  bitmap = "CharDev.cbm";
  description = "Character Device";
}

rule("B", "xxx", "*") {
  bitmap = "BlockDev.cbm";
  description = "Block Device";
}

rule("L", "xxx", "*") {
  bitmap = "Question_2.cbm";
  description = "Symbolic Link";
}

rule("D", "xxx", "*") {
  bitmap = "Folder.cbm";
  description = "Directory";
  print {
    preproc = "ls -lg %file";
  }
}

rule("D", "x0x", "*") {
  bitmap = "ProtectedFolder.cbm";
}

rule("R", "xx0", "*") {
  bitmap = "NormalFile.cbm";
  description = "Data File";
  print {
    preproc = "cat %file";
  }
  script {
    open("1") {
      console("more %file ; echo -n \"Press RETURN to continue\"; read dummy");
    }
    open("s1") {
      console("more %file ; echo -n \"Press RETURN to continue\"; read dummy");
    }
  }
}

rule("R", "xx1", "*") {
  bitmap = "Command.cbm";
  description = "Command";
  print {
    preproc = "%path";
  }
  script {
    open("1") {
      console("%path ; echo -n \"Press RETURN to continue\"; read dummy");
    }
    open("s1") {
      console("%path | more ; echo -n \"Press RETURN to continue\"; read dummy");
    }
  }
}

/****************************************
*					*
*	Rules for UNIX Command		*
*					*
****************************************/

/****************************************
*					*
*	Rules for UNIX Files		*
*					*
****************************************/

rule("R", "xx0", ".*") {
  bitmap = "Control.cbm";
  description = "Comtrol File";
}

rule("R", "xx0", "*.Z") {
  bitmap = "Compressed.cbm";
  description = "Compressed File";
}

rule("R", "xx0", "*.pic") {
  bitmap = "Pic.cbm";
  description = "Pic File";
}

rule("R", "xx0", "*.man") {
  bitmap = "MANroff.cbm";
  description = "MAN Format File";
  print {
    preproc = "ditroff -man %file";
    filter = "-n";
  }
  script {
    open("1") { shell("ditroff -man %file | xprev"); }
  }
}

rule("R", "xx0", "*.me") {
  bitmap = "MEroff.cbm";
  description = "ME Format File";
  print {
    preproc = "ditroff -me %file";
    filter = "-n";
  }
  script {
    open("1") { shell("ditroff -me %file | xprev"); }
  }
}

rule("R", "xx0", "*.tbl.ms") {
  description = "MS Format File With TBL";
  print {
    preproc = "tbl %file | ditroff -ms";
    filter = "-n";
  }
  script {
    open("1") { shell("tbl %file | ditroff -ms | xprev"); }
  }
}

rule("R", "xx0", "*.ms") {
  bitmap = "MSroff.cbm";
  description = "MS Format File";
  print {
    preproc = "ditroff -ms %file";
    filter = "-n";
  }
  script {
    open("1") { shell("ditroff -ms %file | xprev"); }
  }
}

rule("R", "xx0", "Imakefile*") {
  bitmap = "Imakefile.cbm";
  description = "Imakefile";
}

rule("R", "xx0", "Makefile*") {
  bitmap = "Makefile.cbm";
  description = "Makefile";
}

rule("R", "xx0", "*.a") {
  bitmap = "Library.cbm";
  description = "Library File";
}

rule("R", "xx0", "*.h") {
  bitmap = "Header.cbm";
  description = "Header File";
}

rule("R", "xx0", "*.o") {
  bitmap = "Object.cbm";
  description = "Object File";
}

rule("R", "xx0", "*.c") {
  bitmap = "CSource.cbm";
  description = "C Source File";
}

/****************************************
*					*
*	Rules for X Window Command	*
*					*
****************************************/

rule("R", "xx1", "X") {
  bitmap = "Xcommand.cbm";
  description = "X Window System server";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "Xnews") {
  bitmap = "Xcommand.cbm";
  description = "X Window System server";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "*clock") {
  bitmap = "Clock_1.cbm";
  description = "clock for X";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "*term") {
  bitmap = "Terminal.cbm";
  description = "terminal Emulater for X";
  script {
    open("1") { shell("%path"); }
    open("s1") { shell("%path -sb"); }
  }
}

rule("R", "xx1", "*wm") {
  bitmap = "Xcommand.cbm";
  description = "Window Manager for X Window System";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "*xdm") {
  bitmap = "Door.cbm";
  description = "X Display Manager";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "appres") {
  description = "list application resource database";
  script {
    open("1") {
      console("\n\
	classname=`sxparam -pr \"Enter application class name\"` \n\
	case $classname in \n\
	'') ;; \n\
	*) %path $classname | more; echo -n \"Press RETURN to continue\"; read dummy;; \n\
	esac");
    }
  }
}

rule("R", "xx1", "atobm") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "bdftosnf") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "bitmap") {
  bitmap = "Xcommand.cbm";
  description = "bitmap editor";
  script {
    open("1") {
      shell("\n\
	filename=`sxparam -pr \"Enter filename\"` \n\
	case $filename in \n\
	'') ;; \n\
	*) %path $filename ;; \n\
	esac");
    }
    drop("1") { shell("%command %file"); }
  }
}

rule("R", "xx1", "bmtoa") {
  script {
    open("1") {
      console("\n\
	filename=`sxparam -pr \"Enter bitmap file name\"` \n\
	case $filename in \n\
	'') ;; \n\
	*) %path -chars 01 $filename | more \n\
	   echo  -n \"Press RETURN to continue\"; read dummy ;; \n\
	esac");
    }
    drop("1") {
      console("\n\
	%command -chars 01 %file | more \n\
	echo -n \"Press RETURN to continue\"; read dummy");
    }
  }
}

rule("R", "xx1", "editres") {
  bitmap = "Xcommand.cbm";
  description = "a dynamic resource editor for X Toolkit applications";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "ico") {
  bitmap = "Ico.cbm";
  description = "animate an icosahedron or other polyhedron";
  script {
    open("1") { shell("%path"); }
    open("s1") { shell("%path -faces -colors red green blue"); }
  }
}

rule("R", "xx1", "imake") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "makedepend") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "maze") {
  bitmap = "Maze.cbm";
  description = "an automated maze program";
  script {
    open("1") { shell("%path"); }
    open("s1") { shell("%path -S"); }
  }
}

rule("R", "xx1", "mkdirhier") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "mkfontdir") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "muncher") {
  bitmap = "Muncher.cbm";
  description = "draw interesting patterns in an X window";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "plaid") {
  bitmap = "Plaid.cbm";
  description = "paint some plaid-like patterns in an X window";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "puzzle") {
  bitmap = "Puzzle.cbm";
  description = "15-puzzle game for X";
  script {
    open("1") { shell("%path"); }
    open("s1") { shell("%path -picture /usr/sony/demo/X11/puzzle/mandrill.cm"); }
  }
}

rule("R", "xx1", "resize") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "showsnf") {
  bitmap = "Showsnf.cbm";
  description = "print contents of an SNF file";
  script {
    open("1") {
      console("\n\
	filename=`sxparam -pr \"Enter font file name\"` \n\
	case $filename in \n\
	'') ;; \n\
	*) %path $filename | more; echo -n \"Press RETURN to continue\"; read dummy;; \n\
	esac");
    }
    drop("1") {
      console("%command %file | more ; echo -n \"Press RETURN to continue\"; read dummy"); }
    }
}

rule("R", "xx1", "scx") {
  bitmap = "SJX.cbm";
  description = "Chinese input front end";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "sjx") {
  bitmap = "SJX.cbm";
  description = "Japanese input front end";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "skx") {
  bitmap = "SJX.cbm";
  description = "Korean input front end";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "startx") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "uil") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xauth") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "viewres") {
  bitmap = "Xcommand.cbm";
  description = "graphical class browser for Xt";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xbiff") {
  bitmap = "/usr/include/X11/bitmaps/flagdown";
  description = "mailbox flag for X";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xcalc") {
  bitmap = "Calculator.cbm";
  description = "scientific calculator for X";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xclipboard") {
  bitmap = "Xcommand.cbm";
  description = "X clipboard client";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xclock") {
  script {
    open("1") { shell("%path -d -u 1"); }
    open("s1") { shell("%path -u 1"); }
  }
}

rule("R", "xx1", "xcutsel") {
  bitmap = "Xcommand.cbm";
  description = "interchange between cut buffer and selection";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xditview") {
  bitmap = "Xcommand.cbm";
  description = "display ditroff DVI files";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xdpr") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xedit") {
  bitmap = "Xcommand.cbm";
  description = "simple text editor for X";
  script {
    open("1") { shell("%path"); }
    drop("1") { shell("%command %file"); }
  }
}

rule("R", "xx1", "xev") {
  bitmap = "Xcommand.cbm";
  description = "print contents of X events";
  script {
    open("1") { console("%path"); }
  }
}

rule("R", "xx1", "xeyes") {
  bitmap = "Xeyes.cbm";
  description = "watch over your shoulder";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xfd") {
  bitmap = "Xfd.cbm";
  description = "font displayer for X";
  script {
    open("1") {
      shell("\n\
	fontname=`sxparam -pr \"Enter font name\"` \n\
	case $fontname in \n\
	'') ;; \n\
	*) %path -fn $fontname;; \n\
	esac");
    }
  }
}

rule("R", "xx1", "xfontsel") {
  bitmap = "Xcommand.cbm";
  description = "point & click interface for selection X11 font";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xgc") {
  bitmap = "Xcommand.cbm";
  description = "X graphics demo";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xgraph") {
  bitmap = "Xgraph.cbm";
  description = "graph dusplay for snmp";
  script {
    open("1") {
      shell("\n\
	filename=`sxparam -pr \"Enter graph file name\"` \n\
	case $filename in \n\
	'') ;; \n\
	*) %path $filename;; \n\
	esac");
    }
    drop("1") {
      shell("%command %file");
    }
  }
}

rule("R", "xx1", "xhost") {
  bitmap = "Xhost.cbm";
  description = "server access control program for X";
  script {
    open("1") {
      console("\n\
	option=`sxparam -pr \"Enter option : [[+-]hostname ...]\"` \n\
	case $? in \n\
	0) %path $option | more; echo -n \"Press RETURN to continue\"; read dummy;; \n\
	1) ;; \n\
	esac");
    }
  }
}

rule("R", "xx1", "xinit") {
  description = "X Window System initializer";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xisdn") {
  bitmap = "Xisdn.cbm";
  description = "isdm demo for X Window";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xkill") {
  bitmap = "Xkill.cbm";
  description = "kill a clients by its X resource";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xload") {
  bitmap = "Xload.cbm";
  description = "load average display for X";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xlogo") {
  bitmap = "Xlogo.cbm";
  description = "X Window System logo";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xmag") {
  bitmap = "Xmag.cbm";
  description = "magnify parts of the screen";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xman") {
  bitmap = "Xman.cbm";
  description = "Manual page display program for the X Window System";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xmh") {
  bitmap = "Xcommand.cbm";
  description = "X interface to the MH message handling system";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xmj") {
  bitmap = "Mahjong.cbm";
  description = "Shanghai Game";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xmkmf") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xmodmap") {
  bitmap = "Xmodmap.cbm";
  description = "utility for modifying keymaps in X";
}

rule("R", "xx1", "xpr") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xprev") {
  bitmap = "Xcommand.cbm";
  description = "ditroff previewer";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xrdb") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xrefresh") {
  bitmap = "Xrefresh.cbm";
  description = "refresh all or part of an X screen";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xscn") {
  bitmap = "Xscn.cbm";
  description = "Image Scaner";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xsed") {
  bitmap = "s_apr.cbm";
  description = "Sound Editor";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "xset") {
  bitmap = "Xset.cbm";
  description = "user preference utility for X";
  script {
    open("1") {
      console("%path q ; echo -n \"Press RETURN to continue\"; read dummy");
    }
  }
}

rule("R", "xx1", "xsetroot") {
  bitmap = "Xsetroot.cbm";
  description = "root window parameter setting utility for X";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xstdcmap") {
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "xvmap") {
  bitmap = "Xvmap.cbm";
  description = "videomap demo for X Window";
  script {
    open("1") { shell("%path"); }
    open("s1") {
      shell("%path -dev `sxparam -pr \"Enter device name\"`");
    }
  }
}

rule("R", "xx1", "xwd") {
  bitmap = "Xwd.cbm";
  description = "dump an image of an X window";
  print {
    preproc = "xwd";
    filter = "-x";
  }
  script {
    open("1") {
      shell("\n\
	filename=`sxparam -pr \"Enter file name for save image \"` \n\
	case $filename in \n\
	'') ;; \n\
	*) xwd -out $filename \n\
	esac");
    }
  }
}

rule("R", "xx1", "xwud") {
  bitmap = "Xwud.cbm";
  description = "image displayer for X";
  script {
    open("1") {
      shell("\n\
	filename=`sxparam -pr \"Enter filename to display\"` \n\
	case $filename in \n\
	'') ;; \n\
	*) xwud -in $filename;; \n\
	esac");
    }
    drop("1") { shell("%command -in %file"); }
  }
}

/****************************************
*					*
*	Rules for X Window Files	*
*					*
****************************************/

rule("R", "xx0", "*.xwd") {
  bitmap = "Image.cbm";
  description = "X Window dump file";
  print {
    preproc = "cat %file";
    filter = "-x";
  }
  script {
    open("1") { shell("xwud -in %file"); }
  }
}

rule("R", "xxx", "*.snf") {
  bitmap = "Snf.cbm";
  description = "Font file for X Window System";
  script {
    open("1") { shell("xfd -fn `basename %file .snf`"); }
    open("2") { console("showsnf %file | more; echo -n \"press RETURN to continue\"; read dummy"); }
  }
}

rule("R", "xxx", "*.xg") {
  bitmap = "Graph.cbm";
  description = "graph file for xgraph command";
  script {
    open("1") { shell("xgraph %file"); }
  }
}

/****************************************
*					*
*	Rules for desktop Commands	*
*					*
****************************************/

rule("R", "xx1", "sxsession") {
  bitmap = "Xcommand.cbm";
  description = "NEWS Desk Session Manager";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "sxfiler") {
  bitmap = "Sxfiler.cbm";
  description = "NEWS Desk File Manager";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "sxmail") {
  bitmap = "Sxmail.cbm";
  description = "NEWS Desk Mail Handler";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "sxsend") {
  bitmap = "Sxsend.cbm";
  description = "NEWS Desk Mail Sender";
  script {
    open("1") { shell("%path"); }
    drop("1") { shell("%command -sf %file"); }
  }
}

rule("R", "xx1", "sxedit") {
  bitmap = "Editor.cbm";
  description = "NEWS Desk Text Editor";
  script {
    open("1") { shell("%path"); }
    drop("1") { shell("%command -file %file"); }
  }
}

rule("R", "xx1", "sxbitmap") {
  bitmap = "IconMaker.cbm";
  description = "NEWS Desk Bitmap Editor";
  script {
    open("1") { shell("%path"); }
    drop("1") { shell("%command -file %file"); }
  }
}

rule("R", "xx1", "sxcal") {
  bitmap = "Calendar_1.cbm";
  description = "NEWS Desk Calendar";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "sxfloppy") {
  bitmap = "Format.cbm";
  description = "NEWS Desk Floppy Tool";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "sxadmin") {
  bitmap = "SystemControl.cbm";
  description = "NEWS Desk System Admin";
  script {
    open("1") { shell("%path"); }
  }
}

rule("R", "xx1", "sxparam") {
  bitmap = "Xcommand.cbm";
  description = "NEWS Desk Utility";
  script {
    open("1") { shell(""); }
  }
}

rule("R", "xx1", "sxmenu") {
  bitmap = "Xcommand.cbm";
  description = "NEWS Desk Utility";
  script {
    open("1") { shell(""); }
  }
}

/****************************************
*					*
*	Rules for desktop Files		*
*					*
****************************************/

rule("R", "xx0", "*::TEXT") {
  bitmap = "Paper_2.cbm";
  description = "Plain Text File";
  print {
    preproc = "cat %file";
  }
  script {
    open("1") { shell("sxedit -file %file"); }
  }
}

rule("R", "xx0", "*.txt") {
  bitmap = "Paper_2.cbm";
  description = "Plain Text File";
  print {
    preproc = "cat %file";
  }
  script {
    open("1") { shell("sxedit -file %file"); }
  }
}

rule("R", "xx0", "*.snd") {
  bitmap = "s_data.cbm";
  description = "Sound File";
  script {
    open("1") { shell("xsed %file"); }
    open("3") { shell("sbplay %file"); }
  }
}

rule("R", "xx0", "*.cbm") {
  bitmap = "Bitmap.cbm";
  description = "Compact Bitmap File";
  script {
    open("1") { shell("sxbitmap -file %file"); }
  }
}

rule("R", "xx0", "*::CBM") {
  bitmap = "Bitmap.cbm";
  description = "Compact Bitmap File";
  script {
    open("1") { shell("sxbitmap -file %file"); }
  }
}

/****************************************
*					*
*	Rules for Applications		*
*					*
****************************************/

/****************************************
*					*
*	Rules for CD-ROM Creator	*
*					*
****************************************/

rule("R", "xx1", "mkcd") {
  bitmap = "mkcd.cbm";
  description = "CD-ROM Creator";
  script {
    open("1") { shell("%path"); }
    drop("1") { shell("%command %file"); }
  }
}

rule("R", "xx0", "*.cfi") {
  bitmap = "Cfi.cbm";
  description = "CD-ROM format information file";
  script {
    open("1") { shell("mkcd %path"); }
  }
}

/****************************************
*					*
*	Rules for xadpcm		*
*					*
****************************************/

rule("R", "xx1", "xadpcm") {
  bitmap = "Xadpcm.cbm";
  description = "ADPCM-Real Time Encoder";
  script {
    open("1") { shell("%path"); }
  }
}
