File: noslash.patch

package info (click to toggle)
imaptool 0.9-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 332 kB
  • sloc: ansic: 3,740; makefile: 95
file content (41 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 1836401e8a7460111c0192661e3c38226407a7af Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Sat, 18 Jan 2014 16:45:05 +0000
Subject: Do the right thing if given a filename without any slashes

Don't just say "unexpected error" (when trying to strip off the directory to
find the map name), but do the right thing instead.

Forwarded: no
Last-Update: 2010-03-02

Patch-Name: noslash.patch
---
 imaptool.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/imaptool.c b/imaptool.c
index 6436dcd..c7084fd 100644
--- a/imaptool.c
+++ b/imaptool.c
@@ -751,13 +751,13 @@ void dump(Widget w, XtPointer client_data, XtPointer call_data)
 	char *mapname = NULL;
 
 	mapname = strrchr(picturefilename,'/');
-        if (!mapname) {
-		printf("unexpected error\n");
-		return;
-        }
-
-	/* skip over the "\" */
-	mapname++;
+	if (mapname) {
+		/* skip over the "/" */
+		mapname++;
+	}
+	else {
+		mapname = picturefilename;
+	}
 
 	if (outputHtmlInLowerCase) {
 		printf("<map name=\"map-%s\">\n",mapname);