View Single Post
Old 07-10-2012, 11:54 AM   #1
mmatej
Connoisseur
mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.mmatej is less competitive than you.
 
Posts: 91
Karma: 14730
Join Date: Jun 2012
Device: none
Small screen printing framework

Hi all!
I've created a small printing framework based on the "eips" utility in the Kindle. It's written as a shell script which you can source and use its functions.
Features:
  • prints on the screen
  • auto new-lineing
  • auto scrolling
  • small formatting utility
  • you can print "-i" on the screen with it! (try it with eips... no good)
Limitations:
This tool is limited by eips, so:
  1. certain characters are replaced by similar ones / totally OT ones
  2. the "\" character is not replaced (stupid shell.. don't know why )
Function list:
  • mp_reset -> resets screen+options
  • print <text> -> prints text with no newline at the end
  • printn <text> -> prints text with newline at the end
  • pcenter <text> -> prints text centered on the line
  • psetpos <x> <y> -> sets cursor position on the screen
  • pback -> moves back one character on the line
  • pbackf -> erases character under cursor and moves back one character on the line
  • pbackline -> if the X cursor position is zero, moves to previous line, else sets x=0
  • pbacklinef -> like pbackline + erases line
  • pscroll <num> [from] -> scrolls num lines (if from is set, skips from lines from the up)
  • pprintf <text> -> prints text with formatting
  • pprintfn <text> -> like pprintf but with the newline at the end
The last two options allow you to print some program output to the screen like this:
Code:
pprintfn "$(ls)"
which prints dir listing to the screen.
Configurables: (enabled means set to 1)
  • mp_h -> if enabled, text is printed out highlighted
  • mp_scroll -> sets num lines to autoscroll;0=erase entire screen
  • mp_scroll_from -> num of lines which won't be erased when scrolling/erasing (from up)
Download:
http://jailbreak-kt.tk/bin/pfw
How to use:
Code:
source /path/to/pfw
# it will init automatically
printn "Hello world!"
This one started as screen printing helper in web jailbreak, but I decided it would be good to refine it and share. Hope my effort was useful!

Last edited by mmatej; 07-10-2012 at 11:57 AM.
mmatej is offline   Reply With Quote