1991-10-16 20:41:33 +01:00
|
|
|
/* Filter stdin to a suitable C string literal.
|
|
|
|
Copyright (C) 1991 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
This file is part of GLD, the Gnu Linker.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
1991-04-14 05:22:02 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
int ch;
|
1992-04-05 03:47:16 +02:00
|
|
|
|
1991-04-14 05:22:02 +02:00
|
|
|
ch = getchar();
|
|
|
|
printf("/* Generated through mkscript */\n");
|
1992-04-05 03:47:16 +02:00
|
|
|
printf("\"{");
|
1991-04-14 05:22:02 +02:00
|
|
|
while (ch != EOF) {
|
1991-10-11 22:02:22 +01:00
|
|
|
if (ch == '\"' || ch == '\\' || ch == '\'') {
|
1991-04-14 05:22:02 +02:00
|
|
|
putchar('\\');
|
1991-10-11 22:02:22 +01:00
|
|
|
putchar(ch);
|
1991-04-14 05:22:02 +02:00
|
|
|
}
|
1991-10-11 22:02:22 +01:00
|
|
|
else { if (ch == '\n')
|
|
|
|
fputs("\\n\\", stdout);
|
1991-04-14 05:22:02 +02:00
|
|
|
putchar(ch);
|
1991-04-23 17:59:24 +02:00
|
|
|
}
|
1991-04-14 05:22:02 +02:00
|
|
|
ch = getchar();
|
|
|
|
}
|
1991-04-23 17:59:24 +02:00
|
|
|
printf("}\"\n");
|
1991-04-14 05:22:02 +02:00
|
|
|
return 0;
|
|
|
|
}
|