summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore14
-rw-r--r--AUTHORS3
-rw-r--r--BUGS0
-rw-r--r--COPYING4
-rw-r--r--CREDITS6
-rw-r--r--ChangeLog0
-rw-r--r--INSTALL32
-rw-r--r--Makefile40
-rw-r--r--Makefile.am13
-rw-r--r--NEWS0
-rw-r--r--README2
-rw-r--r--cli.c (renamed from src/cli.c)16
-rw-r--r--config.mk24
-rw-r--r--configure.ac34
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/RELEASING45
-rw-r--r--download.c (renamed from src/download.c)21
-rw-r--r--getht.1 (renamed from doc/getht.man)22
-rw-r--r--getht.c (renamed from src/getht.c)23
-rw-r--r--getht.h92
-rw-r--r--issuemem.c (renamed from src/issuemem.c)17
-rw-r--r--parseconfig.c (renamed from src/config.c)24
-rwxr-xr-xprepare-release.sh64
-rw-r--r--src/.gitignore5
-rw-r--r--src/Makefile.am7
-rw-r--r--src/getht.h52
-rw-r--r--src/issue.h59
-rw-r--r--tocxml.c (renamed from src/tocxml.c)50
-rw-r--r--xml.c (renamed from src/xml.c)16
29 files changed, 199 insertions, 488 deletions
diff --git a/.gitignore b/.gitignore
index 42255fb..afee52f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1 @@
-# ignore auto-generated autoconf files
-Makefile
-Makefile.in
-aclocal.m4
-stamp-h1
-config.h
-config.h.in
-config.h.log
-config.log
-config.status
-config
-configure
-autom4te.cache
+getht
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index fbf808e..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-Main program code and maintainer:
-Nick White <getht@njw.me.uk>
- http://www.njw.me.uk
diff --git a/BUGS b/BUGS
deleted file mode 100644
index e69de29..0000000
--- a/BUGS
+++ /dev/null
diff --git a/COPYING b/COPYING
index 94a9ed0..cb6e900 100644
--- a/COPYING
+++ b/COPYING
@@ -1,3 +1,7 @@
+GetHT is Copyright 2006,2008,2010 Nick White. It is licensed under the
+GNU General Public License version 3, or any later version.
+
+
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
diff --git a/CREDITS b/CREDITS
deleted file mode 100644
index d4ebfc5..0000000
--- a/CREDITS
+++ /dev/null
@@ -1,6 +0,0 @@
-So far this program has been written entirely by me, Nick White.
-Many thanks to Bridget Cady for her patient testing.
-
-If you'd like to contribute suggestions, bug reports, or anything
-else you believe would be useful, I would be delighted, and your
-name would be mentioned here.
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e69de29..0000000
--- a/ChangeLog
+++ /dev/null
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 12a7728..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,32 +0,0 @@
-To install this package, simply follow the following steps:
-
-1. Decompress & untar the archive
- $ tar -xjf getht-<version>.tar.bz2
-
-2. Change to the source directory
- $ cd getht-<version>
-
-4. Prepare the software for your system
- $ ./configure
-
- Note that there are several options which can be applied
- here, such as prefix and locations of libraries.
- For more information run:
- $ ./configure --help
-
-4. Build the software
- $ make
-
-5. Install the software (ensure that you have superuser
- privilages if installing outside of your home directory)
- $ make install
-
-
-You can then run the package by typing the following
-command into a terminal:
-$ getht
-
-Note that the AutoTools scripts to build and install GetHT are
-quite simple, and have not been thoroughly tested.
-If you encounter any problems building please let me know, using
-one of the methods suggested in the README file.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9a9847c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,40 @@
+# See COPYING file for copyright, license and warranty details.
+
+include config.mk
+
+TARGET = getht
+SRC = $(shell find . -name '*.c')
+OBJ = $(SRC:.c=.o)
+MAN = $(TARGET:=.1)
+DOC = README
+
+all: $(TARGET)
+
+$(TARGET:=.o): $(SRC)
+ cc -c $(SRC) $(CFLAGS)
+
+$(TARGET): $(OBJ)
+ cc -o $@ $(OBJ) $(LDFLAGS)
+
+clean:
+ rm -f -- $(TARGET) $(OBJ)
+
+install:
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp -f $(TARGET) $(DESTDIR)$(PREFIX)/bin
+ mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+ cp -f $(MAN) $(DESTDIR)$(MANPREFIX)/man1
+
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET)
+ rm -f $(DESTDIR)$(MANPREFIX)/man1/$(MAN)
+
+dist: clean
+ mkdir -p getht-$(VERSION)
+ cp -R $(SRC) $(DOC) getht-$(VERSION)
+ sed "s/VERSION/$(VERSION)/g" < $(MAN) > getht-$(VERSION)/$(MAN)
+ tar -c getht-$(VERSION) > getht-$(VERSION).tar
+ bzip2 < getht-$(VERSION).tar > getht-$(VERSION).tar.bz2
+ rm -rf getht-$(VERSION).tar getht-$(VERSION)
+ gpg -b < getht-$(VERSION).tar.bz2 > getht-$(VERSION).tar.bz2.sig
+ sha1sum < getht-$(VERSION).tar.bz2 > getht-$(VERSION).tar.bz2.sha1
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 8f2b81f..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-## A simple file to process with Automake, to produce Makefile.in
-
-SUBDIRS = src doc
-
-doc_DATA = \
- AUTHORS \
- BUGS \
- ChangeLog \
- COPYING \
- CREDITS \
- INSTALL \
- NEWS \
- README
diff --git a/NEWS b/NEWS
deleted file mode 100644
index e69de29..0000000
--- a/NEWS
+++ /dev/null
diff --git a/README b/README
index 6c36bb6..0c96f05 100644
--- a/README
+++ b/README
@@ -24,7 +24,7 @@ libxml2 2.0.0+
libcurl 7.7.2+
-Install
-For details on how to install GetHT see the INSTALL file.
+make && make install
-Proxy Support
GetHT supports HTTP, SOCKS4 & SOCKS5 proxys (though they haven't been
diff --git a/src/cli.c b/cli.c
index e1bedcf..156ff0b 100644
--- a/src/cli.c
+++ b/cli.c
@@ -1,27 +1,13 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#include <stdio.h>
#include <stdlib.h>
-#include "issue.h"
#include "getht.h"
void list_issues(iss ** issue, int no_of_issues, int verbose)
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..3251293
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,24 @@
+# See COPYING file for copyright, license and warranty details.
+
+VERSION = 0.2
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
+
+# includes and libs
+INCS = -I. -I/usr/include
+LIBS = -L/usr/lib -lc
+
+CURLINC = $(shell pkg-config --cflags libcurl)
+CURLLIB = $(shell pkg-config --libs libcurl)
+XMLINC = $(shell pkg-config --cflags libxml-2.0)
+XMLLIB = $(shell pkg-config --libs libxml-2.0)
+
+# flags
+#CFLAGS = -pedantic -Wall -Werror ${INCS} ${CURLINC} ${XMLINC} -DVERSION=\"${VERSION}\"
+CFLAGS = -std=c99 -Wall -Werror ${INCS} ${CURLINC} ${XMLINC} -DVERSION=\"${VERSION}\"
+LDFLAGS = ${LIBS} ${CURLLIB} ${XMLLIB}
+
+# compiler and linker
+CC = cc
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 6111c42..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.63])
-AC_INIT([getht], [0.2])
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([-Wall -Werror])
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_AWK
-AC_PROG_MAKE_SET
-
-# Checks for libraries.
-PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.0.0])
-PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.7.2])
-LIBS="$LIBXML2_LIBS $LIBCURL_LIBS $LIBS"
-CFLAGS="$LIBXML2_CFLAGS $LIBCURL_CFLAGS $CFLAGS"
-
-# Checks for header files.
-AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_TYPE_SIZE_T
-
-# Checks for library functions.
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
-AC_CHECK_FUNCS([mkdir])
-
-AC_CONFIG_FILES([Makefile
- doc/Makefile
- src/Makefile])
-AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index 5ab40eb..0000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-man1_MANS = getht.man
-##doc_DATA = *.txt
diff --git a/doc/RELEASING b/doc/RELEASING
deleted file mode 100644
index 6260e96..0000000
--- a/doc/RELEASING
+++ /dev/null
@@ -1,45 +0,0 @@
-== PROCEDURE FOR MAKING A NEW RELEASE ==
-
-- Version Number -
-1. Set version number in build system
- configure.ac
-2. Tag current commit in git
- git-tag -s vX.X
- git-push --tags
-
-- Source Tarball -
-1. Create a clean tarball, and sign & checksum it
- ./prepare-release.sh
-2. Upload tarball & related files
- scp getht-*.tar.bz2* <user>@dl.sv.nongnu.org:/releases/getht/
-
-- Webpages -
-1. Get downloads webpage
- wget http://download.savannah.gnu.org/releases/getht/
-2. Add new version information
-3. Upload updated webpage
- scp index.html <user>@dl.sv.nongnu.org:/releases/getht/
-4. Take screenshot of new version
-5. Upload new screenshot
- cvs commit
-
-- Infrastructure -
-1. Add to new version option to bug tracker
- https://savannah.nongnu.org/bugs/admin/field_values.php?group_id=9005&list_value=1&field=release_id
-
-- Announcement -
-1. Post news to mailing list
- getht-general@nongnu
-2. Post news to Savannah
- https://savannah.nongnu.org/news/submit.php?group=getht
-3. Post new version to the following directories:
- Freshmeat: http://freshmeat.net/add-release/64475/
- IceWalkers: http://www.icewalkers.com/submit.php?ID=3035
- SourceWell: http://sourcewell.berlios.de/updapp.php?id=3655
-
-- Clean up -
-1. Delete local copy of release files
- rm index.html getht-*.tar.bz2*
-
-- Packaging -
-1. Update packages maintained
diff --git a/src/download.c b/download.c
index a6dcc49..4aab15a 100644
--- a/src/download.c
+++ b/download.c
@@ -1,32 +1,21 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
#include "getht.h"
-#include "issue.h"
int read_func(void *ptr, size_t size, size_t nmemb, FILE *stream)
{ return fread(ptr, size, nmemb, stream); }
@@ -212,7 +201,7 @@ char * getissuedir(struct config * options, iss * issue)
{
char getht_path[STR_MAX];
snprintf(getht_path,STR_MAX,"%s/.getht",getenv("HOME"));
- updateconfig(getht_path, &options);
+ updateconfig(getht_path, options);
}
snprintf(newdir,STR_MAX,"%s/%i_%i-%i",options->save_path,
diff --git a/doc/getht.man b/getht.1
index 4c4b5a7..06b850c 100644
--- a/doc/getht.man
+++ b/getht.1
@@ -1,24 +1,4 @@
-.\" Copyright 2007,2008 Nick White
-.\"
-.\" This file is part of GetHT
-.\"
-.\" This is free documentation; you can redistribute it and/or modify
-.\" it under the terms of the GNU General Public License as published by
-.\" the Free Software Foundation; either version 3 of the License, or
-.\" (at your option) any later version.
-.\"
-.\" The GNU General Public License's references to "object code"
-.\" and "executables" are to be interpreted as the output of any
-.\" document formatting or typesetting system, including
-.\" intermediate and printed output.
-.\"
-.\" This manual is distributed in the hope that it will be useful,
-.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
-.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.\" GNU General Public License for more details.
-.\"
-.\" You should have received a copy of the GNU General Public License
-.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
+.\" See COPYING file for copyright, license and warranty details
.TH GETHT 1
.SH NAME
.B GetHT
diff --git a/src/getht.c b/getht.c
index de72384..57996c5 100644
--- a/src/getht.c
+++ b/getht.c
@@ -1,33 +1,20 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
-#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
#include <curl/curl.h>
-#include "issue.h"
#include "getht.h"
int update_contents_files(struct config * options);
@@ -133,7 +120,7 @@ int main(int argc, char *argv[])
option = 1;
break;
case 'V':
- printf("%s version: %s\n",PACKAGE_NAME, PACKAGE_VERSION);
+ printf("GetHT version: %s\n", VERSION);
option = 1;
return 0;
break;
@@ -196,7 +183,7 @@ int main(int argc, char *argv[])
printf("Downloading %s to %s\n", cursec->title, downdir);
- downloadsection(&options, cursec, &downdir, force);
+ downloadsection(&options, cursec, downdir, force);
}
else
downloadissue(&options, issue[downissueno], force);
diff --git a/getht.h b/getht.h
new file mode 100644
index 0000000..4ec9b01
--- /dev/null
+++ b/getht.h
@@ -0,0 +1,92 @@
+/*
+ * This file is part of GetHT
+ *
+ * See COPYING file for copyright, license and warranty details.
+ *
+ */
+
+#define XML_TOC_URI "http://www.hinduismtoday.com/digital/htde_toc.xml"
+
+#define ISS_XML_FILE "htde_toc.xml"
+
+#define STR_MAX 512
+
+#include <curl/curl.h>
+#include <libxml/xmlmemory.h>
+
+struct proxy_options {
+ char type;
+ char auth;
+ char address[STR_MAX];
+ long port;
+ char user[STR_MAX];
+ char pass[STR_MAX];
+};
+
+struct config {
+ char toc_xml[STR_MAX];
+ char issue_uri[STR_MAX];
+
+ char save_path[STR_MAX];
+
+ struct proxy_options proxy;
+
+ int startup_check;
+
+ int verbose;
+ int quiet;
+
+ CURL *curl_handle;
+};
+
+typedef struct
+{
+ int year;
+ int firstmonth;
+ int lastmonth;
+} issdates;
+
+typedef struct
+{
+ int firstpage;
+ int lastpage;
+ char * title;
+} it;
+
+typedef struct
+{
+ char uri[512];
+ char title[512];
+ int number;
+ int size;
+ it ** item;
+ int no_of_items;
+} sec;
+
+typedef struct
+{
+ char preview_uri[512];
+ char title[512];
+ int size;
+ issdates date;
+ sec ** section;
+ int no_of_sections;
+} iss;
+
+iss ** parsetoc(char *filepath, int * iss_no);
+
+iss ** assignnew_iss(iss ** issue, int *no_of_issues);
+sec ** assignnew_sec(sec ** section, int * no_of_sections);
+it ** assignnew_it(it ** item, int * no_of_items);
+
+int updateconfig(char * getht_path, struct config * options);
+int loadconfig(char * getht_path, struct config * options);
+int writefreshconfig(char * getht_path, struct config * options);
+void showusage();
+void downloadissue(struct config * options, iss * issue, int force);
+char * getissuedir(struct config * options, iss * issue);
+void downloadsection(struct config * options, sec * section, char * downdir, int force);
+void list_issues(iss ** issue, int no_of_issues, int verbose);
+int save_file(char *uri, char *filepath, char *filetitle, long resume_offset, struct config * options);
+int ready_xml(char * filepath, char * rootnode, xmlDocPtr * file, xmlNodePtr * node);
+int issuesort(iss ** issue, int no_of_issues);
diff --git a/src/issuemem.c b/issuemem.c
index 354c7d9..2aa7edb 100644
--- a/src/issuemem.c
+++ b/issuemem.c
@@ -1,27 +1,14 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#include <stdio.h>
#include <stdlib.h>
-#include "issue.h"
+#include "getht.h"
void nogo_mem()
/* called if memory assignation fails
diff --git a/src/config.c b/parseconfig.c
index b22e158..0bfda05 100644
--- a/src/config.c
+++ b/parseconfig.c
@@ -1,24 +1,12 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "getht.h"
@@ -129,14 +117,14 @@ int writefreshconfig(char * getht_path, struct config * options)
if(options->proxy.address[0])
fprintf(config_file, "%s = %s\n", "proxy_address", options->proxy.address);
if(options->proxy.port)
- fprintf(config_file, "%s = %i\n", "proxy_port", options->proxy.port);
+ fprintf(config_file, "%s = %li\n", "proxy_port", options->proxy.port);
if(options->proxy.auth)
{
- if(options->proxy.auth = CURLAUTH_BASIC)
+ if(options->proxy.auth == CURLAUTH_BASIC)
fprintf(config_file, "%s = %s\n", "proxy_auth", "basic");
- else if(options->proxy.auth = CURLAUTH_DIGEST)
+ else if(options->proxy.auth == CURLAUTH_DIGEST)
fprintf(config_file, "%s = %s\n", "proxy_auth", "digest");
- else if(options->proxy.auth = CURLAUTH_NTLM)
+ else if(options->proxy.auth == CURLAUTH_NTLM)
fprintf(config_file, "%s = %s\n", "proxy_auth", "ntlm");
}
if(options->proxy.user[0])
diff --git a/prepare-release.sh b/prepare-release.sh
deleted file mode 100755
index 23d4cab..0000000
--- a/prepare-release.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2006,2008 Nick White
-#
-# This file is part of GetHT.
-#
-# GetHT is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# GetHT is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GetHT. If not, see <http://www.gnu.org/licenses/>.
-
-TMPDIR="/tmp"
-ORIGDIR=$(pwd)
-
-VERSION=$(grep AC_INIT configure.ac | \
- awk -F \[ '{print $3}' | awk -F \] '{print $1}')
-
-echo Packaging GetHT version $VERSION
-
-echo Copying sources to a temporary directory
-rm -rf $TMPDIR/getht-$VERSION && \
-git clone . $TMPDIR/getht-$VERSION && \
-cd $TMPDIR/getht-$VERSION
-
-# ensure version number in configure.ac is set correctly
-sed -i "s|^AC_INIT(getht, .*)$|AC_INIT(getht, $VERSION)|" configure.ac
-
-echo Building necessary autotools parts
-autoreconf -i
-
-echo Cleaning make environment
-make clean
-
-echo Cleaning up working directory
-rm -rf autom4te.cache
-rm -rf .git* */.git*
-rm "$0"
-
-echo Packaging into a tarball
-cd ..
-tar -cjf getht-$VERSION.tar.bz2 getht-$VERSION
-
-echo Removing temporary directory
-rm -rf getht-$VERSION
-
-cd $ORIGDIR
-mv $TMPDIR/getht-$VERSION.tar.bz2 .
-
-echo Signing package
-gpg -b getht-$VERSION.tar.bz2
-
-echo Checksumming package
-sha1sum getht-$VERSION.tar.bz2 > getht-$VERSION.tar.bz2.sha1
-
-echo "Packaging of GetHT $VERSION complete."
-echo "The tarball resides at ./getht-$VERSION.tar.bz2"
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 546ae33..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-# ignore autotools creations
-.deps
-
-# ignore built binary
-getht
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index e6b2bc1..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-## A simple file to process with Automake, to produce Makefile.in
-
-bin_PROGRAMS = getht
-
-getht_SOURCES = config.c cli.c download.c getht.c issuemem.c \
- tocxml.c xml.c \
- getht.h issue.h version.h
diff --git a/src/getht.h b/src/getht.h
deleted file mode 100644
index 6a64b6e..0000000
--- a/src/getht.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2006,2008 Nick White
- *
- * This file is part of GetHT
- *
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#define XML_TOC_URI "http://www.hinduismtoday.com/digital/htde_toc.xml"
-
-#define ISS_XML_FILE "htde_toc.xml"
-
-#define STR_MAX 512
-
-#include <curl/curl.h>
-
-struct proxy_options {
- char type;
- char auth;
- char address[STR_MAX];
- long port;
- char user[STR_MAX];
- char pass[STR_MAX];
-};
-
-struct config {
- char toc_xml[STR_MAX];
- char issue_uri[STR_MAX];
-
- char save_path[STR_MAX];
-
- struct proxy_options proxy;
-
- int startup_check;
-
- int verbose;
- int quiet;
-
- CURL *curl_handle;
-};
diff --git a/src/issue.h b/src/issue.h
deleted file mode 100644
index 44f2601..0000000
--- a/src/issue.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2006,2008 Nick White
- *
- * This file is part of GetHT
- *
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-typedef struct
-{
- int year;
- int firstmonth;
- int lastmonth;
-} issdates;
-
-typedef struct
-{
- int firstpage;
- int lastpage;
- char * title;
-} it;
-
-typedef struct
-{
- char uri[512];
- char title[512];
- int number;
- int size;
- it ** item;
- int no_of_items;
-} sec;
-
-typedef struct
-{
- char preview_uri[512];
- char title[512];
- int size;
- issdates date;
- sec ** section;
- int no_of_sections;
-} iss;
-
-iss ** parsetoc(char *filepath, int * iss_no);
-
-iss ** assignnew_iss(iss ** issue, int *no_of_issues);
-sec ** assignnew_sec(sec ** section, int * no_of_sections);
-it ** assignnew_it(it ** item, int * no_of_items);
diff --git a/src/tocxml.c b/tocxml.c
index 60ef31b..ac75ec7 100644
--- a/src/tocxml.c
+++ b/tocxml.c
@@ -1,21 +1,8 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#include <stdio.h>
@@ -24,7 +11,6 @@
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
-#include "issue.h"
#include "getht.h"
iss ** parsetoc(char *filepath, int * iss_no);
@@ -50,18 +36,16 @@ iss ** parsetoc(char *filepath, int * iss_no)
iss ** issue = NULL;
- int year;
-
xmlNodePtr cnode;
while(node != NULL)
{
- if(!xmlStrncmp(node->name,(char *) "year",4))
+ if(!xmlStrncmp(node->name,(unsigned char *) "year",4))
{
cnode = node->children;
while(cnode != NULL)
{
- if(!xmlStrncmp(cnode->name,(char *) "issue",5))
+ if(!xmlStrncmp(cnode->name,(unsigned char *) "issue",5))
{
/* assign memory for the new issue */
issue = assignnew_iss(issue, &no_of_issues);
@@ -71,7 +55,7 @@ iss ** parsetoc(char *filepath, int * iss_no)
issue[no_of_issues]->date.year =
atoi( (const char *)(xmlStrsub(node->name,5,4)) );
tokenise_hyphons(
- xmlStrsub(cnode->name,6,5),
+ (char *) xmlStrsub(cnode->name,6,5),
&(issue[no_of_issues]->date.firstmonth),
&(issue[no_of_issues]->date.lastmonth));
@@ -96,13 +80,13 @@ iss ** parsetoc(char *filepath, int * iss_no)
int parseissue(xmlDocPtr file, xmlNodePtr node, iss * cur_issue)
/* parses issue from xml, saving in cur_issue structure */
{
- strncpy(cur_issue->title, (char *) xmlGetProp(node, "title"), STR_MAX);
- strncpy(cur_issue->preview_uri, (char *) xmlGetProp(node, "coverlink"), STR_MAX);
+ strncpy(cur_issue->title, (char *) xmlGetProp(node, (unsigned char *)"title"), STR_MAX);
+ strncpy(cur_issue->preview_uri, (char *) xmlGetProp(node, (unsigned char *) "coverlink"), STR_MAX);
node = node->xmlChildrenNode;
while(node != NULL){
- if(!xmlStrncmp(node->name, (char *) "section",7) ||
+ if(!xmlStrncmp(node->name, (unsigned char *) "section",7) ||
!xmlStrcmp(node->name, (const xmlChar *) "cover"))
{
/* assign memory for new section */
@@ -126,8 +110,8 @@ void parsesection(xmlDocPtr file, xmlNodePtr node, sec * cur_section)
{
it * cur_item = NULL;
- strncpy(cur_section->uri, (char *) xmlGetProp(node, "pdflink"), STR_MAX);
- strncpy(cur_section->title, (char *) xmlGetProp(node, "title"), STR_MAX);
+ strncpy(cur_section->uri, (char *) xmlGetProp(node, (unsigned char *) "pdflink"), STR_MAX);
+ strncpy(cur_section->title, (char *) xmlGetProp(node, (unsigned char *) "title"), STR_MAX);
if(!xmlStrcmp(node->name, (const xmlChar *) "cover"))
cur_section->number = 0;
@@ -138,8 +122,6 @@ void parsesection(xmlDocPtr file, xmlNodePtr node, sec * cur_section)
char * pagenums;
- it ** tmp = NULL;
-
while(node != NULL)
{
if(!xmlStrcmp(node->name, (const xmlChar *) "item"))
@@ -154,8 +136,8 @@ void parsesection(xmlDocPtr file, xmlNodePtr node, sec * cur_section)
cur_item = cur_section->item[cur_section->no_of_items];
/* parse item */
- cur_item->title = xmlNodeListGetString(file, node->xmlChildrenNode, 1);
- if(pagenums = (char *) xmlGetProp(node, "pages"))
+ cur_item->title = (char *) xmlNodeListGetString(file, node->xmlChildrenNode, 1);
+ if(pagenums == (char *) xmlGetProp(node, (unsigned char *) "pages"))
tokenise_hyphons(pagenums, &(cur_item->firstpage), &(cur_item->lastpage));
else
{
@@ -233,19 +215,19 @@ int cur_identifiers(char * filepath, char * title, issdates * date)
xmlChar *temp;
while(node != NULL)
{
- if(!xmlStrncmp(node->name,(char *) "year",4))
+ if(!xmlStrncmp(node->name,(unsigned char *) "year",4))
{
cnode = node->children;
while(cnode != NULL)
{
- if(!xmlStrncmp(cnode->name,(char *) "issue",5))
+ if(!xmlStrncmp(cnode->name,(unsigned char *) "issue",5))
{
- temp = xmlGetProp(cnode, "current");
+ temp = xmlGetProp(cnode, (unsigned char *) "current");
if(temp)
{
- strncpy(title, (char *) xmlGetProp(cnode, "title"), STR_MAX);
+ strncpy(title, (char *) xmlGetProp(cnode, (unsigned char *) "title"), STR_MAX);
date->year = atoi( (const char *)(xmlStrsub(node->name,5,4)) );
- tokenise_hyphons(xmlStrsub(cnode->name,6,5), &(date->firstmonth), &(date->lastmonth));
+ tokenise_hyphons((char *)xmlStrsub(cnode->name,6,5), &(date->firstmonth), &(date->lastmonth));
return 0;
}
}
diff --git a/src/xml.c b/xml.c
index 9d59cf4..d39ad5b 100644
--- a/src/xml.c
+++ b/xml.c
@@ -1,21 +1,8 @@
/*
- * Copyright 2006,2008 Nick White
- *
* This file is part of GetHT
*
- * GetHT is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * GetHT is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * See COPYING file for copyright, license and warranty details.
*
- * You should have received a copy of the GNU General Public License
- * along with GetHT. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#include <stdio.h>
@@ -24,7 +11,6 @@
#include <libxml/parser.h>
#include "getht.h"
-#include "issue.h"
int ready_xml(char * filepath, char * rootnode, xmlDocPtr * file, xmlNodePtr * node)
/* Opens filepath, filling nec pointers with essential information. */