binutils-gdb/ld/mkscript.c

44 lines
1.2 KiB
C
Raw Normal View History

/* 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;
1991-04-14 05:22:02 +02:00
ch = getchar();
printf("/* Generated through mkscript */\n");
printf("\"{");
1991-04-14 05:22:02 +02:00
while (ch != EOF) {
if (ch == '\"' || ch == '\\' || ch == '\'') {
1991-04-14 05:22:02 +02:00
putchar('\\');
putchar(ch);
1991-04-14 05:22:02 +02: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;
}