9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] how to print a program
@ 2010-09-07 21:00 Rudolf Sykora
  2010-09-07 21:05 ` Rudolf Sykora
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Rudolf Sykora @ 2010-09-07 21:00 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

I want to 'print' the 'page' program, i.e. put /sys/src/cmd/page/* on paper.
I want different files start on new pages, with the header of every
page being the file name and the page.
For this the command
a=`{ls} pr $a | lp -dstdout > toprint.ps
is almost ok.
That 'almost' is in the fact that long lines get truncated, which is
highly undesirable.
fmt -j
could help, but it also replaces spaces and tabs by a single space, again bad.
(btw. why
fmt <>afile
doesn't work?)

So how?
Can anybody help? (I mean, is there a one-liner?)
Thank you!
Ruda



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:00 [9fans] how to print a program Rudolf Sykora
@ 2010-09-07 21:05 ` Rudolf Sykora
  2010-09-07 21:06 ` John Floren
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Rudolf Sykora @ 2010-09-07 21:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

also, a nice feature of 'fmt' is that long lines are broken AND
indented according to the start of the just-being-processed line; this
is welcome...
R

On 7 September 2010 23:00, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> Hello,
>
> I want to 'print' the 'page' program, i.e. put /sys/src/cmd/page/* on paper.
> I want different files start on new pages, with the header of every
> page being the file name and the page.
> For this the command
> a=`{ls} pr $a | lp -dstdout > toprint.ps
> is almost ok.
> That 'almost' is in the fact that long lines get truncated, which is
> highly undesirable.
> fmt -j
> could help, but it also replaces spaces and tabs by a single space, again bad.
> (btw. why
> fmt <>afile
> doesn't work?)
>
> So how?
> Can anybody help? (I mean, is there a one-liner?)
> Thank you!
> Ruda
>



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:00 [9fans] how to print a program Rudolf Sykora
  2010-09-07 21:05 ` Rudolf Sykora
@ 2010-09-07 21:06 ` John Floren
  2010-09-07 21:37   ` Rudolf Sykora
  2010-09-08  6:25   ` Rudolf Sykora
  2010-09-07 21:19 ` erik quanstrom
  2010-09-08 11:45 ` roger peppe
  3 siblings, 2 replies; 13+ messages in thread
From: John Floren @ 2010-09-07 21:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Tue, Sep 7, 2010 at 5:00 PM, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> Hello,
>
> I want to 'print' the 'page' program, i.e. put /sys/src/cmd/page/* on paper.
> I want different files start on new pages, with the header of every
> page being the file name and the page.
> For this the command
> a=`{ls} pr $a | lp -dstdout > toprint.ps
> is almost ok.
> That 'almost' is in the fact that long lines get truncated, which is
> highly undesirable.
> fmt -j
> could help, but it also replaces spaces and tabs by a single space, again bad.
> (btw. why
> fmt <>afile
> doesn't work?)
>
> So how?
> Can anybody help? (I mean, is there a one-liner?)
> Thank you!
> Ruda
>
>

Run it through cb before you print it and give cb a length argument. I
did basically this same thing just the other day.

John
--
"With MPI, familiarity breeds contempt. Contempt and nausea. Contempt,
nausea, and fear. Contempt, nausea, fear, and .." -- Ron Minnich



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:00 [9fans] how to print a program Rudolf Sykora
  2010-09-07 21:05 ` Rudolf Sykora
  2010-09-07 21:06 ` John Floren
@ 2010-09-07 21:19 ` erik quanstrom
  2010-09-08 11:45 ` roger peppe
  3 siblings, 0 replies; 13+ messages in thread
From: erik quanstrom @ 2010-09-07 21:19 UTC (permalink / raw)
  To: 9fans

> (btw. why
> fmt <>afile
> doesn't work?)

sure it does.  fmt <>file will open file for
reading and writing on fd 0.  fd 1 will be your
terminal.  if you want fd1 to be the same channel,
you can add >[1=0], but this will not have the
intended effect in this case.  why is left as an
exercise.

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:06 ` John Floren
@ 2010-09-07 21:37   ` Rudolf Sykora
  2010-09-07 21:48     ` erik quanstrom
  2010-09-08  6:25   ` Rudolf Sykora
  1 sibling, 1 reply; 13+ messages in thread
From: Rudolf Sykora @ 2010-09-07 21:37 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Run it through cb before you print it and give cb a length argument. I
> did basically this same thing just the other day.
>
> John

ok. this will be enough for now, I hope.
Nonetheless, generally, there may be not-c files present (other
languages...; even in my case there is a .ps file, which I still want
to be printed as text).
Is there anything of help then? Something that just folds long lines?
(Is awk line length-limited?)

Thanks!
Ruda



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:37   ` Rudolf Sykora
@ 2010-09-07 21:48     ` erik quanstrom
  0 siblings, 0 replies; 13+ messages in thread
From: erik quanstrom @ 2010-09-07 21:48 UTC (permalink / raw)
  To: 9fans

> (Is awk line length-limited?)

you can test stuff like this yourself:

; dd -if /dev/zero -bs 8192 -count 10 | tr '\0' 'x' | awk '{print length($1)}'
10+0 records in
10+0 records out
81920

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:06 ` John Floren
  2010-09-07 21:37   ` Rudolf Sykora
@ 2010-09-08  6:25   ` Rudolf Sykora
  2010-09-08  7:08     ` Lawrence E. Bakst
  1 sibling, 1 reply; 13+ messages in thread
From: Rudolf Sykora @ 2010-09-08  6:25 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Run it through cb before you print it and give cb a length argument. I
> did basically this same thing just the other day.
>
> John

also, just note that cb doesn't always work even for c source:
running on /sys/src/cmd/page/gfx.c
produces crap...

thanks
ruda



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-08  6:25   ` Rudolf Sykora
@ 2010-09-08  7:08     ` Lawrence E. Bakst
  2010-09-08 17:59       ` erik quanstrom
  2010-09-08 18:42       ` Akshat
  0 siblings, 2 replies; 13+ messages in thread
From: Lawrence E. Bakst @ 2010-09-08  7:08 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

At 8:25 AM +0200 9/8/10, Rudolf Sykora wrote:
>also, just note that cb doesn't always work even for c source:
>running on /sys/src/cmd/page/gfx.c
>produces crap...

cb has been a looser since I've known it, which is longer than most. It often dumped core, even back in the 70's. It's good in a pinch to turn someone's "far out" indenting style back to K&R normal form.

OTOH gofmt is more of the real deal done right.

My advise is to stick with pr and deal with truncated lines. If you can't deal with truncated lines try landscape mode or messing with fonts and sizes if that's possible. If you have access to another platform enscript has lots of bells and whistles for doing what you want.

It's probably time to move past "lp". They don't exist much anymore in the real world.

leb
--
leb@iridescent.org




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-07 21:00 [9fans] how to print a program Rudolf Sykora
                   ` (2 preceding siblings ...)
  2010-09-07 21:19 ` erik quanstrom
@ 2010-09-08 11:45 ` roger peppe
  2010-09-08 13:55   ` Federico G. Benavento
  3 siblings, 1 reply; 13+ messages in thread
From: roger peppe @ 2010-09-08 11:45 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

i've always used an ancient version of a2ps for this,
ported to plan 9 by forsyth@terzerima.net. this does almost
everything i want (in particular two-column landscape mode)
with the exception that it doesn't
grok utf-8. i'm sure charles will send you a copy
if you wish.

the current gnu version is likely to be a little harder
to port :-)


On 7 September 2010 22:00, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> Hello,
>
> I want to 'print' the 'page' program, i.e. put /sys/src/cmd/page/* on paper.
> I want different files start on new pages, with the header of every
> page being the file name and the page.
> For this the command
> a=`{ls} pr $a | lp -dstdout > toprint.ps
> is almost ok.
> That 'almost' is in the fact that long lines get truncated, which is
> highly undesirable.
> fmt -j
> could help, but it also replaces spaces and tabs by a single space, again bad.
> (btw. why
> fmt <>afile
> doesn't work?)
>
> So how?
> Can anybody help? (I mean, is there a one-liner?)
> Thank you!
> Ruda
>
>



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-08 11:45 ` roger peppe
@ 2010-09-08 13:55   ` Federico G. Benavento
  0 siblings, 0 replies; 13+ messages in thread
From: Federico G. Benavento @ 2010-09-08 13:55 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

steve has a fold program which he used combined with pr to generate
http://plan9.bell-labs.com/sources/contrib/steve/doc/kernel-june2k-a4.ps

/n/sources/contrib/steve/rc/kernel.print
/n/sources/contrib/steve/fold.tbz

On Wed, Sep 8, 2010 at 8:45 AM, roger peppe <rogpeppe@gmail.com> wrote:
> i've always used an ancient version of a2ps for this,
> ported to plan 9 by forsyth@terzerima.net. this does almost
> everything i want (in particular two-column landscape mode)
> with the exception that it doesn't
> grok utf-8. i'm sure charles will send you a copy
> if you wish.
>
> the current gnu version is likely to be a little harder
> to port :-)
>
>
> On 7 September 2010 22:00, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
>> Hello,
>>
>> I want to 'print' the 'page' program, i.e. put /sys/src/cmd/page/* on paper.
>> I want different files start on new pages, with the header of every
>> page being the file name and the page.
>> For this the command
>> a=`{ls} pr $a | lp -dstdout > toprint.ps
>> is almost ok.
>> That 'almost' is in the fact that long lines get truncated, which is
>> highly undesirable.
>> fmt -j
>> could help, but it also replaces spaces and tabs by a single space, again bad.
>> (btw. why
>> fmt <>afile
>> doesn't work?)
>>
>> So how?
>> Can anybody help? (I mean, is there a one-liner?)
>> Thank you!
>> Ruda
>>
>>
>
>



--
Federico G. Benavento



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-08  7:08     ` Lawrence E. Bakst
@ 2010-09-08 17:59       ` erik quanstrom
  2010-09-08 18:42       ` Akshat
  1 sibling, 0 replies; 13+ messages in thread
From: erik quanstrom @ 2010-09-08 17:59 UTC (permalink / raw)
  To: ml, 9fans

> cb has been a looser since I've known it,
> which is longer than most. It often dumped core,
> even back in the 70's. It's good in a pinch to turn
> someone's "far out" indenting style back to K&R normal form.

loose programs, loose women.  each to his
own vice.

- erik



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-08  7:08     ` Lawrence E. Bakst
  2010-09-08 17:59       ` erik quanstrom
@ 2010-09-08 18:42       ` Akshat
  2010-09-08 19:16         ` Charles Forsyth
  1 sibling, 1 reply; 13+ messages in thread
From: Akshat @ 2010-09-08 18:42 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Sep 8, 2010, at 12:08 AM, "Lawrence E. Bakst" <ml@iridescent.org>
wrote:
> It's probably time to move past "lp". They don't exist much anymore
> in the real world.

Sorry, how is this formatting issue
the fault of 'lp', exactly?

ak




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9fans] how to print a program
  2010-09-08 18:42       ` Akshat
@ 2010-09-08 19:16         ` Charles Forsyth
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Forsyth @ 2010-09-08 19:16 UTC (permalink / raw)
  To: 9fans

> It's probably time to move past "lp". They don't exist much anymore
> in the real world.

has anyone ported CUPS? i just wanted to check whether someone should be burnt at the stake.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-09-08 19:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-07 21:00 [9fans] how to print a program Rudolf Sykora
2010-09-07 21:05 ` Rudolf Sykora
2010-09-07 21:06 ` John Floren
2010-09-07 21:37   ` Rudolf Sykora
2010-09-07 21:48     ` erik quanstrom
2010-09-08  6:25   ` Rudolf Sykora
2010-09-08  7:08     ` Lawrence E. Bakst
2010-09-08 17:59       ` erik quanstrom
2010-09-08 18:42       ` Akshat
2010-09-08 19:16         ` Charles Forsyth
2010-09-07 21:19 ` erik quanstrom
2010-09-08 11:45 ` roger peppe
2010-09-08 13:55   ` Federico G. Benavento

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).