diff options
Diffstat (limited to 'contrib/global/gozilla')
-rw-r--r-- | contrib/global/gozilla/Imakefile | 22 | ||||
-rw-r--r-- | contrib/global/gozilla/gozilla.c | 68 | ||||
-rw-r--r-- | contrib/global/gozilla/gozilla.man | 4 | ||||
-rw-r--r-- | contrib/global/gozilla/remote.c | 2 |
4 files changed, 73 insertions, 23 deletions
diff --git a/contrib/global/gozilla/Imakefile b/contrib/global/gozilla/Imakefile index 5bcbc01e03cc..035c5443cbde 100644 --- a/contrib/global/gozilla/Imakefile +++ b/contrib/global/gozilla/Imakefile @@ -2,11 +2,23 @@ XCOMM XCOMM Imakefile for gozilla XCOMM -LOCAL_LIBRARIES = XawClientLibs -L../lib -lutil - DEPLIBS = XawClientDepLibs ../lib/libutil.a - DEFINES = -DSTANDALONE -DGLOBAL -I../lib + INC = ../lib +LOCAL_LIBRARIES = XawClientLibs + DEPLIBS = XawClientDepLibs + DEFINES = -DSTANDALONE -DGLOBAL -I$(INC) - SRCS = gozilla.c remote.c - OBJS = gozilla.o remote.o + SRCS = gozilla.c remote.c test.c getdbpath.c strbuf.c conf.c \ + mgets.c locatestring.c makepath.c strmake.c + OBJS = gozilla.o remote.o test.o getdbpath.o strbuf.o conf.o \ + mgets.o locatestring.o makepath.o strmake.o + +LinkSourceFile(test.c,$(INC)) +LinkSourceFile(getdbpath.c,$(INC)) +LinkSourceFile(strbuf.c,$(INC)) +LinkSourceFile(conf.c,$(INC)) +LinkSourceFile(mgets.c,$(INC)) +LinkSourceFile(locatestring.c,$(INC)) +LinkSourceFile(makepath.c,$(INC)) +LinkSourceFile(strmake.c,$(INC)) ComplexProgramTarget(gozilla) diff --git a/contrib/global/gozilla/gozilla.c b/contrib/global/gozilla/gozilla.c index fd43bbf6150d..32d4730d21d8 100644 --- a/contrib/global/gozilla/gozilla.c +++ b/contrib/global/gozilla/gozilla.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1997 Shigio Yamaguchi. All rights reserved. + * Copyright (c) 1996, 1997, 1998 Shigio Yamaguchi. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,17 +28,20 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * gozilla.c 27-Oct-97 + * gozilla.c 17-Jul-98 * */ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "global.h" -char *progname = "gozilla"; /* command name */ +const char *progname = "gozilla"; /* command name */ static void usage __P((void)); -void main __P((int, char **)); + +int main __P((int, char **)); +int issource __P((char *)); int sendcommand __P((char *)); int bflag; @@ -54,17 +57,17 @@ usage() exit(1); } -void +int main(argc, argv) int argc; char *argv[]; { char c, *p, *q; - char *browser = (char *)0; - char *command = (char *)0; - char *arg = (char *)0; + char *browser = NULL; + char *command = NULL; + char *arg = NULL; char URL[MAXPATHLEN+1]; - char com[MAXCOMLINE+1]; + char com[MAXFILLEN+1]; int linenumber = 0; int status; @@ -101,16 +104,19 @@ char *argv[]; } if (argc == 0) usage(); - if (locatestring(argv[0], "http:", 1) || locatestring(argv[0], "file:", 1)) + if (locatestring(argv[0], "http:", MATCH_AT_FIRST) || + locatestring(argv[0], "ftp:", MATCH_AT_FIRST) || + locatestring(argv[0], "news:", MATCH_AT_FIRST) || + locatestring(argv[0], "mail:", MATCH_AT_FIRST) || + locatestring(argv[0], "file:", MATCH_AT_FIRST)) strcpy(URL, argv[0]); else { char *abspath; - char pathbuf[MAXPATHLEN+1]; - char htmlpath[MAXPATHLEN+1]; + char buf[MAXPATHLEN+1]; - if (!test("f", argv[0]) && !test("d", argv[0])) + if (!test("f", argv[0]) && !test("d", NULL)) die1("path '%s' not found.", argv[0]); - if (!(abspath = realpath(argv[0], pathbuf))) + if (!(abspath = realpath(argv[0], buf))) die1("cannot make absolute path name. realpath(%s) failed.", argv[0]); if (*abspath != '/') die("realpath(3) is not compatible with BSD version."); @@ -152,7 +158,7 @@ char *argv[]; /* * execute generic browser. */ - if (browser && !locatestring(browser, "netscape", 3)) { + if (browser && !locatestring(browser, "netscape", MATCH_AT_LAST)) { sprintf(com, "%s '%s'", browser, URL); system(com); exit (0); @@ -171,7 +177,7 @@ char *argv[]; if ((pid = fork()) < 0) { die("cannot execute netscape (fork)."); } else if (pid == 0) { - execlp("netscape", "netscape", URL, (char *)0); + execlp("netscape", "netscape", URL, NULL); die("loading mozilla failed."); } exit(0); @@ -179,6 +185,34 @@ char *argv[]; exit(status); } int +issource(path) +char *path; +{ + STRBUF *sb = stropen(); + char *p; + char suff[MAXPATHLEN+1]; + int retval = 0; + + if (!getconfs("suffixes", sb)) { + strclose(sb); + return 0; + } + suff[0] = '.'; + for (p = strvalue(sb); p; ) { + char *unit = p; + if ((p = locatestring(p, ",", MATCH_FIRST)) != NULL) + *p++ = 0; + strcpy(&suff[1], unit); + if (locatestring(path, suff, MATCH_AT_LAST)) { + retval = 1; + break; + } + } + strclose(sb); + return retval; + +} +int sendcommand(com) char *com; { @@ -188,7 +222,7 @@ char *com; argv[0] = "netscape-remote"; argv[1] = "-remote"; argv[2] = com; - argv[3] = (char *)0; + argv[3] = NULL; return netscape_remote(argc, argv); } diff --git a/contrib/global/gozilla/gozilla.man b/contrib/global/gozilla/gozilla.man index 1065529e1f07..39e257fd2b3b 100644 --- a/contrib/global/gozilla/gozilla.man +++ b/contrib/global/gozilla/gozilla.man @@ -139,3 +139,7 @@ can treat not only source file but also normal file, directory, HTML file and even URL, because it is omnivorous. .Sh AUTHORS Shigio Yamaguchi (shigio@wafu.netgate.net) +.Sh HISTORY +The +.Nm +command appeared in FreeBSD 2.2.5. diff --git a/contrib/global/gozilla/remote.c b/contrib/global/gozilla/remote.c index d2e6a3417ce8..ebc08d7ca109 100644 --- a/contrib/global/gozilla/remote.c +++ b/contrib/global/gozilla/remote.c @@ -586,7 +586,7 @@ usage (void) int netscape_remote(int argc, char **argv) #else -void +int main (int argc, char **argv) #endif { |