Re: refdbc -C addref & stdin
"Markus Hoenicka" <[email protected]>
| Newsgroups | gmane.text.refdb.devel |
|---|---|
| Message-ID | <[email protected]> |
Michael Smith writes: > Will it break behavior on other platforms if I just include the -f stdin > option by default in the set of args that Emacs passes to > refdbc -C addref ? That is, is -f stdin just ignored on platforms that > can already auto detect data on stdin? > It is safe to use this switch on all platforms. The switch isn't actually ignored on the other platforms but it sets a variable to 1 which has the value 1 anyway if data are available on stdin. > Anyway, when I actually try it on Cygwin, it doesn't seem to work - > > $ refdbc -d foo -C addref -f stdin < /tmp/data/alltypes.ris > Could not set terminal attributes > 0 dataset(s) added, 0 skipped, 0 failed > 0 dataset(s) sent. > I'm afraid this is my fault. I've just checked that for reasons entirely unclear to me addref does not yet support the -f stdin switch. It will fail on Cygwin no matter how hard you'll try. The appended patch fixes the problem. It is against a current CVS version so expect some hunks to fail if you try to patch 0.9.3. regards, Markus -- Markus Hoenicka [email protected] (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de
refdbc.c.diff
(application/octet-stream, 5.2 KB)
--- refdbc.c.orig Sat Dec 13 00:17:02 2003
+++ refdbc.c Sat Dec 13 00:27:29 2003
@@ -2853,6 +2853,12 @@
strncpy(db, optarg, PREFS_BUF_LEN); /* override preset db */
db[PREFS_BUF_LEN-1] = '\0';
break;
+ case 'f':
+ /* printf("-f %s\n", optarg); */
+ if (!strcmp(optarg, "stdin")) {
+ n_read_stdin = 1;
+ }
+ break;
case 'h':
delete_all_lilimem(&sentinel);
fprintf(errstream, "Replaces the specified references in the database\nSyntax: updateref [-c command] [-d database] [-h] [-o outfile] [-O outfile] [-P] [-t type] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P update only personal information (AV, N1, RP)\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n");
@@ -2886,7 +2892,6 @@
case 'C': /* fall through - nothing to do */
case 'e':
case 'E':
- case 'f':
case 'F':
case 'g':
case 'G':
@@ -2939,6 +2944,12 @@
/* printf("-d %s\n", optarg); */
strcpy(db, optarg); /* override preset db */
break;
+ case 'f':
+ /* printf("-f %s\n", optarg); */
+ if (!strcmp(optarg, "stdin")) {
+ n_read_stdin = 1;
+ }
+ break;
case 'h':
delete_all_lilimem(&sentinel);
fprintf(errstream, "Adds the specified references to the database\nSyntax: addref [-c command] [-d database] [-g deffile] [-h] [-k] [-o outfile] [-O outfile] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -k keep reference ID\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n");
@@ -2972,7 +2983,6 @@
case 'C': /* fall through - nothing to do */
case 'e':
case 'E':
- case 'f':
case 'F':
case 'g':
case 'G':
@@ -3508,6 +3518,12 @@
strncpy(db, optarg, PREFS_BUF_LEN); /* override preset db */
db[PREFS_BUF_LEN-1] = '\0';
break;
+ case 'f':
+ /* printf("-f %s\n", optarg); */
+ if (!strcmp(optarg, "stdin")) {
+ n_read_stdin = 1;
+ }
+ break;
case 'h':
delete_all_lilimem(&sentinel);
fprintf(errstream, "Replaces the specified notes in the database\nSyntax: updateref [-c command] [-d database] [-h] [-o outfile] [-O outfile] [-P] [-t type] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -P update only personal information (AV, N1, RP)\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n");
@@ -3541,7 +3557,6 @@
case 'C': /* fall through - nothing to do */
case 'e':
case 'E':
- case 'f':
case 'F':
case 'g':
case 'G':
@@ -3594,6 +3609,12 @@
/* printf("-d %s\n", optarg); */
strcpy(db, optarg); /* override preset db */
break;
+ case 'f':
+ /* printf("-f %s\n", optarg); */
+ if (!strcmp(optarg, "stdin")) {
+ n_read_stdin = 1;
+ }
+ break;
case 'h':
delete_all_lilimem(&sentinel);
fprintf(errstream, "Adds the specified notes to the database\nSyntax: addref [-c command] [-d database] [-g deffile] [-h] [-k] [-o outfile] [-O outfile] [-U username] {file|-f infile}\nOptions: -c command pipe the output through command\n -d database specify the database to work with\n -f infile Read the names of the files with the references from file infile\n -g deffile read global fields from file deffile\n -h prints this mini-help\n -k keep reference ID\n -o outfile save the output in outfile (overwrite)\n -O outfile append the output to outfile\n -t input data type (ris|risx), ris is default\n -U username specify a different username than the current user\n All other arguments are interpreted as filenames.\n");
@@ -3627,7 +3648,6 @@
case 'C': /* fall through - nothing to do */
case 'e':
case 'E':
- case 'f':
case 'F':
case 'g':
case 'G':