summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver McFadden <z3ro.geek@gmail.com>2007-12-09 21:13:26 +0000
committerOliver McFadden <z3ro.geek@gmail.com>2007-12-09 21:13:26 +0000
commit5840ae6a2d091a43fe567ca7e1d5d765b1264a2a (patch)
tree699f61c6d425307449e1186869cd77a3c8b156f0
parent98e0d1c128e55774a98ec4c86ada046598a3aed2 (diff)
Added file and line information to the error messages.
-rw-r--r--src/revenge_detect.c7
-rw-r--r--src/revenge_dump.c4
-rw-r--r--src/revenge_dump_misc.c12
-rw-r--r--src/revenge_main.c60
-rw-r--r--src/revenge_memory.c20
-rw-r--r--src/revenge_test.c26
6 files changed, 66 insertions, 63 deletions
diff --git a/src/revenge_detect.c b/src/revenge_detect.c
index e486cf1..bfeb3fa 100644
--- a/src/revenge_detect.c
+++ b/src/revenge_detect.c
@@ -66,8 +66,8 @@ detect_agp_aperture (void)
if (!(file = fopen ("/proc/iomem", "r")))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -229,7 +229,8 @@ detect_reg_aperture (void)
{
if (!(pci_config = (unsigned char *) malloc (64)))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
+ fprintf (stderr, "%s: %s:%d: %s\n",
+ program_invocation_short_name, __FILE__, __LINE__,
strerror (errno));
exit (EXIT_FAILURE);
}
diff --git a/src/revenge_dump.c b/src/revenge_dump.c
index f4ba4f8..13f6148 100644
--- a/src/revenge_dump.c
+++ b/src/revenge_dump.c
@@ -158,8 +158,8 @@ dump_packets (unsigned int head, unsigned int tail, unsigned int *mem_map,
if (!(file = fopen (name, "w")))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
diff --git a/src/revenge_dump_misc.c b/src/revenge_dump_misc.c
index c1b0ee5..f1a8b90 100644
--- a/src/revenge_dump_misc.c
+++ b/src/revenge_dump_misc.c
@@ -32,8 +32,8 @@ dump_device_id (void)
if (!(file = fopen ("device_id.txt", "w")))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -49,8 +49,8 @@ dump_device_name (void)
if (!(file = fopen ("device_name.txt", "w")))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -85,8 +85,8 @@ dump_interface (void)
if (!(file = fopen ("interface.txt", "w")))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
diff --git a/src/revenge_main.c b/src/revenge_main.c
index 866bd25..b78a7d5 100644
--- a/src/revenge_main.c
+++ b/src/revenge_main.c
@@ -156,8 +156,8 @@ main (int argc, char **argv)
if ((mem_fd = open ("/dev/mem", O_RDWR)) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -166,8 +166,8 @@ main (int argc, char **argv)
mmap (NULL, reg_len, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd,
reg_addr)) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -176,8 +176,8 @@ main (int argc, char **argv)
mmap (NULL, fb_len, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd,
fb_addr)) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -189,8 +189,8 @@ main (int argc, char **argv)
mmap (NULL, agp_len, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd,
agp_addr)) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
break;
@@ -200,8 +200,8 @@ main (int argc, char **argv)
mmap (NULL, pcigart_len, PROT_READ | PROT_WRITE, MAP_SHARED,
mem_fd, pcigart_addr)) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
break;
@@ -212,8 +212,8 @@ main (int argc, char **argv)
mmap (NULL, pcigart_len, PROT_READ | PROT_WRITE, MAP_SHARED,
mem_fd, pcigart_addr)) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
break;
@@ -223,8 +223,8 @@ main (int argc, char **argv)
mmap (NULL, pcigart_len, PROT_READ | PROT_WRITE, MAP_SHARED,
mem_fd, pcigart_addr)) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
break;
@@ -240,16 +240,16 @@ main (int argc, char **argv)
{
if (errno != EEXIST)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
}
if (chdir (buf) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -259,15 +259,15 @@ main (int argc, char **argv)
if (munmap (reg_mem_map, reg_len) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
if (munmap (fb_mem_map, fb_len) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -276,8 +276,8 @@ main (int argc, char **argv)
case INTERFACE_AGP:
if (munmap (agp_mem_map, agp_len) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
break;
@@ -287,8 +287,8 @@ main (int argc, char **argv)
case INTERFACE_RS690:
if (munmap (pcigart_mem_map, pcigart_len) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
break;
@@ -299,15 +299,15 @@ main (int argc, char **argv)
if (close (mem_fd) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
if (chdir ("..") < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
diff --git a/src/revenge_memory.c b/src/revenge_memory.c
index b5f04c3..be16274 100644
--- a/src/revenge_memory.c
+++ b/src/revenge_memory.c
@@ -38,8 +38,8 @@ memory_read_agp (unsigned int addr, unsigned int size)
if (!(tmp = (void *) malloc (size)))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -104,8 +104,8 @@ memory_read_pcigart (unsigned int addr, unsigned int size)
if (!(mem_map = (void *) malloc (buf_size)))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -125,8 +125,8 @@ memory_read_pcigart (unsigned int addr, unsigned int size)
MAP_SHARED, mem_fd,
memory_virt_to_phys (start_page_addr))) == MAP_FAILED)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -134,16 +134,16 @@ memory_read_pcigart (unsigned int addr, unsigned int size)
if (munmap (page_mem_map, ATI_PCIGART_PAGE_SIZE) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
}
if (!(dest = (void *) malloc (size)))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
memcpy (dest, mem_map + addr_mod, size);
diff --git a/src/revenge_test.c b/src/revenge_test.c
index bcc97d6..0f0b525 100644
--- a/src/revenge_test.c
+++ b/src/revenge_test.c
@@ -94,8 +94,8 @@ random_texture (int width, int height)
if (!(texture = (GLuint *) malloc (width * height * sizeof (GLuint))))
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
return NULL;
}
@@ -151,7 +151,8 @@ test_prologue (char *buf)
{
if (errno != EEXIST)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
+ fprintf (stderr, "%s: %s:%d: %s\n",
+ program_invocation_short_name, __FILE__, __LINE__,
strerror (errno));
exit (EXIT_FAILURE);
}
@@ -159,8 +160,8 @@ test_prologue (char *buf)
if (chdir (buf) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
}
@@ -176,8 +177,8 @@ test_epilogue (bool buf)
{
if (chdir ("..") < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
}
@@ -254,7 +255,8 @@ test (void)
{
if (errno != EEXIST)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
+ fprintf (stderr, "%s: %s:%d: %s\n",
+ program_invocation_short_name, __FILE__, __LINE__,
strerror (errno));
exit (EXIT_FAILURE);
}
@@ -262,8 +264,8 @@ test (void)
if (chdir (test->name) < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
@@ -273,8 +275,8 @@ test (void)
if (chdir ("..") < 0)
{
- fprintf (stderr, "%s: %s\n", program_invocation_short_name,
- strerror (errno));
+ fprintf (stderr, "%s: %s:%d: %s\n", program_invocation_short_name,
+ __FILE__, __LINE__, strerror (errno));
exit (EXIT_FAILURE);
}
}