Re: Syslog Facility Patch - Mailing list pgsql-hackers
From | Larry Rosenman |
---|---|
Subject | Re: Syslog Facility Patch |
Date | |
Msg-id | 20001114235550.A7035@lerami.lerctr.org Whole thread Raw |
In response to | Re: Syslog Facility Patch (Larry Rosenman <ler@lerctr.org>) |
List | pgsql-hackers |
* Larry Rosenman <ler@lerctr.org> [001114 20:45]: > * Larry Rosenman <ler@lerctr.org> [001114 16:56]: > > Ok, so what I think(?) needs to happen is the FIXME: tag needs to be > > handled. We need to code a version of src/backend/parser/scansup.c > > that doesn't use palloc, and also strips the apostrophes from the > > front and end of the string? This doesn't look that hard. Do I have > > "permission" to play with it, and submit a patch when I've got it > > fixed? > > > > I ass/u/me we want to allow any of the 'C' escapes? or just > > a-zA-Z0-9-. for a GUC_STRING? > Ok, baring objections, I'm going to code up a routine to put into > guc-file.l that removes the quotes/apostrophes from a GUC_STRING, and > matches for [-.a-zA-Z0-9] within the string. We can tune more later. > > Probably won't get posted tonight, but in the next 48 hours. Ok, I changed my mind, and brute forced it. Here's a patch that accepts either 'string' or "string", and then kills off the ' or ". Let me know if this violates style or portability guidelines. It depends on ANSI memmove(). Index: guc-file.l =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v retrieving revision 1.4 diff -c -r1.4 guc-file.l *** guc-file.l 2000/07/27 19:49:18 1.4 --- guc-file.l 2000/11/15 05:52:57 *************** *** 45,51 **** /* prototype, so compiler is happy with our high warnings setting */ int GUC_yylex(void); - %} SIGN ("-"|"+") --- 45,50 ---- *************** *** 69,76 **** * work right. Now there are no string options, and if there were then * the unquoted (`ID') tokens shouldstill work. Of course this only * affects the configuration file. */ ! STRING \'([^'\n]|\\.)*' %% --- 68,79 ---- * work right. Now there are no string options, and if there were then * the unquoted (`ID') tokens shouldstill work. Of course this only * affects the configuration file. + * LER 14NOV2000: I set it up to accept either a quoted string or a string + * in apostrophes. I then kill off the 1st and last characters. There is + * no special handling for doubled terminators or 'C' escapes. + * this allows most other characters to be used. */ ! STRING (\'|\")([^'"\n]|\\.)*(\'|\") %% *************** *** 215,220 **** --- 218,232 ---- opt_value = strdup(yytext); if (opt_value == NULL) gotoout_of_memory; + if (token == GUC_STRING) + { + /* remove the beginning and ending quote/apostrophe */ + /* first: shift the whole shooting match down one + character */ + memmove(opt_value,opt_value+1,strlen(opt_value)-1); + /* second: null out the 2 characters we shifted */ + opt_value[strlen(opt_value)-2]='\0'; + } parse_state = 2; break; -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
pgsql-hackers by date: