diff -c info/dribble.c d:info/dribble.c *** info/dribble.c Mon Feb 01 19:50:46 1993 --- d:info/dribble.c Mon Jul 05 18:44:46 1993 *************** *** 1,4 **** --- 1,5 ---- /* dribble.c -- Dribble files for Info. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 37,43 **** --- 38,48 ---- /* Perhaps close existing dribble file. */ close_dribble_file (); + #ifdef EMX + info_dribble_file = fopen (name, "wb"); + #else info_dribble_file = fopen (name, "w"); + #endif #if defined (HAVE_SETVBUF) if (info_dribble_file) diff -c info/filesys.c d:info/filesys.c *** info/filesys.c Fri May 21 21:51:42 1993 --- d:info/filesys.c Mon Jul 05 20:21:38 1993 *************** *** 1,4 **** --- 1,5 ---- /* filesys.c -- File system specific functions for hacking this system. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 30,35 **** --- 31,45 ---- #include "tilde.h" #include "filesys.h" + #ifdef EMX + #define COLONCHR ';' + #define COLONSTR ";" + #include + #else /* !EMX */ + #define COLONCHR ':' + #define COLONSTR ":" + #endif /* !EMX */ + #if !defined (O_RDONLY) #if defined (HAVE_SYS_FCNTL_H) #include *************** *** 55,60 **** --- 65,73 ---- /* Local to this file. */ static char *info_file_in_path (), *lookup_info_filename (); + #ifdef EMX + static char *info_check_file (); + #endif /* EMX */ static void remember_info_filename (), maybe_initialize_infopath (); #if !defined (NULL) *************** *** 70,82 **** --- 83,105 ---- "", ".info", "-info", + #ifdef EMX + ".inf", + #endif (char *)NULL }; static COMPRESSION_ALIST compress_suffixes[] = { + #ifdef EMX + { ".z", "gzip -d" }, + { ".gz", "gzip -d" }, + { ".Z", "compress -d" }, + { ".Y", "yabba -d" }, + #else /* !EMX */ { ".Z", "uncompress" }, { ".Y", "unyabba" }, { ".z", "gunzip" }, + #endif /* !EMX */ { (char *)NULL, (char *)NULL } }; *************** *** 117,129 **** --- 140,162 ---- various extensions to it. I guess we have to stat this file after all. */ if (initial_character == '/') + #ifdef EMX + temp = info_check_file (partial); + else if (_fngetdrive (partial) != 0) + temp = info_check_file (partial); + #else /* !EMX */ temp = info_file_in_path (partial + 1, "/"); + #endif /* !EMX */ else if (initial_character == '~') { expansion = tilde_expand_word (partial); if (*expansion == '/') { + #ifdef EMX + temp = info_check_file (expansion); + #else /* !EMX */ temp = info_file_in_path (expansion + 1, "/"); + #endif /* !EMX */ free (expansion); } else *************** *** 147,153 **** --- 180,192 ---- strcat (local_temp_filename, "/"); strcat (local_temp_filename, partial); + #ifdef EMX + temp = info_check_file (local_temp_filename); + free (local_temp_filename); + return (temp); + #else /* !EMX */ return (local_temp_filename); + #endif /* !EMX */ } else temp = info_file_in_path (partial, infopath); *************** *** 174,188 **** --- 213,234 ---- info_file_in_path (filename, path) char *filename, *path; { + #ifdef EMX + char *temp_dirname, *final_name; + int dirname_index; + #else /* !EMX */ struct stat finfo; char *temp_dirname; int statable, dirname_index; + #endif /* !EMX */ dirname_index = 0; while (temp_dirname = extract_colon_unit (path, &dirname_index)) { + #ifndef EMX register int i, pre_suffix_length; + #endif /* !EMX */ char *temp; /* Expand a leading tilde if one is present. */ *************** *** 201,210 **** --- 247,282 ---- strcat (temp, "/"); strcat (temp, filename); + #ifndef EMX pre_suffix_length = strlen (temp); + #endif /* !EMX */ free (temp_dirname); + #ifdef EMX + final_name = info_check_file (temp); + free (temp); + if (final_name) + return (final_name); + } + return ((char *)NULL); + } + + /* check if the file exists, possibly trying the compressed file suffixes */ + static char * + info_check_file (filename) + char *filename; + { + register int i, statable, pre_suffix_length; + struct stat finfo; + char *temp; + + temp = (char *)xmalloc (30 + strlen (filename)); + strcpy (temp, filename); + + pre_suffix_length = strlen (temp); + #endif /* EMX */ + for (i = 0; info_suffixes[i]; i++) { strcpy (temp + pre_suffix_length, info_suffixes[i]); *************** *** 253,260 **** --- 325,334 ---- return (temp); } } + #ifndef EMX } free (temp); + #endif /* !EMX */ } return ((char *)NULL); } *************** *** 273,279 **** if ((i >= strlen (string)) || !string) return ((char *) NULL); ! while (string[i] && string[i] != ':') i++; if (i == start) { --- 347,353 ---- if ((i >= strlen (string)) || !string) return ((char *) NULL); ! while (string[i] && string[i] != COLONCHR) i++; if (i == start) { *************** *** 382,395 **** strcpy (infopath, path); else if (where == INFOPATH_APPEND) { ! strcat (infopath, ":"); strcat (infopath, path); } else if (where == INFOPATH_PREPEND) { char *temp = savestring (infopath); strcpy (infopath, path); ! strcat (infopath, ":"); strcat (infopath, temp); free (temp); } --- 456,469 ---- strcpy (infopath, path); else if (where == INFOPATH_APPEND) { ! strcat (infopath, COLONSTR); strcat (infopath, path); } else if (where == INFOPATH_PREPEND) { char *temp = savestring (infopath); strcpy (infopath, path); ! strcat (infopath, COLONSTR); strcat (infopath, temp); free (temp); } *************** *** 416,421 **** --- 490,498 ---- long *filesize; struct stat *finfo; { + #ifdef EMX + int result; + #endif /* EMX */ *filesize = filesys_error_number = 0; if (compressed_filename_p (pathname)) *************** *** 436,442 **** --- 513,524 ---- /* Try to read the contents of this file. */ contents = (char *)xmalloc (1 + finfo->st_size); + #ifdef EMX + result = read (descriptor, contents, finfo->st_size); + if (result == -1 || result > finfo->st_size) + #else /* !EMX */ if ((read (descriptor, contents, finfo->st_size)) != finfo->st_size) + #endif /* !EMX */ { filesys_error_number = errno; close (descriptor); diff -c info/general.h d:info/general.h *** info/general.h Mon Feb 01 19:44:08 1993 --- d:info/general.h Mon Jul 05 18:44:46 1993 *************** *** 1,4 **** --- 1,5 ---- /* general.h -- Some generally useful defines. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 23,28 **** --- 24,33 ---- #if !defined (_GENERAL_H_) #define _GENERAL_H_ + + #ifdef EMX + #define whitespace_or_newline(c) (whitespace (c) || (c == '\n') || (c == '\r')) + #endif /* EMX */ extern void *xmalloc (), *xrealloc (); diff -c info/info.c d:info/info.c *** info/info.c Sun May 23 04:07:02 1993 --- d:info/info.c Mon Jul 05 18:44:48 1993 *************** *** 1,4 **** --- 1,5 ---- /* info.c -- Display nodes of Info files in multiple windows. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 82,88 **** --- 83,93 ---- }; /* String describing the shorthand versions of the long options found above. */ + #ifdef EMX + static char *short_options = "d:n:f:o:sh?"; + #else /* !EMX */ static char *short_options = "d:n:f:o:s"; + #endif /* !EMX */ /* When non-zero, the Info window system has been initialized. */ int info_windows_initialized_p = 0; *************** *** 110,115 **** --- 115,123 ---- #endif /* NeXT && NOTDEF */ remember_info_program_name (argv[0]); + #ifdef EMX + setvbuf(stdout, NULL, _IOFBF, BUFSIZ); + #endif /* EMX */ while (1) { *************** *** 151,156 **** --- 159,171 ---- user_filename = savestring (optarg); break; + #ifdef EMX + /* User is requesting help. */ + case 'h': + print_help_p = 1; + break; + #endif /* EMX */ + /* User is specifying the name of a file to output to. */ case 'o': if (user_output_filename) *************** *** 475,480 **** --- 490,498 ---- static void usage () { + #ifdef EMX + fprintf (stderr,"\nGNU Info, Version %s.", version_string ()); + #endif /* EMX */ fprintf (stderr,"%s\n%s\n%s\n%s\n%s\n", "Usage: info [-d dir-path] [-f info-file] [-o output-file] [-n node-name]...", " [--directory dir-path] [--file info-file] [--node node-name]...", diff -c info/search.c d:info/search.c *** info/search.c Mon Feb 01 19:47:22 1993 --- d:info/search.c Mon Jul 05 18:44:50 1993 *************** *** 1,4 **** --- 1,5 ---- /* search.c -- How to search large bodies of text. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 372,377 **** --- 373,379 ---- return (i); } + #ifndef EMX /* Unix doesn't have stricmp () functions. */ int stricmp (string1, string2) *************** *** 419,424 **** --- 421,427 ---- } return (count); } + #endif /* !EMX */ /* **************************************************************** */ /* */ diff -c info/session.c d:info/session.c *** info/session.c Tue Feb 09 13:45:08 1993 --- d:info/session.c Sun Jul 11 17:20:20 1993 *************** *** 1,4 **** --- 1,5 ---- /* session.c -- The user windowing interface to Info. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 26,31 **** --- 27,36 ---- #include #include + #ifdef EMX + # include + #endif /* EMX */ + #if defined (HAVE_SYS_TIME_H) # include # define HAVE_STRUCT_TIMEVAL *************** *** 292,298 **** --- 297,307 ---- { FILE *stream; + #ifdef EMX + stream = fopen (filename, "rb"); + #else /* !EMX */ stream = fopen (filename, "r"); + #endif /* !EMX */ if (!stream) return; *************** *** 2410,2416 **** --- 2419,2429 ---- if (strcmp (output_filename, "-") == 0) output_stream = stdout; else + #ifdef EMX + output_stream = fopen (output_filename, "wb"); + #else /* !EMX */ output_stream = fopen (output_filename, "w"); + #endif if (!output_stream) { *************** *** 2535,2541 **** --- 2548,2558 ---- if (strcmp (filename, "-") == 0) output_stream = stdout; else + #ifdef EMX + output_stream = fopen (filename, "wb"); + #else /* !EMX */ output_stream = fopen (filename, "w"); + #endif /* !EMX */ if (!output_stream) { *************** *** 4081,4086 **** --- 4098,4107 ---- space_avail = info_input_buffer_space_available (); + #ifdef EMX + while (chars_avail < space_avail && (tty = pc_getc (0)) != -1) + input[chars_avail++] = tty; + #else /* !EMX */ /* If we can just find out how many characters there are to read, do so. */ #if defined (FIONREAD) { *************** *** 4108,4113 **** --- 4129,4135 ---- } # endif /* O_NDELAY */ #endif /* !FIONREAD */ + #endif /* !EMX */ /* Store the input characters just read into our input buffer. */ { diff -c info/signals.c d:info/signals.c *** info/signals.c Mon Feb 01 19:46:42 1993 --- d:info/signals.c Mon Jul 05 18:44:54 1993 *************** *** 1,4 **** --- 1,5 ---- /* signals.c -- Install and maintain Info signal handlers. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 30,36 **** /* */ /* **************************************************************** */ ! #if !defined (_POSIX_VERSION) /* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */ static void sigprocmask (operation, newset, oldset) --- 31,37 ---- /* */ /* **************************************************************** */ ! #if !defined (_POSIX_VERSION) && !defined(EMX) /* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */ static void sigprocmask (operation, newset, oldset) *************** *** 58,64 **** abort (); } } ! #endif /* !_POSIX_VERSION */ /* **************************************************************** */ /* */ --- 59,65 ---- abort (); } } ! #endif /* !_POSIX_VERSION && !EMX */ /* **************************************************************** */ /* */ diff -c info/signals.h d:info/signals.h *** info/signals.h Mon Feb 01 19:42:46 1993 --- d:info/signals.h Mon Jul 05 18:44:54 1993 *************** *** 1,4 **** --- 1,5 ---- /* signals.h -- Header to include system dependent signal definitions. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 26,31 **** --- 27,38 ---- #include + #ifdef EMX + + #define UNBLOCK_SIGNAL(sig) + + #else /* !EMX */ + #define HAVE_SIGSETMASK #if !defined (_POSIX_VERSION) && !defined (sigmask) *************** *** 81,85 **** --- 88,94 ---- sigaddset (&nvar, sig); \ sigprocmask (SIG_UNBLOCK, &nvar, &ovar); \ } while (0) + + #endif /* !EMX */ #endif /* !_SIGNALS_H_ */ diff -c info/terminal.c d:info/terminal.c *** info/terminal.c Fri May 21 22:26:04 1993 --- d:info/terminal.c Mon Jul 05 18:44:54 1993 *************** *** 1,4 **** --- 1,5 ---- /* terminal.c -- How to handle the physical terminal for Info. */ + /* Changed for emx by Kai Uwe Rommel & Eberhard Mattes -- Jul 1993 */ /* This file is part of GNU Info, a program for reading online documentation stored in Info format. *************** *** 135,140 **** --- 136,146 ---- static void terminal_end_using_terminal () { + #ifdef EMX + terminal_goto_xy (0, screenheight - 2); /* cmd.exe writes extra newline */ + #else /* !EMX */ + terminal_goto_xy (0, screenheight - 1); + #endif /* !EMX */ send_to_terminal (term_end_use); } *************** *** 410,415 **** --- 416,429 ---- { screenwidth = screenheight = 0; + #ifdef EMX + { + int size[2]; + _scrsize (size); + screenwidth = size[0]; + screenheight = size[1]; + } + #else /* !EMX */ #if defined (TIOCGWINSZ) { struct winsize window_size; *************** *** 421,426 **** --- 435,441 ---- } } #endif /* TIOCGWINSZ */ + #endif /* !EMX*/ /* Environment variable COLUMNS overrides setting of "co". */ if (screenwidth <= 0) *************** *** 619,624 **** --- 634,645 ---- tty = fileno (stdin); + #ifdef EMX + + pc_init (); + + #else /* !EMX */ + #if defined (HAVE_TERMIO_H) ioctl (tty, TCGETA, &original_termio); ioctl (tty, TCGETA, &ttybuff); *************** *** 703,708 **** --- 724,731 ---- ttybuff.sg_flags |= CBREAK; ioctl (tty, TIOCSETN, &ttybuff); #endif /* !HAVE_TERMIO_H */ + + #endif /* !EMX */ } /* Restore the tty settings back to what they were before we started using *************** *** 720,725 **** --- 743,754 ---- tty = fileno (stdin); + #ifdef EMX + + pc_exit (); + + #else + #if defined (HAVE_TERMIO_H) ioctl (tty, TCSETA, &original_termio); #else /* !HAVE_TERMIO_H */ *************** *** 740,745 **** --- 769,777 ---- #endif /* TIOCLGET && LPASS8 */ #endif /* !HAVE_TERMIO_H */ + + #endif /* !EMX */ + terminal_end_using_terminal (); } diff -c makeinfo/makeinfo.c d:makeinfo/makeinfo.c *** makeinfo/makeinfo.c Sun May 23 00:29:46 1993 --- d:makeinfo/makeinfo.c Mon Jul 05 20:23:36 1993 *************** *** 18,23 **** --- 18,30 ---- rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ + + /* emx port and enhancements (c) 1992 Kai Uwe Rommel, + rommel@informatik.tu-muenchen.de + + This port is also distributed under the terms of the + GNU General Public License as published by the + Free Software Foundation. */ /* This is Makeinfo version 1.55. If you change the version number of Makeinfo, please change it here and at the lines reading: *************** *** 83,88 **** --- 90,103 ---- #include #endif + #ifdef EMX + #include + #include + #include + #include + #include + #endif /* EMX */ + #if defined (HAVE_STRING_H) #include #else *************** *** 792,797 **** --- 807,817 ---- char *filename_part (); int c, ind; + #ifdef EMX + _response(&argc, &argv); + _wildcard(&argc, &argv); + #endif /* EMX */ + /* The name of this program is the last filename in argv[0]. */ progname = filename_part (argv[0]); *************** *** 889,894 **** --- 909,917 ---- /* Display the version info of this invocation of Makeinfo. */ print_version_info () { + #ifdef EMX + putchar('\n'); + #endif /* EMX */ fprintf (stderr, "This is GNU Makeinfo version %d.%d.\n", major_version, minor_version); } *************** *** 948,953 **** --- 971,980 ---- /* Tell the user how to use this program. */ usage () { + #ifdef EMX + fprintf (stderr, "\nGNU makeinfo, version %d.%d.\n\n", + major_version, minor_version); + #endif /* EMX */ fprintf (stderr, "Usage: %s [options] texinfo-file...\n\ \n\ This program accepts as input files of texinfo commands and text\n\ *************** *** 1029,1034 **** --- 1056,1064 ---- { struct stat fileinfo; int file = -1, n, i, count = 0; + #ifdef EMX + int bytes_read; + #endif /* EMX */ char *fullpath, *result, *get_file_info_in_path (); result = fullpath = (char *)NULL; *************** *** 1040,1046 **** --- 1070,1080 ---- filename = fullpath; + #ifdef EMX + file = open (filename, O_RDONLY|O_TEXT); + #else file = open (filename, O_RDONLY); + #endif if (file < 0) goto error_exit; *************** *** 1057,1063 **** --- 1091,1102 ---- if (n == -1) #else /* !VMS */ count = fileinfo.st_size; + #ifdef EMX + bytes_read = read (file, result, fileinfo.st_size); + if (bytes_read <= 0 || bytes_read > fileinfo.st_size) + #else /* !EMX */ if (read (file, result, fileinfo.st_size) != fileinfo.st_size) + #endif /* !EMX */ #endif /* !VMS */ error_exit: { *************** *** 1076,1082 **** --- 1115,1125 ---- /* Set the globals to the new file. */ input_text = result; + #ifdef EMX + size_of_input_text = bytes_read; + #else /* !EMX */ size_of_input_text = count; + #endif /* !EMX */ input_filename = savestring (fullpath); node_filename = savestring (fullpath); input_text_offset = 0; *************** *** 1295,1300 **** --- 1338,1346 ---- } else { + #ifdef EMX + return (savestring (filename)); + #else /* !EMX */ struct passwd *user_entry; int i, c; char *username = (char *)xmalloc (257); *************** *** 1320,1325 **** --- 1366,1372 ---- strcpy (temp_name, user_entry->pw_dir); strcat (temp_name, &filename[i]); return (temp_name); + #endif /* !EMX */ } } } *************** *** 1710,1715 **** --- 1757,1765 ---- ".texinfo", ".texi", ".txinfo", + #ifdef EMX + ".tex", + #endif /* EMX */ (char *)NULL }; *************** *** 1800,1806 **** --- 1850,1860 ---- if (!real_output_filename) real_output_filename = expand_filename (output_filename, name); + #ifdef EMX + output_stream = fopen (real_output_filename, "wb"); + #else /* !EMX */ output_stream = fopen (real_output_filename, "w"); + #endif /* !EMX */ } if (output_stream == NULL) *************** *** 1906,1911 **** --- 1960,1968 ---- the function with the proper arguments. */ reader_loop () { + #ifdef EMX + extern int executing_string; + #endif /* EMX */ int character; int done = 0; int dash_count = 0; *************** *** 1914,1920 **** --- 1971,1981 ---- { if (input_text_offset >= size_of_input_text) { + #ifdef EMX + if (filestack && !executing_string) + #else /* !EMX */ if (filestack) + #endif /* !EMX */ { free (input_filename); free (input_text); *************** *** 2652,2657 **** --- 2713,2721 ---- { last_inserted_character = '\n'; last_char_was_newline = 1; + #ifdef EMX + last_inserted_character = 0; + #endif /* EMX */ } /* Align the end of the text in output_paragraph with fill_column. */ *************** *** 2771,2776 **** --- 2835,2842 ---- return (-1); } + #ifndef EMX + /* Whoops, Unix doesn't have stricmp. */ /* Case independent string compare. */ *************** *** 2795,2800 **** --- 2861,2868 ---- } } + #endif /* EMX */ + enum insertion_type { menu, quotation, lisp, smalllisp, example, smallexample, display, itemize, format, enumerate, cartouche, table, ftable, vtable, group, ifinfo, flushleft, flushright, ifset, ifclear, deffn, *************** *** 3518,3524 **** --- 3586,3596 ---- cm_bold (arg, start, end) int arg, start, end; { + #ifdef EMX + cm_italic (arg, start, end); + #else /* !EMX */ cm_italic (arg); + #endif /* !EMX */ } /* Current text is in roman font. */ *************** *** 3537,3543 **** --- 3609,3619 ---- cm_title (arg, start, end) int arg, start, end; { + #ifdef EMX + cm_italic (arg, start, end); + #else /* !EMX */ cm_italic (arg); + #endif /* !EMX */ } /* @refill is a NOP. */ *************** *** 4612,4621 **** --- 4688,4705 ---- (10 + strlen (root_pathname) + strlen (root_filename)); sprintf (split_filename, + #ifdef EMX + "%s%s.i%.2d", root_pathname, root_filename, which_file); + #else /* !EMX */ "%s%s-%d", root_pathname, root_filename, which_file); + #endif /* !EMX */ fd = open + #ifdef EMX + (split_filename, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666); + #else (split_filename, O_WRONLY | O_TRUNC | O_CREAT, 0666); + #endif if ((fd < 0) || (write (fd, the_header, header_size) != header_size) || *************** *** 4636,4642 **** --- 4720,4730 ---- indirect_info += strlen (indirect_info); } + #ifdef EMX + sprintf (indirect_info, "%s.i%.2d: %ld\n", + #else /* !EMX */ sprintf (indirect_info, "%s-%d: %d\n", + #endif /* !EMX */ root_filename, which_file, file_top); free (split_filename); *************** *** 4651,4657 **** --- 4739,4749 ---- /* We have sucessfully created the subfiles. Now write out the original again. We must use `output_stream', or write_tag_table_indirect () won't know where to place the output. */ + #ifdef EMX + output_stream = fopen (filename, "wb"); + #else /* !EMX */ output_stream = fopen (filename, "w"); + #endif /* !EMX */ if (!output_stream) { perror (filename); *************** *** 6388,6395 **** --- 6480,6489 ---- if (!find_and_load (filename)) { + #ifndef EMX extern char *sys_errlist[]; extern int errno, sys_nerr; + #endif /* !EMX */ popfile (); /* Cannot "@include foo", in line 5 of "/wh/bar". */ diff -c texindex/texindex.c d:texindex/texindex.c *** texindex/texindex.c Fri Dec 11 17:19:48 1992 --- d:texindex/texindex.c Mon Jul 05 18:45:08 1993 *************** *** 17,22 **** --- 17,31 ---- You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + char *version = "1.43"; + + /* emx port (c) 1991 Kai Uwe Rommel, + rommel@informatik.tu-muenchen.de + + This port is also distributed under the terms of the + GNU General Public License as published by the + Free Software Foundation. */ #include *************** *** 60,65 **** --- 69,76 ---- #else /* !VMS */ + # ifndef EMX + extern int sys_nerr; extern char *sys_errlist[]; *************** *** 75,84 **** --- 86,108 ---- # include # endif /* !HAVE_FCNTL_H */ # endif /* !_AIX && _POSIX_VERSION */ + + # endif /* !EMX */ + # define TI_NO_ERROR 0 # define TI_FATAL_ERROR 1 + #endif /* !VMS */ + #ifdef EMX + #include + #include + #include + #include + #include + #include + #endif /* EMX */ + #if !defined (SEEK_SET) # define SEEK_SET 0 # define SEEK_CUR 1 *************** *** 194,199 **** --- 218,228 ---- { int i; + #ifdef EMX + _response(&argc, &argv); + _wildcard(&argc, &argv); + #endif /* EMX */ + tempcount = 0; last_deleted_tempcount = 0; program_name = argv[0]; *************** *** 219,225 **** --- 248,258 ---- decode_command (argc, argv); + #ifdef EMX + tempbase = mktemp (concat ("tiXXXXXX", "", "")); + #else /* !EMX */ tempbase = mktemp (concat ("txiXXXXXX", "", "")); + #endif /* !EMX */ /* Process input files completely, one by one. */ *************** *** 257,262 **** --- 290,298 ---- void usage () { + #ifdef EMX + fprintf (stderr, "\nGNU texindex %s\n\n", version); + #endif /* EMX */ fprintf (stderr, "\ Usage: %s [-k] infile [-o outfile] ...\n", program_name); exit (1); *************** *** 281,290 **** --- 317,335 ---- if (tempdir == NULL) tempdir = "sys$scratch:"; #else + #ifdef EMX + if (tempdir == NULL) + tempdir = getenv("TMP"); + if (!tempdir ) + tempdir = "/"; + else + tempdir = concat (tempdir, "/", ""); + #else /* !EMX */ if (tempdir == NULL) tempdir = "/tmp/"; else tempdir = concat (tempdir, "/", ""); + #endif /* !EMX */ #endif keep_tempfiles = 0; *************** *** 836,844 **** /* Sort an input file too big to sort in core. */ void ! sort_offline (infile, nfiles, total, outfile) char *infile; - int nfiles; long total; char *outfile; { --- 881,888 ---- /* Sort an input file too big to sort in core. */ void ! sort_offline (infile, total, outfile) char *infile; long total; char *outfile; { *************** *** 917,923 **** for (i = 0; i < ntemps; i++) { char *newtemp = maketempname (++tempcount); ! sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp); if (!keep_tempfiles) unlink (tempfiles[i]); tempfiles[i] = newtemp; --- 961,967 ---- for (i = 0; i < ntemps; i++) { char *newtemp = maketempname (++tempcount); ! sort_in_core (tempfiles[i], MAX_IN_CORE_SORT, newtemp); if (!keep_tempfiles) unlink (tempfiles[i]); tempfiles[i] = newtemp; *************** *** 1007,1013 **** Make a `struct lineinfo' for each line, which records the keyfield as well as the line, and sort them. */ ! lineinfo = (struct lineinfo *) malloc ((nextline - linearray) * sizeof (struct lineinfo)); if (lineinfo) { --- 1051,1057 ---- Make a `struct lineinfo' for each line, which records the keyfield as well as the line, and sort them. */ ! lineinfo = (struct lineinfo *) xmalloc ((nextline - linearray) * sizeof (struct lineinfo)); if (lineinfo) { *************** *** 1671,1677 **** "Virtual memory exhausted in %s ()! Needed %d bytes.", callers_name, bytes_wanted); ! error (printable_string); abort (); } --- 1715,1721 ---- "Virtual memory exhausted in %s ()! Needed %d bytes.", callers_name, bytes_wanted); ! error (printable_string, ""); abort (); }