Browse code

move strrcpy() into str.c

git-svn: trunk@2033

Tomasz Kojm authored on 2006/06/21 01:54:31
Showing 8 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Jun 20 18:49:10 CEST 2006 (tk)
2
+----------------------------------
3
+  * libclamav/strrcpy.[ch]: remove files; move strrcpy() into str.c
4
+
1 5
 Sat Jun 17 22:57:37 CEST 2006 (tk)
2 6
 ----------------------------------
3 7
   * libclamav: minor code cleanup
... ...
@@ -58,8 +58,6 @@ libclamav_la_SOURCES = \
58 58
 	message.h \
59 59
 	snprintf.c \
60 60
 	snprintf.h \
61
-	strrcpy.c \
62
-	strrcpy.h \
63 61
 	table.c \
64 62
 	table.h \
65 63
 	text.c \
... ...
@@ -79,14 +79,14 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
79 79
 libclamav_la_DEPENDENCIES =
80 80
 am_libclamav_la_OBJECTS = matcher-ac.lo matcher-bm.lo matcher.lo \
81 81
 	md5.lo others.lo readdb.lo cvd.lo dsig.lo str.lo scanners.lo \
82
-	filetypes.lo blob.lo mbox.lo message.lo snprintf.lo strrcpy.lo \
83
-	table.lo text.lo ole2_extract.lo vba_extract.lo msexpand.lo \
84
-	pe.lo cabd.lo lzxd.lo mszipd.lo qtmd.lo system.lo upx.lo \
85
-	htmlnorm.lo chmunpack.lo rebuildpe.lo petite.lo fsg.lo line.lo \
86
-	untar.lo unzip.lo special.lo binhex.lo is_tar.lo tnef.lo \
87
-	unrar15.lo unrarvm.lo unrar.lo unrarfilter.lo unrarppm.lo \
88
-	unrar20.lo unrarcmd.lo pdf.lo spin.lo yc.lo elf.lo sis.lo \
89
-	uuencode.lo pst.lo
82
+	filetypes.lo blob.lo mbox.lo message.lo snprintf.lo table.lo \
83
+	text.lo ole2_extract.lo vba_extract.lo msexpand.lo pe.lo \
84
+	cabd.lo lzxd.lo mszipd.lo qtmd.lo system.lo upx.lo htmlnorm.lo \
85
+	chmunpack.lo rebuildpe.lo petite.lo fsg.lo line.lo untar.lo \
86
+	unzip.lo special.lo binhex.lo is_tar.lo tnef.lo unrar15.lo \
87
+	unrarvm.lo unrar.lo unrarfilter.lo unrarppm.lo unrar20.lo \
88
+	unrarcmd.lo pdf.lo spin.lo yc.lo elf.lo sis.lo uuencode.lo \
89
+	pst.lo
90 90
 libclamav_la_OBJECTS = $(am_libclamav_la_OBJECTS)
91 91
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
92 92
 depcomp = $(SHELL) $(top_srcdir)/depcomp
... ...
@@ -257,8 +257,6 @@ libclamav_la_SOURCES = \
257 257
 	message.h \
258 258
 	snprintf.c \
259 259
 	snprintf.h \
260
-	strrcpy.c \
261
-	strrcpy.h \
262 260
 	table.c \
263 261
 	table.h \
264 262
 	text.c \
... ...
@@ -445,7 +443,6 @@ distclean-compile:
445 445
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/special.Plo@am__quote@
446 446
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spin.Plo@am__quote@
447 447
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Plo@am__quote@
448
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strrcpy.Plo@am__quote@
449 448
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/system.Plo@am__quote@
450 449
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@
451 450
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text.Plo@am__quote@
... ...
@@ -16,7 +16,7 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: message.c,v 1.174 2006/06/12 13:24:06 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: message.c,v 1.175 2006/06/20 16:54:31 tkojm Exp $";
20 20
 
21 21
 #if HAVE_CONFIG_H
22 22
 #include "clamav-config.h"
... ...
@@ -49,7 +49,6 @@ static	char	const	rcsid[] = "$Id: message.c,v 1.174 2006/06/12 13:24:06 njh Exp
49 49
 #include "others.h"
50 50
 #include "str.h"
51 51
 #include "filetypes.h"
52
-#include "strrcpy.h"
53 52
 
54 53
 #include "mbox.h"
55 54
 
