Thread

  1. Re: [HACKERS] Current open 6.3 issues

    Andrew Martin <martin@biochemistry.ucl.ac.uk> — 1998-01-23T11:45:01Z

    > > > psql .psqlrc file startup(Andrew)
    > > Unfortunately I simply don't have time to implement any of the nicer suggestions
    > > for how this should work. I wish I did...
    > 
    > OK, what are we doing the .psqlrc.  Can you send the old patch, or are
    > we dropping it for 6.3?
    > 
    > -- 
    > Bruce Momjian
    > maillist@candle.pha.pa.us
    > 
    
    Here's the patch I supplied before:
    
    *** src/bin/psql/psql.c.orig    Fri Jun 20 21:54:31 1997
    --- src/bin/psql/psql.c Fri Jun 20 22:23:49 1997
    ***************
    *** 1598,1603 ****
    --- 1598,1605 ----
          bool            singleSlashCmd = 0;
          int             c;
      
    +     char           *home = NULL;  /* Used to store $HOME */
    + 
          memset(&settings, 0, sizeof settings);
          settings.opt.align = 1;
          settings.opt.header = 1;
    ***************
    *** 1728,1733 ****
    --- 1730,1760 ----
            printf("   type \\g or terminate with semicolon to execute query\n");
            printf(" You are currently connected to the database: %s\n\n", dbname);
          }
    + 
    +     /*
    +      * 20.06.97 ACRM See if we've got a /etc/psqlrc or .psqlrc file
    +      */
    +     if(!access("/etc/psqlrc",R_OK))
    +        HandleSlashCmds(&settings, "\\i /etc/psqlrc", "");
    +     if((home = getenv("HOME"))!=NULL) {
    +        char *psqlrc = NULL,
    +        *line   = NULL;
    + 
    +        if((psqlrc = (char *)malloc(strlen(home) + 10))!=NULL) {
    +           sprintf(psqlrc, "%s/.psqlrc", home);
    +           if(!access(psqlrc, R_OK)) {
    +              if((line = (char *)malloc(strlen(psqlrc) + 5))!=NULL) {
    +                 sprintf(line, "\\i %s", psqlrc);
    +                 HandleSlashCmds(&settings, line, "");
    +                 free(line);
    +              }
    +           }
    +           free(psqlrc);
    +        }
    +     }
    +     /* End of check for psqlrc files */
    + 
    +     
          if (qfilename || singleSlashCmd) {
            /*
             * read in a file full of queries instead of reading in queries
    
    
    
    Andrew
    
    ----------------------------------------------------------------------------
    Dr. Andrew C.R. Martin                             University College London
    EMAIL: (Work) martin@biochem.ucl.ac.uk    (Home) andrew@stagleys.demon.co.uk
    URL:   http://www.biochem.ucl.ac.uk/~martin
    Tel:   (Work) +44(0)171 419 3890                    (Home) +44(0)1372 275775