2 Copyright (C) 2003 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published
6 by the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
19 /* Written by Bruno Haible <bruno@clisp.org>. */
29 /* Print an ASCII string with quotes and escape sequences where needed. */
31 print_escaped (stream
, str
)
36 for (; *str
!= '\0'; str
++)
39 fputs ("\\n\"", stream
);
42 fputs ("\n\"", stream
);
46 if (*str
== '"' || *str
== '\\')
53 /* Add to the log file an entry denoting a failed translation. */
55 _nl_log_untranslated (logfilename
, domainname
, msgid1
, msgid2
, plural
)
56 const char *logfilename
;
57 const char *domainname
;
62 static char *last_logfilename
= NULL
;
63 static FILE *last_logfile
= NULL
;
66 /* Can we reuse the last opened logfile? */
67 if (last_logfilename
== NULL
|| strcmp (logfilename
, last_logfilename
) != 0)
69 /* Close the last used logfile. */
70 if (last_logfilename
!= NULL
)
72 if (last_logfile
!= NULL
)
74 fclose (last_logfile
);
77 free (last_logfilename
);
78 last_logfilename
= NULL
;
80 /* Open the logfile. */
81 last_logfilename
= (char *) malloc (strlen (logfilename
) + 1);
82 if (last_logfilename
== NULL
)
84 strcpy (last_logfilename
, logfilename
);
85 last_logfile
= fopen (logfilename
, "a");
86 if (last_logfile
== NULL
)
89 logfile
= last_logfile
;
91 fprintf (logfile
, "domain ");
92 print_escaped (logfile
, domainname
);
93 fprintf (logfile
, "\nmsgid ");
94 print_escaped (logfile
, msgid1
);
97 fprintf (logfile
, "\nmsgid_plural ");
98 print_escaped (logfile
, msgid2
);
99 fprintf (logfile
, "\nmsgstr[0] \"\"\n");
102 fprintf (logfile
, "\nmsgstr \"\"\n");
103 putc ('\n', logfile
);
This page took 0.049863 seconds and 4 git commands to generate.