... ...
@@ -1848,9 +1847,9 @@ decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, s
1848 1848
 		case EIGHTBIT:
1849 1849
 		default:	/* unknown encoding type - try our best */
1850 1850
 			if(line)	/* empty line? */
1851
-				buf = (unsigned char *)strrcpy((char *)buf, line);
1851
+				buf = (unsigned char *)cli_strrcpy((char *)buf, line);
1852 1852
 			/* Put the new line back in */
1853
-			return (unsigned char *)strrcpy((char *)buf, "\n");
1853
+			return (unsigned char *)cli_strrcpy((char *)buf, "\n");
1854 1854
 
1855 1855
 		case QUOTEDPRINTABLE:
1856 1856
 			if(line == NULL) {	/* empty line */
... ...
@@ -331,3 +331,16 @@ const char *cli_memstr(const char *haystack, int hs, const char *needle, int ns)
331 331
 
332 332
     return NULL;
333 333
 }
334
+
335
+char *cli_strrcpy(char *dest, const char *source) /* by NJH */
336
+{
337
+
338
+    if(!dest || !source) {
339
+	cli_errmsg("cli_strrcpy: NULL argument\n");
340
+	return NULL;
341
+    }
342
+
343
+    while((*dest++ = *source++));
344
+
345
+    return --dest;
346
+}
... ...
@@ -29,5 +29,5 @@ int cli_hex2num(const char *hex);
29 29
 char *cli_str2hex(const char *string, unsigned int len);
30 30
 char *cli_strtokbuf(const char *input, int fieldno, const char *delim, char *output);
31 31
 const char *cli_memstr(const char *haystack, int hs, const char *needle, int ns);
32
-
32
+char *cli_strrcpy(char *dest, const char *source);
33 33
 #endif
34 34
deleted file mode 100644
... ...
@@ -1,50 +0,0 @@
1
-/*
2
- *  Copyright (C) 2002 Nigel Horne <njh@bandsman.co.uk>
3
- *
4
- *  This program is free software; you can redistribute it and/or modify
5
- *  it under the terms of the GNU General Public License as published by
6
- *  the Free Software Foundation; either version 2 of the License, or
7
- *  (at your option) any later version.
8
- *
9
- *  This program is distributed in the hope that it will be useful,
10
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
- *  GNU General Public License for more details.
13
- *
14
- *  You should have received a copy of the GNU General Public License
15
- *  along with this program; if not, write to the Free Software
16
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
- *  MA 02110-1301, USA.
18
- */
19
-
20
-#if HAVE_CONFIG_H
21
-#include "clamav-config.h"
22
-#endif
23
-
24
-#include <stdio.h>
25
-
26
-#ifndef	CL_DEBUG
27
-#define	NDEBUG	/* map CLAMAV debug onto standard */
28
-#endif
29
-
30
-#include <assert.h>
31
-
32
-#include "strrcpy.h"
33
-
34
-/*
35
- * Like strcpy, but return the END of the destination, allowing a quicker
36
- * means of adding to the end of a string than strcat
37
- */
38
-char *
39
-strrcpy(char *dest, const char *source)
40
-{
41
-	/* Pre assertions */
42
-	assert(dest != NULL);
43
-	assert(source != NULL);
44
-	assert(dest != source);
45
-
46
-	/* tk: parentheses */
47
-	while((*dest++ = *source++))
48
-		;
49
-	return(--dest);
50
-}
51 1
deleted file mode 100644
... ...
@@ -1,27 +0,0 @@
1
-/*
2
- *  Copyright (C) 2002 Nigel Horne <njh@bandsman.co.uk>
3
- *
4
- *  This program is free software; you can redistribute it and/or modify
5
- *  it under the terms of the GNU General Public License as published by
6
- *  the Free Software Foundation; either version 2 of the License, or
7
- *  (at your option) any later version.
8
- *
9
- *  This program is distributed in the hope that it will be useful,
10
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
- *  GNU General Public License for more details.
13
- *
14
- *  You should have received a copy of the GNU General Public License
15
- *  along with this program; if not, write to the Free Software
16
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
- *  MA 02110-1301, USA.
18
- */
19
-
20
-/* tk: added strrcpy.h */
21
-
22
-#ifndef __STRRCPY_H
23
-#define __STRRCPY_H
24
-
25
-char	*strrcpy(char *dest, const char *source);
26
-
27
-#endif