]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Remove strip_file_to_fd
authormmj <none@none>
Thu, 22 Apr 2004 13:46:17 +0000 (23:46 +1000)
committermmj <none@none>
Thu, 22 Apr 2004 13:46:17 +0000 (23:46 +1000)
include/strip_file_to_fd.h [deleted file]
src/Makefile.am
src/Makefile.in
src/mylocking.c
src/strip_file_to_fd.c [deleted file]

diff --git a/include/strip_file_to_fd.h b/include/strip_file_to_fd.h
deleted file mode 100644 (file)
index c158e77..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2002, 2003 Mads Martin Joergensen <mmj at mmj.dk>
- *
- * $Id$
- *
- * This file is redistributable under version 2 of the GNU General
- * Public License as described at http://www.gnu.org/licenses/gpl.txt
- */
-
-#ifndef STRIP_FILE_TO_FD_H
-#define STRIP_FILE_TO_FD_H
-
-#include <stdio.h>
-
-char *strip_headers(char *readbuf, const char **headers_to_strip);
-int custom_lines(int fd, FILE *infile);
-void strip_file_to_fd(FILE *in, int out_fd, const char **headers_to_strip,
-                   FILE *headerfile, FILE *footerfile, char *toheader);
-
-#endif /* STRIP_FILE_TO_FD_H */
index 1e53819a25b4399dfabf4aa17844068f1cb4bfd6..3da747d418ea79921502c292e692a78a3fe5cd3b 100644 (file)
@@ -17,16 +17,15 @@ mlmmj_send_SOURCES = mlmmj-send.c writen.c mail-functions.c itoa.c chomp.c \
                     mylocking.c init_sockfd.c strgen.c random-int.c \
                     print-version.c
 
-mlmmj_recieve_SOURCES = mlmmj-recieve.c writen.c strip_file_to_fd.c \
-                        random-int.c header_token.c getlistaddr.c chomp.c \
-                       strgen.c print-version.c mygetline.c
-
-mlmmj_process_SOURCES = mlmmj-process.c writen.c strip_file_to_fd.c \
-                        find_email_adr.c incindexfile.c itoa.c \
-                       getlistaddr.c chomp.c mylocking.c listcontrol.c \
-                       random-int.c strgen.c header_token.c print-version.c \
-                       send_help.c do_all_the_voodo_here.c mygetline.c \
-                       gethdrline.c
+mlmmj_recieve_SOURCES = mlmmj-recieve.c writen.c random-int.c header_token.c \
+                       getlistaddr.c chomp.c strgen.c print-version.c \
+                       mygetline.c
+
+mlmmj_process_SOURCES = mlmmj-process.c writen.c find_email_adr.c \
+                       incindexfile.c itoa.c getlistaddr.c chomp.c \
+                       mylocking.c listcontrol.c random-int.c strgen.c i\
+                       header_token.c print-version.c send_help.c \
+                       do_all_the_voodo_here.c mygetline.c gethdrline.c
 
 mlmmj_subscribe_SOURCES = mlmmj-subscribe.c writen.c mylocking.c \
                        getlistaddr.c chomp.c random-int.c strgen.c \
index 697923341eba8c5c3d117e25513f1043e0a0ea31..5c6917a226b47d33d283af8a6f4d864379433dbd 100644 (file)
@@ -55,19 +55,18 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
 am_mlmmj_process_OBJECTS = mlmmj-process.$(OBJEXT) writen.$(OBJEXT) \
