Re: psql \i handling ~ in specified file name - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: psql \i handling ~ in specified file name
Date
Msg-id 200401091513.i09FD1l21355@candle.pha.pa.us
Whole thread Raw
In response to Re: psql \i handling ~ in specified file name  (Zach Irmen <zirmen@shaw.ca>)
List pgsql-patches
Zach Irmen wrote:
>
> Bruce Momjian wrote:
> > Yes, seems like that will be required.  Please use my attached version
> > to make the adjustments.
>
> Ok. Adjustments made.  All psql commands should be handled.
>
> > Zach Irmen wrote:
> > > And finally, I was wondering if arguments with leading pipes
> > > (e.g. "|~/file") should  also get substituted.
> >
> > Yep, that too.
>
> Actually, I found out that popen calls seem to handle the tilde fine as
> this was already working on my FreeBSD box without
> substitution. I'm not sure if this is true for all Unix systems in
> general, but I won't bother putting that in unless it turns out
> to be needed.

Oh, yea, "|" should work fine because it uses the shell.  pipe manual
page says:

     The popen() function ``opens'' a process by creating an IPC connection,
     forking, and invoking the shell.

and

     The command argument is a pointer to a null-terminated string containing
     a shell command line.  This command is passed to /bin/sh using the -c
     flag; interpretation, if any, is performed by the shell.

so we are find with pipe already.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Kris Jurka
Date:
Subject: Dev version doesn't acknowledge cross type indexes
Next
From: Bruce Momjian
Date:
Subject: Re: pg_usleep