summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Ewing <marc@redhat.com>1998-03-08 21:24:45 +0000
committerrhlabs <rhlabs>1998-03-08 21:24:45 +0000
commitb3b1989c00dbeaf47f10fbecd2ff3fb9717e7554 (patch)
treec823ad7e9c9d81dcd49dd33fd0f87d76e04c4a2e
parent8ddd248e79ac6d516b9222f784d7d5035ec9d71b (diff)
downloadyelp-b3b1989c00dbeaf47f10fbecd2ff3fb9717e7554.tar.gz
Misc cleanups of gnome-helpwin, gnome-info2html, gnome-man2html, my bogus
1998-03-08 Marc Ewing <marc@redhat.com> * Misc cleanups of gnome-helpwin, gnome-info2html, gnome-man2html, my bogus function casts. * Rework some of docobj to handle binary data. Now the raw/conv data is *not* NULL terminated! * Added simple (stupid) http transport.
-rw-r--r--src/info2html/data.h6
-rw-r--r--src/info2html/html.c6
-rw-r--r--src/info2html/main.c6
-rw-r--r--src/man2html/yelp-man2html.c156
4 files changed, 10 insertions, 164 deletions
diff --git a/src/info2html/data.h b/src/info2html/data.h
index 581e4ca5..60a2ce74 100644
--- a/src/info2html/data.h
+++ b/src/info2html/data.h
@@ -4,12 +4,6 @@
/* data.h - first cut at data structures for info2html filter */
/* many of these are motivated by the source code to the 'info' program */
-/* be quiet or not? */
-static int be_quiet=1;
-
-/* line_number we're on */
-static int work_line_number;
-
/* file we're working on */
char work_filename[1024];
diff --git a/src/info2html/html.c b/src/info2html/html.c
index 90c2e2fb..802a4b87 100644
--- a/src/info2html/html.c
+++ b/src/info2html/html.c
@@ -202,10 +202,10 @@ void html_error( char *s, char *p, char *q )
void dump_html_for_node( NODE *node )
{
- char *destdir;
- char *destfile;
+/* char *destdir; */
+/* char *destfile; */
char *escaped_nodename;
- char *converted_nodename;
+/* char *converted_nodename; */
char *contents_start, *contents_end;
char *header_name;
char *p, *q, *r, *skippnt;
diff --git a/src/info2html/main.c b/src/info2html/main.c
index a490a24b..4bae84aa 100644
--- a/src/info2html/main.c
+++ b/src/info2html/main.c
@@ -10,6 +10,12 @@
#include "utils.h"
#include "version.h"
+/* be quiet or not? */
+static int be_quiet=1;
+
+/* line_number we're on */
+static int work_line_number;
+
int
main(int argc, char **argv)
{
diff --git a/src/man2html/yelp-man2html.c b/src/man2html/yelp-man2html.c
index 05bb0fa1..bf40671e 100644
--- a/src/man2html/yelp-man2html.c
+++ b/src/man2html/yelp-man2html.c
@@ -157,20 +157,6 @@
*/
#define free(x)
-static char *sections = "123456789nl";
-
-
-static char
-*strgrow(char *old, int len)
-{
- char *new = realloc(old, (strlen(old) + len + 1) * sizeof(char));
- if (!new) {
- fprintf(stderr, "man2html: out of memory");
- exit(EXIT_FAILURE);
- }
- return new;
-}
-
static char
*stralloc(int len)
{
@@ -184,17 +170,6 @@ static char
}
static char
-*strduplicate(char *from)
-{
-/* Some systems don't have strdup so lets use our own - which can also
- * check for out of memory.
- */
- char *new = stralloc(strlen(from));
- strcpy(new, from);
- return new;
-}
-
-static char
*strmaxcpy(char *to, char *from, int n)
{ /* Assumes space for n plus a null */
int len = strlen(from);
@@ -204,19 +179,6 @@ static char
}
static char
-*strmaxcat(char *to, char *from, int n)
-{ /* Assumes space for n plus a null */
- int to_len = strlen(to);
- if (to_len < n) {
- int from_len = strlen(from);
- int cp = (to_len + from_len <= n) ? from_len : n - to_len;
- strncpy(to + to_len, from, cp);
- to[to_len + cp] = '\0';
- }
- return to;
-}
-
-static char
*strlimitcpy(char *to, char *from, int n, int limit)
{ /* Assumes space for limit plus a null */
int len = n > limit ? limit : n;
@@ -225,36 +187,6 @@ static char
return to;
}
-static char
-*escape_input(char *str)
-/* takes string and escapes all metacharacters. should be used before
- including string in system() or similar call. */
-{
- int i,j = 0;
- static char new[NULL_TERMINATED(MED_STR_MAX)];
-
- if (strlen(str) * 2 + 1 > MED_STR_MAX) {
- fprintf(stderr,
- "man2html: escape_input - str too long:\n%-80s...\n",
- str);
- exit(EXIT_FAILURE);
- }
-
- for (i = 0; i < strlen(str); i++) {
- if (!( ((str[i] >= 'A') && (str[i] <= 'Z')) ||
- ((str[i] >= 'a') && (str[i] <= 'z')) ||
- ((str[i] >= '0') && (str[i] <= '9')) )) {
- new[j] = '\\';
- j++;
- }
- new[j] = str[i];
- j++;
- }
- new[j] = '\0';
- return new;
-}
-
-
/* below this you should not change anything unless you know a lot
** about this program or about troff.
*/
@@ -3677,98 +3609,12 @@ static char
return ret;
}
-
-static char *sectionname=NULL;
-static STRDEF *foundpages=NULL;
-
-static void get_man_config()
-{
-#ifdef MAN_CONFIG
- FILE *config = NULL;
- int num_paths = 1; /* Zero is reserved for searches */
- int num_zcats = 0;
- char buffer[NULL_TERMINATED(MED_STR_MAX + 1)];
- /* Allow for adding a "/" */
-
- config = fopen(MAN_CONFIG, "r");
- if (!config)
- return; /* Assume no config. */
-
- while (fgets(buffer, MED_STR_MAX, config)) {
- char *dir, *line = buffer;
- line = line + strspn(line, " \t"); /* Skip spaces and tabs */
- if (num_paths < MAX_MAN_PATHS
- && strncmp("MANPATH", line, 7) == 0
- && (dir = strchr(line, '/'))) { /* dir points to start
- of dir-name */
- char *end_dir = strpbrk(dir, " \t\n") ;
- if (end_dir) { /* End of dir name. */
- (*end_dir) = '/'; /* Replace newline/space
- with "/" */
- (*(end_dir + 1)) = '\0';
- }
- manpath[num_paths] = strduplicate(dir);
- num_paths++;
- }
-#ifndef DISABLE_ZCATS
- else if (num_zcats < MAX_ZCATS
- && *line == '.') {
- char *sp, *new;
- line[strlen(line) - 1] = '\0'; /* Remove newline */
- zcats[num_zcats] = strduplicate(line);
- sp = strpbrk(zcats[num_zcats], " \t");
- if (sp) { /* Chop off trailing spaces */
- (*sp) = '\0';
- num_zcats++;
- } else {
- free(zcats[num_zcats]);
- }
- }
-#endif
- }
- if (num_paths != 0) { /* Mark new end of paths list */
- manpath[num_paths] = NULL;
- }
-#ifndef DISABLE_ZCATS
- if (num_zcats != 0) { /* Mark new end of zcats list */
- zcats[num_zcats] = NULL;
- }
-#endif
-
-#ifndef UNSECURE_MANPATH
- /* Make sure settable first path is
- * a valid path.
- */
-
- if (strcmp(manpath[0], "/") != 0) {
- /* Something other than default */
- int i;
- for (i = 1; manpath[i]; i++) {
- /* Set - see if it is a valid prefix */
- if (strncmp(manpath[i], manpath[0],
- strlen(manpath[i])) == 0) {
- break; /* valid */
- }
- }
- /* Also check for .. */
- if (!manpath[i] ||
- strstr(manpath[0], "..") != NULL) { /* invalid */
- fprintf(stderr, "man2html: invalid -M path: "
- "%s\n", manpath[0]);
- manpath[0] = manpath[1];
- }
- }
-#endif
- fclose(config);
-#endif
-}
-
void
main(int argc, char **argv)
{
char *t=NULL;
int i;char *buf;
- char *h, *fullname;
+ char *h = '\0';
STRDEF *stdf;