-       strip_file_to_fd.$(OBJEXT) find_email_adr.$(OBJEXT) \
-       incindexfile.$(OBJEXT) itoa.$(OBJEXT) getlistaddr.$(OBJEXT) \
-       chomp.$(OBJEXT) mylocking.$(OBJEXT) listcontrol.$(OBJEXT) \
-       random-int.$(OBJEXT) strgen.$(OBJEXT) header_token.$(OBJEXT) \
-       print-version.$(OBJEXT) send_help.$(OBJEXT) \
-       do_all_the_voodo_here.$(OBJEXT) mygetline.$(OBJEXT) \
-       gethdrline.$(OBJEXT)
+       find_email_adr.$(OBJEXT) incindexfile.$(OBJEXT) itoa.$(OBJEXT) \
+       getlistaddr.$(OBJEXT) chomp.$(OBJEXT) mylocking.$(OBJEXT) \
+       listcontrol.$(OBJEXT) random-int.$(OBJEXT) strgen.$(OBJEXT) \
+       header_token.$(OBJEXT) print-version.$(OBJEXT) \
+       send_help.$(OBJEXT) do_all_the_voodo_here.$(OBJEXT) \
+       mygetline.$(OBJEXT) gethdrline.$(OBJEXT)
 mlmmj_process_OBJECTS = $(am_mlmmj_process_OBJECTS)
 mlmmj_process_LDADD = $(LDADD)
 am_mlmmj_recieve_OBJECTS = mlmmj-recieve.$(OBJEXT) writen.$(OBJEXT) \
-       strip_file_to_fd.$(OBJEXT) random-int.$(OBJEXT) \
-       header_token.$(OBJEXT) getlistaddr.$(OBJEXT) chomp.$(OBJEXT) \
-       strgen.$(OBJEXT) print-version.$(OBJEXT) mygetline.$(OBJEXT)
+       random-int.$(OBJEXT) header_token.$(OBJEXT) \
+       getlistaddr.$(OBJEXT) chomp.$(OBJEXT) strgen.$(OBJEXT) \
+       print-version.$(OBJEXT) mygetline.$(OBJEXT)
 mlmmj_recieve_OBJECTS = $(am_mlmmj_recieve_OBJECTS)
 mlmmj_recieve_LDADD = $(LDADD)
 am_mlmmj_send_OBJECTS = mlmmj-send.$(OBJEXT) writen.$(OBJEXT) \
@@ -117,7 +116,6 @@ am__depfiles_maybe = depfiles
 @AMDEP_TRUE@   ./$(DEPDIR)/print-version.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/random-int.Po ./$(DEPDIR)/readln.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/send_help.Po ./$(DEPDIR)/strgen.Po \
-@AMDEP_TRUE@   ./$(DEPDIR)/strip_file_to_fd.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/subscriberfuncs.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/writen.Po
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -211,16 +209,15 @@ mlmmj_send_SOURCES = mlmmj-send.c writen.c mail-functions.c itoa.c chomp.c \
                     mylocking.c init_sockfd.c strgen.c random-int.c \
                     print-version.c
 
-mlmmj_recieve_SOURCES = mlmmj-recieve.c writen.c strip_file_to_fd.c \
-                        random-int.c header_token.c getlistaddr.c chomp.c \
-                       strgen.c print-version.c mygetline.c
+mlmmj_recieve_SOURCES = mlmmj-recieve.c writen.c random-int.c header_token.c \
+                       getlistaddr.c chomp.c strgen.c print-version.c \
+                       mygetline.c
 
-mlmmj_process_SOURCES = mlmmj-process.c writen.c strip_file_to_fd.c \
-                        find_email_adr.c incindexfile.c itoa.c \
-                       getlistaddr.c chomp.c mylocking.c listcontrol.c \
-                       random-int.c strgen.c header_token.c print-version.c \
-                       send_help.c do_all_the_voodo_here.c mygetline.c \
-                       gethdrline.c
+mlmmj_process_SOURCES = mlmmj-process.c writen.c find_email_adr.c \
+                       incindexfile.c itoa.c getlistaddr.c chomp.c \
+                       mylocking.c listcontrol.c random-int.c strgen.c i\
+                       header_token.c print-version.c send_help.c \
+                       do_all_the_voodo_here.c mygetline.c gethdrline.c
 
 mlmmj_subscribe_SOURCES = mlmmj-subscribe.c writen.c mylocking.c \
                        getlistaddr.c chomp.c random-int.c strgen.c \
