diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-06-12 07:27:12 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-06-12 07:27:12 +0000 |
commit | 476e9367ec1f440aa23904b7bc482ea4a3b8041c (patch) | |
tree | 4f7f5a5e9a6668f908834bb6e216c8fa3727d4b3 /lib-src | |
parent | a13f8f50d4cc544d3bbfa78568e82ce09e68bded (diff) | |
parent | 6b519504c3297595101628e823e72c91e562ab45 (diff) | |
download | emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.gz emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.bz2 emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.zip |
Merged from emacs@sv.gnu.org.
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-294
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-295
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-296
Update from CVS: admin/FOR-RELEASE: Update refcard section.
* emacs@sv.gnu.org/emacs--devo--0--patch-297
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-298
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-299
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-300
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-301
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-302
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-303
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-304
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-103
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-104
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/ChangeLog | 37 | ||||
-rw-r--r-- | lib-src/Makefile.in | 5 | ||||
-rw-r--r-- | lib-src/digest-doc.c | 11 | ||||
-rw-r--r-- | lib-src/ebrowse.c | 22 | ||||
-rw-r--r-- | lib-src/leditcfns.c | 21 | ||||
-rw-r--r-- | lib-src/makefile.w32-in | 34 | ||||
-rw-r--r-- | lib-src/sorted-doc.c | 14 | ||||
-rw-r--r-- | lib-src/yow.c | 185 |
8 files changed, 99 insertions, 230 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 9ba3191ed46..040f155221f 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,40 @@ +2006-06-09 Eli Zaretskii <eliz@gnu.org> + + * yow.c: Remove file. + + * makefile.w32-in ($(BLD)/yow.$(O)): Remove target. + + * Makefile.in (UTILITIES): Remove yow${EXEEXT}. + yow${EXEEXT}: Remove target. + +2006-06-04 Masatake YAMATO <jet@gyve.org> + + * ebrowse.c (main): Exit with EXIT_FAILURE if BROWSE file + doesn't exist, is not seekable, not is failed in ftall. + +2006-06-03 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in (ALL): Add sorted-doc and digest-doc. + ($(BLD)/sorted-doc.exe, $(BLD)/digest-doc.exe) + ($(BLD)/test-distrib.exe): New targets. + (sorted-doc, digest-doc, test-distrib): New targets. + (install): Install sorted-doc.exe and digest-doc.exe. + ($(BLD)/sorted-doc.$(O)): Update dependencies. + + * digest-doc.c [DOS_NT] <top level>: Include fcntl.h and io.h. + (main) [DOS_NT]: Switch stdin to binary mode, if it is not a + terminal device. + + * sorted-doc.c [DOS_NT] <top level>: Include fcntl.h and io.h. + [WINDOWSNT] <top level>: Don't redeclare malloc. + (main) [DOS_NT]: Switch stdin to binary mode, if it is not a + terminal device. + (main): Initialize bp, to avoid compiler warnings + + * makefile.w32-in: Delete traces of leditcfns.c. + + * leditcfns.c: Remove file. + 2006-05-23 Francesco Potort,Al(B <pot@gnu.org> * pop.c (pop_open, socket_connection, KPOP_SERVICE): Added diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 85a7c13c95a..4eb1658ac0a 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -107,7 +107,7 @@ INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog # Things that Emacs runs internally, or during the build process, # which should not be installed in bindir. UTILITIES= profile${EXEEXT} digest-doc${EXEEXT} sorted-doc${EXEEXT} movemail${EXEEXT} cvtmail${EXEEXT} fakemail${EXEEXT} \ - yow${EXEEXT} hexl${EXEEXT} update-game-score${EXEEXT} + hexl${EXEEXT} update-game-score${EXEEXT} DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT} @@ -449,9 +449,6 @@ cvtmail${EXEEXT}: ${srcdir}/cvtmail.c fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail -yow${EXEEXT}: ${srcdir}/yow.c ../src/epaths.h - $(CC) ${ALL_CFLAGS} ${srcdir}/yow.c $(LOADLIBES) -o yow - emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h $(GETOPTDEPS) $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c $(GETOPTOBJS) \ -DVERSION="\"${version}\"" \ diff --git a/lib-src/digest-doc.c b/lib-src/digest-doc.c index 7b5a9677e7c..7787d422e39 100644 --- a/lib-src/digest-doc.c +++ b/lib-src/digest-doc.c @@ -26,12 +26,23 @@ #include <stdio.h> +#ifdef DOS_NT +#include <fcntl.h> /* for O_BINARY */ +#include <io.h> /* for setmode */ +#endif + int main () { register int ch; register int notfirst = 0; +#ifdef DOS_NT + /* DOC is a binary file. */ + if (!isatty (fileno (stdin))) + setmode (fileno (stdin), O_BINARY); +#endif + printf (".TL\n"); printf ("Command Summary for GNU Emacs\n"); printf (".AU\nRichard M. Stallman\n"); diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 94fa9114d23..398dd10896e 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -3909,17 +3909,31 @@ main (argc, argv) fp = fopen (out_filename, "r"); if (fp == NULL) - yyerror ("file `%s' must exist for --append", out_filename); + { + yyerror ("file `%s' must exist for --append", out_filename); + exit (EXIT_FAILURE); + } rc = fseek (fp, 0, SEEK_END); if (rc == -1) - yyerror ("error seeking in file `%s'", out_filename); + { + yyerror ("error seeking in file `%s'", out_filename); + exit (EXIT_FAILURE); + } rc = ftell (fp); if (rc == -1) - yyerror ("error getting size of file `%s'", out_filename); + { + yyerror ("error getting size of file `%s'", out_filename); + exit (EXIT_FAILURE); + } + else if (rc == 0) - yyerror ("file `%s' is empty", out_filename); + { + yyerror ("file `%s' is empty", out_filename); + /* It may be ok to use an empty file for appending. + exit (EXIT_FAILURE); */ + } fclose (fp); } diff --git a/lib-src/leditcfns.c b/lib-src/leditcfns.c deleted file mode 100644 index 239db1cd1fa..00000000000 --- a/lib-src/leditcfns.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <sgtty.h> -#include <signal.h> -#define STRLEN 100 -static char str[STRLEN+1] = "%?emacs"; /* extra char for the null */ - -switch_to_proc(){ - char *ptr = str; - while (*ptr) ioctl(0, TIOCSTI, ptr++); - ioctl(0, TIOCSTI, "\n"); - kill(getpid(), SIGTSTP); - } - -set_proc_str(ptr) char *ptr; { - if (strlen(ptr) <= STRLEN) - strcpy(str, ptr); - else - printf("string too long for set-proc-str: %s\n", ptr); - } - -/* arch-tag: eb7ae804-0d6e-4077-ab42-7173821410c3 - (do not change this comment) */ diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 6aa15964f45..96464e39506 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -20,7 +20,7 @@ # Boston, MA 02110-1301, USA. # -ALL = make-docfile hexl ctags etags movemail ebrowse +ALL = make-docfile hexl ctags etags movemail ebrowse sorted-doc digest-doc .PHONY: $(ALL) @@ -30,15 +30,10 @@ LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \ # don't know what (if) to do with these yet... # -# $(BLD)/sorted-doc.exe \ -# $(BLD)/env.exe \ # $(BLD)/server.exe \ # $(BLD)/emacstool.exe \ -# $(BLD)/leditcfns.exe \ # $(BLD)/emacsclient.exe \ # $(BLD)/cvtmail.exe \ -# $(BLD)/digest-doc.exe \ -# $(BLD)/test-distrib.exe \ LIBS = $(BASE_LIBS) $(ADVAPI32) @@ -48,6 +43,12 @@ $(BLD)/hexl.exe: $(BLD)/hexl.$(O) $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS) $(BLD)/fakemail.exe: $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O) $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O) $(LIBS) +$(BLD)/sorted-doc.exe: $(BLD)/sorted-doc.$(O) + $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/sorted-doc.$(O) $(LIBS) +$(BLD)/digest-doc.exe: $(BLD)/digest-doc.$(O) + $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/digest-doc.$(O) $(LIBS) +$(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) + $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS) make-docfile: $(BLD) $(BLD)/make-docfile.exe ctags: $(BLD) $(BLD)/ctags.exe @@ -56,6 +57,11 @@ ebrowse: $(BLD) $(BLD)/ebrowse.exe hexl: $(BLD) $(BLD)/hexl.exe movemail: $(BLD) $(BLD)/movemail.exe fakemail: $(BLD) $(BLD)/fakemail.exe +sorted-doc: $(BLD) $(BLD)/sorted-doc.exe +digest-doc: $(BLD) $(BLD)/digest-doc.exe + +test-distrib: $(BLD) $(BLD)/test-distrib.exe + "$(BLD)/test-distrib.exe" "$(SRC)/testfile" GETOPTOBJS = $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O) GETOPTDEPS = $(GETOPTOBJS) getopt.h @@ -114,15 +120,10 @@ $(BLD)/ctags.$(O): ctags.c # # don't know what to do with these yet... # -# $(BLD)/sorted-doc.exe: $(BLD)/sorted-doc.$(O) -# $(BLD)/yow.exe: $(BLD)/yow.$(O) # $(BLD)/emacstool.exe: $(BLD)/emacstool.$(O) -# $(BLD)/leditcfns.exe: $(BLD)/leditcfns.$(O) # $(BLD)/server.exe: $(BLD)/server.$(O) # $(BLD)/cvtmail.exe: $(BLD)/cvtmail.$(O) -# $(BLD)/digest-doc.exe: $(BLD)/digest-doc.$(O) # $(BLD)/emacsclient.exe: $(BLD)/emacsclient.$(O) -# $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) # # From ..\src\Makefile.in @@ -293,6 +294,8 @@ install: $(INSTALL_FILES) $(CP) $(BLD)/ctags.exe $(INSTALL_DIR)/bin $(CP) $(BLD)/hexl.exe $(INSTALL_DIR)/bin $(CP) $(BLD)/movemail.exe $(INSTALL_DIR)/bin + $(CP) $(BLD)/sorted-doc.exe $(INSTALL_DIR)/bin + $(CP) $(BLD)/digest-doc.exe $(INSTALL_DIR)/bin - mkdir "$(INSTALL_DIR)/etc" $(CP) $(DOC) $(INSTALL_DIR)/etc @@ -448,7 +451,10 @@ $(BLD)/qsort.$(O) : \ $(SRC)/qsort.c $(BLD)/sorted-doc.$(O) : \ - $(SRC)/sorted-doc.c + $(SRC)/sorted-doc.c \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/m/intel386.h \ + $(EMACS_ROOT)/src/config.h \ $(BLD)/tcp.$(O) : \ $(SRC)/tcp.c @@ -461,7 +467,3 @@ $(BLD)/timer.$(O) : \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/lib-src/../src/config.h - -$(BLD)/yow.$(O) : \ - $(SRC)/yow.c \ - $(EMACS_ROOT)/lib-src/../src/paths.h diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index 0a06aa2c984..a8b2d441f9a 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c @@ -29,9 +29,15 @@ #include <stdio.h> #include <ctype.h> +#ifdef DOS_NT +#include <fcntl.h> /* for O_BINARY */ +#include <io.h> /* for setmode */ +#endif #ifndef HAVE_STDLIB_H /* config.h includes stdlib. */ +#ifndef WINDOWSNT /* src/s/ms-w32.h includes stdlib.h */ extern char *malloc (); #endif +#endif #define NUL '\0' #define MARKER '\037' @@ -134,6 +140,14 @@ main () DOCSTR *docs = NULL; /* chain of allocated DOCSTRS */ char buf[512]; /* line buffer */ +#ifdef DOS_NT + /* DOC is a binary file. */ + if (!isatty (fileno (stdin))) + setmode (fileno (stdin), O_BINARY); +#endif + + bp = buf; + while (1) /* process one char at a time */ { /* this char from the DOCSTR file */ diff --git a/lib-src/yow.c b/lib-src/yow.c deleted file mode 100644 index 18f0f7b2e13..00000000000 --- a/lib-src/yow.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * yow.c - * - * Print a quotation from Zippy the Pinhead. - * Qux <Kaufman-David@Yale> March 6, 1986 - * - * This file is in the public domain because the author published it - * with no copyright notice before the US signed the Bern Convention. - * - * With dynamic memory allocation. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <ctype.h> -#ifdef TIME_WITH_SYS_TIME -#include <sys/time.h> -#include <time.h> -#else -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#else -#include <time.h> -#endif -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include "epaths.h" /* For PATH_DATA. */ - -#define BUFSIZE 80 -#define SEP '\0' - -#ifndef YOW_FILE -#define YOW_FILE "yow.lines" -#endif - -#ifdef MSDOS -#define rootrelativepath(rel) \ -({\ - static char res[BUFSIZE], *p;\ - strcpy (res, argv[0]);\ - p = res + strlen (res);\ - while (p != res && *p != '/' && *p != '\\' && *p != ':') p--;\ - strcpy (p + 1, "../");\ - strcpy (p + 4, rel);\ - &res;}) -#endif - -void yow(); -void setup_yow(); - -int -main (argc, argv) - int argc; - char *argv[]; -{ - FILE *fp; - char file[BUFSIZ]; - - if (argc > 2 && !strcmp (argv[1], "-f")) - strcpy (file, argv[2]); - else -#ifdef vms - sprintf (file, "%s%s", PATH_DATA, YOW_FILE); -#else - sprintf (file, "%s/%s", PATH_DATA, YOW_FILE); -#endif - - if ((fp = fopen(file, "r")) == NULL) { - fprintf(stderr, "yow: "); - perror(file); - exit(EXIT_FAILURE); - } - - /* initialize random seed */ - srand((int) (getpid() + time((time_t *) 0))); - - setup_yow(fp); - yow(fp); - fclose(fp); - return EXIT_SUCCESS; -} - -static long len = -1; -static long header_len; - -#define AVG_LEN 40 /* average length of a quotation */ - -/* Sets len and header_len */ -void -setup_yow(fp) - FILE *fp; -{ - int c; - - /* Get length of file */ - /* Because the header (stuff before the first SEP) can be very long, - * thus biasing our search in favor of the first quotation in the file, - * we explicitly skip that. */ - while ((c = getc(fp)) != SEP) { - if (c == EOF) { - fprintf(stderr, "yow: file contains no separators\n"); - exit(EXIT_FAILURE); - } - } - header_len = ftell(fp); - if (header_len > AVG_LEN) - header_len -= AVG_LEN; /* allow the first quotation to appear */ - - if (fseek(fp, 0L, 2) == -1) { - perror("yow"); - exit(EXIT_FAILURE); - } - len = ftell(fp) - header_len; -} - - -/* go to a random place in the file and print the quotation there */ -void -yow (fp) - FILE *fp; -{ - long offset; - int c, i = 0; - char *buf; - unsigned int bufsize; - - offset = rand() % len + header_len; - if (fseek(fp, offset, 0) == -1) { - perror("yow"); - exit(EXIT_FAILURE); - } - - /* Read until SEP, read next line, print it. - (Note that we will never print anything before the first separator.) - If we hit EOF looking for the first SEP, just recurse. */ - while ((c = getc(fp)) != SEP) - if (c == EOF) { - yow(fp); - return; - } - - /* Skip leading whitespace, then read in a quotation. - If we hit EOF before we find a non-whitespace char, recurse. */ - while (isspace(c = getc(fp))) - ; - if (c == EOF) { - yow(fp); - return; - } - - bufsize = BUFSIZE; - buf = (char *) malloc(bufsize); - if (buf == (char *)0) { - fprintf(stderr, "yow: virtual memory exhausted\n"); - exit (EXIT_FAILURE); - } - - buf[i++] = c; - while ((c = getc(fp)) != SEP && c != EOF) { - buf[i++] = c; - - if (i == bufsize-1) { - /* Yow! Is this quotation too long yet? */ - bufsize *= 2; - buf = (char *) realloc(buf, bufsize); - if (buf == (char *)0) { - fprintf(stderr, "yow: virtual memory exhausted\n"); - exit (EXIT_FAILURE); - } - } - } - buf[i++] = 0; - printf("%s\n", buf); - free (buf); -} - -/* arch-tag: e40fc0df-bafb-4001-af24-5c883d1c685e - (do not change this comment) */ - -/* yow.c ends here */ |