#include <string.h>
#include <argp.h>
+#include <support/support.h>
+
const char *argp_program_version = "argp-test 1.0";
\f
struct argp_option sub_options[] =
if (key == ARGP_KEY_HELP_POST_DOC && text)
{
time_t now = time (0);
- asprintf (&new_text, text, ctime (&now));
+ new_text = xasprintf (text, ctime (&now));
}
else if (key == 'f')
/* Show the default for the --foonly option. */
- asprintf (&new_text, "%s (ZOT defaults to %x)",
- text, params->foonly_default);
+ new_text = xasprintf ("%s (ZOT defaults to %x)",
+ text, params->foonly_default);
else
new_text = (char *)text;
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
puts ("canonicalize_file_name failed");
return 1;
}
- char *path;
- asprintf (&path, "%s:../libio:../elf", bindir);
- if (path == NULL)
- {
- puts ("asprintf failed");
- return 1;
- }
+
+ char *path = xasprintf ("%s:../libio:../elf", bindir);
setenv ("PATH", path, 1);
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
{
char *buf;
int off;
- asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
- if (buf == NULL)
- {
- puts ("asprintf failed");
- exit (1);
- }
+
+ buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
if (system (buf) != 0)
{
puts ("system failed");
puts ("canonicalize_file_name failed");
return 1;
}
- char *path;
- asprintf (&path, "%s:../libio:../elf", bindir);
- if (path == NULL)
- {
- puts ("asprintf failed");
- return 1;
- }
+
+ char *path = xasprintf ("%s:../libio:../elf", bindir);
setenv ("PATH", path, 1);
#include <stdlib.h>
#include <unistd.h>
+#include <support/support.h>
+
static char buf[8192];
int
the perhaps incompatible new shared libraries. */
unsetenv ("LD_LIBRARY_PATH");
- asprintf (&printbuf, "cmp %s %s", inname, outname);
+ printbuf = xasprintf ("cmp %s %s", inname, outname);
result = system (printbuf);
remove (inname);
remove (outname);
#include <stdio.h>
#include <string.h>
+#include <support/support.h>
+
static int
do_test (void)
{
return 1;
}
- asprintf (&line, "\
+ line = xasprintf ("\
GDB is free software and you are welcome to distribute copies of it\n\
under certain conditions; type \"show copying\" to see the conditions.\n\
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
#include <time.h>
#include <sys/stat.h>
+#include <support/support.h>
static int
do_test (void)
if (tmpdir == NULL || tmpdir[0] == '\0')
tmpdir = "/tmp";
- asprintf (&fname, "%s/tst-fseek.XXXXXX", tmpdir);
- if (fname == NULL)
- error (EXIT_FAILURE, errno, "cannot generate name for temporary file");
+ fname = xasprintf ("%s/tst-fseek.XXXXXX", tmpdir);
/* Create a temporary file. */
fd = mkstemp (fname);