@@ -351,7 +348,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readln.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send_help.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strgen.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip_file_to_fd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subscriberfuncs.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writen.Po@am__quote@
 
index d6cd6f453039f83520d364de406f93e6d222e8db..47155ac7c736019bc0612b1cb65d3a5b88b9099c 100644 (file)
@@ -34,6 +34,3 @@ int myunlock(int fd)
 
        return myunlock;
 }
-
-
-
diff --git a/src/strip_file_to_fd.c b/src/strip_file_to_fd.c
deleted file mode 100644 (file)
index 45ae3a5..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (C) 2002, 2003 Mads Martin Joergensen <mmj at mmj.dk>
- *
- * $Id$
- *
- * This file is redistributable under version 2 of the GNU General
- * Public License as described at http://www.gnu.org/licenses/gpl.txt
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-
-#include "strip_file_to_fd.h"
-#include "mlmmj.h"
-#include "wrappers.h"
-
-#include "log_error.c"
-
-char *strip_headers(char *buf, const char **headers)
-{
-       int i = 0;
-
-       if(buf[0] == '\t' || headers == 0)
-               return buf;
-       while(headers[i]) {
-               if(strncmp(buf, headers[i], strlen(headers[i])) == 0)
-                       buf[0] = 0;
-               i++;
-       }
-       return buf;
-}
-
-/* This function just adds the custom lines such as header, footer */
-int custom_lines(int fd, FILE *infile)
-{
-       int ch;
-       
-       while((ch = fgetc(infile)) != -1)
-               writen(fd, &ch, 1);
-       
-       return 0;
-}
-
-/* strip_file_to_fd reads a complete mail from in_fd, strips all headers in
-   headers_to_strip from it, and saves it to out_fd. If headerfile is not 0 it
-   will write this file in the headers. If we meet the To: header, we copy it
-   to toheader.
- */
-void strip_file_to_fd(FILE *in, int out_fd, const char **headers_to_strip,
-                   FILE *headerfile, FILE *footerfile, char *toheader)
-{
-       char buf[READ_BUFSIZE];
-       signed char readbuf[2];
-       int bytes_written;
-       int buf_count = 0;
-       
-       memset(buf, 0, READ_BUFSIZE);
-       while((readbuf[0]=fgetc(in)) != -1) {
-               if(readbuf[0] == '\n') {
-                       readbuf[1]=fgetc(in);
-                       if(readbuf[1] != -1)
-                               ungetc(readbuf[1], in);
-                       else if(ferror(in))
-                               exit(EXIT_FAILURE);
-               }
-               if(readbuf[0] != '\n')
-                       buf[buf_count++] = readbuf[0];
-               else if(readbuf[1] == '\t') {
-                       buf[buf_count++] = readbuf[0];
-                       buf[buf_count] = readbuf[1];
-                       memset(readbuf, 0, 2);
-               } else { /* readbuf[0] == '\n' */
-                       if (readbuf[1] == '\n' && headerfile)
-                               custom_lines(out_fd, headerfile);
-                       buf[buf_count] = readbuf[0];
-                       if(buf_count == 0) /* headers are done */
-                               headers_to_strip = 0;
-                               /* XXX:free_str_array(headers_to_strip);*/
-                       if(headers_to_strip) {/* only strip if still headers */
-                               strip_headers(buf, headers_to_strip);
-                               if(toheader && (strncmp(buf, "To: ", 4) == 0))
-                                       sprintf(toheader, "%s", buf);
-                       }
-                       if(buf[0]) {
-                               bytes_written = writen(out_fd, buf, strlen(buf));
-                               if(bytes_written == -1) {
-                                       log_error("error writing to fd");
-                                       exit(EXIT_FAILURE);
-                               }
-                       }
-                       memset(buf, 0, READ_BUFSIZE);
-                       buf_count = 0;
-               }
-       }
-       if(footerfile)
-               custom_lines(out_fd, footerfile);
-
-       if(ferror(in))
-               exit(EXIT_FAILURE);
-}
-