9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "roger peppe" <rogpeppe@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] rc: token buffer too short
Date: Wed, 12 Dec 2007 11:04:17 +0000	[thread overview]
Message-ID: <df49a7370712120304o6f911e2bx17fc3ad821fabb98@mail.gmail.com> (raw)
In-Reply-To: <74D6B736-B261-44EC-B2AF-86ACC35E971A@mac.com>

On Dec 11, 2007 7:46 PM, Pietro Gagliardi <pietro10@mac.com> wrote:
> Not in this case, no. The format of awk is
>
>         awk 'program' files
>         awk -f prgm files
>
> What I could do instead is
>
>         u=/tmp/$0$pid$apid$0
>         cat > $u <<\END
>         program
>         END
>         awk -f $u $*
>         rm $u
>
> but I'd rather not go that way to avoid possible collisions.

actually, you could use a here file and a named pipe:
awk -f <{cat << 'EOF'} $*
program
EOF

i do think that a quoted argument should be able
to take an arbitrary amount of text though.

> Here's another problem. The error check function cats to [1=2].
> However, instead of going to standard output, it makes a file [1=2]
> and writes the message there. How do I fix this?

awk uses ape/sh to run its commands, so you can fix it
by using >&2 as under unix.

On Dec 12, 2007 10:14 AM, Douglas A. Gwyn <DAGwyn@null.net> wrote:
> Another similar approach would be for the open of a new special
> file to create a unique temp file, which would vanish upon final
> close, and have the app share/clone the file descriptor, which
> could be dup2()ed (or whatever Plan9 equivalent is) to stdout,
> stdin, etc., for the various processes in your script.

that's similar to the named-pipe approach, except that you can't
seek on named pipes. i often find myself mounting
a new instance of ramfs, thus getting rid of the problem in most
cases (the exception being if you don't want to fork the namespace).


      parent reply	other threads:[~2007-12-12 11:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-01 17:43 Pietro Gagliardi
2007-12-01 19:09 ` Martin Neubauer
2007-12-11 13:32   ` roger peppe
2007-12-11 19:46     ` Pietro Gagliardi
2007-12-12 10:14       ` Douglas A. Gwyn
2007-12-12 11:04       ` roger peppe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df49a7370712120304o6f911e2bx17fc3ad821fabb98@mail.gmail.com \
    --to=rogpeppe@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).