LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[OT] postscript programming q (was: Re: [ILUG] unix mail scri pt virus hole long before windows?)

[OT] postscript programming q (was: Re: [ILUG] unix mail scri pt virus hole long before windows?)

Foley, Brian (Galway) Brian.P.Foley at compaq.com
Tue Jul 10 16:00:55 IST 2001


Hmm...
I don't think you really need to explicitly kill the interpreter. On a real
PS printer, the interpreter is continually running a job server, and when it
falls off the end of a job, that job context is just ended.

Kinda like not needing to explicitly do exit(0); in a C program (albeit for
different reasons).

To duplicate a string you could do something like the following:

%!PS
/s1 (Buffy ) def
/s2 (Summers) def

s1 length s2 length add		% Get the sum of the length of the strings
string					% Create a string that long
dup 0 s1 putinterval			% Put s1 into the string at offset 0
dup s1 length s2 putinterval	% Put s2 into the string at offset
strlen(s1)

==					% Print the (string) object to
stdout

There is a cleaner way that I figured out at some stage. Something to do
with using forall I think. I've got it scribbled down somewhere at home, so
I'll bring it in tomorrow.

Does getenv really exist in GhostScript BTW? Its definitely not in the PS
reference manual, so I assume it must be a GNUism.

Cheers,
Brian.

-----Original Message-----
From: kevin lyda [mailto:kevin at suberic.net]
Sent: 10 July 2001 15:00
To: Foley, Brian (Galway)
Cc: 'Paul Jakma'; ilug at linux.ie
Subject: [OT] postscript programming q (was: Re: [ILUG] unix mail script
virus hole long before windows?)


On Tue, Jul 10, 2001 at 03:57:32PM +0200, Foley, Brian (Galway) wrote:
> %!PS
> /f
> 	(~/i_could_have_deleted_all_your_files) (w) file
> def
> 
> f (You've been PostScripted!) writestring
> f closefile

ok, i forgot to close the file, but you forgot to exit the interpreter!
:)  one thing i was trying to do was to get the home environment var
and use it.  so i wanted to do something like this:

    (HOME) getenv {
	(HOME) getenv \home exch def
	\home + (/i_could_have_deleted_all_your_files) (w) files \out exch
def
    } {
	(/i_could_have_deleted_all_your_files) (w) files \out exch def
    } ifelse

obviously this fails since + doesn't combine strings.  how do you combine
two strings to make one?  something like

    (fu) (bar) concat

kevin




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell